我想在 Protege 中模拟电影系列的概念。
这是我的电影三部曲课:
以下是“电影系列”类中个人的定义:
个人具有三个“hasEpisode”属性。但是开放世界假设(OWA)阻止了这个人被推断为“三部曲”类。
可能的解决方案:我可以为 Film Series 类中的每个人提供一个数据属性,该属性指定该系列中的电影数量。
但是,我宁愿使用“hasEpisode”对象属性的数量(因为它们已经可用并且意味着更少的维护)。
您需要做的就是声明这三部电影不一样,并断言这是该系列仅有的三部电影。你可以通过说剧集都不同来做到这一点:
情节 1 ≠ 情节2 情节 1 ≠ 情节
3 情节 2 ≠
情节 3
三部曲只有这些情节:
{theTriology} ⊑ ∀ hasEpisode.{Episode1, Episode2, Episode3}
你需要两种类型的公理。通用公理说,该系列的每一集都必须是第一集、第二集或第三集。这意味着该系列最多有三集,但如果其中任何一个人实际上是相同的,它可能会更少。然后不等式说这些人都是不同的,这意味着该系列实际上至少有三集。由于它至少有三个,最多三个,所以它必须正好有三个。
这是 Protege 中的样子(请注意,TheMatrix被推断为三部曲):
这是本体,如果您想看一下:
@prefix : <http://www.semanticweb.org/taylorj/ontologies/2015/2/untitled-ontology-38#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix untitled-ontology-38: <http://www.semanticweb.org/taylorj/ontologies/2015/2/untitled-ontology-38#> .
@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#> .
untitled-ontology-38:Triology
a owl:Class ;
owl:equivalentClass [ a owl:Class ;
owl:intersectionOf ( untitled-ontology-38:FilmSeries _:b0 )
] .
untitled-ontology-38:FilmSeries
a owl:Class .
_:b0 a owl:Restriction ;
owl:cardinality "3"^^xsd:nonNegativeInteger ;
owl:onProperty untitled-ontology-38:hasEpisode .
untitled-ontology-38:hasEpisode
a owl:ObjectProperty .
<http://www.semanticweb.org/taylorj/ontologies/2015/2/untitled-ontology-38>
a owl:Ontology .
untitled-ontology-38:TheMatrixRevolution
a owl:Thing , owl:NamedIndividual .
untitled-ontology-38:TheMatrixReloaded
a owl:Thing , owl:NamedIndividual .
untitled-ontology-38:TheMatrix
a owl:Thing , owl:NamedIndividual .
[ a owl:AllDifferent ;
owl:distinctMembers ( untitled-ontology-38:TheMatrix untitled-ontology-38:TheMatrixReloaded untitled-ontology-38:TheMatrixRevolution )
] .
untitled-ontology-38:Matrix
a owl:NamedIndividual , untitled-ontology-38:FilmSeries ;
a [ a owl:Restriction ;
owl:allValuesFrom [ a owl:Class ;
owl:oneOf ( untitled-ontology-38:TheMatrixReloaded untitled-ontology-38:TheMatrix untitled-ontology-38:TheMatrixRevolution )
] ;
owl:onProperty untitled-ontology-38:hasEpisode
] ;
untitled-ontology-38:hasEpisode
untitled-ontology-38:TheMatrix , untitled-ontology-38:TheMatrixReloaded , untitled-ontology-38:TheMatrixRevolution .
<rdf:RDF
xmlns:untitled-ontology-38="http://www.semanticweb.org/taylorj/ontologies/2015/2/untitled-ontology-38#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
<owl:Ontology rdf:about="http://www.semanticweb.org/taylorj/ontologies/2015/2/untitled-ontology-38"/>
<owl:Class rdf:about="http://www.semanticweb.org/taylorj/ontologies/2015/2/untitled-ontology-38#FilmSeries"/>
<owl:Class rdf:about="http://www.semanticweb.org/taylorj/ontologies/2015/2/untitled-ontology-38#Triology">
<owl:equivalentClass>
<owl:Class>
<owl:intersectionOf rdf:parseType="Collection">
<owl:Class rdf:about="http://www.semanticweb.org/taylorj/ontologies/2015/2/untitled-ontology-38#FilmSeries"/>
<owl:Restriction>
<owl:onProperty>
<owl:ObjectProperty rdf:about="http://www.semanticweb.org/taylorj/ontologies/2015/2/untitled-ontology-38#hasEpisode"/>
</owl:onProperty>
<owl:cardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger"
>3</owl:cardinality>
</owl:Restriction>
</owl:intersectionOf>
</owl:Class>
</owl:equivalentClass>
</owl:Class>
<owl:NamedIndividual rdf:about="http://www.semanticweb.org/taylorj/ontologies/2015/2/untitled-ontology-38#Matrix">
<rdf:type rdf:resource="http://www.semanticweb.org/taylorj/ontologies/2015/2/untitled-ontology-38#FilmSeries"/>
<rdf:type>
<owl:Restriction>
<owl:onProperty rdf:resource="http://www.semanticweb.org/taylorj/ontologies/2015/2/untitled-ontology-38#hasEpisode"/>
<owl:allValuesFrom>
<owl:Class>
<owl:oneOf rdf:parseType="Collection">
<owl:Thing rdf:about="http://www.semanticweb.org/taylorj/ontologies/2015/2/untitled-ontology-38#TheMatrixReloaded">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#NamedIndividual"/>
</owl:Thing>
<owl:Thing rdf:about="http://www.semanticweb.org/taylorj/ontologies/2015/2/untitled-ontology-38#TheMatrix">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#NamedIndividual"/>
</owl:Thing>
<owl:Thing rdf:about="http://www.semanticweb.org/taylorj/ontologies/2015/2/untitled-ontology-38#TheMatrixRevolution">
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#NamedIndividual"/>
</owl:Thing>
</owl:oneOf>
</owl:Class>
</owl:allValuesFrom>
</owl:Restriction>
</rdf:type>
<untitled-ontology-38:hasEpisode rdf:resource="http://www.semanticweb.org/taylorj/ontologies/2015/2/untitled-ontology-38#TheMatrix"/>
<untitled-ontology-38:hasEpisode rdf:resource="http://www.semanticweb.org/taylorj/ontologies/2015/2/untitled-ontology-38#TheMatrixReloaded"/>
<untitled-ontology-38:hasEpisode rdf:resource="http://www.semanticweb.org/taylorj/ontologies/2015/2/untitled-ontology-38#TheMatrixRevolution"/>
</owl:NamedIndividual>
<owl:AllDifferent>
<owl:distinctMembers rdf:parseType="Collection">
<owl:Thing rdf:about="http://www.semanticweb.org/taylorj/ontologies/2015/2/untitled-ontology-38#TheMatrix"/>
<owl:Thing rdf:about="http://www.semanticweb.org/taylorj/ontologies/2015/2/untitled-ontology-38#TheMatrixReloaded"/>
<owl:Thing rdf:about="http://www.semanticweb.org/taylorj/ontologies/2015/2/untitled-ontology-38#TheMatrixRevolution"/>
</owl:distinctMembers>
</owl:AllDifferent>
</rdf:RDF>