Re: RDF*/SPARQL* syntax

> On 5 Aug 2019, at 15:16, Olaf Hartig <olaf.hartig@liu.se> wrote:
> 
> On Mon, 2019-07-08 at 11:09 +0100, Richard Cyganiak wrote:
>> [...]
>> 4. I have concerns about the RDF*/SPARQL* syntax that I'd like to
>> discuss at some point.
> 
> What are these concerns?
> 
> Are these concerns related to the abstract syntax (nested triples and
> nested triple patterns)

No, the abstract syntax as proposed seems quite sensible and parsimonious to me.

> or to the Turtle* serialization format?

The concerns are related to the Turtle* and SPARQL* serialisation syntaxes. My concern for SPARQL* is bigger than for Turtle* as queries are more often written by hand.

In these syntaxes, a triple :s :p :o annotated with property-value :annoP :annoV is:

    <<:s :p :o>> :annoP :annoV.

In Turtle, a common and important idiom is to use the common-subject abbreviation:

    :resource1 a :SomeType;
        :p1 :o1;
        :p2 :o2;
        :p3 :o3;
        .

Similarly in SPARQL:

    ?resource a :SomeType;
        :p1 :o1;
        :p2 ?value2;
        :p3 ?value3

The design of the Turtle*/SPARQL* syntax is such that it cannot coexist with this important idiom. To add an RDF*/SPARQL* annotation to either of the snippets above, one has to rip the snippet apart, undoing the common-subject abbreviation. For example:

    ?resource a :SomeType;
        :p1 :o1.
    <<?resource :p2 ?value2>> :annoP ?annoV
    ?resource :p3 ?value3

This involves a lot of unnecessary typing and syntactic repetition. The result suffers from poor readability and does not make the intent visually clear.

There are various alternative syntaxes that would not share these shortcomings. As a straw man:

    ?resource a :SomeType;
        :p1 :o1;
        :p2 ?value2 <<:annoP ?annoV>>;
        :p3 ?value3

Sp what I would like to see is a different way of extending Turtle and SPARQL with nested triples and nested triple patterns that does play better with idiomatic Turtle and SPARQL.

Richard

Received on Wednesday, 7 August 2019 15:56:05 UTC