Re: [Dbpedia-discussion] DBpedia SPARQL Endpoint and Transitive Queries

Jürgen Jakobitsch wrote:
> hi,
>
> results might sometimes also be correct but clinton-like (misleading)
>
> consider the fact, that sparqling for skos:broaderTransitive does not include the direct skos:broader.
>
> for example : 
>
> - conceptA skos:broader conceptB
> - conceptB skos:broader conceptC
> - conceptC skos:broader conceptD
>
> sparql for skos:broader of conceptA => includes conceptB (and nothing else)
> sparql for skos:broaderTranisitive of conceptA => includes conceptC, conceptD (but not conceptA)
> sparql for skos:broader of conceptC => includes conceptD (and nothing else)
> sparql for skos:broaderTransitive of conceptC => includes emptiness
>
> if you would like the whole chain of broaders you would need to use skos:broader UNION skos:broaderTransitive
>
> analog for narrowers
>
> but there's definitly something wrong with the broaderTransitive reasoning.
>
> some further down wrote something broaderTransitive subPropertyOf broader :
>
> PLEASE take care skos:broader is a subPropertyOf skos:broaderTransitive !!
>
> wkr www.turnguard.com
>
>
>
>
> ----- Original Message -----
> From: "Alexandre Passant" <alexandre.passant@deri.org>
> To: "Kingsley Idehen" <kidehen@openlinksw.com>
> Cc: public-lod@w3.org, "Antoine Isaac" <aisaac@few.vu.nl>, pedantic-web@googlegroups.com, dbpedia-discussion@lists.sourceforge.net
> Sent: Thursday, October 8, 2009 1:17:41 PM GMT -05:00 US/Canada Eastern
> Subject: Re: [Dbpedia-discussion] DBpedia SPARQL Endpoint and Transitive Queries
>
> Hi,
>
> On 8 Oct 2009, at 16:54, Kingsley Idehen wrote:
>
>   
>> Antoine Isaac wrote:
>>     
>>> Alexandre Passant a écrit :
>>>       
>>>> Hi,
>>>>
>>>> On 8 Oct 2009, at 16:09, Kingsley Idehen wrote:
>>>>
>>>>         
>>>>> All,
>>>>>
>>>>> The intersection of Leigh Dodds SPARQL extensions survey [1],  
>>>>> imminent official release of Virtuoso 6.0 (DBpedia basic and Live  
>>>>> already use this, ditto LOD Cache, and B3S public endpoints), and  
>>>>> an old post by Bernard Vatant re. skos:broader, has lead to this  
>>>>> simple, but powerful example of  Virtuoso's Transitive Option  
>>>>> extension for SPARQL :
>>>>>
>>>>> #Transitive Option Off
>>>>>
>>>>> PREFIX p: <http://dbpedia.org/property/>
>>>>> PREFIX dbpedia: <http://dbpedia.org/resource/>
>>>>> PREFIX category: <http://dbpedia.org/resource/Category:>
>>>>> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
>>>>> PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
>>>>> PREFIX geo: <http://www.georss.org/georss/>
>>>>>
>>>>> SELECT DISTINCT ?m ?n ?p ?d
>>>>> WHERE {
>>>>> ?m rdfs:label ?n.
>>>>> ?m skos:subject ?c.
>>>>> ?c skos:broader category:Churches_in_Paris.
>>>>> ?m p:abstract ?d.
>>>>> ?m geo:point ?p
>>>>> FILTER ( lang(?n) = "fr" )
>>>>> FILTER ( lang(?d) = "fr" )
>>>>> }
>>>>>
>>>>> #Transitive Option On
>>>>>
>>>>> PREFIX p: <http://dbpedia.org/property/>
>>>>> PREFIX dbpedia: <http://dbpedia.org/resource/>
>>>>> PREFIX category: <http://dbpedia.org/resource/Category:>
>>>>> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
>>>>> PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
>>>>> PREFIX geo: <http://www.georss.org/georss/>
>>>>>
>>>>> SELECT DISTINCT ?m ?n ?p ?d
>>>>> WHERE {
>>>>> ?m rdfs:label ?n.
>>>>> ?m skos:subject ?c.
>>>>> ?c skos:broader category:Churches_in_Paris OPTION (TRANSITIVE).
>>>>> ?m p:abstract ?d.
>>>>> ?m geo:point ?p
>>>>> FILTER ( lang(?n) = "fr" )
>>>>> FILTER ( lang(?d) = "fr" )
>>>>> }
>>>>>
>>>>>
>>>>>           
>>>> As skos:broader is not transitive [1] but its superproperty  
>>>> skos:broaderTransitive is, shouldn't the second query be
>>>>
>>>> ?c skos:broaderTransitive category:Churches_in_Paris OPTION  
>>>> (TRANSITIVE).
>>>>
>>>> Best,
>>>>
>>>> Alex.
>>>>
>>>> [1] http://www.w3.org/TR/2009/REC-skos-reference-20090818/#L2413
>>>>         
>>> +1. Also, skos:subject is not in the recommendation...
>>>       
>> Fine, but what happens when the data in question already has such  
>> triples? Try this against DBpedia:
>>
>> PREFIX p: <http://dbpedia.org/property/>
>> PREFIX dbpedia: <http://dbpedia.org/resource/>
>> PREFIX category: <http://dbpedia.org/resource/Category:>
>> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
>> PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
>> PREFIX geo: <http://www.georss.org/georss/>
>>
>> SELECT DISTINCT ?m ?n ?p ?d
>> WHERE {
>>   ?m rdfs:label ?n.
>>   ?m skos:subject ?c.
>>   ?c skos:broaderTransitive category:Churches_in_Paris option  
>> (transitive) .
>>   ?m p:abstract ?d.
>>   ?m geo:point ?p
>>  FILTER ( lang(?n) = "fr" )
>>  FILTER ( lang(?d) = "fr" )
>> }
>>
>> You will have an empty result-set. Again, this is the point Bernard  
>> Vatant made in his post a long time ago.
>>     
>
> So there is something wrong in the current inference done in DBPedia.
> Indeed, that query lists one result
>
> PREFIX p: <http://dbpedia.org/property/>
> PREFIX dbpedia: <http://dbpedia.org/resource/>
> PREFIX category: <http://dbpedia.org/resource/Category:>
> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
> PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
> PREFIX geo: <http://www.georss.org/georss/>
>
> SELECT DISTINCT ?m ?n ?p ?d
> WHERE {
>    ?m rdfs:label ?n.
>    ?m skos:subject ?c.
>    ?c skos:broader category:Churches_in_Paris .
>    ?m p:abstract ?d.
>    ?m geo:point ?p
>   FILTER ( lang(?n) = "fr" )
>   FILTER ( lang(?d) = "fr" )
> }
>
> But the following one list none
>
> PREFIX p: <http://dbpedia.org/property/>
> PREFIX dbpedia: <http://dbpedia.org/resource/>
> PREFIX category: <http://dbpedia.org/resource/Category:>
> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
> PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
> PREFIX geo: <http://www.georss.org/georss/>
>
> SELECT DISTINCT ?m ?n ?p ?d
> WHERE {
>    ?m rdfs:label ?n.
>    ?m skos:subject ?c.
>    ?c skos:broaderTransitive category:Churches_in_Paris .
>    ?m p:abstract ?d.
>    ?m geo:point ?p
>   FILTER ( lang(?n) = "fr" )
>   FILTER ( lang(?d) = "fr" )
> }
>
> However, skos:broaderTransitive is a superproperty of skos:broader, so  
> you should get at least the result of the first query included here.
> Then, the query you mentioned earlier (using option (transitive) with  
> skos:broaderTransitive) should not give an empty set - and everything  
> work fine.
>
> Thanks,
>
> Alex.
>
> BTW, do you have a link to Bernard's post ?
>
>   
>> Ultimate solution: make an inference rule that asserts:  
>> <skos:broaderTransitive> owl:subPropertyOf <skos:broader> (or make a  
>> context rule from the entire skos ontology), and you will then have  
>> the revised query return data for those databases that have used  
>> skos:broader to build their concept scheme structure (assuming you  
>> apply the inference rule pragma). Otherwise,  If your store has  
>> skos:broaderTransitive data, then just change the query :-)
>>     
>
>   
>> Kingsley
>>     
>>> Best,
>>>
>>> Antoine
>>>
>>>
>>>       
>> -- 
>>
>>
>> Regards,
>>
>> Kingsley Idehen       Weblog: http://www.openlinksw.com/blog/~kidehen
>> President & CEO OpenLink Software     Web: http://www.openlinksw.com
>>
>>
>>
>>
>>     
>
> --
> Dr. Alexandre Passant
> Digital Enterprise Research Institute
> National University of Ireland, Galway
> :me owl:sameAs <http://apassant.net/alex> .
>
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay 
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Dbpedia-discussion mailing list
> Dbpedia-discussion@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/dbpedia-discussion
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay 
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Dbpedia-discussion mailing list
> Dbpedia-discussion@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/dbpedia-discussion
>   
All,


