org.apache.jena.system.JenaSystem.logLifecycle NoSuchMethodError

2016-09-14 Thread George News
Hi all,

I have posted an error on deploying a REST webservice using Jena in WildFly.

http://stackoverflow.com/q/39497473/422680

I know crossposting is not the way to go, but I don't know which would
be better not only for getting a possible answer but also for making it
publicly available.

Regards,
Jorge


Re: ConcurrentModificationException

2016-09-14 Thread Andy Seaborne

Hi Laurent,

On 14/09/16 15:16, Laurent Rucquoy wrote:

Hi Andy,

Thank you for your help.

I have tested the following code according to your suggestions (get the
model inside the transaction and remove the use of locks):

dataset.begin(ReadWrite.WRITE);

Model model = dataset.getNamedModel("http://my-model-name;);
try {
UpdateAction.parseExecute(sparql, model);


What is the update?


if(writeMode) {
dataset.commit();
}
} finally {

model.close();


You are using the model after the commit


dataset.end();
}




Andy



When multiple updates are made on our TDB-backed dataset, the java.util.
ConcurrentModificationException is still thrown, leaving the dataset in an
inaccessible state.
Here is the stacktrace part:

Caused by: java.util.ConcurrentModificationException: Iterator: started at

5, now 8
at
org.apache.jena.tdb.sys.DatasetControlMRSW.policyError(DatasetControlMRSW.java:157)
at
org.apache.jena.tdb.sys.DatasetControlMRSW.access$000(DatasetControlMRSW.java:32)
at
org.apache.jena.tdb.sys.DatasetControlMRSW$IteratorCheckNotConcurrent.checkCourrentModification(DatasetControlMRSW.java:110)
at
org.apache.jena.tdb.sys.DatasetControlMRSW$IteratorCheckNotConcurrent.hasNext(DatasetControlMRSW.java:118)
at org.apache.jena.atlas.iterator.Iter$2.hasNext(Iter.java:265)
at org.apache.jena.atlas.iterator.Iter.hasNext(Iter.java:870)
at org.apache.jena.atlas.iterator.Iter$1.hasNext(Iter.java:192)
at org.apache.jena.atlas.iterator.Iter.hasNext(Iter.java:870)
at
org.apache.jena.atlas.iterator.RepeatApplyIterator.hasNext(RepeatApplyIterator.java:58)
at
org.apache.jena.tdb.solver.SolverLib$IterAbortable.hasNext(SolverLib.java:195)
at org.apache.jena.atlas.iterator.Iter$2.hasNext(Iter.java:265)
at
org.apache.jena.sparql.engine.iterator.QueryIterPlainWrapper.hasNextBinding(QueryIterPlainWrapper.java:53)
at
org.apache.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:111)
at
org.apache.jena.sparql.engine.iterator.QueryIterRepeatApply.makeNextStage(QueryIterRepeatApply.java:101)
at
org.apache.jena.sparql.engine.iterator.QueryIterRepeatApply.hasNextBinding(QueryIterRepeatApply.java:65)
at
org.apache.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:111)
at org.apache.jena.atlas.iterator.Iter$2.hasNext(Iter.java:265)
at
org.apache.jena.atlas.iterator.RepeatApplyIterator.hasNext(RepeatApplyIterator.java:45)
at
org.apache.jena.tdb.solver.SolverLib$IterAbortable.hasNext(SolverLib.java:195)
at org.apache.jena.atlas.iterator.Iter$2.hasNext(Iter.java:265)
at
org.apache.jena.sparql.engine.iterator.QueryIterPlainWrapper.hasNextBinding(QueryIterPlainWrapper.java:53)
at
org.apache.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:111)
at org.apache.jena.atlas.iterator.Iter$2.hasNext(Iter.java:265)
at
org.apache.jena.atlas.iterator.RepeatApplyIterator.hasNext(RepeatApplyIterator.java:45)
at
org.apache.jena.tdb.solver.SolverLib$IterAbortable.hasNext(SolverLib.java:195)
at org.apache.jena.atlas.iterator.Iter$2.hasNext(Iter.java:265)
at
org.apache.jena.sparql.engine.iterator.QueryIterPlainWrapper.hasNextBinding(QueryIterPlainWrapper.java:53)
at
org.apache.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:111)
at
org.apache.jena.sparql.engine.iterator.QueryIterConcat.hasNextBinding(QueryIterConcat.java:82)
at
org.apache.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:111)
at
org.apache.jena.sparql.engine.iterator.QueryIterRepeatApply.hasNextBinding(QueryIterRepeatApply.java:74)
at
org.apache.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:111)
at
org.apache.jena.sparql.engine.iterator.QueryIterConvert.hasNextBinding(QueryIterConvert.java:58)
at
org.apache.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:111)
at
org.apache.jena.sparql.engine.iterator.QueryIterDistinct.getInputNextUnseen(QueryIterDistinct.java:104)
at
org.apache.jena.sparql.engine.iterator.QueryIterDistinct.hasNextBinding(QueryIterDistinct.java:70)
at
org.apache.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:111)
at
org.apache.jena.sparql.engine.iterator.QueryIteratorWrapper.hasNextBinding(QueryIteratorWrapper.java:39)
at
org.apache.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:111)
at
org.apache.jena.sparql.engine.iterator.QueryIteratorWrapper.hasNextBinding(QueryIteratorWrapper.java:39)
at
org.apache.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:111)
at
org.apache.jena.sparql.engine.ResultSetStream.hasNext(ResultSetStream.java:74)
at
org.apache.jena.sparql.engine.ResultSetCheckCondition.hasNext(ResultSetCheckCondition.java:59)




Regards,
Laurent



On 14 September 2016 at 11:36, Andy Seaborne  wrote:


Hi Laurant,

Try getting the model inside transaction, not passing it across
transaction boundaries.

dataset.begin(ReadWrite.WRITE);

Re: ConcurrentModificationException

2016-09-14 Thread Laurent Rucquoy
Hi Andy,

Thank you for your help.

I have tested the following code according to your suggestions (get the
model inside the transaction and remove the use of locks):

