jena-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benson Margulies <bimargul...@gmail.com>
Subject Getting my first query to find something in TDB
Date Fri, 10 Dec 2010 17:41:34 GMT
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> .

Mime
View raw message