我正在寻找一种清晰的OWL解决方案来定义一个属性,该属性是另一个属性的限制,类似于等效类。限制基于域或范围的数据属性。受限制的属性绝对是子属性,必须进行推断。
“孩子”,“母亲”,“父亲”是Person的
Father.gender =“男性”数据属性
mother.gender =“女性”
(一个Male subclassOf Person =等效类“性别值”“ male”)
父亲parentOf孩子的对象关系
母亲parentOf孩子的对象关系
如何根据parentOf和父亲的性别定义fatherOf属性?
显然,它是parentOf的子属性。
但是,Protégé中等效的对象属性编辑器不允许设置属性查询,即使我真的看不到是否可以使用属性链解决。
不能将父亲父亲定义为子属性,并且(手动)设置父亲父亲而不是父亲父亲是不可行的,因为这个家庭的例子是在更为复杂的情况下过于简化的情况。
<Declaration>
<Class IRI="#Person"/>
</Declaration>
<Declaration>
<ObjectProperty IRI="#fatherOf"/>
</Declaration>
<Declaration>
<ObjectProperty IRI="#parentOf"/>
</Declaration>
<Declaration>
<DataProperty IRI="#gender"/>
</Declaration>
<Declaration>
<NamedIndividual IRI="#father"/>
</Declaration>
<Declaration>
<NamedIndividual IRI="#kid"/>
</Declaration>
<Declaration>
<NamedIndividual IRI="#mother"/>
</Declaration>
<ClassAssertion>
<Class IRI="#Person"/>
<NamedIndividual IRI="#father"/>
</ClassAssertion>
<ClassAssertion>
<Class IRI="#Person"/>
<NamedIndividual IRI="#kid"/>
</ClassAssertion>
<ClassAssertion>
<Class IRI="#Person"/>
<NamedIndividual IRI="#mother"/>
</ClassAssertion>
<ObjectPropertyAssertion>
<ObjectProperty IRI="#parentOf"/>
<NamedIndividual IRI="#father"/>
<NamedIndividual IRI="#kid"/>
</ObjectPropertyAssertion>
<ObjectPropertyAssertion>
<ObjectProperty IRI="#parentOf"/>
<NamedIndividual IRI="#mother"/>
<NamedIndividual IRI="#kid"/>
</ObjectPropertyAssertion>
<DataPropertyAssertion>
<DataProperty IRI="#gender"/>
<NamedIndividual IRI="#father"/>
<Literal datatypeIRI="&rdf;PlainLiteral">male</Literal>
</DataPropertyAssertion>
<DataPropertyAssertion>
<DataProperty IRI="#gender"/>
<NamedIndividual IRI="#mother"/>
<Literal datatypeIRI="&rdf;PlainLiteral">female</Literal>
</DataPropertyAssertion>
<SubObjectPropertyOf>
<ObjectProperty IRI="#fatherOf"/>
<ObjectProperty IRI="#parentOf"/>
</SubObjectPropertyOf>
<DataPropertyDomain>
<DataProperty IRI="#gender"/>
<Class IRI="#Person"/>
</DataPropertyDomain>
<DataPropertyRange>
<DataProperty IRI="#gender"/>
<Datatype abbreviatedIRI="xsd:string"/>
</DataPropertyRange>
最佳答案
因此,您的数据中包含以下内容:
:x :parentOf :y .
:x :gender "male" .
并且您想推断:
:x :fatherOf :y .
恐怕您不能在OWL中执行此操作。对于这种情况,您可能希望依赖诸如SWRL,SPIN等规则语言。但是,对于父亲,母亲等特定情况,可以执行以下操作:
将
:hasParent
定义为:parentOf
的倒数;将
:hasParent
的基数限制为2;将
:hasFather
定义为:fatherOf
的倒数;使
:hasFather
为owl:FunctionalProperty
;将
:hasMother
定义为:motherOf
的倒数;使
:hasMother
为owl:FunctionalProperty
;定义男性的阶级
:Man
;定义女性的阶级
:Woman
;使
:Man
与:Woman
不相交;将
:hasFather
的范围设置为:Man
;将
:hasMother
的范围设置为:Woman
。所以本体看起来像这样(在Turtle中,因为我不熟悉OWL / XML):
:Person a owl:Class;
rdfs:subClassOf [
a owl:Restriction;
owl:onProperty :hasParent;
owl:cardinality 2
] .
:Man a owl:Class;
owl:equivalentclass [
a owl:Class;
owl:intersectionOf (
:Person
[
a owl:Restriction;
owl:onProperty :gender;
owl:hasValue "male";
]
)
] .
:Woman a owl:Class;
owl:equivalentclass [
a owl:Class;
owl:intersectionOf (
:Person
[
a owl:Restriction;
owl:onProperty :gender;
owl:hasValue "female";
]
)
] .
:gender a owl:DatatypeProperty, owl:FunctionalProperty .
:hasParent a owl:ObjectProperty;
owl:inverseOf :parentOf;
rdfs:domain :Person;
rdfs:range :Person .
:hasFather a owl:ObjectProperty, owl:FunctionalProperty;
rdfs:subPropertyOf :hasParent;
rdfs:range :Man .
:hasMother a owl:ObjectProperty, owl:FunctionalProperty;
rdfs:subPropertyOf :hasParent;
rdfs:range :Woman .
这应该可以解决问题,但这是一个非常复杂的本体,并且推理可能很慢。
编辑:我补充说,
:gender
必须起作用,否则可能有一位母亲同时是父亲,这将不起作用!关于semantic-web - OWL:基于值的属性限制:可能吗?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/9396185/