dataset.begin(ReadWrite.WRITE);
> Model model = dataset.getNamedModel("http://my-model-name;);
> try {
> UpdateAction.parseExecute(sparql, model);
> if(writeMode) {
> dataset.commit();
> }
> } finally {
>
> model.close();
> dataset.end();
> }


When multiple updates are made on our TDB-backed dataset, the java.util.
ConcurrentModificationException is still thrown, leaving the dataset in an
inaccessible state.
Here is the stacktrace part:

Caused by: java.util.ConcurrentModificationException: Iterator: started at
> 5, now 8
> at
> org.apache.jena.tdb.sys.DatasetControlMRSW.policyError(DatasetControlMRSW.java:157)
> at
> org.apache.jena.tdb.sys.DatasetControlMRSW.access$000(DatasetControlMRSW.java:32)
> at
> org.apache.jena.tdb.sys.DatasetControlMRSW$IteratorCheckNotConcurrent.checkCourrentModification(DatasetControlMRSW.java:110)
> at
> org.apache.jena.tdb.sys.DatasetControlMRSW$IteratorCheckNotConcurrent.hasNext(DatasetControlMRSW.java:118)
> at org.apache.jena.atlas.iterator.Iter$2.hasNext(Iter.java:265)
> at org.apache.jena.atlas.iterator.Iter.hasNext(Iter.java:870)
> at org.apache.jena.atlas.iterator.Iter$1.hasNext(Iter.java:192)
> at org.apache.jena.atlas.iterator.Iter.hasNext(Iter.java:870)
> at
> org.apache.jena.atlas.iterator.RepeatApplyIterator.hasNext(RepeatApplyIterator.java:58)
> at
> org.apache.jena.tdb.solver.SolverLib$IterAbortable.hasNext(SolverLib.java:195)
> at org.apache.jena.atlas.iterator.Iter$2.hasNext(Iter.java:265)
> at
> org.apache.jena.sparql.engine.iterator.QueryIterPlainWrapper.hasNextBinding(QueryIterPlainWrapper.java:53)
> at
> org.apache.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:111)
> at
> org.apache.jena.sparql.engine.iterator.QueryIterRepeatApply.makeNextStage(QueryIterRepeatApply.java:101)
> at
> org.apache.jena.sparql.engine.iterator.QueryIterRepeatApply.hasNextBinding(QueryIterRepeatApply.java:65)
> at
> org.apache.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:111)
> at org.apache.jena.atlas.iterator.Iter$2.hasNext(Iter.java:265)
> at
> org.apache.jena.atlas.iterator.RepeatApplyIterator.hasNext(RepeatApplyIterator.java:45)
> at
> org.apache.jena.tdb.solver.SolverLib$IterAbortable.hasNext(SolverLib.java:195)
> at org.apache.jena.atlas.iterator.Iter$2.hasNext(Iter.java:265)
> at
> org.apache.jena.sparql.engine.iterator.QueryIterPlainWrapper.hasNextBinding(QueryIterPlainWrapper.java:53)
> at
> org.apache.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:111)
> at org.apache.jena.atlas.iterator.Iter$2.hasNext(Iter.java:265)
> at
> org.apache.jena.atlas.iterator.RepeatApplyIterator.hasNext(RepeatApplyIterator.java:45)
> at
> org.apache.jena.tdb.solver.SolverLib$IterAbortable.hasNext(SolverLib.java:195)
> at org.apache.jena.atlas.iterator.Iter$2.hasNext(Iter.java:265)
> at
> org.apache.jena.sparql.engine.iterator.QueryIterPlainWrapper.hasNextBinding(QueryIterPlainWrapper.java:53)
> at
> org.apache.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:111)
> at
> org.apache.jena.sparql.engine.iterator.QueryIterConcat.hasNextBinding(QueryIterConcat.java:82)
> at
> org.apache.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:111)
> at
> org.apache.jena.sparql.engine.iterator.QueryIterRepeatApply.hasNextBinding(QueryIterRepeatApply.java:74)
> at
> org.apache.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:111)
> at
> org.apache.jena.sparql.engine.iterator.QueryIterConvert.hasNextBinding(QueryIterConvert.java:58)
> at
> org.apache.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:111)
> at
> org.apache.jena.sparql.engine.iterator.QueryIterDistinct.getInputNextUnseen(QueryIterDistinct.java:104)
> at
> org.apache.jena.sparql.engine.iterator.QueryIterDistinct.hasNextBinding(QueryIterDistinct.java:70)
> at
> org.apache.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:111)
> at
> org.apache.jena.sparql.engine.iterator.QueryIteratorWrapper.hasNextBinding(QueryIteratorWrapper.java:39)
> at
> org.apache.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:111)
> at
> org.apache.jena.sparql.engine.iterator.QueryIteratorWrapper.hasNextBinding(QueryIteratorWrapper.java:39)
> at
> org.apache.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:111)
> at
> org.apache.jena.sparql.engine.ResultSetStream.hasNext(ResultSetStream.java:74)
> at
> org.apache.jena.sparql.engine.ResultSetCheckCondition.hasNext(ResultSetCheckCondition.java:59)



Regards,
Laurent



On 14 September 2016 at 11:36, Andy Seaborne  wrote:

> Hi Laurant,
>
> Try getting the model inside transaction, not passing it across
> transaction boundaries.

Re: Programatically adding filters to sparql query

2016-09-14 Thread Bart van Leeuwen
I would prefer plain Jena

Met Vriendelijke Groet / With Kind Regards
Bart van Leeuwen

##
# twitter: @semanticfire
# netage.nl
# http://netage.nl
# Esdoornstraat 3
# 3461ER Linschoten
# tel. +31(0)6-53182997
##



From:   Martynas Jusevičius 
To: users@jena.apache.org
Date:   14-09-2016 15:20
Subject:Re: Programatically adding filters to sparql query



Are you able to use SPIN or does it have to be plain Jena?

On Wed, 14 Sep 2016 at 16:08, Bart van Leeuwen 

wrote:

> Hi,
>
> I'm looking for some documentation on adding additional filters to a
> parsed sparql query
>
> I can do:
>
> Query q = new Query('select ?s ?p ?o where { ?s a sem:Event . ?s ?p ?o
> }');
>
> now I'd like to use the Query object Q to extend this query with a 
FIlter
> clause.
>
> any documentation pointers are appreciated.
>
> Met Vriendelijke Groet / With Kind Regards
> Bart van Leeuwen
>
> ##
> # twitter: @semanticfire
> # netage.nl
> # http://netage.nl
> # Esdoornstraat 3
> # 3461ER Linschoten
> # tel. +31(0)6-53182997
> ##




Re: Restarting FUSEKI with TDB and OWL reasoner

2016-09-14 Thread Filip Masri
So the thing I did is:

1. unzip apache-jena-fuseki-2.4.0.zip
2. run ./fuseki-server --mem /ds -> so the /run directory is created
(Canceled by CTRL+C, but this should not affect the final Dataset)
3. Setup init script (fuseki as attachment with HOME, BASE and CONFIG
confifurations)
4. Start the service = service fuseki start (DB database is created)
5. Upload schema file through GUI (mobilePhonesCustomClasses.ttl) to /inf
dataset
6. Try to query through GUI = 200 OK

