On 22/09/12 13:57, Paul Taylor wrote:
Hello there again,
I have a Jena model that is stored in an SDBStore backed by MySQL. I would like to know
whether a particular Resource exists in the Model. I cannot use the
model.getResource("uri") because according to javadoc this will always return a
Resource since it will create a new one if it does not exist. Therefore, I use jena arq
engine and a SPARQL ASK query:
Q1: ASK WHERE {<http://purl.org/ontology/mo/performance> ?p ?o .}
Q2: ASK WHERE {<http://purl.org/ontology/mo/Performance> ?p ?o .}
Q1 returns false, and Q2 returns true. Notice that in Q2 the last word starts
with a capital letter. Just want to know whether there is a way to make this
case-insensitive. Or whether there is any other way to find out whether a
particular Resource exists in the Model.
I am using: jena-core-2.7.3, jena-sdb-1.3.5-SNAPSHOT, jena-arq-2.9.3.
Thanks in advance for your help.
In RDF, URIs are case sensitive.
ASK WHERE
{?s ?p ?o .
FILTER(lcase(str(?s)) = 'http://purl.org/ontology/mo/performance')
}
(untested)
will do (but with SDB will be slow).
It is much faster in TDB.
Andy