首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何将个人与个人的组合联系起来?

如何将个人与个人的组合联系起来?
EN

Stack Overflow用户
提问于 2013-06-23 15:35:49
回答 2查看 123关注 0票数 2

我有一个包含植物和疾病的本体和一个属性treat (植物treat的疾病)。我有很多植物和疾病,但现在我想增加一种可以通过两种或更多种植物联合治疗的疾病。例如,我如何表示以下句子?

X病可由植物A和植物B联合治疗,但不能仅靠植物A或植物B治疗。

我一直在考虑用推理机来获得这个,但我不知道怎么做到的。

EN

回答 2

Stack Overflow用户

发布于 2013-06-23 20:25:33

听起来,目前您有一个带有类DiseasePlant的本体,以及一个带有域Plant和range Disease的属性treats。据我所知,问题在于,应该处理某些Disease的不是单独的Plant,而是它们的组合。在这种情况下,我们可以说,植物是用来治疗一种疾病,但本身并不是治疗疾病。如果一种植物本身治疗一种疾病,那么它也被用于治疗一种疾病,这可能也是合理的。

那么,您有一组以前没有考虑过的个体,即植物的组合,那么为什么不引入一个类PlantCombination和一个属性hasComponent,将PlantCombination与组合中的植物联系起来呢?您还可以添加一个限制,即每个植物组合至少有两个植物,如果您愿意的话,用PlantCombination SubClassOf hasComponent min 2 Plant来表示。因为PlantPlantCombination都可以处理Disease,所以您需要将treats的域更改为Plant or PlantCombination。为了确保推理者能够推断出如果plant82 treats disease92那么plant82 isUsedToTreat disease92,您可以断言该treats SubPropertyOf isUsedToTreat。(这也意味着治疗疾病的植物组合也被用于治疗这种疾病。)为了确保与组件plant23的组合用于治疗疾病,plant23用于治疗疾病,您可以添加断言inverse(hasComponent) o treats SubPropertyOf isUsedToTreat。这里有一个本体论,它就是这样做的:

N3格式

代码语言:javascript
运行
复制
@prefix :        <http://www.example.org/plantsAndDiseases#> .
@prefix rdfs:    <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl:     <http://www.w3.org/2002/07/owl#> .
@prefix xsd:     <http://www.w3.org/2001/XMLSchema#> .
@prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .

<http://www.example.org/plantsAndDiseases>
      a       owl:Ontology .

:Plant
      a       owl:Class .

:Disease
      a       owl:Class .

:PlantCombination
      a       owl:Class ;
      rdfs:subClassOf
              [ a       owl:Restriction ;
                owl:minQualifiedCardinality
                        "2"^^xsd:nonNegativeInteger ;
                owl:onClass :Plant ;
                owl:onProperty :hasComponent
              ] .

:hasComponent
      a       owl:ObjectProperty ;
      rdfs:domain :PlantCombination ;
      rdfs:range :Plant .

:isUsedToTreat
      a       owl:ObjectProperty ;
      rdfs:comment "X isUsedToTreat Y means that X is used in the treatment of Y.  X may either treat Y, or may be a component of a combination that treats Y." ;
      rdfs:domain
              [ a       owl:Class ;
                owl:unionOf (:Plant :PlantCombination)
              ] ;
      rdfs:range :Disease ;
      owl:propertyChainAxiom
              ([ owl:inverseOf :hasComponent
                ] :treats) .

:treats
      a       owl:ObjectProperty ;
      rdfs:comment "X treats Y means that X is a sufficient treatment for Y." ;
      rdfs:domain
              [ a       owl:Class ;
                owl:unionOf (:Plant :PlantCombination)
              ] ;
      rdfs:range :Disease ;
      rdfs:subPropertyOf :isUsedToTreat .

OWL功能语法

