【问题标题】:Why is owl:Restriction reasoning not working in Blazegraph?为什么猫头鹰:限制推理在 Blazegraph 中不起作用?
【发布时间】:2015-04-22 18:45:19
【问题描述】:

在 Blazegraph 中使用以下 RDF(取自 this answer):

:eats rdf:type owl:ObjectProperty .

:Vegetable rdf:type owl:Class ;
       rdfs:subClassOf owl:Thing .

:Vegetarian rdf:type owl:Class ;
        owl:equivalentClass [ rdf:type owl:Restriction ;
                              owl:onProperty :eats ;
                              owl:someValuesFrom :Vegetable
                            ] .

:Carrot rdf:type :Vegetable ,
             owl:NamedIndividual .

:John rdf:type owl:NamedIndividual , owl:Thing ;
      :eats :carrot .

以下 SPARQL 返回空白:

select ?who
where 
{
  ?who a :Vegetarian .       
}

这是 Blazegraph 命名空间配置(Blazegraph 从命令行作为 NanoSparqlServer 运行):

com.bigdata.namespace.kb.spo.com.bigdata.btree.BTree.branchingFactor    1024
com.bigdata.relation.container  test-ng-2
com.bigdata.journal.AbstractJournal.bufferMode  DiskRW
com.bigdata.journal.AbstractJournal.file    bigdata.jnl
com.bigdata.journal.AbstractJournal.initialExtent   209715200
com.bigdata.rdf.store.AbstractTripleStore.vocabularyClass   com.bigdata.rdf.vocab.DefaultBigdataVocabulary
com.bigdata.rdf.store.AbstractTripleStore.textIndex false
com.bigdata.btree.BTree.branchingFactor 128
com.bigdata.namespace.kb.lex.com.bigdata.btree.BTree.branchingFactor    400
com.bigdata.rdf.store.AbstractTripleStore.axiomsClass   com.bigdata.rdf.axioms.OwlAxioms
com.bigdata.service.AbstractTransactionService.minReleaseAge    1
com.bigdata.rdf.sail.truthMaintenance   true
com.bigdata.journal.AbstractJournal.maximumExtent   209715200
com.bigdata.rdf.sail.namespace  test-ng-2
com.bigdata.relation.class  com.bigdata.rdf.store.LocalTripleStore
com.bigdata.rdf.store.AbstractTripleStore.quads false
com.bigdata.relation.namespace  test-ng-2
com.bigdata.btree.writeRetentionQueue.capacity  4000
com.bigdata.rdf.store.AbstractTripleStore.statementIdentifiers  true

我错过了什么?

【问题讨论】:

    标签: semantic-web owl inference reasoning blazegraph


    【解决方案1】:

    存在一些 RDF 语法问题,但根本原因是 Blazegraph 不支持开箱即用的 OWL 推理。请参阅当前的support。 ELK Reasoner 已经做了一些工作。

    关于本示例中的 RDF,这里有一个经过验证可在 Blazegraph 1.5.1 中加载的更新。它结合了上面的反馈并添加了命名空间。我使用上面的属性创建了一个属性 (test.properties) 文件,并使用 Sourceforge 的可执行 jar 加载了 Blazegraph。

    java -Xmx2g -Dbigdata.propertyFile=test.properties -jar bigdata-bundled.jar

    转到工作台:http://localhost:9999/bigdata/ 并将下面的 RDF 粘贴到工作台上的“更新”选项卡中,选择格式为“Turtle”的“RDF 数据”。

    @prefix : <http://stackoverflow.com/> .
    @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
    @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
    @prefix owl: <http://www.w3.org/2002/07/owl#> .
    
    :eats rdf:type owl:ObjectProperty .
    
    :Vegetable rdf:type owl:Class ;
       rdfs:subClassOf owl:Thing .
    
    :Vegetarian rdf:type owl:Class ;
       owl:equivalentClass [ rdf:type owl:Restriction ;
                              owl:onProperty :eats ;
                              owl:someValuesFrom :Vegetable
                            ] .
    
    :Carrot rdf:type :Vegetable ,
             owl:NamedIndividual .
    
    :carrot rdf:type owl:NamedIndividual , owl:Thing, :Carrot .
    
    :John rdf:type owl:NamedIndividual , owl:Thing ;
              :eats :carrot .
    

    如果您随后转到查询选项卡并运行以下内容:

    select * where { ?s ?p ?o }
    

    您将看到 OWLAxiomsVocabulary 推断出的所有三元组。

    【讨论】:

      【解决方案2】:

      原因似乎是在

      :胡萝卜 rdf:type :Vegetable ,

      Carrot 以大写字母开头,但在

       :eats :carrot .
      

      你使用小写字母。

      【讨论】:

      • 但大概胡萝卜是胡萝卜的一个实例。由于 eats 是一个对象属性,因此说“约翰吃胡萝卜”是没有意义的,因为对象属性将个人与其他个人相关联,而不是类。
      • 我认为这里的胡萝卜是一个个体,和胡萝卜一样。只是不一定是同一个。
      • 由于Carrot的完整定义包含rdf:type owl:NamedIndividual,所以我认为这只是一个错字
      • 感谢您指出错字,已修复。然而,这并没有改变什么。我仍然没有得到想要的输出。
      【解决方案3】:

      这个数据还没有很好的形成:

      :Carrot rdf:type :Vegetable ,
                   owl:NamedIndividual .
      
      :John rdf:type owl:NamedIndividual , owl:Thing ;
            :eats :carrot .
      

      您还需要说 :carrot 是一个类型为 :Carrot 的个体,其断言如下:

      :carrot rdf:type owl:NamedIndividual , owl:Thing, :Carrot .
      

      然后,由于 :carrot 将是 :Carrot 的实例,并且 :Carrot 是 :Vegetable 的子类,因此您可以推断 :carrot 是 :Vegetable 的实例,因此 :John :eats some :Vegetable。如果 Blazegraph 支持 OWL 推理(例如,不仅仅是 RDFS 推理),那应该足以让您推断 :John 是一个 :Vegetarian(至少根据素食的非标准定义)。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2014-04-22
        • 1970-01-01
        • 2023-03-29
        • 1970-01-01
        • 2016-07-12
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多