Re: Making querying of annotations optional

Before letting this discussion go too far, I want to be sure that we share the same assumptions.
[0] assumes a CG-style notion of triple reification, which is not the one adopted by the current baseline. 
The current baseline has a clear definition for simple entailment, which  remains the basis for BGP matching in SPARQL.
--e.

> On 15 Aug 2024, at 14:10, Thomas Lörtsch <tl@rat.io> wrote:
> 
> Hi Olaf,
> 
> 
> thank you very much for the correction, and the detailed response!
> 
>> On 15. Aug 2024, at 10:41, Olaf Hartig <olaf.hartig@liu.se> wrote:
>> 
>> 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
> 
> 
> I’m glad I added that caveat ;-) Obviously I’m challenged reading abstract definitions.
> 
>>> 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
> 
> 
> I had to look that up again, in particular sentence 1 which says that any standard triple is also an RDF* triple:
> 
> Definition 1.
> An RDF⋆ triple is a 3-tuple that is defined recursively as follows:
> 1. Any RDF triple t∈(I∪B)×I×(I∪B∪L) is an RDF⋆ triple; and
> 2. Given RDF⋆ triples t and t′, and RDF terms s ∈ (I∪B), p ∈ I and o ∈ (I∪B∪L),
> then the tuples (t, p, o), (s, p, t) and (t, p, t′ ) are 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).
> 
> This does indeed make much more sense to me than what I wrongly understood the definition to be (and argued about above). It seems like this is very similar to how I would like the proposed 'rdfs:states' to be defined. I hope I’m not again overlooking something important.
> 
>>> 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.
> 
> 
> "Of course" in a way ;-) Yes, if one asks for annotations, then the query shouldn’t return statements that are not annotated. However, at an early stage in exploring a graph - and those early stages are IMO those that need the most support from syntax - one is probably interested in statements both annotated or not. That’s what the query below does, as you correctly point out.
> 
>> 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 .
>>  }
>> }
> 
> Exactly. And the culmination of my long-ish mail [1] was to suggest that some syntactic sugar in support of this use case seems appropriate.
> 
> 
> Thanks again,
> Thomas
> 
> 
>> 
>>> [...]
>>> 
>>> [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 14:45:36 UTC