代码语言:javascript
运行
复制
Prefix(xsd:=<http://www.w3.org/2001/XMLSchema#>)
Prefix(owl:=<http://www.w3.org/2002/07/owl#>)
Prefix(xml:=<http://www.w3.org/XML/1998/namespace>)
Prefix(rdf:=<http://www.w3.org/1999/02/22-rdf-syntax-ns#>)
Prefix(rdfs:=<http://www.w3.org/2000/01/rdf-schema#>)

Ontology(<http://www.example.org/plantsAndDiseases>

Declaration(Class(<http://www.example.org/plantsAndDiseases#Disease>))
Declaration(Class(<http://www.example.org/plantsAndDiseases#Plant>))
Declaration(Class(<http://www.example.org/plantsAndDiseases#PlantCombination>))
SubClassOf(<http://www.example.org/plantsAndDiseases#PlantCombination> ObjectMinCardinality(2 <http://www.example.org/plantsAndDiseases#hasComponent> <http://www.example.org/plantsAndDiseases#Plant>))
Declaration(ObjectProperty(<http://www.example.org/plantsAndDiseases#hasComponent>))
ObjectPropertyDomain(<http://www.example.org/plantsAndDiseases#hasComponent> <http://www.example.org/plantsAndDiseases#PlantCombination>)
ObjectPropertyRange(<http://www.example.org/plantsAndDiseases#hasComponent> <http://www.example.org/plantsAndDiseases#Plant>)
Declaration(ObjectProperty(<http://www.example.org/plantsAndDiseases#isUsedToTreat>))
AnnotationAssertion(rdfs:comment <http://www.example.org/plantsAndDiseases#isUsedToTreat> "X isUsedToTreat Y means that X is used in the treatment of Y.  X may either treat Y, or may be a component of a combination that treats Y.")
ObjectPropertyDomain(<http://www.example.org/plantsAndDiseases#isUsedToTreat> ObjectUnionOf(<http://www.example.org/plantsAndDiseases#PlantCombination> <http://www.example.org/plantsAndDiseases#Plant>))
ObjectPropertyRange(<http://www.example.org/plantsAndDiseases#isUsedToTreat> <http://www.example.org/plantsAndDiseases#Disease>)
Declaration(ObjectProperty(<http://www.example.org/plantsAndDiseases#treats>))
AnnotationAssertion(rdfs:comment <http://www.example.org/plantsAndDiseases#treats> "X treats Y means that X is a sufficient treatment for Y.")
SubObjectPropertyOf(<http://www.example.org/plantsAndDiseases#treats> <http://www.example.org/plantsAndDiseases#isUsedToTreat>)
ObjectPropertyDomain(<http://www.example.org/plantsAndDiseases#treats> ObjectUnionOf(<http://www.example.org/plantsAndDiseases#PlantCombination> <http://www.example.org/plantsAndDiseases#Plant>))
ObjectPropertyRange(<http://www.example.org/plantsAndDiseases#treats> <http://www.example.org/plantsAndDiseases#Disease>)
SubObjectPropertyOf(ObjectPropertyChain(ObjectInverseOf(<http://www.example.org/plantsAndDiseases#hasComponent>) <http://www.example.org/plantsAndDiseases#treats>) <http://www.example.org/plantsAndDiseases#isUsedToTreat>)
)
票数 2
EN

Stack Overflow用户

发布于 2013-06-23 21:09:23

替代Joshua's answer:您可以将疾病和植物表示为OWL类,因为这里引用的是一组植物(不是特定的实例,您可以在自然界中找到这些实例)。然后,您可以使用存在限制(some -生物学中的常见模式)链接类。

你还需要在你的模型中引入一个补充步骤,就像前面提到的:植物可以是治疗的成分,疾病可以通过治疗来治疗。

然后,如果考虑以下注释(#)本体(曼彻斯特语法),我将描述建模的公理。您可以保存该文件并使用Protege打开它。

代码语言:javascript
运行
复制
Prefix: xsd: <http://www.w3.org/2001/XMLSchema#>
Prefix: owl: <http://www.w3.org/2002/07/owl#>
Prefix: : <http://www.example.org/demo.owl#>
Prefix: xml: <http://www.w3.org/XML/1998/namespace>
Prefix: rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
Prefix: rdfs: <http://www.w3.org/2000/01/rdf-schema#>

Ontology: <http://www.example.org/demo.owl>

ObjectProperty: has-ingredient

ObjectProperty: treatableBy

Class: owl:Thing

Class: PlantA
  SubClassOf: 
    Plant

Class: Treatment

#Your treatment obtained by mixing some 
#of the plant B and some of the plant A
Class: TreatmentAB
  SubClassOf: 
    Treatment,
    (has-ingredient some PlantA)
     and (has-ingredient some PlantB)

Class: PlantB
  SubClassOf: 
    Plant

#This treatment has ingredient the plant A
Class: TreatmentA
  SubClassOf: 
    has-ingredient some PlantA,
    Treatment

#This treatment is made from plant B (among other things) 
Class: TreatmentB
  SubClassOf: 
    Treatment,
    has-ingredient some PlantB

Class: Disease

Class: Plant

# This disease is treatable by the TreatmentAB
Class: DiseaseA
  SubClassOf: 
    treatableBy some TreatmentAB,
    Disease

Class: DiseaseB
  SubClassOf: 
    treatableBy some TreatmentB,
    Disease

现在,如果我们对本体进行推理,并请求treatableBy some TreatmentA的子类,那么我们就不会得到任何类。表达式treatableBy some TreatmentAB按预期返回DiseaseA

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17262359

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档