>> Since all your models seem to be in-memory then you could simply drop
>> the close(), it's not necessary here.
> 
> Are there any kind of models available in current Jena version? I was storing 
> the Dataset using TDB. Then I call getNamedModel() on the dataset and work 
> with it or just with the in-memory.
> 
> Is there any way to use another thing different that the file based TDB?

If you actually need disk persistence for the models in your dataset, TDB is 
your best choice. If they are in-memory only, try using a TIM (transactional 
in-memory) dataset:

https://jena.apache.org/documentation/rdf/datasets.html

or if they are not part of a dataset, even just an in-memory Model.

---
A. Soroka
The University of Virginia Library

> On Jan 2, 2017, at 7:37 AM, George News <george.n...@gmx.net> wrote:
> 
> 
> On 02/01/2017 13:00, Dave Reynolds wrote:
>>> 
>>> Yes it does. I want to speedup things, as ontologies are not changing.
>>> 
>>> <DocumentManagerPolicy>
>>>    <!-- policy for controlling the document manager's behaviour -->
>>>    <processImports rdf:datatype="&xsd;boolean">true</processImports>
>>>    <cacheModels rdf:datatype="&xsd;boolean">true</cacheModels>
>>> </DocumentManagerPolicy>
>>> 
>>>> Does the code you haven't shown us close your OntModels somewhere?
>>> 
>>> I call OntModel close on local models vars. But each time I'm creating a
>>> new model, so don't understand why it's being closed.
>> 
>> It sounds like your OntModels include imports. These are implemented as
>> separate sub-models which are bound into a multi-union. If you close the
>> OntModel that will (I think) close all the imported models.
>> 
>> If some of those imported models are cached (which seems to be the case
>> with your setup) and thus shared with other OntModels then you will be
>> closing submodels of other concurrent OntModel instances. That would
>> explain your symptoms.
> 
> I have removed the cached and now it takes ages to perform stuff. As an
> example, something that took 20 sec now it takes 170 sec. I cannot go
> for that solution.
> 
>> 
>> Since all your models seem to be in-memory then you could simply drop
>> the close(), it's not necessary here.
> 
> Are there any kind of models available in current Jena version? I was
> storing the Dataset using TDB. Then I call getNamedModel() on the
> dataset and work with it or just with the in-memory.
> 
> Is there any way to use another thing different that the file based TDB?
> 
>>>> However, since FileManager caching doesn't look particularly thread-safe
>>>> to me then unless you are doing your own synchronization around all the
>>>> operations that touch it that could also cause problems.
>>> 
>>> Could you further explain that? I don't fully understand. What operation
>>> are touch what? The local ontology files are there just in case the
>>> remote ones are not accessible.
>> 
>> FileManager doesn't say it is thread safe and from a quick look at the
>> code it doesn't seem to be. So if you have two different threads which
>> are concurrently importing models via the same FileManager then the
>> cache could become corrupted.
>> 
>> Possible ways round that would include:
>> 
>> - preloading your FileManager cache will all the relevant imported
>> models so there's no concurrent update to the cache
> 
> How can I do that? Sorry for the "silly" question. It seems the easiest
> way to solve the problem.
> 
> I'm also thinking on FileManager.setModelCaching(false). Would it make
> any sense?
> 
>> - build your own thread-safe filemanager (hmm, don't think the design
>> allows for that)
>> 
>> - perform all your local OntModel instantiation from within a suitably
>> protected critical section so that all the import processing is done by
>> a single thread
>> 
>> Dave
>> 
>> 
>> 

Reply via email to