Hi,
I have loaded large N-Triple data into tdb by using tdbloader.
This is a command that I have used :
C:\apache-jena-2.11.1\bat>tdbloader --loc tdblocation xyz.nt

After that I have written java code for text based search.

public static void main(String[] args) {
        Dataset ds = null;
        String directory = "TDB";
        Dataset ds1 = TDBFactory.createDataset(directory);
        try {
            EntityDefinition entDef = new EntityDefinition("uri",
"property", RDFS.label);
            Directory dir = FSDirectory.open(new File("LUCENE"));

            ds = TextDatasetFactory.createLucene(ds1, dir, entDef);

            String queryString = "PREFIX rdf: <
http://www.w3.org/1999/02/22-rdf-
       syntax-ns#> \n"
                + " PREFIX text: <http://jena.apache.org/text#> \n"
                + " Select * where  {?s text:query \"xyz\" . \n"
                + " }";

            ds.begin(ReadWrite.READ);

            Query q = QueryFactory.create(queryString);
            QueryExecution qexec = QueryExecutionFactory.create(q, ds);
            QueryExecUtils.executeQuery(q, qexec);
            ds.end();

        } catch (Exception e) {
            System.out.println(e.toString());
        }

    }


The above code doesn't give any result.
And after the execution of this line ( ds =
TextDatasetFactory.createLucene(ds1, dir, entDef);) I thought that it will
create the index, but I can't see anything in LUCENE folder.

Therefore I think that it doesn't have the index data therefore text:query
is not working.

If I replace text:query with ?p , it shows some result.
But I want to do text based search on the dataset created from TDB.

Does any one know how to make it work??
Any suggestions?

Reply via email to