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

Re: Sparql query help

From: Samuel Pedro <samuelcpspam@gmail.com>
Date: Fri, 12 Jun 2009 15:52:39 +0100
Message-ID: <cc48d5440906120752r35b28803rf5c30df25ecc17c@mail.gmail.com>
To: Lee Feigenbaum <lee@thefigtrees.net>
Cc: public-sparql-dev@w3.org
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>

> 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:53:16 GMT

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