SPARQL: ignore datatype of a value in a query

480 Views Asked by At

I have an ontology entity instance in RDF/XML like this:

<owl:NamedIndividual rdf:about="http://example.org#x1">
    <rdf:type rdf:resource="http://example.org/Example"/>
    <ex:amount rdf:datatype="http://www.w3.org/2001/XMLSchema#float">uuid-v4</ex:amount>
    <rdfs:label xml:lang="en">An example instance</rdfs:label>
</owl:NamedIndividual>

I need to select this instance given only its <ex:amount> value which, in this case, is a string. The SPARQL query that I have looks like this:

SELECT * WHERE {
    ?s ?p "uuid-v4" .
}

As you can see, the specified value "uuid-v4" is a string, but the <ex:amount> property's datatype is float.

Questions:

  1. Why is the result empty? Is it because of the mismatched datatypes?
  2. What should I do to make this query work? I cannot change the rdf:datatype to http://www.w3.org/2001/XMLSchema#string. What are the options?

It looks like specifying the datatype helps.

SELECT * WHERE {
    ?s ?p "uuid-v4"^^xsd:float .
}

But I do not know anything about the property until I select the instance. The only information available is the "uuid-v4"

0

There are 0 best solutions below