W3C home > Mailing lists > Public > public-sparql-dev@w3.org > July to September 2009

Re: Retrieving all classes

From: Bijan Parsia <bparsia@cs.man.ac.uk>
Date: Mon, 17 Aug 2009 12:25:15 +0100
Cc: "'Danny Ayers'" <danny.ayers@gmail.com>, <public-sparql-dev@w3.org>
Message-Id: <7741EB61-7CC4-4988-9FFC-B8B4F199E4C3@cs.man.ac.uk>
To: "On Lee" <onlee2000@hotmail.com>
On 16 Aug 2009, at 16:40, On Lee wrote:

> Thanks,Danny.
>
> My data is http://danbri.org/foaf.rdf. I originally loaded it using  
> Jena 2.6.0. It returned nothing. Since I am new and still learning  
> about this technology, I thought I did something wrong.

The key bit is that without some mode of inference engaged by the  
query engine, your sparql query will only return explicit triples from  
the source.

If you open up foaf.rdf in a text editor and search for the string  
"Class" you'll get no hits. Absent entities, that means sparql will do  
no better.

> Later, I learnt from about SPARQLer (http://sparql.org/sparql.html)  
> mentioned in http://www.cambridgesemantics.com/2008/09/sparql-by-example/#%288%29 
> .
>
> I used http://danbri.org/foaf.rdf on the http://sparql.org/ 
> sparql.html and executed
> 	PREFIX rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
> 	PREFIX rdfs:    <http://www.w3.org/2000/01/rdf-schema#>
>
> 	SELECT  ?c WHERE {  ?c rdf:type rdfs:Class .  }
>
> It returned nothing.
>
> Per your advice/comments below, I changed to the following:
> 	PREFIX rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
> 	PREFIX rdfs:    <http://www.w3.org/2000/01/rdf-schema#>
> 	PREFIX foaf:   <http://xmlns.com/foaf/0.1/>
>
> 	SELECT  ?c WHERE {  ?c rdf:type foaf:Person .  }
>
> It returns something.

If you string search for "Person", you'll find the syntax for the  
relevant triples, e.g.,

"""   <Person>
         <name>Dan Brickley</name>
         <isPrimaryTopicOf rdf:resource="http://www.geocities.com/danbfan/ 
"/>
         <img rdf:resource="http://www.geocities.com/danbfan/ 
Ford3.jpg"/>
       </Person>""""

That fragment explicitly states the triple:

[] <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person 
 >.

Hence is available as a result.

The current SPARQL wg is working on defining entailment regimes for  
SPARQL which should allow you to query that document with your  
rdfs:Class query and get the expected results.

Unfortunately, it'll be still somewhat complicated by the fact that we  
have both rdfs:Class and owl:Class.

Cheers,
Bijan.
Received on Monday, 17 August 2009 11:25:54 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 17 August 2009 11:25:55 GMT