Graph
rdf:Bag

🗃️rdf:Bag

NEW

RDF container class representing an unordered collection that may include duplicate members.

DESCRIPTION

rdf:Bag is an RDF container used for unordered collections where item order is not significant and duplicates may occur. It relies on container membership properties (rdf:_1, rdf:_2, …) without guaranteeing sequence. Bags are legacy constructs; modern modeling often prefers rdf:List or domain-specific vocabularies like SKOS for clearer semantics.

ALTERNATIVE DEFINITIONS

W3C RDF Schema 1.1

RDF defines three container types: Bag, Seq, and Alt. A Bag is used to indicate membership without implying order.

Explicitly emphasizes unordered membership as the defining trait.

Source

Wikipedia

A Bag is an unordered collection; items may be repeated and their ordering is not significant.

Highlights duplicates and lack of ordering.

Source

RDF RDF Schema RDF Container rdf:Seq rdf:Alt SPARQL Turtle OWL Simple Knowledge Organization System

COMPETING TERMS

rdf:List

KNOWLEDGE AREAS

Semantic & Knowledge Modeling Data Modeling Data Integration & Interoperability

TARGET AUDIENCE

Data Modeler Data Architect Data Engineer Information Analyst Data Steward

EXTERNAL SOURCES

  • Wikipedia - RDF Schema
  • W3C - Definition of RDF containers
  • Apache Jena - Tutorial on RDF containers
  • W3C - Primer explaining containers

TOP QUESTIONS

What is rdf:Bag in RDF?

rdf:Bag denotes an unordered container of members using container membership properties (rdf:_n). Duplicates are allowed and ordering is not guaranteed.

Category: Definition

When should I use rdf:Bag?

Use rdf:Bag only when order is irrelevant and duplicates are acceptable. Prefer rdf:List or domain vocabularies for clearer semantics in most cases.

Category: Usage

How does rdf:Bag differ from rdf:List?

rdf:Bag is unordered and uses rdf:_n membership properties, while rdf:List is ordered via rdf:first/rdf:rest. Lists provide deterministic traversal.

Category: Comparison

Are RDF containers considered legacy?

Yes, containers like rdf:Bag are legacy constructs. Modern RDF modeling typically favors rdf:List and application-specific vocabularies.

Category: Opinion

How do I query members of rdf:Bag in SPARQL?

Select container membership properties (rdf:_1, rdf:_2, …) via property paths or filter by predicate names, noting order is not meaningful.

Category: HowTo

Can rdf:Bag contain duplicates?

Yes. rdf:Bag allows repeated items because it represents membership, not a set with uniqueness constraints.

Category: Capabilities

What are risks of using rdf:Bag?

Unclear semantics about order can lead to inconsistent client behavior. Some tools offer limited support compared to lists.

Category: Risks

Is rdf:Bag suitable for labeling alternatives?

No. rdf:Alt is intended for alternatives. For concept labels, prefer SKOS, which provides altLabel with broader community support.

Category: Recommendation

How is rdf:Bag serialized in Turtle?

Turtle doesn’t have a compact syntax for containers; you assert membership via rdf:_n predicates on the container resource.

Category: Syntax