On 06/09/11 15:52, [email protected] wrote:
Hi,
I am using TDB and I have two ontologies, the NCI thesaurus and my own ontology
(EC, created using Protege), both in RDF/XML format.Here is what I did so far:
- Imported both ontologies into the same TDB store, using different graphs (for
this example http://nci.gov and http://ec.org)
- I can issue SparQL queries without any problems (listing the subjects,
predicates and objects; restricting searches etc.), also across graphs.
I am using a SparQl like this to get a certain subject:
SELECT ?s
FROM NAMED http://nci.gov
FROM NAMED http://ec.org
WHERE {
GRAPH http://nci.gov { ?s nci:Preferred_Name "Overall"^^xsd:string }
}
And my Jena code is:
ResultSet rs = qe.execSelect();
while(rs.hasNext()){
QuerySolution qs = rs.next();
Resource subject = qs.get("s").asResource();
StmtIterator iter = subject.listProperties();
System.out.println(iter.hasNext());
}
The iterator.hasNext() call returns false and all other attempts to
get a property (e.g. the preferred name property) return null.
Earlier in my project, I loaded both ontologies into the default
graph
and did not use named graphs and the approach used to work to get
properties. Now listProperties() returns nothing even though a modified
SparQl that returns any predicate along with the subject shows all
expected properties and their URIs exactly like I am using them for
getProperty() calls.
Does anybody know why listProperties returns null when the
ontologies
are loaded into two separate graphs, but it works if both are loaded
into the default graph?
Thanks in advance for any help!
Is the data
"Overall"^^xsd:string
or
"Overall"
They match differently in TDB (good news, the RDF Working Group is going
to fix this).
Try
SELECT *
...
{ ?s nci:Preferred_Name ?x }
(you can use tdbquery)
and see what the output is.
Also:
{ ?s nci:Preferred_Name ?x . FILTER ( ?x = "Overall" ) }
does a value test, not an exact term test.
Andy