Re: Sparql query help

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.

On Fri, Jun 12, 2009 at 3:52 PM, Samuel Pedro <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>
>
> 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 15:08:56 UTC