Re: Subject lists in SPARQL

> On Mar 26, 2015, at 2:24 PM, Sandro Hawke <sandro@w3.org> wrote:
> 
> I implemented this in an experimental TriG parser a few years ago.   I just made comma work anywhere, allowing the term before the comma to be repeated.
> 
> So if you want to say Alice, Bob, and Charlie all have friend Doug, you say:
> 
>   :Alice, :Bob, :Charlie :hasFriend :Doug.
> 
> Another example of subject-comma:
> 
>   :Alice, :Bob, :Charlie a foaf:Person.
> 
> I also allowed it in the predicate position:
> 
>   :sandro foaf:firstName,vcard:firstName "Sandro"
> 
> and in the Graph position:
> 
>   GRAPH :g1, :g2, :g3 { ... some triples }
> 
> That says that all three of those graphs contain those triples.   When you want to say that, it's incredibly painful without this syntax.
> 
> Note that you can use them together:  <a>,<b> <c>,<d> <e>,<f>. is 8 triples.
> 
> I think this is a completely wonderful and elegant and useful syntax, and I shopped it around a little, but was unable to get folks in the RDF WG at the time (2013) interested.   I resigned myself to it not being in Turtle or TriG, and I'd just put it in the language I was going to propose right after they went to Rec.   Alas, that didn't happen.   (It would also have allowed { } expression to occur anywhere a blank node can, as syntactic sugar for a blank node graph label, and make the pointy brackets optional when they're not required for parsing.   And maybe some other things, like date literals.)

I agree; it’s not too late to re-visit this as a new community-based serialization format. I believe I had my own implementation of something like this [1], but there were some compatibility issues with existing TriG, so we didn’t pursue it at the time.

The ability to not repeat yourself for such things is quite useful. Note that you can do this with predicates in RDFa, and with subjects in Microdata RDF (through use of @itemref).

I’d  be interested in helping on such an effort; may need a CG, though.

Gregg

[1] https://github.com/ruby-rdf/rdf-trig/tree/feature/TrigN3 <https://github.com/ruby-rdf/rdf-trig/tree/feature/TrigN3>

>        -- Sandro
> 
> On 03/26/2015 07:59 AM, Bijan Parsia wrote:
>> I don’t understand the example or the goal.
>> 
>> On 24 Mar 2015, at 16:48, Fabiano Luz <fabianocomp@gmail.com <mailto:fabianocomp@gmail.com>> wrote:
>> 
>>>> Hello Folks,
>>> On the predicate lists we have omitted the subject, for example:
>>> 
>>>      ?x  foaf:name  ?name ;
>>>            foaf:mbox  ?mbox .
>> 
>> This is clear.
>> 
>>> I wonder if there is some kind of "subject lists" where we omitted the
>>> predicate, for example:
>>> 
>>>      foaf:Bob  foaf:phone  ?phone1; foaf:John  ?phone2 .
>> 
>> Er.. not so much. Let me try reformatting:
>> 
>>  foaf:Bob foaf:phone ?phone1;
>>  foaf:John                  ?phone2.
>> 
>> Well, that syntax would be dreadful (as ambiguous) and not super readable (contrary to the first one). I guess you could add a pro-predicate.
>> 
>>  foaf:Bob foaf:phone ?phone1;
>>  foaf:John  ^^^           ?phone2.
>> 
>> That could be general purpose so the first example was sugar for:
>> 
>>  ?x  foaf:name  ?name ;
>>         ^^^      foaf:mbox  ?mbox .
>> 
>> I don’t see the value.
>> 
>>> PS: I do not want to repeat the predicate.
>> 
>> Why not? What’s the use case?
>> 
>> Cheers,
>> Bijan.
>> 
> 

Received on Thursday, 26 March 2015 23:44:29 UTC