diff --git a/spec/index.html b/spec/index.html index 662137c..e340c97 100644 --- a/spec/index.html +++ b/spec/index.html @@ -812,16 +812,22 @@

Triple Terms

-
-

Reified Triples

- -

A reified triple - may be the subject or - object of an - RDF triple.

- -

A reified triple is syntactic sugar for a specific relationship between an - identifier (reifier) and a triple term. +

+

Reifying Triples

+ +

In RDF, triple terms are rarely used directly, + as they are generally restricted to be used + only as the object of a triple + using the `rdf:reifies` predicate. + Such a triple is called a reifying triple. + Turtle provides a shorthand notation for writing reifying triples + using the reifiedTriple production.

+ +

A reifiedTriple + is syntactic sugar representing a reifying triple, + which defines a specific relationship between an + identifier (reifier) + and a triple term. The identifier becomes a way to indirectly refer to a triple term, which may or may not be asserted within the graph corresponding to this input document.

@@ -833,7 +839,7 @@

Reified Triples

RDF 1.2 uses the term to identify a triple term using the `rdf:reifies` predicate.

-

A reified triple is represented using the +

A reifying triple is represented using the reifiedTriple production starting with <<, followed by either a subject @@ -854,7 +860,7 @@

Reified Triples

as with `<< :subject :predicate :object >>`, or `<< :subject :predicate :object ~ >>`.

-

Reified Triples may be nested, +

reifiedTriples may be nested, like
`<< :subject1 :predicate1 << :subject2 :predicate2 :object2 >> ~:IRIREF1 >>` or
`<< :subject4 :predicate4 << :subject3 :predicate3 :object3 ~:IRIREF3 >> >>`.

@@ -890,13 +896,13 @@

Reified Triples

After declaring a prefix so that IRIs can be abbreviated, the first triple in this example asserts that `employee38` has a `familyName` of "Smith". Note that this graph does not assert that `employee38` has a `jobTitle` of "Assistant Designer"; - it says that `employee22` has made that claim using a reified triple. + it says that `employee22` has made that claim using a reifiedTriple. In other words, the triple "`employee38` has a `jobTitle` of 'Assistant Designer'" is not a member of the graph, itself, as "employee38 has a `familyName` of 'Smith'" is above; - rather, it is known as a reified triple.

+ rather, it is known as a reifying triple.

-

A reified triple is syntactic sugar relating one ore more - reifiers to a tripleTerm +

A reifiedTriple is syntactic sugar relating a + reifier to a tripleTerm using the rdf:reifies predicate.

@@ -913,7 +919,7 @@

Annotation Syntax

subject or object of additional triples and/or triple terms. - As with a reified triple, + As with a reifiedTriple, the annotation syntax allows the definition of one or more reifiers as either IRIs or blank nodes, @@ -1635,7 +1641,7 @@

Selected Terminal Literal Strings

-
+

Parsing

The RDF 1.2 Concepts and Abstract Syntax specification [[!RDF12-CONCEPTS]] defines four types of RDF terms: @@ -1659,9 +1665,7 @@

Parsing

Parser State

-

Parsing Turtle requires a state of six items:

- -

Describe parser state for tracking reifier to be associated with an annotation block.

+

Parsing Turtle requires a state of eight items:

+ +

Term Constructurs can create a stack of these values indicated by + using language such as "records the |curSubject| and |curPredicate|."

@@ -1753,6 +1772,16 @@

RDF Term Constructors

blankNodePropertyList blank node A blank node is generated. Note the rules for blankNodePropertyList in the next section. collection blank node For non-empty lists, a blank node is generated. Note the rules for collection in the next section. IRI For empty lists, the resulting IRI is rdf:nil. Note the rules for collection in the next section. + reifier IRI + | blank node + + The |curReifier| is taken from term, which is taken from the matched + iri production + or BlankNode production, if any. + If no such production is matched, term is taken + from a fresh RDF blank node. + + tripleTerm triple term The triple term @@ -1762,28 +1791,19 @@

RDF Term Constructors

ttObject productions. - reifiedTriple IRI | blank node + reifiedTriple IRI | blank node - The reifiedTriple production - defines an RDF term in addition to a triple term. - The term constructed from this production - is composed of an optional identifier from either the iri - production or the BlankNode production, - if present, otherwise from a fresh RDF blank node. + The term is taken from the matched reifier, if any, + or from a fresh RDF blank node. - annotation IRI | blank node + annotationBlock IRI | blank node - The annotation production - defines an RDF term in addition to a triple term. - The term constructed from this production - is composed of an identifier from either the iri - or BlankNode productions, - if present, otherwise from a fresh RDF blank node. -
Requires state to recall any previously defined reifier.
+ The term is taken from a previously matched reifier, if any, + or from a fresh RDF blank node. - +
@@ -1802,63 +1822,64 @@

