Skip to content

Versions of The Abstract Syntax

Niklas Lindström edited this page Jul 18, 2024 · 5 revisions

Versions of The RDF Abstract Syntax [DRAFT]

Warning

This is a basis for discussion, and does not represent the current baseline.

In a pseudo-BNF where:

  • Terminals begin with an upper-case character.
  • Exclusions are allowed (using or ).

RDF 1.1

Regular:

graph                 ::= triple*
triple                ::= namedNode IRI object
object                ::= namedNode | Literal
namedNode             ::= IRI | BlankNode

Generalized (non-normative; may be used to represent results of entailment):

graph                 ::= triple*
triple                ::= node node node
node                  ::= IRI | BlankNode | Literal

RDF 1.2

Agreed baseline (allows ill-formed; normative but incomplete?):

graph                 ::= triple*
triple                ::= namedOrTriple IRI object
object                ::= namedNode | Literal | triple
namedOrTriple         ::= namedNode | triple
namedNode             ::= IRI | BlankNode

Allows triples as subjects and objects (called triple terms).

Note

Opinion (held by: @niklasl): This adds complexity, due to the now recursive definition of a triple. Triples as objects are deemed necessary to have a fixed point reference to the relationship it denotes. We should only add that. Rationale: Only add as little as is necessary, since taking away what is added is a breaking change. That would make for a more minimal addition:

   graph                 ::= triple*
   triple                ::= namedNode IRI object
   object                ::= namedNode | Literal | triple
   namedNode             ::= IRI | BlankNode

Allows triples as objects (called triple terms).

Well-formed (normative):

graph                 ::= triple*
triple                ::= ( namedNode regularPredicate object ) |
                          ( namedNode rdf:reifies triple )
regularPredicate      ::= IRI ≠ rdf:reifies
object                ::= namedNode | Literal
namedNode             ::= IRI | BlankNode

Only allows triples as objects of rdf:reifies.

Generalized (non-normative; may be used to represent results of entailment):

graph                 ::= triple*
triple                ::= node node node
node                  ::= IRI | BlankNode | Literal | triple

Potential Extensions

Warning

These may conflict with irregular uses in the wild.

Well-formed including type-well-formed (non-normative):

graph                 ::= triple*
triple                ::= ( namedNode regularPredicate object ) |
                          ( namedNode rdf:reifies triple ) |
                          ( namedNode rdf:type namedNode )
regularPredicate      ::= IRI ∉ {rdf:reifies, rdf:type}
object                ::= namedNode | Literal
namedNode             ::= IRI | BlankNode

Prohibits literals as types.

Well-formed including type-well-formed (non-normative) and list-well-formed (non-normative):

graph                 ::= triple*
triple                ::= ( namedNode regularPredicate object ) |
                          ( namedNode rdf:reifies triple ) |
                          ( namedNode rdf:type namedNode ) |
                          ( BlankNode rdf:first object ) |
                          ( BlankNode rdf:rest object )
regularPredicate      ::= IRI ∉ {rdf:reifies, rdf:type, rdf:first, rdf:rest}
object                ::= namedNode | Literal
namedNode             ::= IRI | BlankNode

Also prohibits RDF collections with named cons-pairs. Does not cover all rules for list-well-formed (that would require an additional functional restriction on those predicates).

Clone this wiki locally