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

Re: Sparql query help

From: Lee Feigenbaum <lee@thefigtrees.net>
Date: Fri, 12 Jun 2009 10:30:34 -0400
Message-ID: <4A32668A.3010203@thefigtrees.net>
To: Samuel Pedro <samuelcpspam@gmail.com>
CC: public-sparql-dev@w3.org
Samuel Pedro wrote:
> Im trying to do this query...
> 
> SELECT ?subject ?object
> WHERE { ?subject owl:equivalenteClass ?object FILTER( ?object = "Meat") }
> 
> im trying to find the equivalente Class of meat, but it doesn't return 
> what i want, what am i doing wrong?
> 
> if i do this...
> 
> SELECT ?subject ?object
> WHERE { ?subject owl:equivalenteClass ?object FILTER( ?object != "Meat") }
> 
> i get all the equivalent class that there is in the owl. why?

Without seeing your data, it's hard to say for sure, but I think it's 
pretty likely that your classes are resources (URIs) and "Meat" is just 
a label for the class. If this is right, you probably want a query 
similar to:

SELECT ?equivalentClass ?meatClass
WHERE {
   ?equivalentClass owl:equivalentClass ?meatClass .
   ?meatClass rdfs:label "Meat" .
}


The details will vary depending on what predicate is used to give a 
label to your classes (in my example I assume that it's rdfs:label). 
Also, note that the label needs to be exactly "Meat" for this to work.

hope this helps,
Lee
Received on Friday, 12 June 2009 14:31:20 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 12 June 2009 14:31:20 GMT