Re: Sparql query help

Hi Paul, Hi Lee,

the query

PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX plate: <http://www.owl-ontologies.com/testFood2.owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?ingredients
WHERE {
 plate:ChickenWithTomato rdfs:subClassOf [
   owl:onProperty plate:hasIngridients ;
   owl:someValuesFrom ?ingredients
 ]
}

works fine in protégé, with jena not so ever but like paul said i need
pellet to work (must search how i do that)

but with

WHERE { plate:ChickenWithTomato plate:hasIngredients ?ingredients }

it doesn't work. i'm trying to install also IsaViz to see the graph but with
no sucess so far.

I have more questions, what do you mean by "You have the query the direct
triples"? You mean this?

<owl:Class rdf:about="#RedMeat">
    <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
    >Red Meat</rdfs:label>
    <rdfs:subClassOf>
      <owl:Class rdf:about="#Meat"/>
    </rdfs:subClassOf>
  </owl:Class>

 ( I really have to put IsaViz to work to understand this better.)

and other thing, in the last query
...
plate:ChickenWithTomato rdfs:subClassOf [
   owl:onProperty plate:hasIngridients ;
   owl:someValuesFrom ?ingredients...

can please explain better why it works? i'm trying to "read" it but i dont
understand it.

-> "the plate chicken with tomato (subject ) is subclass of (property)
((object) onProperty of the subject it hasIngredients; ((object) (have)
someValuesFrom ?ingredients"

ok, its wrong what im saying, but i'm just trying to understand what's
there... I notice that i'm search the "<rdfs:subClassOf>" of the node, is
that correct?



2009/6/14 Paul Gearon <gearon@ieee.org>

> On Sat, Jun 13, 2009 at 1:21 PM, Samuel Pedro<samuelcpspam@gmail.com>
> wrote:
> > I changed the ontology, have now this class,
>
> <snip/>
>
> At a glance it looks better. I haven't looked at it in detail though.
>
> > If i want to know which ingredients have the plate "Chicken with Onions"?
> > Shouldn´t be...
> >
> > PREFIX owl:<http://www.w3.org/2002/07/owl#>
> > PREFIX plate:<http://www.owl-ontologies.com/testFood2.owl#">
> > SELECT ?ingredients
> >
> > WHERE { ?ingredients owl:someValuesFrom plate:ChickenWithTomato } -->
> (how
> > do you read this?)
> >
> > what's wrong this time?
>
> For a start, Lee is right. You have the query the direct triples
> (unless you have something to generate inferred triples for you, like
> Pellet).
>
> Secondly, your use of owl:someValuesFrom in inappropriate. This is a
> predicate that is used to describe how a predicate works. It isn't
> used for specific instances of anything. In your ontology, you've used
> this predicate to describe a constraint on the use of #hasIngredient.
>
> Presuming you have a reasoner running (generating inferred triples),
> then you should be asking:
>
> WHERE { plate:ChickenWithTomato plate:hasIngredients ?ingredients }
>
> Paul
>



-- 
--
Samuel Pedro

Received on Tuesday, 16 June 2009 17:50:04 UTC