1

I am new to RDF. And don't understand the difference between a list and multiple tripples. Is there a difference between the following two examples.

http://example.org/courses/6.001
    s:students ex:Amy,
               ex:Mohamed,
               ex:Johann.
http://example.org/courses/6.001
    s:students [
        a rdf:Bag;
        rdf:_1 ex:Amy;
        rdf:_2 ex:Mohamed;
        rdf:_3 ex:Johann
    ].

As far as I understand it, the second one uses a blank node, but is there a reason one should choose one solution over the other.

Thanks in advance!

Stati
  • 11
  • 4
  • one difference of container classes vs RDF triple is that an RDF collection can contain the same resource multiple times, with triples this won't work as an RDF graph is basically a **set** of triples. But to be honest, from what I can say I haven't really seen somebody using Alt or Bag, sometimes Seq, ok - more often RDF list though. – UninformedUser Dec 02 '22 at 06:56
  • Thank you for the comment. Is there a problem when using the first approach or should I consider using a RDF list? – Stati Dec 02 '22 at 12:38

1 Answers1

1

In your question you mention a list, which is an ordered RDF collection but you are using a bag, which is an unordered RDF container. To find out more about RDF containers and collections, please refer to the RDF schema "other vocabulary" section.

Which one you should use depends on your use case and intended semantics. I personally prefer to use multiple triples as a default option, because tool support is usually better. For example, most RDF browsers don't define visualization shortcuts for containers and collections, which may confuse users who have to open an awkwardly named entry like _:xyz123456789 and see the values on a separate page. Note that the semantic of multiple triples is that of a set (unordered, no duplicates), as noted by @UninformedUser.

On the other hand, if it is important to convey that the order is important (list, for example the finalists of a race) or that elements may occur multiple times (bag), then you may need to use a container or collection.

Konrad Höffner
  • 11,100
  • 16
  • 60
  • 118