You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Martynas Jusevičius <ma...@atomgraph.com> on 2022/01/22 20:14:25 UTC

Replacing FileManager with Dataset

Hi,

We are using FileManager as part of the Ontology API. We noticed it's
Model cache related methods are marked deprecated:
https://jena.apache.org/documentation/javadoc/jena/org/apache/jena/util/FileManager.html

I don't see how OntDocumentManager can work without some sort of model
cache. But I think that FileManager (or at least the caching part)
could be replaced with a Dataset implementation. <URI, String> cache
map in FileManager is essentially the same as the named graphs in the
Dataset.

One immediate advantage would be that all OntDocumentManager
ontologies would be accessible using SPARQL. We have a use case to
make the queryable which lead to this idea.

I've made a PoC implementation. It uses DataManager as a subclass of
FileManager with getModelCache() exposed as an immutable map, because
FileManager itself provides no way to list the entries in the cache
map.
https://github.com/AtomGraph/LinkedDataHub/blob/develop/src/main/java/com/atomgraph/linkeddatahub/server/util/DataManagerDataset.java

Thoughts?

Martynas

Re: Replacing FileManager with Dataset

Posted by Andy Seaborne <an...@apache.org>.
FileManager does two things - finding data and caching data.

FileManager only exists for code in jena-core: Ont API with some 
internal only operations for the rules engine. There is FileManagerImpl 
to make jena-core run its own tests - running jena-core on its own is 
not a good idea for an application.

RIOT does not use it. For the "finding" part there is StreamManager 
which has no caching.

FileManagerImpl is replaced by AdapterFileManager by RIOT initialization 
for backwards compatibility.

Only Ont API caches.

In the general case, built-in caching does not work - caching is 
complicated and one policy does not fit all.

The FileManager interface could expose the map (better, as a map-level 
copy - immutable isn't enough - the cache may drop a model) so the app 
can use DatasetFactory.createGeneral.

Note that Dataset isn't in jena-core.

     Andy

On 22/01/2022 20:18, Martynas Jusevičius wrote:
> I meant <String, Model> map in FileManager...
> 
> On Sat, Jan 22, 2022 at 9:14 PM Martynas Jusevičius
> <ma...@atomgraph.com> wrote:
>>
>> Hi,
>>
>> We are using FileManager as part of the Ontology API. We noticed it's
>> Model cache related methods are marked deprecated:
>> https://jena.apache.org/documentation/javadoc/jena/org/apache/jena/util/FileManager.html
>>
>> I don't see how OntDocumentManager can work without some sort of model
>> cache. But I think that FileManager (or at least the caching part)
>> could be replaced with a Dataset implementation. <URI, String> cache
>> map in FileManager is essentially the same as the named graphs in the
>> Dataset.
>>
>> One immediate advantage would be that all OntDocumentManager
>> ontologies would be accessible using SPARQL. We have a use case to
>> make the queryable which lead to this idea.
>>
>> I've made a PoC implementation. It uses DataManager as a subclass of
>> FileManager with getModelCache() exposed as an immutable map, because
>> FileManager itself provides no way to list the entries in the cache
>> map.
>> https://github.com/AtomGraph/LinkedDataHub/blob/develop/src/main/java/com/atomgraph/linkeddatahub/server/util/DataManagerDataset.java
>>
>> Thoughts?
>>
>> Martynas

Re: Replacing FileManager with Dataset

Posted by Martynas Jusevičius <ma...@atomgraph.com>.
I meant <String, Model> map in FileManager...

On Sat, Jan 22, 2022 at 9:14 PM Martynas Jusevičius
<ma...@atomgraph.com> wrote:
>
> Hi,
>
> We are using FileManager as part of the Ontology API. We noticed it's
> Model cache related methods are marked deprecated:
> https://jena.apache.org/documentation/javadoc/jena/org/apache/jena/util/FileManager.html
>
> I don't see how OntDocumentManager can work without some sort of model
> cache. But I think that FileManager (or at least the caching part)
> could be replaced with a Dataset implementation. <URI, String> cache
> map in FileManager is essentially the same as the named graphs in the
> Dataset.
>
> One immediate advantage would be that all OntDocumentManager
> ontologies would be accessible using SPARQL. We have a use case to
> make the queryable which lead to this idea.
>
> I've made a PoC implementation. It uses DataManager as a subclass of
> FileManager with getModelCache() exposed as an immutable map, because
> FileManager itself provides no way to list the entries in the cache
> map.
> https://github.com/AtomGraph/LinkedDataHub/blob/develop/src/main/java/com/atomgraph/linkeddatahub/server/util/DataManagerDataset.java
>
> Thoughts?
>
> Martynas