Skip to content

Versions of The Abstract Syntax

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

Versions of The RDF Abstract Syntax [DRAFT]

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

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

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

Allows triples as objects (called triple terms).

Note

Rationale: 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. Only add as little as is necessary, since taking away what is added is a breaking change.

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:type namedNode ) |
                          ( namedNode rdf:reifies triple )
regularPredicate      ::= IRI ∉ {rdf:type, rdf:reifies}
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:type namedNode ) |
                          ( BlankNode rdf:first object ) |
                          ( BlankNode rdf:rest object ) |
                          ( namedNode rdf:reifies triple )
regularPredicate      ::= IRI ∉ {rdf:type, rdf:reifies, 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