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

Re: Why don't i have any result? Part 2

From: Paul Gearon <gearon@ieee.org>
Date: Thu, 25 Jun 2009 22:01:30 -0500
Message-ID: <a25ac1f0906252001k3cc1eeadle372437e49915700@mail.gmail.com>
To: Samuel Pedro <samuelcpspam@gmail.com>
Cc: public-sparql-dev@w3.org
Again, you're trying to match a plain literal against an xsd:string.
Apparently Protege allows this, though I didn't realize it was legal to do
so.

You can either look for the label by providing an xsd:string datatype on the
literal, or you can FILTER on the label being equal (=) to the string, since
Jena has an extension that allows equals in a FILTER expression to compare
untyped with xsd:string.

ie. to add the datatype:
  WHERE { ?class rdf:type owl:Class .
   ?class rdfs:label "bifinhos com cogumelos"^^xsd:string }

to use the FILTER extension:
  WHERE { ?class rdf:type owl:Class .
   ?class rdfs:label ?label
    FILTER ?label = "bifinhos com cogumelos" }

Regards,
Paul Gearon

On Thu, Jun 25, 2009 at 9:50 PM, Samuel Pedro <samuelcpspam@gmail.com>wrote:

> I'm trying to know witch class have that label, and again with protege i
> have the right result and with jena i'm not.
> I'm missing any other Prefix?
>
> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
> PREFIX owl: <http://www.w3.org/2002/07/owl#>
> SELECT ?class
> WHERE { ?class rdf:type owl:Class .
> ?class rdfs:label "bifinhos com cogumelos" }
>
>
>  the class that have that label is this
>
>
> <owl:Class rdf:about="#BifinhosComCogumelos">
>     <rdfs:subClassOf>
>       <owl:Restriction>
>         <owl:someValuesFrom rdf:resource="#Ovo"/>
>         <owl:onProperty>
>           <owl:ObjectProperty rdf:about="#hasIngredient"/>
>         </owl:onProperty>
>       </owl:Restriction>
>     </rdfs:subClassOf>
>     <rdfs:subClassOf>
>       <owl:Restriction>
>         <owl:someValuesFrom>
>           <owl:Class rdf:about="#Alface"/>
>         </owl:someValuesFrom>
>         <owl:onProperty>
>           <owl:ObjectProperty rdf:about="#hasIngredient"/>
>         </owl:onProperty>
>       </owl:Restriction>
>     </rdfs:subClassOf>
>     <rdfs:subClassOf rdf:resource="#PratosdeCarne"/>
>     <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
>     >bifinhos com cogumelos</rdfs:label>
>   </owl:Class>
>
>
> Any ideias of whats wrong this time? Is there another way of do this query?
>
Received on Friday, 26 June 2009 03:02:12 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 26 June 2009 03:02:12 GMT