You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Benson Margulies <bi...@gmail.com> on 2010/12/10 18:41:34 UTC

Getting my first query to find something in TDB

1.  TDB.getContext().set(TDB.symUnionDefaultGraph, "true");

2. dataset = TDBFactory.createDataset(tdbStoreLocation.getAbsolutePath());
   queryModel = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM_RULE_INF);

3. Load some data:

public void addGraph(String graphUri, InputStream rdfStream) {
        Model baseModel = dataset.getNamedModel(graphUri);
        OntModel m =
ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM, baseModel);
        m.read(rdfStream, graphUri, "RDF/XML-ABBREV");
        m.commit();
    }

4. query against the query model:

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?x where { ?x
<http://www.basistech.com/ontologies/2010/6/rex.owl#hasOriginalText>
"Fredrick Chopin"^^xsd:string }

no results from query.

tdbdump shows

<urn:basistech.com:analysis#9>
<http://www.basistech.com/ontologies/2010/6/rex.owl#hasOriginalText>
"Fredrick Chopin"^^<http://www.w3.org/2001/XMLSchema#string>
<urn:misc-test> .