Re: A question regarding the semantics of multi-triple term reifications and querying

> On 15. Sep 2025, at 10:44, Olaf Hartig <olaf.hartig@liu.se> wrote:
> 
> Hi Thomas,
> 
> On Mon, 2025-09-15 at 10:30 +0200, Thomas Lörtsch wrote:
>> Hi Olaf,
>> 
>> thank you for your help!
>> 
>>> On 11. Sep 2025, at 17:51, Olaf Hartig <olaf.hartig@liu.se> wrote:
>>> 
>>> Hi Thomas,
>>> 
>>> On Thu, 2025-09-11 at 17:16 +0200, Thomas Lörtsch wrote:
>>>> Since reifiers can refer to multiple triple terms, do queries for annotations on a triple need to filter out
>>>> eventual
>>>> multi-triple term annotations? Take for example the following graph.:
>>>> 
>>>>    :r rdf:reifies <<( :s :p :o )>> ,
>>>>                   <<( :x :y :z )>> ;
>>>>        :b :c .
>>>> 
>>>> Querying for all annotations on <<( :s :p :o )>> might naively query for all annotations on reifiers that
>>>> rdf:reify
>>>> <<( :s :p :o )>>, e.g.:
>>>> 
>>>> 
>>>>    select ?pred ?obj where {
>>>>      _:x rdf:reifies <<( :s :p :o )>> ;
>>>>          ?pred ?obj
>>>>    }
>>>> 
>>>> However, in the above example that would return the annotation ':r :a :b',
>>> 
>>> Assuming you meant ':r :b :c', then yes, one of the solution mappings in the result of this query over the graph
>>> given
>>> above, is { ?pred -> :b, ?obj -> :c }.
>>> 
>>> In addition to this one, there are two more solution mappings in the result:
>>>  { ?pred -> rdf:reifies, ?obj -> <<( :s :p :o )>> } 
>>> and
>>>  { ?pred -> rdf:reifies, ?obj -> <<( :x :y :z )>> } 
>> 
>> Right.
>> 
>>> That's exactly what the query asks for. If you want to retrieve data about a reifier that reifies only <<( :s :p :o
>>> )>>
>>> and nothing else---at least not within the graph that you are querying---then you need to specify that as an
>>> additional
>>> condition in your query.
>> 
>> IIUC specifying that additional condition requires something like 
>> 
>>     FILTER NOT EXISTS { 
>>         ?reifier rdf:reifies ?otherTriple . 
>>         FILTER (?otherTriple != <<( :s :p :o )>> ) 
>>     }
> 
> Correct.
> 
>>> Notice also that this is not specific to reifiers at all! As an example, consider the graph
>>> 
>>>  :s :p 1 .
>>>  :s :p 2 .
>>>  :s :q :y .
>>> 
>>> and the query
>>> 
>>>  SELECT ?v WHERE {
>>>    _:b :p 1 .
>>>    _:b :q ?v
>>>  }
>>> 
>>> Also here, you get a solution mapping { ?v -> :y }.
>> 
>> Indeed! That seems to suggest that in a multi-part reifier the combination of individual triple terms is to be
>> understood as OR, not AND,
> 
> No, I don't think so. Look again at my example RDF graph with predicates :p and :q above. I wouldn't say that the value
> that :s has for property :p is 1 or 2. Instead, I would say that :s has two (known) values for :p, namely 1 and 2.

I said OR, not XOR. :s for :p has both values, not one value (1 AND 2).

Best,
Thomas

> -Olaf
> 
> 
>> and that my intuition was wrong. I agree that this should not be surprising, given the general design of RDF.
>> 
>> I think this topic should be part of introductory material.
>> 
>> 
>> Thanks again,
>> Thomas
>> 
>> 
>>> -Olaf
>>> 
>>> 
>>>> but ':r' doesn’t just reify <<( :s :p :o )>>, it reifies <<( :s :p :o )>> AND <<( :x :y :z )>>. I at least
>>>> consider
>>>> that a difference (but I’m not quite sure if the specs do too).
>>>> 
>>>> OTOH, filtering out multi-triple term reifiers like ':r' from a result set is pretty tedious, especially if it
>>>> would
>>>> have to be done on a regular basis.
>>>> 
>>>> Best,
>>>> Thomas

Received on Monday, 15 September 2025 09:01:52 UTC