At this point I have a loaded TDB and text index, now I am trying to query
using java. First I tried creating a dataset directly from the TDB but
received

Dataset ds = TDBFactory.createDataset(DBDirectory); <--How I created Dataset

WARN  o.apache.jena.query.text.TextQueryPF - Failed to find the text index
: tried context and as a text-enabled dataset
WARN  o.apache.jena.query.text.TextQueryPF - No text index - no text search
performed
and returns an empty resultSet

I am trying to run this query:

QueryExecution qExec = QueryExecutionFactory.create(
                        "PREFIX text: <http://jena.apache.org/text#> PREFIX
mms: <http://rdf.cdisc.org/mms#> "
                        + "SELECT * WHERE{?s text:query
(mms:dataElementName 'AEACN')}", ds);

ResultSet rs = qExec.execSelect();

So I figured the problem could be that I some how need to combine the TDB
and text index into the same dataset, I tried:

String DBDirectory = "tdb";
String indexDir = "luceneIndexes";
File file = new File(indexDir);
Directory dir = FSDirectory.open(file);
TextIndex index = new TextIndexLucene(dir, null);// need to add the
EntityDefinition?
Dataset ds = TDBFactory.createDataset(DBDirectory);
Dataset dataset = TextDatasetFactory.create(ds, index);

This query does not run because of a nullPointerException. I am not sure if
this is the right way to go about this. If this is the right way to combine
a TDB and text index, is there an easy way to get the EntityDefinition from
the text index?

Reply via email to