Hi,
I have installed Virtuoso OpenSource 5.0.9 on my Mac Powerbook. I have used
the default installation (which is running) and am trying to create an RDF
store using the Sesame2 framework as per
http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSesame2Provider.
I am testing various RDF stores and my use case needs them to be accessible
using the connection API interface in java (hence why I chose the sesame
API). Is this possible using virtuoso with sesame libs? I notice that most
of the doco mentions using the isql / webdav interfaces.
In my case, I can create a repository object and get a connection and load
data..however I can only load 1 file successfully (all others report as
loaded but conn size doesn¹t change) but then my query ("SELECT * WHERE {?s
?p ?o}";) doesn¹t return any results.
Do I have to manually create the RDF_Quad store or is this a default db in
the install? This could be the first port of call.
These instructions I referred to above state that the store is a memory
based store and ideally I would like a persistent native store, are there
any instructions / demos / tutorials that I could use to create native
stores?
Any help in getting Virtuoso (esp as a native store) running would be
greatly appreciated.
Kindly,
Campbell.
Please see the code snippet below:
//Setup the Sesame Repo to use the Virtuoso db
this.myRepository = new
VirtuosoRepository("jdbc:virtuoso://localhost:1111","dba","dba");
//get a context factory this.vf =
this.myRepository.getValueFactory(); System.out.println("Connecting
to the virtuoso repository.....\n"); try { //setup the
repo myRepository.initialize(); //get a connection to
it. conn = myRepository.getConnection(); } catch
(RepositoryException re) { re.printStackTrace(); }
//LOAD SOME DATA IN RDF/XML format
//get a context for the load --> File list is undeclared here..
URL url = new URL(baseURI+fileList[i]); URI context =
vf.createURI(baseURI+fileList[i]); // Load a server-side file in
RDF/XML format into the store's default graph. (IS THIS THE DEFAULT
GRAPH????) this.conn.add(url, url.toString(), RDFFormat.RDFXML,
context);
//QUERY THE DATA
//test if the file exists -> use the cached version (hashCode should
be unique). File xmlResultFile = new File("QueryOutput.xml"); try
{ FileOutputStream fout = new FileOutputStream(xmlResultFile);
SPARQLResultsXMLWriter sparqlWriter = new SPARQLResultsXMLWriter(fout);
try { System.out.println("\nQuery : " + queryString);
TupleQuery tupleQuery = conn.prepareTupleQuery(QueryLanguage.SPARQL,
queryString); tupleQuery.evaluate(sparqlWriter); //RETURNS NO
DATA } catch (Exception e){ throw new
Exception(e.getMessage()); } } catch (Exception e){
e.printStackTrace(); }
--
Campbell Allen, M.Phil Candidate
Centre for Marine Studies
University of Queensland
St Lucia, Brisbane 4072