PREFIX : 
PREFIX owl: 

Select ?s ?p ?o
WHERE {
   ?s ?p ?o .
}
order by ?p


7. service fuseki restart
8. Query again

Error 500: Invalid id node for subject (null node):
([], [0022], [0054])


Fuseki - version 2.4.0 (Build date: 2016-05-10T11:59:39+)

The attachements are the init script, my turtle data/schema to be uploaded,
 config file for the dataset referenced in the init script.

Maybe I am doing something wrong so u will correct me :)

Thanks anyways!


2016-09-14 14:53 GMT+02:00 Andy Seaborne :

>
>
> On 14/09/16 13:39, Filip Masri wrote:
>
>> Well, I could not solve the problem with apache-jena-fuseki-2.4.0 but
>> apache-jena-fuseki-2.3.1
>>  worked without problem.
>>
>
> Ouch!
>
>
>> Do you want me to describe the whole process I did so you could possiby
>> stacktrace the problem?
>>
>
> Yes, please.
>
> Andy
>
>
>
>> Filip
>>
>> 2016-09-14 12:11 GMT+02:00 Andy Seaborne :
>>
>> Hi Filip,
>>>
>>> Error 500: Invalid id node for object (null node):
 ([3C3C], [0007AA], [3D18])

>>>
>>> This is usually a sign that the program exits without sync'ing a
>>> non-transaction TDB database.
>>>
>>> It is possible (probably) that building the inference model in the
>>> assembler is not transactional.  It becomes transactional on first
>>> request.
>>>
>>> So has at any time in the past, not the run which caused the 500, have
>>> you
>>> exited the server during start up (e.g. control-C) or before the first
>>> request to the inference model?  or another program access the same
>>> database?
>>>
>>> The other possible cause is two systems trying to modify the same
>>> database
>>> at the same time.  TDB tries to trap this and warn you but the test is
>>> not
>>> perfect.  (It looks like you are on Linux so the test is much better
>>> there
>>> - on Windows, it has been reported that Windows update can cause restarts
>>> where the process id is reused quiet quickly.)
>>>
>>> Could you please crosslink the stack overflow question to this thread?
>>> Thanks.
>>>
>>> Andy
>>>
>>>
>>>
>>> On 13/09/16 12:32, Filip Masri wrote:
>>>
>>> Dear Jena Community,

 I have a following fuseki dataset configuration:

 @prefix fuseki:  .
 @prefix rdf:  .
 @prefix rdfs:  .
 @prefix tdb:  .
 @prefix ja:  .
 @prefix sdb:  .


 [] a fuseki:Server ;
 fuseki:services ( <#tdb> ) .


 <#tdb> rdf:type fuseki:Service ;
  fuseki:name "ds" ; # http://host/inf
  fuseki:serviceQuery   "query" , "sparql" ;
  fuseki:serviceUpdate "update" ;
  fuseki:dataset <#dataset2> ; #select which set to use
  rdfs:label"TDB ds" ;
  fuseki:serviceReadGraphStore  "get" ;
  fuseki:serviceReadWriteGraphStore
"data" ;
  fuseki:serviceUpload  "upload" .

 [] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
  tdb:DatasetTDB rdfs:subClassOf ja:RDFDataset .
  tdb:GraphTDB rdfs:subClassOf ja:Model .

  <#dataset2> rdf:type ja:RDFDataset ;
   ja:defaultGraph <#model2> .

  <#model2> a ja:InfModel;
   ja:baseModel <#tdbGraph>;
   ja:reasoner
   [ ja:reasonerURL  ] .

  <#tdbGraph> rdf:type tdb:GraphTDB;
  tdb:dataset <#tdbDataset> .

  <#tdbDataset> rdf:type tdb:DatasetTDB ;
  tdb:location "...apache-jena-fuseki-2.4.0/run/databases/ds" .


 Then I start the server as ./fuseki-server --config=ds.ttl. The reasoner
 is
 working. I upload my basic schema saying that SmartPhone is a subClassOf
 MobilePhone etc...Then I post data about smartphones through the REST
 API.
 Everything is working. Now I restart the server.

 And when quering my data i get

 Error 500: Invalid id node for object (null node): ([3C3C],
 [0007AA], [3D18])

 Does you know how to configure it correctly? Is it possible?

 Thanks :)



>>
   .

Re: Programatically adding filters to sparql query

2016-09-14 Thread Martynas Jusevičius
Are you able to use SPIN or does it have to be plain Jena?

On Wed, 14 Sep 2016 at 16:08, Bart van Leeuwen 
wrote:

> Hi,
>
> I'm looking for some documentation on adding additional filters to a
> parsed sparql query
>
> I can do:
>
> Query q = new Query('select ?s ?p ?o where { ?s a sem:Event . ?s ?p ?o
> }');
>
> now I'd like to use the Query object Q to extend this query with a FIlter
> clause.
>
> any documentation pointers are appreciated.
>
> Met Vriendelijke Groet / With Kind Regards
> Bart van Leeuwen
>
> ##
> # twitter: @semanticfire
> # netage.nl
> # http://netage.nl
> # Esdoornstraat 3
> # 3461ER Linschoten
> # tel. +31(0)6-53182997
> ##


Programatically adding filters to sparql query

2016-09-14 Thread Bart van Leeuwen
Hi,

I'm looking for some documentation on adding additional filters to a 
parsed sparql query

I can do:

Query q = new Query('select ?s ?p ?o where { ?s a sem:Event . ?s ?p ?o 
}');

now I'd like to use the Query object Q to extend this query with a FIlter 
clause.

any documentation pointers are appreciated.

Met Vriendelijke Groet / With Kind Regards
Bart van Leeuwen

##
# twitter: @semanticfire
# netage.nl
# http://netage.nl
# Esdoornstraat 3
# 3461ER Linschoten
# tel. +31(0)6-53182997
##

Re: Restarting FUSEKI with TDB and OWL reasoner

2016-09-14 Thread Andy Seaborne



On 14/09/16 13:39, Filip Masri wrote:

Well, I could not solve the problem with apache-jena-fuseki-2.4.0 but
apache-jena-fuseki-2.3.1
 worked without problem.


Ouch!



Do you want me to describe the whole process I did so you could possiby
stacktrace the problem?


Yes, please.

Andy



Filip

2016-09-14 12:11 GMT+02:00 Andy Seaborne :


Hi Filip,


