RDF/XML よりも、Turtle のような構文で RDF を作成する方がはるかに簡単です。あなたが提供したデータは、私たちが作業するのに十分ではありません (例えば、ベース URI が定義されていません)。以下は、データを含む完全な RDF/XML ドキュメントです (ex
名前空間に注意してください)。
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:person="http://rdf.pozitron.com/people/"
xmlns:organization="http://rdf.pozitron.com/organizations/"
xml:base="http://example.org/"
xmlns:ex="http://example.org/#">
<owl:ObjectProperty rdf:ID="employ">
<rdf:type rdf:resource="http://rdf.pozitron.com/organizations/" />
<rdfs:domain rdf:resource="http://rdf.pozitron.com/organizations/"/>
<rdfs:range rdf:resource="http://rdf.pozitron.com/people/"/>
</owl:ObjectProperty>
<owl:ObjectProperty rdf:ID="employedBy">
<rdf:type rdf:resource="http://rdf.pozitron.com/people/" />
<owl:inverseOf rdf:resource="#Employ" />
<rdfs:domain rdf:resource="http://rdf.pozitron.com/people/"/>
<rdfs:range rdf:resource="http://rdf.pozitron.com/organizations/"/>
</owl:ObjectProperty>
<rdf:Description rdf:about="http://rdf.pozitron.com/people/john">
<rdf:type rdf:resource="http://rdf.pozitron.com/people/"/>
<person:personName>John</person:personName>
<organization:organizationName>Pozitron</organization:organizationName>
</rdf:Description>
</rdf:RDF>
Turtle では次のようになり、いくつかの問題が明らかになりました。
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix ex: <http://example.org/#> .
@prefix person: <http://rdf.pozitron.com/people/> .
@prefix organization: <http://rdf.pozitron.com/organizations/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
ex:employedBy
a person: , owl:ObjectProperty ;
rdfs:domain person: ;
rdfs:range organization: ;
owl:inverseOf ex:Employ .
person:john
a person: ;
organization:organizationName
"Pozitron" ;
person:personName "John" .
ex:employ
a owl:ObjectProperty , organization: ;
rdfs:domain organization: ;
rdfs:range person: .
ここでの問題は次のとおりです。
employedBy
の逆は ですがEmploy
、その名前のプロパティはありませんemploy
。
- プロパティ
employ
はorganization
- プロパティ
employedBy
はperson
john
持っていますorganizationName
- 組織はありません
Pozitron
。
これらは、この構文で簡単に修正できます。これを行っている間にトリプルを追加することもできjohn employedBy Pozitron
ます。Pozitron employ john
最終的には次のようになります。
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix ex: <http://example.org/#> .
@prefix person: <http://rdf.pozitron.com/people/> .
@prefix organization: <http://rdf.pozitron.com/organizations/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
ex:employedBy
a owl:ObjectProperty ;
rdfs:domain person: ;
rdfs:range organization: ;
owl:inverseOf ex:employ .
organization:Pozitron
a organization: ;
organization:organizationName
"Pozitron" ;
ex:employ person:john .
person:john
a person: ;
person:personName "John" ;
ex:employedBy organization:Pozitron .
ex:employ
a owl:ObjectProperty ;
rdfs:domain organization: ;
rdfs:range person: .
RDF/XML でこれがどのように見えるかは、元に戻すことで確認できます。
<rdf:RDF
xmlns:ex="http://example.org/#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:person="http://rdf.pozitron.com/people/"
xmlns:organization="http://rdf.pozitron.com/organizations/"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" >
<rdf:Description rdf:about="http://example.org/#employedBy">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/>
<rdfs:domain rdf:resource="http://rdf.pozitron.com/people/"/>
<rdfs:range rdf:resource="http://rdf.pozitron.com/organizations/"/>
<owl:inverseOf rdf:resource="http://example.org/#employ"/>
</rdf:Description>
<rdf:Description rdf:about="http://rdf.pozitron.com/organizations/Pozitron">
<rdf:type rdf:resource="http://rdf.pozitron.com/organizations/"/>
<organization:organizationName>Pozitron</organization:organizationName>
<ex:employ rdf:resource="http://rdf.pozitron.com/people/john"/>
</rdf:Description>
<rdf:Description rdf:about="http://rdf.pozitron.com/people/john">
<rdf:type rdf:resource="http://rdf.pozitron.com/people/"/>
<person:personName>John</person:personName>
<ex:employedBy rdf:resource="http://rdf.pozitron.com/organizations/Pozitron"/>
</rdf:Description>
<rdf:Description rdf:about="http://example.org/#employ">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/>
<rdfs:domain rdf:resource="http://rdf.pozitron.com/organizations/"/>
<rdfs:range rdf:resource="http://rdf.pozitron.com/people/"/>
</rdf:Description>
</rdf:RDF>
逆のプロパティを処理できる OWL 推論を使用している場合は、実際には と の両方を記述する必要はありませjohn employedBy Pozitron
ん Pozitron employ john
。1 つだけを記述すれば、推論機能がもう 1 つを推論します。