我真的需要OWL推理吗?

时间:2017-10-24 16:54:42

标签: sparql rdf owl graphdb

我最近问了question关于在启用OWL推理的情况下将大约1000万条语句加载到三元商店的可行性。

这导致了一些StackOverflow评论以及我的研究小组内部关于我们是否真的需要OWL推理的讨论。

我将从一个似乎不需要 OWL推理的真实世界查询开始。

“41167-4120-0”是用于标识commercial drug product "Fexofenadine hydrochloride 180 MG Oral Tablet [Allegra]" in the US

的NDC代码

NDC的略微修改版本在药物本体中显示为标签(特别是文件 dron-ndc.owl ):

http://purl.obolibrary.org/obo/DRON_00604430 rdfs:label "41167412000"

DrON做出以下OWL断言:

http://purl.obolibrary.org/obo/DRON_00604430 is a packaged drug product 
    and is rdfs:subClass of 
    ( has_proper_part some http://purl.obolibrary.org/obo/DRON_00083688 )

http://purl.obolibrary.org/obo/DRON_00083688 
    rdfs:subClassOf http://purl.obolibrary.org/obo/DRON_00062350

http://purl.obolibrary.org/obo/DRON_00062350 has_proper_part some 
    (scattered molecular aggregate  
    and (is bearer of some active ingredient) 
    and (is bearer of some (mass and 
    (has measurement unit label value milligram) 
    and (has specified value <value> ))) 
    and (has granular part some fexofenadine))

ChEBI说:

http://purl.obolibrary.org/obo/CHEBI_5050 rdfs:label "fexofenadine"
    subClassOf (has role some anti-allergic agent)

http://purl.obolibrary.org/obo/CHEBI_50857 rdfs:label "anti-allergic agent"

因此,为了链接NDC代码和治疗角色,我可以编写如下的查询

PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX obo: <http://purl.obolibrary.org/obo/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
select distinct 
?ndcval ?packdrugprod ?drugbrand ?brandlab ?drugform  ?api ?apilab ?drugrole
where {
    values ?ndcval {
        "41167412000" 
    }
    ?packdrugprod rdfs:subClassOf ?hasproppart ;
                  rdfs:label ?ndcval .
    ?hasproppart a owl:Restriction ;
                 owl:onProperty <http://www.obofoundry.org/ro/ro.owl#has_proper_part> ;
                 owl:someValuesFrom ?drugbrand .
    ?drugbrand rdfs:subClassOf ?drugform ;
               rdfs:label ?brandlab .
    ?drugform rdfs:subClassOf ?proppart .
    ?proppart a owl:Restriction ;
              owl:onProperty <http://www.obofoundry.org/ro/ro.owl#has_proper_part> ;
              owl:someValuesFrom ?valSource1 .
    ?valSource1 owl:intersectionOf ?intsect1 .
    # scat mol agg
    ?intsect1 rdf:first obo:OBI_0000576 .
    ?intsect1 rdf:rest ?scatmolag .
    ?scatmolag rdf:first ?bearacting .
    ?scatmolag rdf:rest ?intsect3 .
    # bearer of active ingredient
    ?bearacting a owl:Restriction ;
                owl:onProperty obo:BFO_0000053 ;
                owl:someValuesFrom obo:DRON_00000028 .
    ?intsect3 rdf:first ?granpart .
    ?intsect3 rdf:rest ?r .
    # has granular part fexofenadine
    ?granpart a owl:Restriction ;
              owl:onProperty obo:BFO_0000071 ;
              owl:someValuesFrom ?api .
    ?api rdfs:subClassOf ?rolerestr ;
         rdfs:label ?apilab .
    # has anti allergic role
    ?rolerestr a owl:Restriction ;
               owl:onProperty obo:RO_0000087 ;
               owl:someValuesFrom ?drugrole  .
    ?drugrole rdfs:label ?drlab .
    values ?drugrole {
        obo:CHEBI_50857 
    }
}

关注:

如何在没有推理的情况下访问嵌套的子类关系?

上述例子很容易,因为非索非那定直接被认为具有“抗过敏”作用

如果我对服用硝酸酯的人感兴趣怎么办?硝酸甘油是硝酸甘油,而硝酸甘油又是硝酸酯。如果我使用的存储库没有启用任何推理,我将必须明确使用 属性路径 来查找正在服用任何硝酸酯的患者,并使用这样的代码片段(右侧) ?)

?s rdfs:subClassOf* <http://purl.obolibrary.org/obo/CHEBI_51080> .

如何推断出个人所属的类别?

如果我的本体论说像