## Rule

PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
INSERT INTO GRAPH <urn:rules.skos> {  skos:broader rdfs:subPropertyOf 
skos:broaderTransitive .
                                      skos:narrower rdfs:subPropertyOf 
skos:narrowerTransitive};
                                                                      
## Virtuoso SQL for associating rule with specific context graph
## Execute via ISQL interface (Conductor or CommandLine variants)

rdfs_rule_set ('skos-trans', 'urn:rules.skos');

## Actual Query that uses a Context Rule to handle Instance data being 
skos:broader based
DEFINE input:inference "skos-trans"                               
PREFIX p: <http://dbpedia.org/property/>
PREFIX dbpedia: <http://dbpedia.org/resource/>
PREFIX category: <http://dbpedia.org/resource/Category:>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX geo: <http://www.georss.org/georss/>

SELECT DISTINCT ?m ?n ?p ?d
WHERE {
  ?m rdfs:label ?n.
  ?m skos:subject ?c.
  ?c skos:broaderTransitive category:Churches_in_Paris option (transitive) .
  ?m p:abstract ?d.
  ?m geo:point ?p
 FILTER ( lang(?n) = "fr" )
 FILTER ( lang(?d) = "fr" )
    }

## Execute the above against the DBpedia SPARQL endpoint will return 
data, now that context rule has been created and pragma is in the SPARQL



-- 


Regards,

Kingsley Idehen       Weblog: http://www.openlinksw.com/blog/~kidehen
President & CEO 
OpenLink Software     Web: http://www.openlinksw.com

Received on Thursday, 8 October 2009 20:29:19 UTC