You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by 月之子 <ti...@qq.com> on 2012/02/22 13:54:15 UTC

How to read big Ontology file into the OntModel ?

As we know ,if we want to parse a OWL file ,we always read in it and then create a OntModel with the ModelFactory. But this will encounter a problem when reading a large file,for example the file size is larger than 50MB.Java will throw an exception for : JAVA heap space,because of the limitation of memeory. So is that mean I can't parse large OWL file with JENA and get the OntModel? If it can , how could I achieve it ? Thanks

Re: How to read big Ontology file into the OntModel ?

Posted by Ian Dickinson <ia...@epimorphics.com>.
On 22/02/12 12:54, 月之子 wrote:
> As we know ,if we want to parse a OWL file ,we always read in it and
> then create a OntModel with the ModelFactory. But this will encounter
> a problem when reading a large file,for example the file size is
> larger than 50MB.Java will throw an exception for : JAVA heap
> space,because of the limitation of memeory.

> So is that mean I can't
> parse large OWL file with JENA and get the OntModel?
No it doesn't. You have a couple of options:

* 50Mb is not that large compared to most modern computers. If you need 
to, allocate the Java process a larger heap with the -Xmx option when 
you start the JVM

* read the model into a persistent model, such as TDB. Then, create the 
OntModel as a wrapper around the TDB model:

Model tdbBaseModel = .... ;
OntModel m = ModelFactory.createOntologyModel(
               OntModelSpec.OWL_MEM,
               tdbBaseModel );

and then carry on as normal.

NOTE: the second strategy will not perform very well if you use an 
OntModel with inference (e.g. OWL_MEM_MICRO_RULE_INF). If you need 
inference, just increase the Java heap size.

Ian

-- 
____________________________________________________________
Ian Dickinson                   Epimorphics Ltd, Bristol, UK
mailto:ian@epimorphics.com        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