RDF Triples Constructors

|curPredicate| N .

-

Triple Terms:

+

Reifiers

-

Beginning the tripleTerm production - records the |curSubject| and |curPredicate|. - Finishing the tripleTerm production - and restores the recorded values of |curSubject| and |curPredicate|.

+

Beginning the reifier production, + the |curReifier| is taken from the reifier term constructor. + Then yield the the RDF triple |curReifier| rdf:reifies |curTripleTerm|.

-

Reifiers:

+

Reified Triples

Beginning the reifiedTriple production - records the |curSubject| and |curPredicate|. - |curSubject| is taken from the - reifiedTriple term constructor. - A new tripleTerm instance |TT| - is composed from + records the |curTripleTerm| as an RDF Triple composed from the subject, - predicate, and + verb, and object productions. - Finishing the reifier production - yields the RDF triple |curSubject| rdf:reifies |TT| - and restores the recorded values of |curSubject| and |curPredicate|.

-

Annotations:

+ Finishing the reifiedTriple production, + if the |curReifier| is not set, it is assigned a fresh fresh RDF blank node + and yields the the RDF triple |curReifier| rdf:reifies |curTripleTerm|. + The node produced by matching reifiedTriple + is the the |curReifier|.

+ +

Annotations

Beginning the annotation production records the |curSubject| and |curPredicate|. - A new tripleTerm instance |TT| - is created using |curSubject| |curPredicate| |curObject|. - The identifier |TI| is taken from the - annotation term constructor. + A new tripleTerm instance |curTripleTerm| + is created using the |curSubject| |curPredicate| |curObject|, + and the value of the |curReifier| is cleared. Finishing the annotation production - yields the RDF triple |TI| rdf:reifies |TT| - and restores the recorded values of |curSubject| and |curPredicate|.

-

Describe parser state for recording and assigning any reifier.

+ restores the recorded values of the |curSubject| and |curPredicate|.

+ +

Annotation Blocks

+ +

Beginning the annotationBlock production, + if the |curReifier| is not set, then the |curReifier| is assigned a fresh RDF blank node + and then yields the RDF triple |curReifier| rdf:reifies |curTripleTerm|. + The |curSubject| is taken from the |curReifier| + Finishing the annotationBlock production, + clears the value of the |curReifier|.

-

Property Lists:

+

Property Lists

Beginning the blankNodePropertyList - production records the |curSubject| - and |curPredicate|, - and sets |curSubject| - to a novel blank node |B|. + production records the |curSubject| and |curPredicate|, + and sets the |curSubject| to a novel blank node |B|. Finishing the blankNodePropertyList - production restores |curSubject| - and |curPredicate|. + production restores the |curSubject| and |curPredicate|. The node produced by matching blankNodePropertyList is the blank node |B|.

-

Collections:

+

Collections

Beginning the collection production records the |curSubject| and |curPredicate|. - Each object in the collection production has a |curSubject| set to a novel blank node |B| and a |curPredicate| set to rdf:first. + Each object in the collection production has |curSubject| set to a novel blank node |B| and |curPredicate| set to rdf:first. For each object objectn after the first produces a triple:objectn-1 rdf:rest objectn . - Finishing the collection production creates an additional triple curSubject rdf:rest rdf:nil . and restores |curSubject| and |curPredicate| + Finishing the collection production creates an additional triple curSubject rdf:rest rdf:nil . and restores the |curSubject| and |curPredicate| The node produced by matching collection is the first blank node |B| for non-empty lists and rdf:nil for empty lists.

@@ -2174,7 +2195,7 @@

Changes between RDF 1.1 and RDF 1.2

