※ 本記事はnote投稿の転載です。
※ https://note.com/super_crow2005/n/n32ade5a3b80b?magazine_key=m1df32e6ef6e1
プロパティ自体が個物の出現回数を制限する場合がある。OWLでは数学の関数の考え方を応用している。数学の関数って何だったか、ということなのだが、xをyに移すとか、入力と出力の関係ともいう。だいたいxに対して1つのyが得られる。1価関数ともいう。複数のyなら多値関数とかいう。プログラミングでも多くは、配列やクラス、リストなどを返すことで実質的に複数の値を返しているようだが、一つの型(クラス)のオブジェクトを返している。Pythonは見た目も複数のオブジェクトを返し得る。
owl:FunctionPropertyというプロパティのクラスを用いれば、その(1価関数の)の入出力関数の関係が得られるということになる。関数のことばで言っているが、SVOならばSに対して1つのOとなる。なお出力がないことも許されている。該当とするOが無い、ということになる。
もう一つ、owl:InverseFunctionalPropertyというプロパティもある。これは逆関数であることを意味する。数学的に逆関数であるとは、xに対してyが必ず1つであって、yに対してもxが1つに決まる1対1の関係にあることである。全単射の関係である。
これらの例として、また趙州さんに登場してもらおう。趙州さんの坐禅会の事を示す。趙州さんは若い頃に南泉さんが責任者として開催している坐禅会「南泉会」に参加した。坐禅会では禅に取り組む人には名前が与えられる。そもそも南泉さんは「願(がん)」さんといっており、趙州さんは「諗(しん)」さんということになった。
ここで、坐禅会は(誰々)~を代表者とする(1人)、という述語を「~を代表者とする」として、これがowl:FunctionalPropertyとなる。また、本人と坐禅会での人格とが一致しているという述語を「(本人は~を)禅での人格(とする)」として、これが一致しなければならないので、owl:InverseFunctoimalPropertyとなる。
つまり、趙州さん、南泉さんは人であるが、願さん、諗さんも人であると定義し、「禅での人格」プロパティによって関係を決めた、ということである。
<owl:ObjectProperty rdf:about="http://zen/zen#代表とする">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#FunctionalProperty"/>
<rdfs:domain rdf:resource="http://zen/zen#坐禅会"/>
<rdfs:range rdf:resource="http://zen/zen#人"/>
</owl:ObjectProperty>
<owl:ObjectProperty rdf:about="http://zen/zen#先生である">
<owl:equivalentProperty rdf:resource="http://zen/zen#師匠である"/>
<rdfs:domain rdf:resource="http://zen/zen#人"/>
<rdfs:range rdf:resource="http://zen/zen#人"/>
</owl:ObjectProperty>
<owl:ObjectProperty rdf:about="http://zen/zen#師匠である">
<owl:inverseOf rdf:resource="http://zen/zen#弟子である"/>
</owl:ObjectProperty>
<owl:ObjectProperty rdf:about="http://zen/zen#弟子である"/>
<owl:ObjectProperty rdf:about="http://zen/zen#禅での人格">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#InverseFunctionalProperty"/>
</owl:ObjectProperty>
<owl:Class rdf:about="http://zen/zen#人">
<owl:equivalentClass>
<owl:Restriction>
<owl:onProperty rdf:resource="http://zen/zen#禅での人格"/>
<owl:qualifiedCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">1</owl:qualifiedCardinality>
<owl:onClass rdf:resource="http://zen/zen#人"/>
</owl:Restriction>
</owl:equivalentClass>
</owl:Class>
<owl:Class rdf:about="http://zen/zen#坐禅会">
<owl:equivalentClass>
<owl:Restriction>
<owl:onProperty rdf:resource="http://zen/zen#代表とする"/>
<owl:qualifiedCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">1</owl:qualifiedCardinality>
<owl:onClass rdf:resource="http://zen/zen#人"/>
</owl:Restriction>
</owl:equivalentClass>
</owl:Class>
<owl:NamedIndividual rdf:about="http://zen/zen#南泉">
<rdf:type rdf:resource="http://zen/zen#人"/>
<zen:先生である rdf:resource="http://zen/zen#趙州"/>
<zen:禅での人格 rdf:resource="http://zen/zen#願"/>
</owl:NamedIndividual>
<owl:NamedIndividual rdf:about="http://zen/zen#南泉会">
<rdf:type rdf:resource="http://zen/zen#坐禅会"/>
<zen:代表とする rdf:resource="http://zen/zen#南泉"/>
<zen:代表とする rdf:resource="http://zen/zen#願"/>
</owl:NamedIndividual>
<owl:NamedIndividual rdf:about="http://zen/zen#諗">
<rdf:type rdf:resource="http://zen/zen#人"/>
</owl:NamedIndividual>
<owl:NamedIndividual rdf:about="http://zen/zen#趙州">
<rdf:type rdf:resource="http://zen/zen#人"/>
<zen:禅での人格 rdf:resource="http://zen/zen#諗"/>
</owl:NamedIndividual>
<owl:NamedIndividual rdf:about="http://zen/zen#願">
<rdf:type rdf:resource="http://zen/zen#人"/>
</owl:NamedIndividual>
「zen:代表とする」はowl:ObjectPropertyのプロパティであって、さらにrdf:typeでowl:FunctionalPropertyとも型付けされている。
また、「zen:禅での人格」はowl:ObjectPropertyのプロパティであって、さらにrdf:typeでInverseFunctionalPropertyとも型付けされている。
これら関数型のプロパティは2重に型付けするように記述するようだ。