Sparql OWL API中的异常

Sparql OWL API中的异常,sparql,ontology,owl-api,pellet,Sparql,Ontology,Owl Api,Pellet,有一天被困了,有人能帮忙吗? 我已经加载了一个本体,它导入了SWEET(地球和环境本体的语义网)。我对它进行了一些SPARQL查询,得到了这样的答案:“对象属性hasLowerBound与hasValue限制一起使用,其中值是一个文本:“0”^^integer”。(hasLowerBound,我已经在SWEET中进行了检查,它是SWEET中的一个数据类型本体) 我怎样才能解决这个问题 这是我写的代码和我得到的错误,非常感谢你的帮助~ public class load { public stat

有一天被困了,有人能帮忙吗? 我已经加载了一个本体,它导入了SWEET(地球和环境本体的语义网)。我对它进行了一些SPARQL查询,得到了这样的答案:“对象属性hasLowerBound与hasValue限制一起使用,其中值是一个文本:“0”^^integer”。(hasLowerBound,我已经在SWEET中进行了检查,它是SWEET中的一个数据类型本体)

我怎样才能解决这个问题

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

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);
}
}
公共类加载{
公共静态void main(字符串[]args)抛出OWLOntologyCreationException{
//获得一个本体管理器
OWLOntologyManager=OWLManager.createOWLOntologyManager();
File File=新文件(“G:/Protege/owlfiles/Before_Gather.owl”);
//加载本地副本
OWLontologyLoadModis=manager.loadOntologyFromOntologyDocument(文件);
制粒机推理机=
PelletReasonerFactory.getInstance().createNonBufferingReasoner(loadMODIS
);
KnowledgeBase kb=reasoner.getKB();
PelletInfGraph图形=新建
org.mindswap.pellet.jena.PelletReasoner().bind(kb);
InfModel model=ModelFactory.createInfModel(图形);
String PREFIX=“PREFIX rdf:”+
“前缀owl:”+
“前缀xsd:”+
“前缀seaice:”+
“前缀repr:”+
“前缀realmCryo:”+
“前缀relaMath:”;
String SELECT=“选择?数据集”;
字符串WHERE=“WHERE{”+
?数据集relaMath:hasLowerBound“+”\“0\”^^xsd:integer+
"}" ;
QueryExecution qe=SparqlDLExecutionFactory.create(QueryFactory.create(前缀+选择+位置),模型);
ResultSet rs=qe.execSelect();
ResultSetFormatter.out(System.out,rs);
rs=null;qe.close();
reasoner.dispose();
//OWLReasonerSPARQLEngine sparqlEngine=新的OWLReasonerSPARQLEngine(新的MinimalPrintingMonitor());
//execQuery(str.toString(),dataset);
System.out.println(“加载的本体:“+loadMODIS”);
}
}
线程“main”org.mindswap.pellet.exceptions.InternalReasureException中的异常:对象属性hasLowerBound与hasValue限制一起使用,其中值为文字:“0”^^整数 在org.mindswap.pellet.tableau.completion.rule.SomeValuesRule.applySomeValuesRule(SomeValuesRule.java:204)上 在org.mindswap.pellet.tableau.completion.rule.SomeValuesRule.apply(SomeValuesRule.java:64)上 位于org.mindswap.pellet.tableau.completion.rule.AbstractTableauRule.apply(AbstractTableauRule.java:64) 位于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) 位于com.clarkparsia.pellet.sparqldl.jena.SparqlDLExecutionFactory.create(SparqlDLExecutionFactory.java:113) 位于com.clarkparsia.pellet.sparqldl.jena.SparqlDLExecutionFactory.create(SparqlDLExecutionFactory.java:261) 位于com.clarkparsia.pellet.sparqldl.jena.SparqlDLExecutionFactory.create(SparqlDLExecutionFactory.java:226)
在loadMODIS.load.main(load.java:78)

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

Pellet正在检查数据属性案例,并假设如果属性不是数据属性,则它必须是对象属性。OWL2本体总是这样,但该本体没有被解析为与OWL2兼容的本体-不允许对注释属性和数据属性进行双关

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

编辑:这是一个解析问题
hasLowerBound
relaMath.owl
中声明为数据属性。但是,
relaMath.owl
导入
repormath.owl
,它使用
hasLowerBound
,但不声明它
repormath.owl
导入
relaMath.owl
,因此在那里有一个循环导入

问题在于,在解析过程中: -解析relaMath.owl,找到导入,解析reprMath.owl导入;尚未解析任何声明。 -解析reprMath.owl,找到导入。已在分析relaMath.owl,因此调用不执行任何操作。解析reprMath.owl时,将包括relaMath.owl中声明的所有实体。问题:尚未解析实体,因此此集合为空<代码>hasLowerBound在Repormath中找到,但尚未存在任何声明。因此,OWLAPI默认为AnnotationProperty。 -relaMath.owl解析继续,找到声明

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

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

<owl:DatatypeProperty rdf:about="#hasLowerBound"/>


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

由于某些原因,属性hasLowerBound作为对象属性处理,因此您必须检查本体中的错误。可能是本体错误,或者在OWLAPI解析步骤中发生了一些事情。非常感谢您的回答。起初我认为我加载的本体论是错误的。但它是正式发布的,我检查了本体,似乎他们是对的。属性hasLowerBound是一个DataProperty。所以我现在正在考虑你说的第二个选择。但是,我如何查看解析步骤呢?你能给我一些建议吗?我建议在OWLAPI邮件列表上寻求帮助。那些家伙跑得很快,通常他都能