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

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 )>> } 

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.

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 }.

-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 Thursday, 11 September 2025 15:51:52 UTC