Class RDFCollections

java.lang.Object
org.eclipse.rdf4j.model.util.RDFCollections

public class RDFCollections extends Object
Utilities for working with RDF Collections and converting to/from Java Collection classes.

RDF Collections are represented using a Lisp-like structure: the list starts with a head resource (typically a blank node), which is connected to the first collection member via the RDF.FIRST relation. The head resource is then connected to the rest of the list via an RDF.REST relation. The last resource in the list is marked using the RDF.NIL node.

As an example, a list containing three literal values "A", "B", and "C" looks like this as an RDF Collection:

   _:n1 -rdf:type--> rdf:List
     |
     +---rdf:first--> "A"
     |
     +---rdf:rest --> _:n2 -rdf:first--> "B"
                        |
                        +---rdf:rest--> _:n3 -rdf:first--> "C"
                                          |
                                          +---rdf:rest--> rdf:nil
 

Here, _:n1 is the head resource of the list. Note that in this example it is declared an instance of RDF.LIST, however this is not required for the collection to be considered well-formed.

Author:
Jeen Broekstra
See Also: