私の質問は SWRL ルールに関連しており、実際には別のユーザーからすでに質問されています ( Protégé-OWL / SWRL のオントロジー プロパティ定義を参照)。それでも、それを機能させる方法に関する指示に従った後、私は成功しませんでした.
私のオントロジーでは、いくつかの複雑な時間的事実 (時間間隔などに関連するもの) を扱う必要があるため、Time Ontologyをインポートします。実際の問題に取り組む前に、簡単な例を考えて、SWRL ルールに基づいてデータ プロパティに値を割り当てる方法をテストします。簡単な例では、クラスPersonを扱います。クラスBirthYear (時間オントロジーのInstantクラスのサブクラス) もあります。ドメインPersonと範囲BirthYearを持つオブジェクト プロパティBornInYearは、個人とその誕生年を関連付けます。今年の人の年齢を計算したいので、次の SWRL ルールを作成します。
Person(?p) ∧bornInYear(?p, ?birthYear) ∧subtract(?age, 2014, ?birthYear) → age(?p, ?age)
クラスPersonの個体を作成し、彼/彼女のBirthYearの値がであるとアサートした後、Pellet は"1977"
この人物の年齢が37であると計算することを期待します。これは起こりません。理由はありますか?SWRL ルールは正しいですか? 37
(値がデータ プロパティageにアサートされているかどうかを知るために、個々の p の [プロパティ アサーション] ビューを確認します。また、推論設定で [オブジェクト プロパティ アサーション] チェック ボックスがオンになっていることも確認します。 .) 私のオントロジーの例は次のようになります。
Prefix(SWRLexample:=<http://www.semanticweb.org/ontologies/2014/1/SWRLexample#>)
Prefix(xsd:=<http://www.w3.org/2001/XMLSchema#>)
Prefix(swrlb:=<http://www.w3.org/2003/11/swrlb#>)
Prefix(owl:=<http://www.w3.org/2002/07/owl#>)
Prefix(:=<http://www.semanticweb.org/ontologies/2014/1/untitled-ontology-101#>)
Prefix(time:=<http://www.w3.org/2006/time#>)
Prefix(xml:=<http://www.w3.org/XML/1998/namespace>)
Prefix(rdf:=<http://www.w3.org/1999/02/22-rdf-syntax-ns#>)
Prefix(swrl:=<http://www.w3.org/2003/11/swrl#>)
Prefix(rdfs:=<http://www.w3.org/2000/01/rdf-schema#>)
Ontology(<http://www.semanticweb.org/ontologies/2014/1/SWRLexample>
Import(<http://www.w3.org/2006/time>)
Declaration(Class(SWRLexample:BirthYear))
SubClassOf(SWRLexample:BirthYear time:Instant)
Declaration(Class(SWRLexample:Person))
Declaration(ObjectProperty(SWRLexample:bornInYear))
ObjectPropertyDomain(SWRLexample:bornInYear SWRLexample:Person)
ObjectPropertyRange(SWRLexample:bornInYear SWRLexample:BirthYear)
Declaration(DataProperty(SWRLexample:age))
AnnotationAssertion(rdfs:comment SWRLexample:age "Age of a person in years")
DataPropertyDomain(SWRLexample:age SWRLexample:Person)
DataPropertyRange(SWRLexample:age xsd:int)
Declaration(NamedIndividual(SWRLexample:birthYear1))
ClassAssertion(SWRLexample:BirthYear SWRLexample:birthYear1)
DataPropertyAssertion(time:year SWRLexample:birthYear1 "1977"^^xsd:gYear)
Declaration(NamedIndividual(SWRLexample:p1))
ClassAssertion(SWRLexample:Person SWRLexample:p1)
ObjectPropertyAssertion(SWRLexample:bornInYear SWRLexample:p1 SWRLexample:birthYear1)
DLSafeRule(Body(ClassAtom(SWRLexample:Person Variable(<urn:swrl#p>)) ObjectPropertyAtom(SWRLexample:bornInYear Variable(<urn:swrl#p>) Variable(<urn:swrl#birthYear>)) BuiltInAtom(swrlb:subtract Variable(<urn:swrl#age>) "2014"^^xsd:integer Variable(<urn:swrl#birthYear>)))Head(DataPropertyAtom(SWRLexample:age Variable(<urn:swrl#p>) Variable(<urn:swrl#age>))))
)