Re: Making querying of annotations optional

Hi Thomas,

I just want to respond to your analysis of querying in RDF* (i.e., my
earlier work prior to the RDF-star CG), because your claims about it
are wrong.

On Thu, 2024-08-08 at 18:02 +0200, Thomas Lörtsch wrote:
> [...]
> 
> QUERYING IN RDF*
> ================
> 
> In a paper on RDF* and SPARQL* [0] the following example data is
> given:
> 
>  :bob foaf:name "Bob" .
>  <<:bob foaf:age 23>> dct:creator <http://example.com/crawlers#c1> ;
>                       dct:source <http://example.net/listing.html> .
> 
> Note that this is RDF*, not RDF-star, and the statement ':bob
> foaf:age 23' is considered to be true in the graph, i.e. stated.
> 
> Then the following query is presented:
> 
>  SELECT ?x ?age ?src 
>  WHERE  { <<?x foaf:age ?age>> dct:source ?src . }
> 
> Since the ?src is explicitly asked for, the query seems sensible. But
> what if one doesn’t care for the source? What if one doesn’t care if
> a source annotation is provided at all? What if one isn’t even aware
> of the possibility that an annotation might have be added? It seems
> that a query for people's age that isn’t aware of that peculiarity
> will not return Bob’s age.
> IIUC the following query
> 
>  SELECT ?x ?age
>  WHERE  { ?x foaf:age ?age . }
> 
> will not return any results, although Bob’s age is considered to be
> "in the graph".

Wrong! By the evaluation semantics for SPARQL* as defined in the paper
(see Definition 3 in [0]), the result of this query over the example
data above consists of the solution mapping

    m = { ?x -> :bob, ?age -> 23 }.

Notice that the formula in Definition 3 says η[B] ⊆ T+(G*), where
T+(G*) denotes the set of all RDF* triples in RDF* graph G*, including
those that are (recursively) embedded in other RDF* triples of G* (as
defined in Section 2.1 of the paper).

> Also the query over embedded triples wouldn’t find any people’s age
> that is not annotated, i.e. that is stated in a plain triple.

Of course not. The graph pattern of that query is explicitly asking for
embedded triples that have the dct:source annotation. The query to
always retrieve the age and optionally the source (if there is one)
needs to be written as follows (assuming the SPARQL* semantics as
defined in the paper!).

SELECT ?x ?age ?src
WHERE  {
   ?x foaf:age ?age .
   OPTIONAL {
      <<?x foaf:age ?age>> dct:source ?src .
   }
}


> [...]
> 
> [0] Olaf Hartig: Foundations of RDF* and SPARQL* - An Alternative
> Approach to Statement-Level Metadata in RDF, June 2017, 
> http://olafhartig.de/files/Hartig_AMW2017_RDFStar.pdf

> [1] 
> https://lists.w3.org/Archives/Public/public-rdf-star-wg/2024Aug/0032.html

Received on Thursday, 15 August 2024 08:42:00 UTC