我有一个包含植物和疾病以及属性treat
(植物treat
疾病)的本体。我有很多植物和疾病,但现在我想添加一种可以通过两种或多种植物组合治疗的疾病。例如,我如何表示下面的句子?
疾病 X 可以通过植物 A 和植物 B 的组合来治疗,但不能单独通过植物 A 或植物 B 治疗。
我一直在考虑使用推理器来获得这个,但我不知道如何。
替代约书亚的答案:您可以将疾病和植物表示为 OWL 类,因为在这里您指的是植物集(不是特定实例,您会在自然界中找到)。然后,您可以将类与存在限制(some
- 生物学中的常见模式)联系起来。
您还需要在建模中引入一个补充步骤,如前所述:植物可以是例如治疗的成分,可以通过治疗来治疗疾病。
然后,如果您考虑以下注释的 ( #
) 本体(曼彻斯特语法),我将描述建模的公理。您可以保存文件并使用 Protege 打开它。
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
听起来您目前拥有一个带有类Disease
和的本体Plant
,以及一个treats
带有域Plant
和范围的属性Disease
。据我了解,问题在于应该对待 some Disease
s 的不是单个Plant
s,而是它们的组合。在这些情况下,我们可以说植物被用于治疗疾病,但它本身并不治疗疾病。同样可以合理地说,如果植物本身可以治疗疾病,那么它也可以用于治疗疾病。
所以,你有一类你以前没有考虑过的个体,那就是植物的组合,那么为什么不引入一个与组合中的植物相关的类PlantCombination
和属性呢?您还可以添加一个限制,即每个植物组合至少有两种植物,如果您愿意,可以说。由于s 和s 都可以处理s,因此您需要将域更改为 be 。为确保推理者可以推断出if then,您可以断言。(这也意味着治疗疾病的植物组合也可用于治疗该疾病。)以确保当与植物成分组合时23hasComponent
PlantCombination
PlantCombination SubClassOf hasComponent min 2 Plant
Plant
PlantCombination
Disease
treats
Plant or PlantCombination
plant82 treats disease92
plant82 isUsedToTreat disease92
treats SubPropertyOf isUsedToTreat
治疗一种疾病,那个plant23是用来治疗疾病的,你可以添加断言 that inverse(hasComponent) o treats SubPropertyOf isUsedToTreat
。这是一个可以做到这一点的本体:
@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 .
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>)
)