Error 500: Invalid id node for object (null node):
([3C3C], [0007AA], [3D18])


This is usually a sign that the program exits without sync'ing a
non-transaction TDB database.

It is possible (probably) that building the inference model in the
assembler is not transactional.  It becomes transactional on first request.

So has at any time in the past, not the run which caused the 500, have you
exited the server during start up (e.g. control-C) or before the first
request to the inference model?  or another program access the same
database?

The other possible cause is two systems trying to modify the same database
at the same time.  TDB tries to trap this and warn you but the test is not
perfect.  (It looks like you are on Linux so the test is much better there
- on Windows, it has been reported that Windows update can cause restarts
where the process id is reused quiet quickly.)

Could you please crosslink the stack overflow question to this thread?
Thanks.

Andy



On 13/09/16 12:32, Filip Masri wrote:


Dear Jena Community,

I have a following fuseki dataset configuration:

@prefix fuseki:  .
@prefix rdf:  .
@prefix rdfs:  .
@prefix tdb:  .
@prefix ja:  .
@prefix sdb:  .


[] a fuseki:Server ;
fuseki:services ( <#tdb> ) .


<#tdb> rdf:type fuseki:Service ;
 fuseki:name "ds" ; # http://host/inf
 fuseki:serviceQuery   "query" , "sparql" ;
 fuseki:serviceUpdate "update" ;
 fuseki:dataset <#dataset2> ; #select which set to use
 rdfs:label"TDB ds" ;
 fuseki:serviceReadGraphStore  "get" ;
 fuseki:serviceReadWriteGraphStore
   "data" ;
 fuseki:serviceUpload  "upload" .

[] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
 tdb:DatasetTDB rdfs:subClassOf ja:RDFDataset .
 tdb:GraphTDB rdfs:subClassOf ja:Model .

 <#dataset2> rdf:type ja:RDFDataset ;
  ja:defaultGraph <#model2> .

 <#model2> a ja:InfModel;
  ja:baseModel <#tdbGraph>;
  ja:reasoner
  [ ja:reasonerURL  ] .

 <#tdbGraph> rdf:type tdb:GraphTDB;
 tdb:dataset <#tdbDataset> .

 <#tdbDataset> rdf:type tdb:DatasetTDB ;
 tdb:location "...apache-jena-fuseki-2.4.0/run/databases/ds" .


Then I start the server as ./fuseki-server --config=ds.ttl. The reasoner
is
working. I upload my basic schema saying that SmartPhone is a subClassOf
MobilePhone etc...Then I post data about smartphones through the REST API.
Everything is working. Now I restart the server.

And when quering my data i get

Error 500: Invalid id node for object (null node): ([3C3C],
[0007AA], [3D18])

Does you know how to configure it correctly? Is it possible?

Thanks :)






Re: sparql algebra differences jena 2.13.0/3.n

2016-09-14 Thread Andy Seaborne

Hi Paul,

On 14/09/16 13:15, Paul Tyson wrote:

On Wed, 2016-09-14 at 10:57 +0100, Andy Seaborne wrote:

Hi Paul,

It's difficult to tell what's going on from your report. Plain strings
are not quite identical in RDF 1.0 and RDF 1.1 so I hope you have
related the data for running Jena 3.x.


I admit I have not studied the subtleties around string literals with
and without datatype tags. None of my data loadfiles have tagged string
literals, nor do my queries. Are you saying they should?


If there are no ^^xsd:string anywhere whatsoever, I don't think a reload 
is necessary but I can't guarantee it.


There is no point saying ^^xsd:string in RDF 1.1.  "abc" and 
"abc"^^xsd:string are two ways to write exactly the same thing.






On less data, does either case produce the wrong answers?



I'll produce a smaller dataset to test.


The regex is not being pushed inwards in the same way which may be an
issue - it "all depends" on the data.

A smaller query exhibiting a timing difference would be very helpful.
Are all parts of the FILTER necessary for the effect?

Yes, they eliminate spurious matches.


OK - in your data they are needed but are they needed to show the effect?

I've mocked up pushing the regex inwards in 3.x - what I don't know is 
whether this is actually the thing you are seeing, or whether there is 
something else going on which is the dominant effect.


Andy





Andy

Unrelated:

{
?var1 :p3 ?var4 .
} UNION {
?var1 :p4 ?var4 .
}

can be written

?var1 (:p3|:p4) ?var4



Yes, but I generate these queries from RIF source, and UNION is easier
for the general RIF statement "Or(x,y)". The surface syntax doesn't make
any difference in the algebra, does it?

Regards,
--Paul


On 14/09/16 02:01, Paul Tyson wrote:

I have some queries that worked fine in jena-2.13.0 but not in
jena-3.1.0, using the same data.

For a long time I've been running a couple dozen queries regularly over
a large (900M triples) TDB, using jena-2.13.0. When I recently upgraded
to jena-3.1.0, I found that 5 of these queries would not return (ran
forever). qparse revealed that the sparql algebra is quite different in
2.13.0 and 3.1.0 (or apparently any 3.n.n version).

Here is a sample query that worked in 2.13.0 but not in 3.1.0, along
with the algebra given by qparse --explain for 2.13.0 and 3.1.0:

