首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >OWL API中的Pellet internalReasonerException

OWL API中的Pellet internalReasonerException
EN

Stack Overflow用户
提问于 2016-01-21 17:57:36
回答 1查看 323关注 0票数 0

有一天被困住了,有没有人愿意帮忙?我已经加载了一个本体,它导入了甜蜜(Semantic Web for Earth and Environmental )。我在上面做了一些SPARQL查询,得到的结果是这样的:“对象属性hasLowerBound的使用带有一个整数值限制:”0“^^ hasValue”。(我在甜食中检查过的hasLowerBound,是甜食中的一个数据类型本体)

我该如何解决这个问题?

这是我写的代码和我得到的错误,非常感谢你的帮助~

代码语言:javascript
复制
public class load {
public static void main(String[] args) throws OWLOntologyCreationException {
    // Get hold of an ontology manager
    OWLOntologyManager manager = OWLManager.createOWLOntologyManager();

    File file = new File("G:/Protege/owlfiles/Before_Gather.owl");
            // Load the local copy
    OWLOntology loadMODIS = manager.loadOntologyFromOntologyDocument(file);

    PelletReasoner reasoner = 
    PelletReasonerFactory.getInstance().createNonBufferingReasoner( loadMODIS         
    );

    KnowledgeBase kb = reasoner.getKB();
    PelletInfGraph graph = new 
    org.mindswap.pellet.jena.PelletReasoner().bind( kb );
    InfModel model = ModelFactory.createInfModel( graph );

    String PREFIX = "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-
    ns#>" +
            "PREFIX owl: <http://www.w3.org/2002/07/owl#>" +
            "PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>" +
            "PREFIX seaice: <http://www.semanticweb.org/SeaIceOntology#>" +
            "PREFIX repr: <http://sweet.jpl.nasa.gov/2.3/reprDataFormat.owl#>" +
            "PREFIX realmCryo: <http://sweet.jpl.nasa.gov/2.3/realmCryo.owl#>" +
            "PREFIX relaMath: <http://sweet.jpl.nasa.gov/2.3/relaMath.owl#>";
    String SELECT = "select ?dataset ";
    String WHERE = "where {" +
            "?dataset relaMath:hasLowerBound " + "\"0\"^^xsd:integer" +
            "}" ;

    QueryExecution qe = SparqlDLExecutionFactory.create(QueryFactory.create(PREFIX + SELECT + WHERE), model);
    ResultSet rs = qe.execSelect();
    ResultSetFormatter.out(System.out,rs);
    rs = null;  qe.close();

    reasoner.dispose();

    //OWLReasonerSPARQLEngine sparqlEngine=new OWLReasonerSPARQLEngine(new MinimalPrintingMonitor());
    //sparqlEngine.execQuery(str.toString(),dataset);

    System.out.println("Loaded ontology: " + loadMODIS);
}
}

线程"main“中的异常org.mindswap.pellet.exceptions.InternalReasonerException:对象属性hasLowerBound与值为文字的整数限制一起使用:”0“^integer 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)在org.mindswap.pellet.ABox.isConsistent(ABox.java:1423)在org.mindswap.pellet.ABox.isConsistent(ABox.java:1260)在org.mindswap.pellet.KnowledgeBase.consistency(KnowledgeBase.java:1987)在org.mindswap.pellet.KnowledgeBase.isConsistent(KnowledgeBase.java:2061)在org.mindswap.pellet.jena.PelletInfGraph.prepare(PelletInfGraph.java:258)在org.mindswap.pellet.jena.PelletInfGraph.prepare(PelletInfGraph.java:241) at com.clarkparsia.pellet.sparqldl.jena.SparqlDLExecutionFactory.create(SparqlDLExecutionFactory.java:113) at com.clarkparsia.pellet.sparqldl.jena.SparqlDLExecutionFactory.create(SparqlDLExecutionFactory.java:261) at com.clarkparsia.pellet.sparqldl.jena.SparqlDLExecutionFactory.create(SparqlDLExecutionFactory.java:226) at loadMODIS.load.main(load.java:78)

EN

回答 1

Stack Overflow用户

发布于 2016-01-23 19:33:44

hasLowerBound被解析为数据属性和注释属性。

Pellet正在检查数据属性的情况,并假定如果属性不是数据属性,则它必须是对象属性。对于OWL 2本体总是如此,但是这个本体没有被解析为OWL 2兼容的本体-注释属性和数据属性的双关语是不允许的。

我还不确定问题是在本体中还是在OWLAPI解析中。

编辑:这是一个解析问题。在relaMath.owl中,hasLowerBound被声明为data属性。然而,relaMath.owl导入了reprMath.owl,它使用了hasLowerBound,但没有声明它。reprMath.owl导入relaMath.owl,因此有一个循环导入。

问题是,在解析过程中:- relaMath.owl被解析,导入被找到,reprMath.owl导入被解析;声明还没有被解析。-解析reprMath.owl,找到import。relaMath.owl已经被解析了,所以call什么也不做。在解析reprMath.owl时,将包含在relaMath.owl中声明的所有实体。问题:实体还没有被解析,所以这个集合是空的。在reprMath中找到hasLowerBound,但尚不存在任何声明。因此,OWLAPI默认为AnnotationProperty。- relaMath.owl解析继续,找到声明。

最终结果:任何导入relaMath.owl的本体都具有对hasLowerBound的非法双关语。OWLAPI错误。

解决方法:向reprMath.owl添加数据属性声明

代码语言:javascript
复制
<owl:DatatypeProperty rdf:about="#hasLowerBound"/>

这可能需要在多个本体中完成。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34920468

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档