使用Pellet作为推理机的OutOfMemoryError [英] OutOfMemoryError using Pellet as Reasoner

查看:183
本文介绍了使用Pellet作为推理机的OutOfMemoryError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Pellet推断数据,但是我的应用程序总是崩溃 在推理过程中由于"OutOfMemoryError:Java堆空间".

I'm trying to infer data using Pellet, but my application always crashes during reasoning due to an "OutOfMemoryError: Java heap space".

正如其他地方所建议的,我已经尝试增加堆大小并 当前,我正在使用以下VM参数:"-XX:MaxPermSize = 256m -Xmx6144m".此外,我必须设置'PelletOptions.USE_CONTINUOUS = 是",但到目前为止,我只能将崩溃时间延迟几分钟. (到目前为止,最长运行时间:30分钟.)

As suggested elsewhere I have already tried to increase heap size and currently I am using these VM arguments: "-XX:MaxPermSize=256m -Xmx6144m". Furthermore I've to set 'PelletOptions.USE_CONTINUOUS = true', but so far I was only able delays the crashs for some minutes. (Longest run so far: 30 min.).

我正在将数据存储在Jena TDB三重存储中.它的总大小为170 mb 并由962117语句组成.本体已建模为 Protege,与隐士或 事实++(当然,此时没有数据).我要的陈述 要推断的对象已使用等效的类进行了建模(例如:A和 (hasX一些X)),逆属性(hasX<-> isXOf)和一些可传递的 特性.一共有55个类别:14个根类别,11个等效类别 (一个根类的所有子类型).目前有14个班级的实例 已添加到Tripestore.

I am storing data in a Jena TDB triplestore. Its total size is 170 mb and consists of 962117 statements. The ontology has been modelled in Protege and there are no inconsistencies when reasoned with Hermit or Fact++ (of course no data is present at that point). The statements I'd like to infer have been modelled using equivalent classes (e.g.: A and (hasX some X)), inverse properties (hasX <--> isXOf) and some transitive properties. There are 55 classes: 14 root classes, 11 equivalent classes (all subtype of one root class). At the moment instances of 14 classes have been added to the tripestore.

我也用拼写法分析了我的本体,但是我不确定哪个 从该结果得出的结论:

I also used pellint to analyse my ontology, but I am not sure which conclusions to draw from this result:

[Untyped classes]
- http://www.w3.org/2002/07/owl#AllDisjointClasses

[Untyped object roles]
- http://www.w3.org/2002/07/owl#topObjectPriority
- http://www.w3.org/2002/07/owl#members

[Untyped datatype roles]
- http://www.w3.org/2002/07/owl#qualifiedCardinality

[Untyped individuals]
- 4 BNodes

这是我创建InfModel的代码:

This is my code for creating the InfModel:

 Dataset dataset = TDBFactory.createDataset(..);
 Model model = dataset.getDefaultModel();

 OntModel ont = ModelFactory.createOntologyModel(PelletReasonerFactory.THE_SPEC,model);
 ont.read("file:.." , "RDF/XML");

 PelletOptions.USE_CONTINUOUS_RULES = true;
 Reasoner reasoner = PelletReasonerFactory.theInstance().create();
 reasoner = reasoner.bindSchema(ont);

 InfModel infModel = infModel = ModelFactory.createInfModel(reasoner, model);

而这实际上是我查询数据的方式:

and this is essentially how I query the data:

 QueryExecution qe = QueryExecutionFactory.create("SELECT ...", infModel);
 Resultset rs = qe.execSelect();

 while(rs.hasNext())
 {
     QuerySolution sol = rs.nextSolution();
     ...
 }
 qe.close();

如您所见,在进行查询时,我都收到了各种异常 数据,准备或验证InfModel.你有什么想法吗 否则我可以尝试解决此错误?

