Reputation: 12363
I followed this article on "Installing and Managing Virtuoso SPARQL Endpoint" (http://logd.tw.rpi.edu/tutorial/installing_using_virtuoso_sparql_endpoint)
After loading data from a ntriple file with the following command
sudo ./vload nt /path/to/data/file/data.nt http://www.soctrace.org/ontologies/st.owl
I successfuly queried those data from the Web interface SPARQL endpoint located at http://localhost:8890/sparql
SELECT ?s ?p ?o WHERE { ?s ?p ?o }
However, I'm interested on querying those data from jena, so I ran the following Java code
public void queryVirtuoso( ) {
Model model = VirtModel.openDatabaseModel("http://www.soctrace.org/ontologies/st.owl", "jdbc:virtuoso://localhost:1111", "dba", "dba");
// Query string.
String queryString = "SELECT ?s ?p ?o WHERE {?s ?p ?o}" ;
System.out.println("Execute query=\n"+queryString) ;
System.out.println() ;
QueryExecution qexec = VirtuosoQueryExecutionFactory.create(queryString, model) ;
try {
ResultSet rs = qexec.execSelect() ;
System.out.println("Number of results founded " + rs.getRowNumber());
} finally {
qexec.close() ;
}
}
But unfortunatly the code returns no result.
It seems that the first parameter of the openDatabaseModel from my code is not correct but I don't know what the correct value is.
Does someone have any indication about how to query a virtuodo graph from Jena giving that data are imported using vload script ?
Best regards,
Upvotes: 0
Views: 72
Reputation: 734
If you not sure about the graph-name, you might look them up in the LinkedData tab in you Virtuoso conductor. It should also be possible to use VirtModel.openDatabaseModel without a graph name (connectionURL, username, password)...
Upvotes: 1