Hi Christopher,
On 18/05/11 04:18, Christoper Blunck wrote:
> I have a question about SDB and loading triples from a store before
> instantiating an OntModel and I was hoping for some help.
>
> I use the following boiler-plate to use SDB to instantiate a Model and then
> create an OntModel from my Model:
> Store store = SDBFactory.connectStore("/Users/chris/sdb.ttl");
> Model model = SDBFactory.connectDefaultModel(store);
> OntModel ontology =
> ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM, model);
>
> I need the OntModel because I use owl2java to translate an OWL to Jena java
> classes and I then want to instantiate them and use them.
>
> The JavaDocs for ModelFactory.createOntologyModel clearly state: Answer a
> new ontology model, constructed according to the given ontology model
> specification, and starting with the ontology data in the given model.
>
> Note the "starting with the ontology data in the given model". I've seen
> that the resulting OntModel does in fact contain all of the triples loaded
> from the SDB store.
Contain in this context means "has access to". No data is copied out of
the SDB model into memory - every interaction with the model, whether a
write or a read, gets translated behind-the-scenes into a call into the
database. The term "OWL_MEM" is slightly unfortunate here: _MEM in this
case means "just the raw model with no inference", not "everything
exists in memory"
> In my code I'm not interested in querying. I'm "write-only" and I'm simply
> trying to insert triples into the store using the owl2java Jena based
> classes I instantiate and populate.
Then what you have should be fine.
> Is there a way for me to use SDB to persist data in a "write-only" way where
> I don't read the existing triples out of the store first?
It's more the other way around: using an SDB-backed model, you have to
go an extra step to get the triples into memory, e.g. for performance
enhancement.
Ian
--
____________________________________________________________
Ian Dickinson Epimorphics Ltd, Bristol, UK
mailto:[email protected] http://www.epimorphics.com
cell: +44-7786-850536 landline: +44-1275-399069
------------------------------------------------------------
Epimorphics Ltd. is a limited company registered in England
(no. 7016688). Registered address: Court Lodge, 105 High St,
Portishead, Bristol BS20 6PT, UK