Mapping Turtle syntax to triples.

At the Friday subgroup meeting, the role of the blank node in option 2 
was discussed.  Part of that is how the blank node comes about.

Below attempts to describe the conversion of the Turtle syntax described 
in the section "What we seem to agree on" in [1] for options 2 (Syntax+) 
and option 3 (new RDF term) [2].

(The name of "rdf:nameOf" is not agreed but used for continuity with
seeking-consensus-2024-01.html)

[1]
https://lists.w3.org/Archives/Public/public-rdf-star-wg/2024Jan/0095.html

[2]
https://htmlpreview.github.io/?https://github.com/w3c/rdf-star-wg/blob/main/docs/seeking-consensus-2024-01.html


== Translation for options 2 and 3 (given name for occurrence)

The Turtle:

   << :e | :s :p :o >> :x :y .

In Option 2, the translation is:

   :e       rdf:nameOf _:blank .
   _:blank  rdf:subject   :s .
   _:blank  rdf:predicate :p .
   _:blank  rdf:object    :o .
   :e       :x :y .

In option 3, the translation is:

   :e       rdf:nameOf <<( :s :p :o )>>
   :e       :x :y .

where <<( :s :p :o )>> is an RDF term.

== Translation for options 2 and 3 (implicit named occurrence)

In Turtle:

   << :s :p :o >> :x :y .

In option 2, the translation is:

   _:a      rdf:nameOf _:blank .
   _:blank  rdf:subject   :s .
   _:blank  rdf:predicate :p .
   _:blank  rdf:object    :o .
   _:a      :x :y .

In option 3, the translation is:

   _:a      rdf:nameOf <<( :s :p :o )>>
   _:a      :x :y .

where <<( :s :p :o )>> is an RDF term.


== Case: Repeated text (given name)

   << :e | :s :p :o >> :x :y .
   << :e | :s :p :o >> :x :y .

-- Option2

Each use of << :e | :s :p :o >> generates a new set of triples.

Triples (NT-level)
   ## Fresh blank node per use:
   :e        rdf:nameOf    _:blank1 .
   _:blank1  rdf:subject   :s .
   _:blank1  rdf:predicate :p .
   _:blank1  rdf:object    :o .

   :e        rdf:nameOf    _:blank2 .
   _:blank2  rdf:subject   :s .
   _:blank2  rdf:predicate :p .
   _:blank2  rdf:object    :o .

   :e :x :y . # One, because a graph does not have duplicates.

-- Option 3

Triples (NT-level)

   ## Two triples.
   :e       rdf:nameOf <<( :s :p :o )>>
   :e :x :y .

<<( :s :p :o )>> is the same RDF term wherever it is used in a file.


== Case: Repeated text (implicit blank node)

   << :s :p :o >> :x :y .
   << :s :p :o >> :x :y .

-- Option2

Triples (NT-level)

   ## Fresh blank node per use:

   _:a1      rdf:nameOf    _:blank1 .
   _:blank1  rdf:subject   :s .
   _:blank1  rdf:predicate :p .
   _:blank1  rdf:object    :o .
   _:a1 :x :y.

   _:a2      rdf:nameOf    _:blank2 .
   _:blank2  rdf:subject   :s .
   _:blank2  rdf:predicate :p .
   _:blank2  rdf:object    :o .
   _:a2 :x :y.

-- Option 3

Triples (NT-level)

   _:a1   rdf:nameOf <<( :s :p :o )>>
   _:a1   :x :y .
   _:a2   rdf:nameOf <<( :s :p :o )>>
   _:a2   :x :y .


== Case: Turtle predicate-object lists

Comparing turtle syntax

   ## [A]
   << :e | :s :p :o >>
      :x1 :y1 ;
      :x2 :y2 .

and

   ## [B]
   << :e | :s :p :o >> :x1 :y1 .
   << :e | :s :p :o >> :x2 :y2 .