prefix : 
CONSTRUCT {
?var1  ?var2 .
}
WHERE {
FILTER (((?var3 = "str1" || ?var3 = "str2") && !(?var4 = "" || ?var4 =
"str3" || regex(?var4,"pat1"
?var2 :p1 ?var4 ; :p2 ?var3 .
{{
?var1 :p3 ?var4 .
} UNION {
?var1 :p4 ?var4 .
}}
}

Jena-2.13.0 produces algebra:
(prefix ((: ))
  (sequence
(filter (|| (= ?var3 "str1") (= ?var3 "str2"))
  (sequence
(filter (! (|| (|| (= ?var4 "") (= ?var4 "str3")) (regex ?var4
"pat1")))
  (bgp (triple ?var2 :p1 ?var4)))
(bgp (triple ?var2 :p2 ?var3
(union
  (bgp (triple ?var1 :p3 ?var4))
  (bgp (triple ?var1 :p4 ?var4)

Jena-3.1.0 produces algebra:
(prefix ((: ))
  (filter (! (|| (|| (= ?var4 "") (= ?var4 "str3")) (regex ?var4
"pat1")))
(disjunction
  (assign ((?var3 "str1"))
(sequence
  (bgp
(triple ?var2 :p1 ?var4)
(triple ?var2 :p2 "str1")
  )
  (union
(bgp (triple ?var1 :p3 ?var4))
(bgp (triple ?var1 :p4 ?var4)
  (assign ((?var3 "str2"))
(sequence
  (bgp
(triple ?var2 :p1 ?var4)
(triple ?var2 :p2 "str2")
  )
  (union
(bgp (triple ?var1 :p3 ?var4))
(bgp (triple ?var1 :p4 ?var4

Thanks for any insight or assistance into this problem.

Regards,
--Paul






Re: Restarting FUSEKI with TDB and OWL reasoner

2016-09-14 Thread Filip Masri
Well, I could not solve the problem with apache-jena-fuseki-2.4.0 but
apache-jena-fuseki-2.3.1
 worked without problem.

Do you want me to describe the whole process I did so you could possiby
stacktrace the problem?

Filip

2016-09-14 12:11 GMT+02:00 Andy Seaborne :

> Hi Filip,
>
> > Error 500: Invalid id node for object (null node):
> > ([3C3C], [0007AA], [3D18])
>
> This is usually a sign that the program exits without sync'ing a
> non-transaction TDB database.
>
> It is possible (probably) that building the inference model in the
> assembler is not transactional.  It becomes transactional on first request.
>
> So has at any time in the past, not the run which caused the 500, have you
> exited the server during start up (e.g. control-C) or before the first
> request to the inference model?  or another program access the same
> database?
>
> The other possible cause is two systems trying to modify the same database
> at the same time.  TDB tries to trap this and warn you but the test is not
> perfect.  (It looks like you are on Linux so the test is much better there
> - on Windows, it has been reported that Windows update can cause restarts
> where the process id is reused quiet quickly.)
>
> Could you please crosslink the stack overflow question to this thread?
> Thanks.
>
> Andy
>
>
>
> On 13/09/16 12:32, Filip Masri wrote:
>
>> Dear Jena Community,
>>
>> I have a following fuseki dataset configuration:
>>
>> @prefix fuseki:  .
>> @prefix rdf:  .
>> @prefix rdfs:  .
>> @prefix tdb:  .
>> @prefix ja:  .
>> @prefix sdb:  .
>>
>>
>> [] a fuseki:Server ;
>> fuseki:services ( <#tdb> ) .
>>
>>
>> <#tdb> rdf:type fuseki:Service ;
>>  fuseki:name "ds" ; # http://host/inf
>>  fuseki:serviceQuery   "query" , "sparql" ;
>>  fuseki:serviceUpdate "update" ;
>>  fuseki:dataset <#dataset2> ; #select which set to use
>>  rdfs:label"TDB ds" ;
>>  fuseki:serviceReadGraphStore  "get" ;
>>  fuseki:serviceReadWriteGraphStore
>>"data" ;
>>  fuseki:serviceUpload  "upload" .
>>
>> [] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
>>  tdb:DatasetTDB rdfs:subClassOf ja:RDFDataset .
>>  tdb:GraphTDB rdfs:subClassOf ja:Model .
>>
>>  <#dataset2> rdf:type ja:RDFDataset ;
>>   ja:defaultGraph <#model2> .
>>
>>  <#model2> a ja:InfModel;
>>   ja:baseModel <#tdbGraph>;
>>   ja:reasoner
>>   [ ja:reasonerURL  ] .
>>
>>  <#tdbGraph> rdf:type tdb:GraphTDB;
>>  tdb:dataset <#tdbDataset> .
>>
>>  <#tdbDataset> rdf:type tdb:DatasetTDB ;
>>  tdb:location "...apache-jena-fuseki-2.4.0/run/databases/ds" .
>>
>>
>> Then I start the server as ./fuseki-server --config=ds.ttl. The reasoner
>> is
>> working. I upload my basic schema saying that SmartPhone is a subClassOf
>> MobilePhone etc...Then I post data about smartphones through the REST API.
>> Everything is working. Now I restart the server.
>>
>> And when quering my data i get
>>
>> Error 500: Invalid id node for object (null node): ([3C3C],
>> [0007AA], [3D18])
>>
>> Does you know how to configure it correctly? Is it possible?
>>
>> Thanks :)
>>
>>


Re: sparql algebra differences jena 2.13.0/3.n

2016-09-14 Thread Paul Tyson
On Wed, 2016-09-14 at 10:57 +0100, Andy Seaborne wrote:
> Hi Paul,
> 
> It's difficult to tell what's going on from your report. Plain strings 
> are not quite identical in RDF 1.0 and RDF 1.1 so I hope you have 
> related the data for running Jena 3.x.

I admit I have not studied the subtleties around string literals with
and without datatype tags. None of my data loadfiles have tagged string
literals, nor do my queries. Are you saying they should?

> 
> On less data, does either case produce the wrong answers?
> 

I'll produce a smaller dataset to test.

> The regex is not being pushed inwards in the same way which may be an 
> issue - it "all depends" on the data.
> 
> A smaller query exhibiting a timing difference would be very helpful. 
> Are all parts of the FILTER necessary for the effect?
Yes, they eliminate spurious matches.

> 
>   Andy
> 
> Unrelated:
> 
> {
> ?var1 :p3 ?var4 .
> } UNION {
> ?var1 :p4 ?var4 .
> }
> 
> can be written
> 
> ?var1 (:p3|:p4) ?var4
> 
> 
Yes, but I generate these queries from RIF source, and UNION is easier
for the general RIF statement "Or(x,y)". The surface syntax doesn't make
any difference in the algebra, does it?

Regards,
--Paul

> On 14/09/16 02:01, Paul Tyson wrote:
> > I have some queries that worked fine in jena-2.13.0 but not in
> > jena-3.1.0, using the same data.
> >
> > For a long time I've been running a couple dozen queries regularly over
> > a large (900M triples) TDB, using jena-2.13.0. When I recently upgraded
> > to jena-3.1.0, I found that 5 of these queries would not return (ran
> > forever). qparse revealed that the sparql algebra is quite different in
> > 2.13.0 and 3.1.0 (or apparently any 3.n.n version).
> >
> > Here is a sample query that worked in 2.13.0 but not in 3.1.0, along
> > with the algebra given by qparse --explain for 2.13.0 and 3.1.0:
> >
> > prefix : 
> > CONSTRUCT {
> > ?var1  ?var2 .
> > }
> > WHERE {
> > FILTER (((?var3 = "str1" || ?var3 = "str2") && !(?var4 = "" || ?var4 =
> > "str3" || regex(?var4,"pat1"
> > ?var2 :p1 ?var4 ; :p2 ?var3 .
> > {{
> > ?var1 :p3 ?var4 .
> > } UNION {
> > ?var1 :p4 ?var4 .
> > }}
> > }
> >
> > Jena-2.13.0 produces algebra:
> > (prefix ((: ))
> >   (sequence
> > (filter (|| (= ?var3 "str1") (= ?var3 "str2"))
> >   (sequence
> > (filter (! (|| (|| (= ?var4 "") (= ?var4 "str3")) (regex ?var4
> > "pat1")))
> >   (bgp (triple ?var2 :p1 ?var4)))
> > (bgp (triple ?var2 :p2 ?var3
> > (union
> >   (bgp (triple ?var1 :p3 ?var4))
> >   (bgp (triple ?var1 :p4 ?var4)
> >
> > Jena-3.1.0 produces algebra:
> > (prefix ((: ))
> >   (filter (! (|| (|| (= ?var4 "") (= ?var4 "str3")) (regex ?var4
> > "pat1")))
> > (disjunction
> >   (assign ((?var3 "str1"))
> > (sequence
> >   (bgp
> > (triple ?var2 :p1 ?var4)
> > (triple ?var2 :p2 "str1")
> >   )
> >   (union
> > (bgp (triple ?var1 :p3 ?var4))
> > (bgp (triple ?var1 :p4 ?var4)
> >   (assign ((?var3 "str2"))
> > (sequence
> >   (bgp
> > (triple ?var2 :p1 ?var4)
> > (triple ?var2 :p2 "str2")
> >   )
> >   (union
> > (bgp (triple ?var1 :p3 ?var4))
> > (bgp (triple ?var1 :p4 ?var4
> >
> > Thanks for any insight or assistance into this problem.
> >
> > Regards,
> > --Paul
> >




Re: sparql algebra differences jena 2.13.0/3.n

2016-09-14 Thread Andy Seaborne



On 14/09/16 11:32, Rob Vesse wrote:

Andy

I am a little surprised at the filter equality transformation being
applied to this query. Variables in question are only used in the
object position so shouldn’t be safe to assume that value equality is
equivalent to term equality here. Or is this a special case because
of the change in handling of plain literals in RDF 1.1?


Yes, this is a case that is enabled by RDF 1.1,

FILTER (?object = "abc") can used to be a pattern match and term and 
value equality are equivalent.


sameTerm("abc", "abc"^^xsd:string) was false (RDF 1.0), and is now true 
(RDF 1.1).


Andy



Rob

 14/09/2016 10:57, "Andy Seaborne"  wrote:

Hi Paul,

It's difficult to tell what's going on from your report. Plain strings
are not quite identical in RDF 1.0 and RDF 1.1 so I hope you have
related the data for running Jena 3.x.

On less data, does either case produce the wrong answers?

The regex is not being pushed inwards in the same way which may be an
issue - it "all depends" on the data.

A smaller query exhibiting a timing difference would be very helpful.
Are all parts of the FILTER necessary for the effect?

Andy

Unrelated:

{
?var1 :p3 ?var4 .
} UNION {
?var1 :p4 ?var4 .
}

can be written

?var1 (:p3|:p4) ?var4


On 14/09/16 02:01, Paul Tyson wrote:
> I have some queries that worked fine in jena-2.13.0 but not in
> jena-3.1.0, using the same data.
>
> For a long time I've been running a couple dozen queries regularly over
> a large (900M triples) TDB, using jena-2.13.0. When I recently upgraded
> to jena-3.1.0, I found that 5 of these queries would not return (ran
> forever). qparse revealed that the sparql algebra is quite different in
> 2.13.0 and 3.1.0 (or apparently any 3.n.n version).
>
> Here is a sample query that worked in 2.13.0 but not in 3.1.0, along
> with the algebra given by qparse --explain for 2.13.0 and 3.1.0:
>
> prefix : 
> CONSTRUCT {
> ?var1  ?var2 .
> }
> WHERE {
> FILTER (((?var3 = "str1" || ?var3 = "str2") && !(?var4 = "" || ?var4 =
> "str3" || regex(?var4,"pat1"
> ?var2 :p1 ?var4 ; :p2 ?var3 .
> {{
> ?var1 :p3 ?var4 .
> } UNION {
> ?var1 :p4 ?var4 .
> }}
> }
>
> Jena-2.13.0 produces algebra:
> (prefix ((: ))
>   (sequence
> (filter (|| (= ?var3 "str1") (= ?var3 "str2"))
>   (sequence
> (filter (! (|| (|| (= ?var4 "") (= ?var4 "str3")) (regex ?var4
> "pat1")))
>   (bgp (triple ?var2 :p1 ?var4)))
> (bgp (triple ?var2 :p2 ?var3
> (union
>   (bgp (triple ?var1 :p3 ?var4))
>   (bgp (triple ?var1 :p4 ?var4)
>
> Jena-3.1.0 produces algebra:
> (prefix ((: ))
>   (filter (! (|| (|| (= ?var4 "") (= ?var4 "str3")) (regex ?var4
> "pat1")))
> (disjunction
>   (assign ((?var3 "str1"))
> (sequence
>   (bgp
> (triple ?var2 :p1 ?var4)
> (triple ?var2 :p2 "str1")
>   )
>   (union
> (bgp (triple ?var1 :p3 ?var4))
> (bgp (triple ?var1 :p4 ?var4)
>   (assign ((?var3 "str2"))
> (sequence
>   (bgp
> (triple ?var2 :p1 ?var4)
> (triple ?var2 :p2 "str2")
>   )
>   (union
> (bgp (triple ?var1 :p3 ?var4))
> (bgp (triple ?var1 :p4 ?var4
>
> Thanks for any insight or assistance into this problem.
>
> Regards,
> --Paul
>







Re: sparql algebra differences jena 2.13.0/3.n

2016-09-14 Thread Rob Vesse
Andy

 I am a little surprised at the filter equality transformation being applied to 
this query. Variables in question are only used in the object position so 
shouldn’t be safe to assume that value equality is equivalent to term equality 
here. Or is this a special case because of the change in handling of plain 
literals in RDF 1.1?

Rob

 14/09/2016 10:57, "Andy Seaborne"  wrote:

Hi Paul,

It's difficult to tell what's going on from your report. Plain strings 
are not quite identical in RDF 1.0 and RDF 1.1 so I hope you have 
related the data for running Jena 3.x.

On less data, does either case produce the wrong answers?

The regex is not being pushed inwards in the same way which may be an 
issue - it "all depends" on the data.

A smaller query exhibiting a timing difference would be very helpful. 
Are all parts of the FILTER necessary for the effect?

Andy

Unrelated:

{
?var1 :p3 ?var4 .
} UNION {
?var1 :p4 ?var4 .
}

can be written

?var1 (:p3|:p4) ?var4


On 14/09/16 02:01, Paul Tyson wrote:
> I have some queries that worked fine in jena-2.13.0 but not in
> jena-3.1.0, using the same data.
>
> For a long time I've been running a couple dozen queries regularly over
> a large (900M triples) TDB, using jena-2.13.0. When I recently upgraded
> to jena-3.1.0, I found that 5 of these queries would not return (ran
> forever). qparse revealed that the sparql algebra is quite different in
> 2.13.0 and 3.1.0 (or apparently any 3.n.n version).
>
> Here is a sample query that worked in 2.13.0 but not in 3.1.0, along
> with the algebra given by qparse --explain for 2.13.0 and 3.1.0:
>
> prefix : 
> CONSTRUCT {
> ?var1  ?var2 .
> }
> WHERE {
> FILTER (((?var3 = "str1" || ?var3 = "str2") && !(?var4 = "" || ?var4 =
> "str3" || regex(?var4,"pat1"
> ?var2 :p1 ?var4 ; :p2 ?var3 .
> {{
> ?var1 :p3 ?var4 .
> } UNION {
> ?var1 :p4 ?var4 .
> }}
> }
>
> Jena-2.13.0 produces algebra:
> (prefix ((: ))
>   (sequence
> (filter (|| (= ?var3 "str1") (= ?var3 "str2"))
>   (sequence
> (filter (! (|| (|| (= ?var4 "") (= ?var4 "str3")) (regex ?var4
> "pat1")))
>   (bgp (triple ?var2 :p1 ?var4)))
> (bgp (triple ?var2 :p2 ?var3
> (union
>   (bgp (triple ?var1 :p3 ?var4))
>   (bgp (triple ?var1 :p4 ?var4)
>
> Jena-3.1.0 produces algebra:
> (prefix ((: ))
>   (filter (! (|| (|| (= ?var4 "") (= ?var4 "str3")) (regex ?var4
> "pat1")))
> (disjunction
>   (assign ((?var3 "str1"))
> (sequence
>   (bgp
> (triple ?var2 :p1 ?var4)
> (triple ?var2 :p2 "str1")
>   )
>   (union
> (bgp (triple ?var1 :p3 ?var4))
> (bgp (triple ?var1 :p4 ?var4)
>   (assign ((?var3 "str2"))
> (sequence
>   (bgp
> (triple ?var2 :p1 ?var4)
> (triple ?var2 :p2 "str2")
>   )
>   (union
> (bgp (triple ?var1 :p3 ?var4))
> (bgp (triple ?var1 :p4 ?var4
>
> Thanks for any insight or assistance into this problem.
>
> Regards,
> --Paul
>







Re: Restarting FUSEKI with TDB and OWL reasoner

2016-09-14 Thread Andy Seaborne

Hi Filip,

> Error 500: Invalid id node for object (null node):
> ([3C3C], [0007AA], [3D18])

This is usually a sign that the program exits without sync'ing a 
non-transaction TDB database.


It is possible (probably) that building the inference model in the 
assembler is not transactional.  It becomes transactional on first request.


So has at any time in the past, not the run which caused the 500, have 
you exited the server during start up (e.g. control-C) or before the 
first request to the inference model?  or another program access the 
same database?


The other possible cause is two systems trying to modify the same 
database at the same time.  TDB tries to trap this and warn you but the 
test is not perfect.  (It looks like you are on Linux so the test is 
much better there - on Windows, it has been reported that Windows update 
can cause restarts where the process id is reused quiet quickly.)


Could you please crosslink the stack overflow question to this thread? 
Thanks.


Andy


On 13/09/16 12:32, Filip Masri wrote:

Dear Jena Community,

I have a following fuseki dataset configuration:

@prefix fuseki:  .
@prefix rdf:  .
@prefix rdfs:  .
@prefix tdb:  .
@prefix ja:  .
@prefix sdb:  .


[] a fuseki:Server ;
fuseki:services ( <#tdb> ) .


<#tdb> rdf:type fuseki:Service ;
 fuseki:name "ds" ; # http://host/inf
 fuseki:serviceQuery   "query" , "sparql" ;
 fuseki:serviceUpdate "update" ;
 fuseki:dataset <#dataset2> ; #select which set to use
 rdfs:label"TDB ds" ;
 fuseki:serviceReadGraphStore  "get" ;
 fuseki:serviceReadWriteGraphStore
   "data" ;
 fuseki:serviceUpload  "upload" .

[] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
 tdb:DatasetTDB rdfs:subClassOf ja:RDFDataset .
 tdb:GraphTDB rdfs:subClassOf ja:Model .

 <#dataset2> rdf:type ja:RDFDataset ;
  ja:defaultGraph <#model2> .

 <#model2> a ja:InfModel;
  ja:baseModel <#tdbGraph>;
  ja:reasoner
  [ ja:reasonerURL  ] .

 <#tdbGraph> rdf:type tdb:GraphTDB;
 tdb:dataset <#tdbDataset> .

 <#tdbDataset> rdf:type tdb:DatasetTDB ;
 tdb:location "...apache-jena-fuseki-2.4.0/run/databases/ds" .


Then I start the server as ./fuseki-server --config=ds.ttl. The reasoner is
working. I upload my basic schema saying that SmartPhone is a subClassOf
MobilePhone etc...Then I post data about smartphones through the REST API.
Everything is working. Now I restart the server.

And when quering my data i get

Error 500: Invalid id node for object (null node): ([3C3C],
[0007AA], [3D18])

Does you know how to configure it correctly? Is it possible?

Thanks :)



Re: sparql algebra differences jena 2.13.0/3.n

2016-09-14 Thread Andy Seaborne

Hi Paul,

It's difficult to tell what's going on from your report. Plain strings 
are not quite identical in RDF 1.0 and RDF 1.1 so I hope you have 
related the data for running Jena 3.x.


On less data, does either case produce the wrong answers?

The regex is not being pushed inwards in the same way which may be an 
issue - it "all depends" on the data.


A smaller query exhibiting a timing difference would be very helpful. 
Are all parts of the FILTER necessary for the effect?


Andy

Unrelated:

{
?var1 :p3 ?var4 .
} UNION {
?var1 :p4 ?var4 .
}

can be written

?var1 (:p3|:p4) ?var4


On 14/09/16 02:01, Paul Tyson wrote:

I have some queries that worked fine in jena-2.13.0 but not in
jena-3.1.0, using the same data.

For a long time I've been running a couple dozen queries regularly over
a large (900M triples) TDB, using jena-2.13.0. When I recently upgraded
to jena-3.1.0, I found that 5 of these queries would not return (ran
forever). qparse revealed that the sparql algebra is quite different in
2.13.0 and 3.1.0 (or apparently any 3.n.n version).

Here is a sample query that worked in 2.13.0 but not in 3.1.0, along
with the algebra given by qparse --explain for 2.13.0 and 3.1.0:

prefix : 
CONSTRUCT {
?var1  ?var2 .
}
WHERE {
FILTER (((?var3 = "str1" || ?var3 = "str2") && !(?var4 = "" || ?var4 =
"str3" || regex(?var4,"pat1"
?var2 :p1 ?var4 ; :p2 ?var3 .
{{
?var1 :p3 ?var4 .
} UNION {
?var1 :p4 ?var4 .
}}
}

Jena-2.13.0 produces algebra:
(prefix ((: ))
  (sequence
(filter (|| (= ?var3 "str1") (= ?var3 "str2"))
  (sequence
(filter (! (|| (|| (= ?var4 "") (= ?var4 "str3")) (regex ?var4
"pat1")))
  (bgp (triple ?var2 :p1 ?var4)))
(bgp (triple ?var2 :p2 ?var3
(union
  (bgp (triple ?var1 :p3 ?var4))
  (bgp (triple ?var1 :p4 ?var4)

Jena-3.1.0 produces algebra:
(prefix ((: ))
  (filter (! (|| (|| (= ?var4 "") (= ?var4 "str3")) (regex ?var4
"pat1")))
(disjunction
  (assign ((?var3 "str1"))
(sequence
  (bgp
(triple ?var2 :p1 ?var4)
(triple ?var2 :p2 "str1")
  )
  (union
(bgp (triple ?var1 :p3 ?var4))
(bgp (triple ?var1 :p4 ?var4)
  (assign ((?var3 "str2"))
(sequence
  (bgp
(triple ?var2 :p1 ?var4)
(triple ?var2 :p2 "str2")
  )
  (union
(bgp (triple ?var1 :p3 ?var4))
(bgp (triple ?var1 :p4 ?var4

Thanks for any insight or assistance into this problem.

Regards,
--Paul



Re: ConcurrentModificationException

2016-09-14 Thread Andy Seaborne

Hi Laurant,

Try getting the model inside transaction, not passing it across 
transaction boundaries.


dataset.begin(ReadWrite.WRITE);
try {
  Model model = dataset.get...
  ...
  dataset.commit() ;
} ...

In 3.1.0, the model is (sort of) connected to the transaction in which 
it is created.  This is fixed in the next release but style-wise, 
because model are just views of the database, they are related to 
transactions.


No need to close the model but it's harmless to do so.

You don't need the locking as well as transactions.

Andy


On 14/09/16 08:59, Laurent Rucquoy wrote:

Hello,

We use a Jena TDB-backed dataset (release 3.1.0) accessed through a single
JVM multi-threaded application running generally on a Microsoft Windows
server.

The read and write accesses are made using transaction and read/write locks.
Here is the SPARQL update code we use:

dataset.begin(ReadWrite.WRITE);

model.enterCriticalSection(Lock.WRITE);
try {
UpdateAction.parseExecute(sparql, model);
if(writeMode) {
dataset.commit();
}
} finally {
model.leaveCriticalSection();
model.close();
dataset.end();
}



Note that our SPARQL query code implements also read transactions and locks.

When multiple updates are made on our TDB-backed dataset, a
java.util.ConcurrentModificationException is sometimes thrown, leaving the
dataset in an inaccessible state.
Here is the stacktrace part:



...
Caused by: java.util.ConcurrentModificationException: Reader = 1, Writer =
1
at
org.apache.jena.tdb.sys.DatasetControlMRSW.policyError(DatasetControlMRSW.java:157)
at
org.apache.jena.tdb.sys.DatasetControlMRSW.policyError(DatasetControlMRSW.java:152)
at
org.apache.jena.tdb.sys.DatasetControlMRSW.checkConcurrency(DatasetControlMRSW.java:79)
at
org.apache.jena.tdb.sys.DatasetControlMRSW.startUpdate(DatasetControlMRSW.java:60)
at
org.apache.jena.tdb.store.nodetupletable.NodeTupleTableConcrete.startWrite(NodeTupleTableConcrete.java:65)
at
org.apache.jena.tdb.store.nodetupletable.NodeTupleTableConcrete.sync(NodeTupleTableConcrete.java:249)



How can we avoid such a situation ?
Can we safely do without read/write locks when we use transactions in a
single JVM multi-threaded application ?

Thank you in advance for your help.

Sincerely,
Laurent



ConcurrentModificationException

2016-09-14 Thread Laurent Rucquoy
Hello,

We use a Jena TDB-backed dataset (release 3.1.0) accessed through a single
JVM multi-threaded application running generally on a Microsoft Windows
server.

The read and write accesses are made using transaction and read/write locks.
Here is the SPARQL update code we use:

dataset.begin(ReadWrite.WRITE);
> model.enterCriticalSection(Lock.WRITE);
> try {
> UpdateAction.parseExecute(sparql, model);
> if(writeMode) {
> dataset.commit();
> }
> } finally {
> model.leaveCriticalSection();
> model.close();
> dataset.end();
> }


Note that our SPARQL query code implements also read transactions and locks.

When multiple updates are made on our TDB-backed dataset, a
java.util.ConcurrentModificationException is sometimes thrown, leaving the
dataset in an inaccessible state.
Here is the stacktrace part:


> ...
> Caused by: java.util.ConcurrentModificationException: Reader = 1, Writer =
> 1
> at
> org.apache.jena.tdb.sys.DatasetControlMRSW.policyError(DatasetControlMRSW.java:157)
> at
> org.apache.jena.tdb.sys.DatasetControlMRSW.policyError(DatasetControlMRSW.java:152)
> at
> org.apache.jena.tdb.sys.DatasetControlMRSW.checkConcurrency(DatasetControlMRSW.java:79)
> at
> org.apache.jena.tdb.sys.DatasetControlMRSW.startUpdate(DatasetControlMRSW.java:60)
> at
> org.apache.jena.tdb.store.nodetupletable.NodeTupleTableConcrete.startWrite(NodeTupleTableConcrete.java:65)
> at
> org.apache.jena.tdb.store.nodetupletable.NodeTupleTableConcrete.sync(NodeTupleTableConcrete.java:249)


How can we avoid such a situation ?
Can we safely do without read/write locks when we use transactions in a
single JVM multi-threaded application ?

Thank you in advance for your help.

Sincerely,
Laurent