2017-10-10 99 views
-1

我有一個Person和City類的本體論。人們旅行到城市,這個旅行在traveledTo對象屬性中表示。我想添加一個WorldTraveler類。如果他們旅行到2個或更多的城市,人們就是世界旅行者。我怎樣才能在我的本體論中做到這一點?通過計數屬性推測OWL知識

@prefix : <http://www.semanticweb.org/chris/ontologies/2017/9/untitled-ontology-64#> . 
@prefix owl: <http://www.w3.org/2002/07/owl#> . 
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . 
@prefix xml: <http://www.w3.org/XML/1998/namespace> . 
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . 
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . 
@base <http://www.semanticweb.org/chris/ontologies/2017/9/untitled-ontology-64> . 

<http://www.semanticweb.org/chris/ontologies/2017/9/untitled-ontology-64> rdf:type owl:Ontology . 

:traveledTo rdf:type owl:ObjectProperty ; 
      rdfs:domain :Person ; 
      rdfs:range :City . 

:City rdf:type owl:Class . 

:Person rdf:type owl:Class . 

:Bob rdf:type owl:NamedIndividual , 
       :Person ; 
    :traveledTo :London , 
       :Ottawa , 
       :Paris . 

:Brussels rdf:type owl:NamedIndividual , 
        :City . 

:London rdf:type owl:NamedIndividual , 
       :City . 

:Ottawa rdf:type owl:NamedIndividual , 
       :City . 

:Paris rdf:type owl:NamedIndividual , 
       :City . 

:Ralph rdf:type owl:NamedIndividual , 
       :Person ; 
     :traveledTo :Rome . 

:Rome rdf:type owl:NamedIndividual , 
       :City . 

:Washington rdf:type owl:NamedIndividual , 
        :City . 

我嘗試添加下面的類,但它似乎沒有工作:

:WorldTraveler rdf:type owl:Class ; 
       owl:equivalentClass [ owl:intersectionOf (:Person 
                  [ rdf:type owl:Restriction ; 
                  owl:onProperty :traveledTo ; 
                  owl:minQualifiedCardinality "2"^^xsd:nonNegativeInteger ; 
                  owl:onClass :City 
                  ] 
                 ) ; 
            rdf:type owl:Class 
            ] . 

我相信我的推理可能無法推斷拉爾夫是開放的,因爲沒有撤換世界的假設。然而,它應該能夠推斷出鮑勃是一名世界旅行者,因爲他曾前往三個城市。

感謝您的幫助。

克里斯

回答

0

除了開放世界假設(OWA),存在的唯一名稱假設(UNA)。 OWL確實使前者(OWA)成爲後者(UNA)。

你應該明確地讓不同的個人有所不同。

在龜語法,它應該是這樣的:

[ rdf:type owl:AllDifferent ; 
    owl:distinctMembers (:Brussels :London :Ottawa :Paris :Rome :Washington) 
] . 
+0

感謝。我不知道UNA。這爲我解決了它。 – Chris