-- Option 2

   ## [A]

   :e        rdf:nameOf    _:blank .
   _:blank   rdf:subject   :s .
   _:blank   rdf:predicate :p .
   _:blank   rdf:object    :o .

   :e :x1 :y1 .
   :e :x2 :y2 .

is different to

   ## [B]

   :e        rdf:nameOf    _:blank1 .
   _:blank1  rdf:subject   :s .
   _:blank1  rdf:predicate :p .
   _:blank1  rdf:object    :o .
   :e        rdf:nameOf    _:blank2 .
   _:blank2  rdf:subject   :s .
   _:blank2  rdf:predicate :p .
   _:blank2  rdf:object    :o .

   :e :x1 :y1 .
   :e :x2 :y2 .

Each use of << :e | :s :p :o >> cause a new blank node.
The generated blank nodes _:blank* make << | >> behave like [ ] in Turtle.

-- Option 3

   << :e | :s :p :o >>
      :x1 :y1 ;
      :x2 :y2 .

and

   << :e | :s :p :o >>  :x1 :y1 .
   << :e | :s :p :o >>  :x2 :y2 .

translate to the same triples.

   ## [A] and [B]
   :e rdf:nameOf <<( :s :p :o )>>
   :e :x1 :y1 .
   :e :x2 :y2 .

The same rdf:nameOf triple, makes << | >> behave like URI terms.


== Case: Annotations 1

Annotations translate to named occurrences and these translate again to 
the data model (here, written in N-Triples).

   :s :p :o {| :x1 :y1 ; :x1a y1a |}
   :s :p :o {| :x2 :y2 |}

which is (still in "agreed" syntax):

   :s :p :o .
   << _:a1 | :s :p :o >> :x1 :y1 .
   << _:a2 | :s :p :o >> :x2 :y2 .
   _:a1 :x1 :y1 .
   _:a1 :x1a :y1  .
   _:a2 :x2 :y2 .

for new blank nodes _:a1 and _:a2.

The :x1/:y1 and :x2/:y2 have been kept apart.

-- Option 2

Triples (NT level)

   :s :p :o .
   _:a1      rdf:nameOf    _:blank1 .
   _:blank1  rdf:subject   :s .
   _:blank1  rdf:predicate :p .
   _:blank1  rdf:object    :o .

   _:a2      rdf:nameOf    _:blank2 .
   _:blank2  rdf:subject   :s .
   _:blank2  rdf:predicate :p .
   _:blank2  rdf:object    :o .

   _:a1 :x1 :y1 .
   _:a1 :x1a :y1a .
   _:a2 :x2 :y2 .

-- Option 3

Triples (NT level)

   :s :p :o .
   _:a1 rdf:nameOf <<( :s :p :o >> .
   _:a2 rdf:nameOf <<( :s :p :o >> .
   _:a1 :x1 :y1 .
   _:a1 :x1a :y1a .
   _:a2 :x2 :y2 .

== Case: Annotations 2

   :s :p :o {| :e | :x1 :y1 |}
   :s :p :o {| :e | :x2 :y2 |}

translates to

   :s :p :o .
   << :e | :s :p :o >> :x1 :y1 .
   << :e | :s :p :o >> :x2 :y2 .
   :e :x1 :y1 .
   :e :x2 :y2 .

-- Option 2

Triples (NT level)

   :s :p :o .

   :e        rdf:nameOf    _:blank1 .
   _:blank1  rdf:subject   :s .
   _:blank1  rdf:predicate :p .
   _:blank1  rdf:object    :o .

   :e        rdf:nameOf    _:blank2 .
   _:blank2  rdf:subject   :s .
   _:blank2  rdf:predicate :p .
   _:blank2  rdf:object    :o .

   :e :x1 :y1 .
   :e :x2 :y2 .

-- Option 3

Triples (NT level)

   :s :p :o .
   :e rdf:nameOf <<( :s :p :o >> .
   :e :x1 :y1 .
   :e :x2 :y2 .

Received on Wednesday, 7 February 2024 22:05:19 UTC