【问题标题】:Setting up OWL reasoner in Jena在 Jena 中设置 OWL 推理器
【发布时间】:2012-09-01 01:02:40
【问题描述】:

我正在尝试在 Turtle 中(在 turtle 中)定义一个对称的传递谓词并从中获得推论。

这是我定义谓词的方式:

:similar a owl:SymmetricProperty; a owl:TransitiveProperty .

我如何使用它(同一个海龟文件):

:a :similar :b .
:b :similar :c .

然后我发出一个 sparkl 查询“select ?x where ?x :similar :c”希望得到 a 和 b。

我尝试过这样设置模型:

OntModel ont = ModelFactory.createOntologyModel( OntModelSpec.OWL_MEM );      
ont.read("file:./myontology.turtle",null,"TURTLE"); 
InfModel model = ModelFactory.createInfModel(ReasonerRegistry.getOWLReasoner(), ont);

然后在我的 QueryExecutionFactory.create 中使用 InfModel。不工作。

我也试过了:

OntModel model = ModelFactory.createOntologyModel( OntModelSpec.OWL_DL_MEM_RULE_INF );
model.read("file:./myontology.turtle",null,"TURTLE");

也没有运气。 什么是正确的方法?我错过了什么?

提前致谢。

【问题讨论】:

    标签: rdf semantic-web jena owl


    【解决方案1】:

    找到了答案。以下工作正常:

    OntModel model = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM_MICRO_RULE_INF);
    model.read("file:./myontology.turtle",null,"TURTLE");
    

    我遇到了一些前缀问题。另外,我将 :similar 声明为一个类,并假设子类将继承 owl:SymmetricProperty 和 owl:TransitiveProperty。好像不是这样的

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-26
      • 1970-01-01
      • 2011-06-08
      • 2023-03-20
      相关资源
      最近更新 更多