- From: Samuel Pedro <samuelcpspam@gmail.com>
- Date: Fri, 12 Jun 2009 16:35:13 +0100
- To: Stephane Corlosquet <scorlosquet@gmail.com>, Lee Feigenbaum <lee@thefigtrees.net>, public-sparql-dev@w3.org
- Message-ID: <cc48d5440906120835u65fd0c87r8ad04d7910273206@mail.gmail.com>
Ok, tried to send as a attachment but probably something went wrong, i will
post here:
<?xml version="1.0"?>
<rdf:RDF
xmlns:xsp="http://www.owl-ontologies.com/2005/08/07/xsp.owl#"
xmlns="http://www.owl-ontologies.com/testFood2.owl#"
xmlns:swrlb="http://www.w3.org/2003/11/swrlb#"
xmlns:swrl="http://www.w3.org/2003/11/swrl#"
xmlns:protege="http://protege.stanford.edu/plugins/owl/protege#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xml:base="http://www.owl-ontologies.com/testFood2.owl">
<owl:Ontology rdf:about=""/>
<owl:Class rdf:ID="Cow">
<rdfs:subClassOf>
<owl:Class rdf:ID="RedMeat"/>
</rdfs:subClassOf>
</owl:Class>
<owl:Class rdf:ID="Chicken">
<rdfs:subClassOf>
<owl:Class rdf:ID="WhiteMeat"/>
</rdfs:subClassOf>
</owl:Class>
<owl:Class rdf:ID="Pig2">
<owl:equivalentClass>
<owl:Class rdf:ID="Pig"/>
</owl:equivalentClass>
<rdfs:subClassOf>
<owl:Class rdf:about="#RedMeat"/>
</rdfs:subClassOf>
<rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
>Pig2</rdfs:label>
</owl:Class>
<owl:Class rdf:ID="Onion">
<rdfs:subClassOf>
<owl:Class rdf:ID="Vegetable"/>
</rdfs:subClassOf>
</owl:Class>
<owl:Class rdf:ID="Ingredients"/>
<owl:Class rdf:about="#Pig">
<rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
>Pig</rdfs:label>
<rdfs:subClassOf>
<owl:Class rdf:about="#RedMeat"/>
</rdfs:subClassOf>
<owl:equivalentClass rdf:resource="#Pig2"/>
</owl:Class>
<owl:Class rdf:ID="ChickenWithTomato">
<rdfs:subClassOf>
<owl:Class rdf:ID="Plates"/>
</rdfs:subClassOf>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty>
<owl:ObjectProperty rdf:ID="hasIngridients"/>
</owl:onProperty>
<owl:someValuesFrom>
<owl:Class>
<owl:intersectionOf rdf:parseType="Collection">
<owl:Class rdf:about="#Chicken"/>
<owl:Class rdf:ID="Tomato"/>
</owl:intersectionOf>
</owl:Class>
</owl:someValuesFrom>
</owl:Restriction>
</rdfs:subClassOf>
</owl:Class>
<owl:Class rdf:ID="ChickenWithOnions">
<rdfs:subClassOf rdf:resource="#Plates"/>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="#hasIngridients"/>
<owl:someValuesFrom>
<owl:Class>
<owl:intersectionOf rdf:parseType="Collection">
<owl:Class rdf:about="#Chicken"/>
<owl:Class rdf:about="#Onion"/>
</owl:intersectionOf>
</owl:Class>
</owl:someValuesFrom>
</owl:Restriction>
</rdfs:subClassOf>
</owl:Class>
<owl:Class rdf:about="#WhiteMeat">
<rdfs:subClassOf>
<owl:Class rdf:ID="Meat"/>
</rdfs:subClassOf>
</owl:Class>
<owl:Class rdf:about="#Tomato">
<rdfs:subClassOf>
<owl:Class rdf:about="#Vegetable"/>
</rdfs:subClassOf>
</owl:Class>
<owl:Class rdf:about="#RedMeat">
<rdfs:subClassOf>
<owl:Class rdf:about="#Meat"/>
</rdfs:subClassOf>
</owl:Class>
<owl:Class rdf:about="#Vegetable">
<rdfs:subClassOf rdf:resource="#Ingredients"/>
</owl:Class>
<owl:Class rdf:about="#Meat">
<rdfs:subClassOf rdf:resource="#Ingredients"/>
</owl:Class>
<owl:ObjectProperty rdf:ID="hasChicken">
<rdfs:subPropertyOf>
<owl:ObjectProperty rdf:ID="hasWhiteMeat"/>
</rdfs:subPropertyOf>
</owl:ObjectProperty>
<owl:ObjectProperty rdf:ID="hasMeat">
<rdfs:subPropertyOf rdf:resource="#hasIngridients"/>
</owl:ObjectProperty>
<owl:ObjectProperty rdf:ID="hasVegetable">
<rdfs:subPropertyOf rdf:resource="#hasIngridients"/>
</owl:ObjectProperty>
<owl:ObjectProperty rdf:ID="hasIngridients_26">
<rdfs:subPropertyOf rdf:resource="#hasIngridients"/>
</owl:ObjectProperty>
<owl:ObjectProperty rdf:ID="hasOnion">
<rdfs:subPropertyOf rdf:resource="#hasVegetable"/>
</owl:ObjectProperty>
<owl:ObjectProperty rdf:about="#hasWhiteMeat">
<rdfs:subPropertyOf rdf:resource="#hasMeat"/>
</owl:ObjectProperty>
</rdf:RDF>
But think that i understand why it cant work that way.
"but I think it's pretty likely that your classes are resources (URIs)" how
i know that?
2009/6/12 Stephane Corlosquet <scorlosquet@gmail.com>
> 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
>>>
>>
>>
>>
>
--
--
Samuel Pedro
Received on Friday, 12 June 2009 15:35:54 UTC