Installing, creating and populating triple stores Part 2: Joseki

Joseki/TDB


Installing Installing of Joseki is easy; just follow the instructions at http://www.joseki.org/start.html.
Creating and populating the TDB triple store I took a shortcut here using Topbraid Composer ME,
which has an export facility to TDB and saves the database as a folder to the file system with extension '.tdb.data' (see screenshot).
Connecting Joseki with TDB This is the hard stuff.
The trick lies in adapting the Joseki configuration file ('joseki-config.ttl').
I added an additional service:
# Service 3 - SPARQL processor handling a TDB dataset
<#service3>
rdf:type joseki:Service ;
rdfs:label "SPARQL on TDB" ;
joseki:serviceRef "TDB" ; # web.xml must route this name to Joseki
# dataset part
joseki:dataset <#newdata> ;
# Service part.
joseki:processor joseki:ProcessorSPARQL_FixedDS .

and an additional corresponding dataset:
## Initialize TDB.
[] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
tdb:DatasetTDB rdfs:subClassOf ja:RDFDataset .
tdb:GraphTDB rdfs:subClassOf ja:Model .
<#newdata> rdf:type tdb:DatasetTDB ;
rdfs:label "A TDB dataset" ;
# location where the tdb.data folder exists
tdb:location "C:/Users/Paul/MyWorkSpaces/TBCMEWorkspace/Test/erfgoedplustdb.tdb.data" .

One also needs to adapt the 'web.xml' file in the webapps/joseki/WEB-INF folder by adding:
 <servlet-mapping>
<servlet-name>SPARQL service processor</servlet-name>
<url-pattern>/TDB</url-pattern>
</servlet-mapping>

Then I made a specific HTML page that contains following form where the action is sent to the TDB service:
<form action="TDB" method="get">
<p>SELECT - get variables (apply XSLT stylesheet)</p>
<p><textarea name="query" cols="70" rows="5">
PREFIX pcce: <http://www.pcce.be/egb/>
SELECT ?a
WHERE
{ ?a a pcce:Germeente.}</textarea>
<br/>

Output XML: <input type="radio" name="output" value="xml" checked/>
with XSLT style sheet (leave blank for none):
<input name="stylesheet" size="25" value="/xml-to-html.xsl" /> <br/>
or JSON output: <br/>
or text output: <br/>
or CSV output: <br/>
or TSV output: <br/>
Force the accept header to <tt>text/plain</tt> regardless
<input type="checkbox" name="force-accept" value="text/plain"/>
<br/>

<input type="submit" value="Get Results" />
</p>
</form>
Overall This took some considerable time to figure out.

Starting Joseki


starting Joseki

Testing Joseki


Joseki running

Exporting from TBC ME


TBC ME export to TDB

Specific Query page to the TDB service


own query screen

Joseki/BigOWLIM


installing Same as above; just follow the instructions at http://www.joseki.org/start.html.
creating and populating a BigOWLIM triple store I used the Sesame console application, using the BigOWLIM repository template file 'bigowlim.ttl' to be copied in the templates directory of the OpenRDF Sesame console folder.
On Windows 7 this is C:\Users\xxx\Appdata\Roaming\Aduna\OpenRDF Sesame console\templates.
See the BigOWLIM Quick Start Guide (PDF).
Populating the repository can then be done using the Sesame web app.
connecting Joseki with the BigOWLIM triple store Similar actions as above.
Editing the joseki configuration file.
a) adding a service
# Service 4 - SPARQL processor handling a BigOWLIM store 
<#service4>
rdf:type joseki:Service ;
rdfs:label "SPARQL on BigOWLIM" ;
joseki:dataset otjena:bridge ;
joseki:serviceRef "BigOWLIM" ;
joseki:processor joseki:ProcessorSPARQL_FixedDS .
b) adding a dataset
## Initialize BigOWLIM
[] ja:loadClass "com.ontotext.jena.SesameVocab" .
otjena:DatasetSesame rdfs:subClassOf ja:RDFDataset .
otjena:bridge rdf:type otjena:DatasetSesame ;
rdfs:label "BigOWLIM repository" ;
## BEWARE path to storage-folder not mentioned in manual
<http://www.ontotext.com/trree/owlim#storage-folder> "owlimTest-storage";
otjena:datasetParam "C:/Windows/System32/config/systemprofile/AppData/Roaming/Aduna/OpenRDF Sesame/repositories/bigowlimTest" .
Editing then web.xml file by adding.
<servlet-mapping>
<servlet-name>SPARQL service processor</servlet-name>
<url-pattern>/BigOWLIM</url-pattern>
</servlet-mapping>
And brewing a HTML file that posts a SPARQL query to the BigOWLIM service (same as above).



Comments