Skip to content

Turtle shortcut for list as a triple term #157

@franconi

Description

@franconi

We could introduce a Turtle shortcut to write a list as a RDF term: e.g., (:a (:c :d) :e) would expand to the RDF term:

<<(a cons 
   <<(<<(c cons 
         <<(d cons 
            nil)>> 
        )>> cons 
      <<(e cons 
         nil)>> 
     )>> 
  )>> 

corresponding to the classical cons tree structure:

ℂ   ➡︎  a
⬇︎
ℂ   ➡︎  ℂ ➡︎ c
⬇︎      ⬇︎
ℂ ➡︎ e  ℂ ➡︎ d
⬇︎      ⬇︎
NIL    NIL

So lists would be RDF terms in both Turtle and N-Triple, and their N-Triple version would be using the reserved IRIs rdfx:cons, rdfx:list, rdfx:nil, with the following axiomatic triples:

rdfx:cons rdfs:range rdfx:list.
rdfx:nil a rdfx:list.

Observe that a triple term using only rdfx:cons properties would always represent a legal list, assuming that each object in the triple term is either a triple term or equal to the rdfx:nil IRI.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions