Search code examples
rdfsemantic-webowlontologydescription-logic

How to represent an ontology using description logic?


I'm learning ontology and the DL language is difficult for me, I found good exercises online and here is one question: given follow ontology:

There are two disjoint kinds of entities: cities and countries. Each country has a single capital, a city. However, a city can be in more than one country. Each country neighbors at least one country and also perhaps the sea (we do not distinguish between different seas).

How can I express this in description logic notation?


Solution

  • The following example demonstrates how cardinalities can be handled. What do you think about this example? In order to left some work to you, you can model sea, cities and disjoint by your own?

    @prefix owl: <http://www.w3.org/2002/07/owl#> .
    @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
    @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
    @prefix world: <http://www.world.org/ontology/world#> .
    
    world: rdf:type owl:Ontology .
    
    
    ############# country ##################
    world:Country 
      a owl:Class , rdfs:Class ;
      rdfs:label "Country" ;
      rdfs:comment "representing an country in the world" ;
      rdfs:subClassOf
        [a owl:Restriction ;
        owl:onProperty :hasNeighbors ;
        owl:minCardinality 1 
        ];
      rdfs:subClassOf
        [a owl:Restriction ;
        owl:onProperty :hasCapital ;
        owl:minCardinality 1 
        ];
      rdfs:isDefinedBy world: .
    
    world:hasNeighbors
        a owl:ObjectProperty, rdf:Property ;
        rdfs:label "hasNeighbors" ;
        rdfs:comment "The neighbor countries." ;
        rdfs:domain :Country ;
        rdfs:range :Country ;
        rdfs:isDefinedBy world: .
    
    world:hasCapital
        a owl:ObjectProperty, rdf:Property ;
        rdfs:label "hasCapital" ;
        rdfs:comment "The capital of a country." ;
        rdfs:domain :Country ;
        rdfs:range :City ;
        rdfs:isDefinedBy world: .
    
    ############### City ####################  
    world:City
      a owl:Class , rdfs:Class ;
      rdfs:label "City" ;
      rdfs:comment "representing an city in the world" ;
      rdfs:isDefinedBy world: .