TDB does not use a relational database - did you mean SDB?
There's are examples of both in the Joseki download.
TDB --------------
[] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
tdb:DatasetTDB rdfs:subClassOf ja:RDFDataset .
tdb:GraphTDB rdfs:subClassOf ja:Model .
## ---- A whole dataset managed by TDB
<#mydata> rdf:type tdb:DatasetTDB ;
tdb:location "TDB" ;
.
SDB --------------
[] ja:loadClass "com.hp.hpl.jena.sdb.SDB" .
sdb:DatasetStore rdfs:subClassOf ja:RDFDataset .
sdb:Model rdfs:subClassOf ja:Model .
<#mydata> rdf:type sdb:DatasetStore ;
## Number of concurrent connections allowed to this dataset.
joseki:poolSize 2 ;
sdb:store <#store> .
<#store> rdf:type sdb:Store ;
rdfs:label "SDB" ;
sdb:layout "layout2" ;
sdb:connection
[ rdf:type sdb:SDBConnection ;
## sdb:sdbType "postgresql" ;
## sdb:sdbHost "localhost" ;
## sdb:sdbName "SDB" ;
# Using Apache Derby
sdb:sdbHost "localhost" ;
sdb:sdbType "derby" ;
sdb:sdbName "DB/Derby" ;
]
.
-------------
You want <#mydata>, as in your original Joseki config file, connecting
to one of the places I have used it above.
You do not want a ja:RDFDataset and identifying a specific model.
Andy
On 17/05/11 18:34, Rob Stewart wrote:
Hi Andy,
Unfortunately, joseki errors are very cryptic e.g.:
WARN [http-8080-2] (Servlet.java:183) - Internal server error
java.lang.NullPointerException
at org.joseki.DatasetDesc.acquireDataset(DatasetDesc.java:78)
I am now trying to use TDB as you recommended, but with no luck. My
configuration:
%%%%%%%%%%
[] ja:loadClass "com.hp.hpl.jena.tdb.TDB" . ## Initialize TDB.
tdb:DatasetTDB rdfs:subClassOf ja:RDFDataset .
tdb:GraphTDB rdfs:subClassOf ja:Model .
<#dataset>
a ja:RDFDataset;
ja:defaultGraph [
a ja:InfModel;
ja:baseModel [
a tdb:GraphTDB;
ja:connection
[
ja:dbType "MySQL" ;
ja:dbURL "jdbc:mysql://localhost/MyDB?autoReconnect=true" ;
ja:dbUser "" ;
ja:dbPassword "" ;
ja:dbClass "com.mysql.jdbc.Driver" ;
] ;
ja:modelName "UserProfiles"
];
];
.
<#service3>
rdf:type joseki:Service ;
rdfs:label "SPARQL-TDB" ;
joseki:serviceRef "sparql" ; # web.xml must route this name to Joseki
joseki:dataset<#dataset> ;
joseki:processor joseki:ProcessorSPARQL_FixedDS ;
.
<#serviceUpdate>
rdf:type joseki:Service ;
rdfs:label "SPARQL/Update" ;
joseki:serviceRef "update/service" ;
# dataset part
joseki:dataset<#dataset>;
# Service part.
# This processor will not allow either the protocol,
# nor the query, to specify the dataset.
joseki:processor joseki:ProcessorSPARQLUpdate
.
%%%%%%%%
I'm not overly familiar with ttl syntax, but the errors given from
Joseki merely say "NullPointException", without reference to the
problem... ttl syntax? Database error? ja:modelName not found?
--
Rob
On 17 May 2011 11:13, Andy Seaborne<[email protected]> wrote:
Sorry my misreading - but you are stil putting one SDB model into a general
dataset. If you want to create new models, yo uneed to use a dataset.
(untested):
joseki:dataset<#mydata> ;
<#mydata> rdf:type sdb:DatasetStore ;
sdb:store<#store> .
<#store> rdf:type sdb:Store ;
rdfs:label "SDB" ;
sdb:layout "layout2" ;
sdb:connection ....
(From joseki-config-sdb.ttl)
http://openjena.org/wiki/SDB/Dataset_Description
Andy
On 17/05/11 10:42, Rob Stewart wrote:
Hi Andy,
Thanks for your input. I can't see in my configuration where I am
pointing to "RDB" at all... Could you highlight my error.
Looking at the fragment below, I would have thought that I am indeed using
SDB ?
%%%%%
_:ProfileDatabase rdf:type ja:SDBModel ;
ja:connection
[
ja:dbType "MySQL" ;
ja:dbURL "jdbc:mysql://localhost/MyDB?autoReconnect=true" ;
ja:dbUser "" ;
ja:dbPassword "" ;
ja:dbClass "com.mysql.jdbc.Driver" ;
] ;
ja:modelName "UserProfiles"
.
%%%%
thanks,
Rob
On 17 May 2011 10:28, Andy Seaborne<[email protected]> wrote:
Hi Rob,
You have one model backed by Jena's old database layer (AKA RDB) in
MySQL.
That model is put into a general purpose, in-memory dataset.
Any further models you create will be in-memory, not in MySQL.
You need to use SDB or TDB to get a persistent dataset, rather than a
single
persistent model.
Currently, DBS provides transactions; TDB scales better.
Fuseki is "Joseki4" and may be easier to use for you.
Andy
On 17/05/11 01:25, Rob Stewart wrote:
Hi,
I'm currently having an issue with Joseki. I have created a mySql
database, and added 1 Jena model, with a small number of triples.
I can SPARQL query them with the use of the sparql.html form, and I
receive all the of the results that I would expect. My problem is with
SPARQL Update, through the use of the update.html form.
I can:
1) CREATE GRAPH's
2) INSERT DATA INTO these graphs
3) Go to the sparql.html form, and query these inserted triples, in
each of these graphs. So - the data is going into memory.
However - I am monitoring the mySql database as I run the INSERT INTO
calls, and no triples are added in `jena_g1t1_stmt', and no graphs are
added in `jena_graph'. Indeed, when I kill Joseki and restart it, all
of my inserted triples dissapear, and cannot be found with a SPARQL
query. Perhaps this is down to an incorrect configuration file? Here
it is, minus sensitive information:
%%%%%%%%%%%%%%
<#server> rdf:type joseki:Server ;
# Example of some initialization code.
joseki:initialization
[ module:implementation
[ module:className<java:org.joseki.util.ServiceInitSimple>
;
rdfs:label "Example initializer" ; ]
] ;
.
<#mydata> rdf:type ja:RDFDataset ;
rdfs:label "DSpaceImage" ;
ja:defaultGraph _:ProfileDatabase
.
_:ProfileDatabase rdf:type ja:SDBModel ;
ja:connection
[
ja:dbType "MySQL" ;
ja:dbURL
"jdbc:mysql://localhost/MyDB?autoReconnect=true"
;
ja:dbUser "" ;
ja:dbPassword "" ;
ja:dbClass "com.mysql.jdbc.Driver" ;
] ;
ja:modelName "UserProfiles"
.
<#service1>
rdf:type joseki:Service ;
rdfs:label "service point" ;
joseki:serviceRef "sparql" ; # web.xml must route this name to
Joseki
joseki:processor joseki:ProcessorSPARQL ;
joseki:dataset<#mydata> ;
.
<#serviceUpdate>
rdf:type joseki:Service ;
rdfs:label "SPARQL/Update" ;
joseki:serviceRef "update/service" ;
# dataset part
joseki:dataset<#mydata>;
# Service part.
# This processor will not allow either the protocol,
# nor the query, to specify the dataset.
joseki:processor joseki:ProcessorSPARQLUpdate
.
<#serviceRead>
rdf:type joseki:Service ;
rdfs:label "SPARQL" ;
joseki:serviceRef "sparql/read" ;
# dataset part
joseki:dataset<#mydata> ; ## Same dataset
# Service part.
# This processor will not allow either the protocol,
# nor the query, to specify the dataset.
joseki:processor joseki:ProcessorSPARQL_FixedDS ;
.
joseki:ProcessorSPARQL
rdfs:label "General SPARQL processor" ;
rdf:type joseki:Processor ;
module:implementation joseki:ImplSPARQL ;
# Parameters - this processor processes FROM/FROM NAMED
joseki:allowExplicitDataset "true"^^xsd:boolean ;
joseki:allowWebLoading "true"^^xsd:boolean ;
## And has no locking policy (it loads data each time).
## The default is mutex (one request at a time)
joseki:lockingPolicy joseki:lockingPolicyNone ;
.
joseki:ProcessorSPARQL_FixedDS
rdfs:label "SPARQL processor for fixed datasets" ;
rdf:type joseki:Processor ;
module:implementation joseki:ImplSPARQL ;
# This processor does not accept queries with FROM/FROM NAMED
joseki:allowExplicitDataset "false"^^xsd:boolean ;
joseki:allowWebLoading "false"^^xsd:boolean ;
joseki:lockingPolicy joseki:lockingPolicyMRSW ;
.
joseki:ProcessorSPARQLUpdate
rdfs:label "SPARQL Update processor" ;
rdf:type joseki:Processor ;
module:implementation joseki:ImplSPARQLUpdate ;
joseki:lockingPolicy joseki:lockingPolicyMRSW ;
.
joseki:ImplSPARQL
rdf:type joseki:ServiceImpl ;
module:className
<java:org.joseki.processors.SPARQL> .
joseki:ImplSPARQLUpdate
rdf:type joseki:ServiceImpl ;
module:className
<java:org.joseki.processors.SPARQLUpdate> .
%%%%%%%%%%%%%%%
Anything that I've missed? I'm also not sure whether to opt for SDB or
TDB, and what the implications of either, are?
--
Rob Stewart