0

I'm new with using Jena TDB with Java. I'm trying to load an .nt file to create a local sparql endpoint to be able to send locally sparql queries.

This is where I got so far :

public static final String tdbDirectory = "D:\\TDB";
public static final String dbdump = "D:\\RDFdump.nt"; 
...

Dataset tdbModel =  TDBFactory.createDataset(tdbDirectory);    
FileManager.getModel().read(dbdump, tdbDirectory, "N-TRIPLES");


String q = "SELECT DISTINCT * WHERE { ?s ?p ?o } LIMIT 10";

Query query = QueryFactory.create(q);

QueryExecution qexec = QueryExecutionFactory.create(query, tdbModel);
ResultSet results2 = qexec.execSelect();
...

But this shows me the following error:

Exception in thread "main" java.lang.NullPointerException

Please, can anyone help me with the issue or help me understand the correct way to load locally an .nt file as a sparql endpoint using Jena TDB and Java? I tried a couple of things but I'm a bit lost.

ichmode
  • 67
  • 1
  • 10

0 Answers0