那会怎么样?
:ViagraPill owl:equivalentClass ( :pill 
    and (:hasColor some :blue ) 
    and (:hasShape some :diamond))
:steelBlue rdfs:subClassOf :blue

我有数据三元组,比如

:patient1 :consumed :pill1 .
:pill1 :hasColor :steelBlue1 ;
    :hasShape :diamond1 .
:steelBlue1 a :steelBlue .
:diamond1 a :diamond.

我想为服用伟哥药丸的患者写一个查询:

?patient a :patient ;
    :consumed ?pill .
?pill a :ViagraPill .

我需要某种形式的OWL推理,对吗?

1 个答案:

答案 0 :(得分:2)

我一直认为OBO和其他生物,生命科学和农业本体论倾向于使用数以百万计的课程,但很少有人是错误的。

上述建模意味着对于Allegra的每个实例(每个单粒药丸,一个盒子或其他包装),您都需要推断如下语句:“它是分散的分子聚集体”,“是某些有效成分的载体”和“具有颗粒状”部分非索非那定”。我觉得这很浪费。

最好将这些陈述直接附加到药物定义上:作为简单陈述,而不是限制。您可以通过两种方式做到这一点:

  1. 仍然将Allegra视为一类,但可以通过修剪将道具直接附加到它上
  2. 以Allegra为例,如果您需要描述单个药丸,请使用类似pill dct:type Allegra的语句

然后,您可以仅通过其药物(分类或不分类)访问药丸属性:

?pill rdf:type ?drug. # or in Variant2: dct:type
?drug obo:RO_0000087 obo:CHEBI_50857. # has anti allergic role

它与您的查询类似,但是更加简单快捷,因为它可以避免限制。

(关于解析rdf:Lists的需求,这必将成为本体创建者意识的沉重负担):

    ?intsect1 rdf:first obo:OBI_0000576 .
    ?intsect1 rdf:rest ?scatmolag .
    ?scatmolag rdf:first ?bearacting .
    ?scatmolag rdf:rest ?intsect3 .
    # bearer of active ingredient

这是您的Viagram示例的简化形式。我已将术语名称:blue:diamond转换为个人(skos:Concept),因为我认为没有理由将它们归为类(:steelBlue1对我来说没有意义)。

:ViagraPill a DrugForm;
  :hasColor :blue;
  :hasShape :diamond.
:steelBlue a skos:Concept;
  skos:broader :blue.

:patient1 :consumed :pill1.
:pill1 :hasColor :steelBlue; :hasShape :diamond.

颜色和形状是识别药物的必要但不充分的条件,因此下面的?drugForm是该药的可能药物,但不确定:

select ?patient ?drugForm {
  ?patient a :patient; :consumed ?pill.
  ?pill :hasColor ?color; :hasShape ?shape.
  ?drugForm :hasColor ?color1; :hasShape ?shape.
  ?color skos:broaderTransitive? ?color1
}

这里我使用了传递推理:路径skos:broaderTransitive?比路径skos:broader*快。

推理并非一无所有:您可以从内置规则集中选择所需的规则。例如,如果您包含RDFS推理,则可以简化:

?x a ?s. ?s rdfs:subClassOf* :CHEBI_51080

?x a :CHEBI_51080

经过优化的默认内置规则集RDFS-Plus已优化,包括RDFS,逆函数和可传递函数。 有关更多建议,请参见http://graphdb.ontotext.com/documentation/enterprise/rules-optimisations.html

您可能会反对:“您不是说要直接将道具附加到毒品(类)上吗?您又怎么将它们附加到上面的:pill1上呢?”

我认为很好:我们可以声明这些道具具有域:DrugIndividual or :DrugForm or :Drug,并将它们解释为:DrugIndividual的“观察到”,但解释为:DrugForm and :Drug的“标称”或“必需”。 顺便说一句,我想使用schema:domainIncludes ...而不是rdfs:range [a owl:Class; owl:unionOf (...)]声明多态域。

如果您不想将道具附加到毒品个体(实例)上,那么您将必须为药片使用“未知类”,例如:

:patient1 :consumed :pill1.
:pill1 a [:hasColor :steelBlue; :hasShape :diamond].

在查询中分别存在一些复杂的问题:

select ?patient ?drugForm {
  ?patient a :patient; :consumed ?pill.
  ?pill a [:hasColor ?color; :hasShape ?shape].
  ?drugForm :hasColor ?color1; :hasShape ?shape.
  ?color skos:broaderTransitive? ?color1
}

总结:

  • GraphDB不支持OWL DL,它支持QL和RL。
  • OBO风格的本体使用数以百万计的类,这规定了从类限制到个人的一整套道具的推论。我觉得这很浪费。