Re: Sparql query help

Stephane Corlosquet wrote:
> Hi Samuel,
> 
> You cannot use  ?meatClass owl:Class "Pig" in your WHERE clause because 
> it is not a valid pattern. You should follow the {subject property 
> object} pattern in your WHERE clause. owl:Class is a class and not a 
> property.
> 
> Stephane.

This is, strictly speaking, not entirely correct. Syntactically

      ?meatClass owl:Class "Pig" .

is totally fine. But, as Lee already mentioned and Steph probably tried 
to make clearer, we'd need to know your data/schema, i.e. what property 
carry the "Pig" label in order to help you.

Can you post some example graph on which you want to pose that query?

Axel

> On Fri, Jun 12, 2009 at 3:52 PM, Samuel Pedro <samuelcpspam@gmail.com 
> <mailto:samuelcpspam@gmail.com>> wrote:
> 
>     This is my owl file, i had to add labels to the classes, and do this:
> 
> 
>     SELECT ?equivalentClass ?meatClass
>     WHERE {
>      ?equivalentClass owl:equivalentClass ?meatClass .
>      ?meatClass rdfs:label "Pig" . (in owl file i have Pig and Pig2)
>     }
> 
>     and why this query doesnt work, why it only works for labels? (I'm
>     trying to understand sparql but...)
> 
> 
>     SELECT ?equivalentClass ?meatClass
>     WHERE {
>      ?equivalentClass owl:equivalentClass ?meatClass .
>      ?meatClass owl:Class "Pig" .
>     }
> 
> 
> 
>     2009/6/12 Lee Feigenbaum <lee@thefigtrees.net
>     <mailto:lee@thefigtrees.net>>
> 
>         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
> 
> 
> 
> 


-- 
Dr. Axel Polleres
Digital Enterprise Research Institute, National University of Ireland, 
Galway
email: axel.polleres@deri.org  url: http://www.polleres.net/

Received on Friday, 12 June 2009 15:14:35 UTC