Re: RDF*/SPARQL* syntax

Hi Olaf,

> On 8 Aug 2019, at 12:50, Olaf Hartig <olaf.hartig@liu.se> wrote:
> 
> Before I respond, let me emphasize that I am not religious about what
> the Turtle*/SPARQL* serialization syntax looks like as long as it serves
> the purpose.   ...and if it does not have the issue that you point out
> for the current serialization syntax, then great.

That's good to hear.

> Now, I understand that the alternative you outline was meant to make
> your point. However, let's consider it as an alternative proposal.
> 
> Then, this proposal indeed seems to have some advantages over the
> serialization syntax as it is now. On the other hand, the current
> serialization syntax is visually less different from the abstract
> syntax. I mean, your proposed serialization syntax does not look like
> nested triples anymore. Perhaps that's not necessary?

Let me state the problem with Turtle* a bit more explicitly.

A Turtle file is (if we ignore base and prefix mappings) a set of blocks of triples, where the triples in each block share the same subject. 

It is common practice to group all triples that share the same subject into such a block.

If Turtle*'s new features (nested triples) are used, this practice is no longer possible.

If a triple t is used as the subject of another triple, then t cannot be grouped together with other triples that share the same subject. Instead, t needs to be removed from the block, or repeated outside of the block.

If there was a way to change Turtle* so that it visually still looks like nested triples, but at the same time retains Turtle's ability to group triples with same subject into a single block (even if some of these triples are annotated), then I would likely prefer that change over my straw man proposal. But I cannot think of such a way.

> Even if it is not, there are some features of (nested) RDF* triples that
> I cannot immediately picture how they may be captured in the alternative
> serialization syntax you outline:
> 
> 1/ What about RDF* triples that consist of multiple levels of nesting?
> For instance, consider the following RDF* triple:
> 
> ( ((:a, :b, :c), :d, :e), :f, :g ) .
> 
> Using the Turtle* syntax as it is defined at the moment, this triple
> would be serialized as follows:
> 
> << <<:a :b :c>> :d :e >> :f :g .
> 
> How would you represent this triple in the alternative serialization
> syntax that you have outlined?

In my straw man syntax, this triple would be written as:

    :a :b :c <<:d :e <<:f :g>> >>.

> 2/ What about (nested) RDF* triples that have a triple in their object
> position? For instance, consider the following RDF* triple:
> 
> ( :a, :b, (:c, :d, :e) ) .
> 
> Using Turtle* as defined at the moment, this triple would be serialized
> as follows:
> 
> :a :b <<:c :d :e>> .
> 
> How would you represent this triple in the alternative serialization
> syntax that you have outlined?

I could think of a number of ways of handling this situation. Before I propose one, I'd like some clarification on the use cases for triples of that shape. I'll start a new thread for that.

Thanks,
Richard



> 
> 
> Thanks,
> Olaf
> 
> 
> On Wed, 2019-08-07 at 16:55 +0100, Richard Cyganiak wrote:
>> 
>>> 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 Sunday, 1 September 2019 12:34:02 UTC