Re: Inferencing on graph patterns

On 14 Nov 2009, at 05:30, Ivan Herman wrote:

>> Consider the following data in a store:
>>
>> (1) ex:C1 rdfs:subClassOf ex:C2 .
>> (2) :myC1 a ex:C1 .
>>
>> Now when you do the following query at the endpoint for the store:
>>
>> SELECT ?type WHERE { ?x a ex:C1 , ?type }
>>
>> and it supports the RDFS entailment regime the result would be  
>> ex:C1 and
>> ex:C2 because the store would infer :myC1 to be of type ex:C2, either
>> when the data got added or on-the-fly.
>> But what if the store didn't contain triple (2) and so no data  
>> about any
>> instances of those two classes? Is there any way that it could make
>> inferences about the data in the WHERE clause and therefore infer  
>> that
>> ?x would be of type ex:C2 as well? I guess not since this is  
>> querying by
>> matching patterns rather than "query by example". But I can see  
>> various
>> uses for this. So if this is not how it's currently defined to work,
>> have you considered this?
>
> The inference regime is defined on possible solution. That indeed  
> means
> that no inference is made on variables which means, as you say, that
> without  the triple (2) the required results will not be returned. And
> there is  no mechanism envisioned in SPARQL to achieve that.

The real "logical" reason why the answer is empty is that the ?x  
variable is understood to be existential, so you are actually asking  
"all the types of an object ?x if such object ?x *exists* and it is of  
type ex:C1". But without (2) it is not guaranteed that such an object  
*necessarily* exists, therefore the answer is empty.

> Note, however, that you may get what you want with a different query.
> For  example, in this case, the
>
> SELECT ?type WHERE { ex:C1 rdfs:subclass ?type. }
>
> will return all possible types.

Well, only the one that can be inferred by the transitive closure of  
rdfs:subClassOf. Indeed rdfs will never return any other type which  
could be inferred by other means -- look at some examples of  
inferences that will never be drawn by RDFS in the attachment.

cheers
--e.

Received on Friday, 20 November 2009 02:09:46 UTC