As you can see I have received various exceptions when either querying data, preparing or validating an InfModel. Do you have any idea, what else I could try to resolve this error?

 java.lang.OutOfMemoryError: Java heap space
 at java.util.Arrays.copyOf(Unknown Source)
 at java.lang.AbstractStringBuilder.expandCapacity(Unknown Source)
 at java.lang.AbstractStringBuilder.append(Unknown Source)
 at java.lang.StringBuilder.append(Unknown Source)
 at java.net.URLStreamHandler.parseURL(Unknown Source)
 at sun.net.www.protocol.file.Handler.parseURL(Unknown Source)
 at java.net.URL.<init>(Unknown Source)
 at java.net.URL.<init>(Unknown Source)
 at sun.misc.URLClassPath$FileLoader.getResource(Unknown Source)
 at sun.misc.URLClassPath.getResource(Unknown Source)
 at java.net.URLClassLoader$1.run(Unknown Source)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.net.URLClassLoader.findClass(Unknown Source)
 at java.lang.ClassLoader.loadClass(Unknown Source)
 at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
 at java.lang.ClassLoader.loadClass(Unknown Source)
 at com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorCheck.warn(QueryIteratorCheck.java:114)
 at com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorCheck.dump(QueryIteratorCheck.java:95)
 at com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorCheck.checkForOpenIterators(QueryIteratorCheck.java:68)
 at com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorCheck.close(QueryIteratorCheck.java:50)
 at com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorWrapper.closeIterator(QueryIteratorWrapper.java:50)
 at com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.close(QueryIteratorBase.java:184)
 at com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorCloseable.close(QueryIteratorCloseable.java:39)
 at com.hp.hpl.jena.sparql.engine.QueryExecutionBase.close(QueryExecutionBase.java:180)


 java.lang.OutOfMemoryError: Java heap space
 at shared.SharedObjectFactory.build(SharedObjectFactory.java:303)
 at aterm.pure.PureFactory.makeAppl(PureFactory.java:191)
 at aterm.pure.PureFactory.makeAppl(PureFactory.java:185)
 at aterm.pure.PureFactory.makeAppl(PureFactory.java:228)
 at org.mindswap.pellet.utils.ATermUtils.makeLiteral(ATermUtils.java:245)
 at org.mindswap.pellet.ABox.addLiteral(ABox.java:1696)
 at org.mindswap.pellet.tableau.completion.rule.SomeValuesRule.applySomeValuesRule(SomeValuesRule.java:174)
 at org.mindswap.pellet.tableau.completion.rule.SomeValuesRule.apply(SomeValuesRule.java:64)
 at org.mindswap.pellet.tableau.completion.rule.AbstractTableauRule.apply(AbstractTableauRule.java:64)
 at org.mindswap.pellet.tableau.completion.SROIQStrategy.complete(SROIQStrategy.java:157)
 at org.mindswap.pellet.ABox.isConsistent(ABox.java:1423)
 at org.mindswap.pellet.ABox.isConsistent(ABox.java:1260)
 at org.mindswap.pellet.KnowledgeBase.consistency(KnowledgeBase.java:1987)
 at org.mindswap.pellet.KnowledgeBase.isConsistent(KnowledgeBase.java:2061)
 at org.mindswap.pellet.jena.PelletInfGraph.prepare(PelletInfGraph.java:247)
 at org.mindswap.pellet.jena.PelletInfGraph.prepare(PelletInfGraph.java:230)
 at com.hp.hpl.jena.rdf.model.impl.InfModelImpl.prepare(InfModelImpl.java:89)


 java.lang.OutOfMemoryError: Java heap space
 at org.mindswap.pellet.tableau.branch.DisjunctionBranch.tryBranch(DisjunctionBranch.java:197)
 at org.mindswap.pellet.tableau.branch.Branch.tryNext(Branch.java:117)
 at org.mindswap.pellet.tableau.completion.rule.ChooseRule.apply(ChooseRule.java:82)
 at org.mindswap.pellet.tableau.completion.rule.ChooseRule.apply(ChooseRule.java:56)
 at org.mindswap.pellet.tableau.completion.rule.AbstractTableauRule.apply(AbstractTableauRule.java:64)
 at org.mindswap.pellet.tableau.completion.SROIQStrategy.complete(SROIQStrategy.java:157)
 at org.mindswap.pellet.ABox.isConsistent(ABox.java:1423)
 at org.mindswap.pellet.ABox.isConsistent(ABox.java:1260)
 at org.mindswap.pellet.KnowledgeBase.consistency(KnowledgeBase.java:1987)
 at org.mindswap.pellet.KnowledgeBase.isConsistent(KnowledgeBase.java:2061)
 at org.mindswap.pellet.jena.PelletInfGraph.prepare(PelletInfGraph.java:247)
 at org.mindswap.pellet.jena.PelletInfGraph.prepare(PelletInfGraph.java:230)
 at org.mindswap.pellet.jena.PelletInfGraph.validate(PelletInfGraph.java:564)
 at com.hp.hpl.jena.rdf.model.impl.InfModelImpl.validate(InfModelImpl.java:111)

推荐答案

infModel的查询显然导致Pellet生成数百个owl:differentFrom语句.解决方案是使用ModelExtractor:

Querying against infModel apparently caused Pellet to generate hundreds of thoundands of owl:differentFrom statements. The solution was to use ModelExtractor:

ModelExtractor ext = new ModelExtractor(inf); 
Model m = ext.extractModel();
QueryExecution qe = QueryExecutionFactory.create("SELECT ...", m);

这篇关于使用Pellet作为推理机的OutOfMemoryError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