【发布时间】:2016-01-21 09:57:35
【问题描述】:
有一天被困住了,有人会好心帮忙吗? 我已经加载了一个导入 SWEET(地球和环境本体的语义网)的本体。我对其进行了一些 SPARQL 查询,得到了这样的答案:“对象属性 hasLowerBound 与 hasValue 限制一起使用,其中值是文字:“0”^^integer”。 (我在SWEET中查过的hasLowerBound是SWEET中的Datatype Ontology)
我该如何解决这个问题?
这是我写的代码和我得到的错误,非常感谢你的帮助~
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 与 hasValue 限制一起使用,其中值是文字:“0”^^integer 在 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 被作为对象属性处理,因此您必须检查本体中的问题。可能是本体错误或在 OWL API 解析步骤中发生了某些事情。
-
非常感谢您的回答。起初我以为我加载的本体 SWEET 是错误的。但是它是正式发布的,我在本体里面查了一下,似乎他们是对的。属性 hasLowerBound 是一个 DataProperty。所以我现在正在考虑你说的第二种选择。但是我怎样才能查看解析步骤呢?你能给我一些建议吗?
-
我建议在 OWL API 邮件列表上寻求帮助。那些家伙速度很快,通常可以很好地帮助你。如果该属性被明确定义为 owl:DatatypeProperty,则其他东西(例如另一个公理)必须让 Pellet 认为它是一个 owl:ObjectProperty。它也可能发生在从 OWL API 到 Pellet 内部结构的转换中。
-
Pellet 和 OWLAPI 的哪个版本?另外,你能添加一个到本体的链接吗?
-
听起来是个好主意!我会去邮件列表寻求帮助。从 OWL API 到 Pellet 内部结构的转换过程中发生错误的可能性很大。非常感谢您的好建议~
标签: sparql ontology owl-api pellet