Re: [External] : Re: handling ("asserted") s-p-o triples and ("stated" or "reified") id-s-p-o 4-tuples in RDF/SPARQL

Am 13. August 2024 17:41:58 MESZ schrieb Gregory Williams <greg@evilfunhouse.com>:
>On Aug 13, 2024, at 5:07 AM, Thomas Lörtsch <tl@rat.io> wrote:
>> 
>> I always stress that I’m not good at SPARQL, but I’m trying. The following queries are my attempts at options 1-3 in standard SPARQl, asking also for eventual annotations. Given the example graph:
>> 
>> @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
>> @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
>> @prefix : <http://ex.org/> .
>> 
>> :s :p :o1 .
>> :s :p :o2 .
>> :t2 rdfs:states <<( :s :p :o2 )>> ;
>>     :x :y .
>> :t3 rdf:reifies <<( :s :p :o3 )>> ;
>>     :x :z .
>
>…
>
>> OPTION 2 (asserted or stated)
>> =============================
>> 
>> SELECT *
>> WHERE {
>>     { :s :p ?o . }
>>     UNION 
>>     { ?id rdfs:states <<( :s :p ?o )>> .
>>       OPTIONAL { ?id ?a ?b . } }
>> }
>> 
>> should return
>> ?id  ?o ?a ?b  
>> :t1 :o1
>> :t2 :o2 :x :y
>
>Hi Thomas,
>
>Where does :t1 come from here? I would expect the first result to have a binding only for ?o.

Oups, you're right! Silly me. 

. t

>thanks,
>.greg
>
>

Received on Tuesday, 13 August 2024 16:44:44 UTC