and `STRING_LITERAL_SINGLE_QUOTE`.
  • Separated from and updated language.
  • -
  • Added +
  • Added , , and for representing triple terms in Turtle.
  • Changes the `LANGTAG` terminal production to diff --git a/spec/turtle-bnf.html b/spec/turtle-bnf.html index 4bb5e0b..914c4d3 100644 --- a/spec/turtle-bnf.html +++ b/spec/turtle-bnf.html @@ -155,7 +155,7 @@ [26] reifiedTriple ::= - '<<' (subject | reifiedTriple) predicate object reifier* '>>' + '<<' (subject | reifiedTriple) verb object reifier? '>>' [27] @@ -179,7 +179,13 @@ [30] annotation ::= - (reifier | ('{|' predicateObjectList '|}'))* + (reifier | annotationBlock)* + + + [31] + annotationBlock + ::= + '{|' predicateObjectList '|}' @@ -194,103 +200,103 @@

    Productions for terminals


    /* #x00=NULL #x01-#x1F=control codes #x20=space */ - [33] + [34] PNAME_NS ::= PN_PREFIX? ':' - [34] + [35] PNAME_LN ::= PNAME_NS PN_LOCAL - [35] + [36] BLANK_NODE_LABEL ::= '_:' (PN_CHARS_U | [0-9]) ((PN_CHARS | '.')* PN_CHARS)? - [36] + [37] LANG_DIR ::= '@' [a-zA-Z]+ ('-' [a-zA-Z0-9]+)* ('--' [a-zA-Z]+)? - [37] + [38] INTEGER ::= [+-]? [0-9]+ - [38] + [39] DECIMAL ::= [+-]? ([0-9]* '.' [0-9]+) - [39] + [40] DOUBLE ::= [+-]? (([0-9]+ '.' [0-9]* EXPONENT) | ('.' [0-9]+ EXPONENT) | ([0-9]+ EXPONENT)) - [40] + [41] EXPONENT ::= [eE] [+-]? [0-9]+ - [41] + [42] STRING_LITERAL_QUOTE ::= '"' ([^#x22#x5C#x0A#x0D] | ECHAR | UCHAR)* '"' - [42] + [43] STRING_LITERAL_SINGLE_QUOTE ::= "'" ([^#x27#x5C#x0A#x0D] | ECHAR | UCHAR)* "'" - [43] + [44] STRING_LITERAL_LONG_SINGLE_QUOTE ::= "'''" (("'" | "''")? ([^'\] | ECHAR | UCHAR))* "'''" - [44] + [45] STRING_LITERAL_LONG_QUOTE ::= '"""' (('"' | '""')? ([^"\] | ECHAR | UCHAR))* '"""' - [45] + [46] UCHAR ::= ('\u' HEX HEX HEX HEX) | ('\U' HEX HEX HEX HEX HEX HEX HEX HEX) - [46] + [47] ECHAR ::= '\' [tbnrf\"'] - [47] + [48] WS ::= #x20 | #x09 | #x0D | #x0A - [48] + [49] ANON ::= '[' WS* ']' - [49] + [50] PN_CHARS_BASE ::= [A-Z] @@ -361,49 +367,49 @@

    Productions for terminals

    [#x00010000-#x000EFFFF] - [50] + [51] PN_CHARS_U ::= PN_CHARS_BASE | '_' - [51] + [52] PN_CHARS ::= PN_CHARS_U | '-' | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040] - [52] + [53] PN_PREFIX ::= PN_CHARS_BASE ((PN_CHARS | '.')* PN_CHARS)? - [53] + [54] PN_LOCAL ::= (PN_CHARS_U | ':' | [0-9] | PLX) ((PN_CHARS | '.' | ':' | PLX)* (PN_CHARS | ':' | PLX))? - [54] + [55] PLX ::= PERCENT | PN_LOCAL_ESC - [55] + [56] PERCENT ::= '%' HEX HEX - [56] + [57] HEX ::= [0-9] | [A-F] | [a-f] - [57] + [58] PN_LOCAL_ESC ::= '\' ('_' | '~' | '.' | '-' | "!" | '$' | '&' | "'" | '(' | ')' | '*' | '+' | ',' | ';' | '=' | '/' | '?' | '#' | '@' | '%') diff --git a/spec/turtle.bnf b/spec/turtle.bnf index 81d5f1e..5657dc8 100644 --- a/spec/turtle.bnf +++ b/spec/turtle.bnf @@ -26,11 +26,12 @@ iri ::= IRIREF | PrefixedName PrefixedName ::= PNAME_LN | PNAME_NS BlankNode ::= BLANK_NODE_LABEL | ANON reifier ::= '~' (iri | BlankNode)? -reifiedTriple ::= '<<' (subject | reifiedTriple) predicate object reifier* '>>' +reifiedTriple ::= '<<' (subject | reifiedTriple) verb object reifier? '>>' tripleTerm ::= '<<(' ttSubject predicate ttObject ')>>' ttSubject ::= iri | BlankNode ttObject ::= iri | BlankNode | literal | tripleTerm -annotation ::= (reifier | '{|' predicateObjectList '|}')* +annotation ::= (reifier | annotationBlock)* +annotationBlock ::= '{|' predicateObjectList '|}' @terminals