Sorry, false alarm: this turned out to be a simpler case of Model
modification during iteration, obscured by a recursive call.
On Fri, Aug 26, 2016 at 8:04 PM, Martynas Jusevičius
wrote:
> Hey Dave,
>
> another case of this came up. When calling imports.hasNext() on
>
>
Hey Dave,
another case of this came up. When calling imports.hasNext() on
ExtendedIterator imports = ontology.listImports();
I consistently get ConcurrentModificationException:
at
org.apache.jena.reasoner.rulesys.impl.LPTopGoalIterator.checkCME(LPTopGoalIterator.java:248)
at
Dave,
I was doing
OntModel ontModel =
OntDocumentManager.getInstance().getOntology(ontologyURI,
ontModelSpec);
...
OntModel clonedModel = ModelFactory.createOntologyModel(ontModelSpec);
where ontModelSpec was new OntModelSpec(OntModelSpec.OWL_MEM) with
GenericRuleReasoner set.
I guess I
On 22/07/16 21:42, Martynas Jusevičius wrote:
Is clonedModel.add(ontModel) the best way to clone a model though?
Because after that ontModel.size() and clonedModel.size() seem to
differ sometimes, e.g. 4723 vs 4729.
I expect you've got inference enabled on both ontModel and clonedModel.
In
Is clonedModel.add(ontModel) the best way to clone a model though?
Because after that ontModel.size() and clonedModel.size() seem to
differ sometimes, e.g. 4723 vs 4729.
On Fri, Jul 22, 2016 at 9:24 AM, Dave Reynolds
wrote:
> On 21/07/16 22:26, Martynas Jusevičius
On 21/07/16 22:26, Martynas Jusevičius wrote:
Thanks Dave. Does the following code look reasonable?
OntModel ontModel =
OntDocumentManager.getInstance().getOntology(ontologyURI,
ontModelSpec);
ontModel.enterCriticalSection(Lock.READ);
try
{
Thanks Dave. Does the following code look reasonable?
OntModel ontModel =
OntDocumentManager.getInstance().getOntology(ontologyURI,
ontModelSpec);
ontModel.enterCriticalSection(Lock.READ);
try
{
OntModel clonedModel =
So that's the reasoner in which case you need to lock the OntModel.
Dave
On 19/07/16 17:04, Martynas Jusevičius wrote:
Hey Andy,
I am not sure yet what is it that I need to lock - is it the OntModel, or
the OntDocumentManager instance, or maybe both.
But here are 2 actual exceptions:
Hey Andy,
I am not sure yet what is it that I need to lock - is it the OntModel, or
the OntDocumentManager instance, or maybe both.
But here are 2 actual exceptions:
java.util.ConcurrentModificationException
at
On 17/07/16 13:54, Martynas Jusevičius wrote:
But then again, I cannot lock what I don't have: locks work on models, and
I only get OntModel instance when getOntology() is called.
Maybe synchronized is the solution here?
You can lock how you like - the Jena lock code is helper code, to
But then again, I cannot lock what I don't have: locks work on models, and
I only get OntModel instance when getOntology() is called.
Maybe synchronized is the solution here?
On Sun, 17 Jul 2016 at 15:32, Martynas Jusevičius
wrote:
> Thanks Andy.
>
> All of our code
As I read the code, getOntology is a write operation just when it doesn't
retrieve a pre-existing (cached) OntModel and must build a new one. If you can
be sure that you have always beforehand written the OntModel you are retrieving
into the OntDocumentManager using addModel, then I don't think
Thanks Andy.
All of our code except OntDocumentManager access uses imutable objects, so
I hope to keep lock usage to an absolute minimum. Transactions look like an
overkill at this point.
So if getOntology() is a write operation, if I wrap only this piece of code
where it is called into a WRITE
From my reading of the code, you will want explicitly add Models from a TIM
dataset to the OntDocumentManager instance. In other words, don't use
getOntology with having added the Model yourself, or the OntDocumentManager
instance will create a Model outside the TIM dataset to give you. But I
On a second thought, since our code is only reading from the models, it is
probably easier and safer just to clone the shared model into a per-request
copy, and keep the code as it is.
Is the following code the fastest way to do it? Is add() expensive?
OntModel ontModel =
15 matches
Mail list logo