Examples

The following examples describe an ontology expressing road connections provided by an imaginary company. All of them describe the same ontology utilizing different functionalities that OntoDL+ has incorporated.

The full version of the ontologies used in the examples, can be downloaded in the download section.

Road connections


The following ontology does not use any of the new functionalities of OntoDL+. It is written purely in OntoDL.


Ontologia mapa

conceitos {
    Ligação[distância:string],
    Cidade[descrição:string, distrito:string, nome:string, população:string]
}

individuos {
    brg, bcl, ptl, gmr, fml, prt, vct,

    lig-ptl-bcl, lig-ptl-brg, lig-brg-bcl, lig-brg-gmr, lig-brg-fml, lig-gmr-fml,
    lig-fml-bcl, lig-fml-prt, lig-bcl-vct, lig-vct-prt, lig-gmr-prt
}

relacoes {
    temDestino,
    temOrigem,
    éDestinoDe,
    éOrigemDe
}

triplos {
    brg = iof => Cidade [descrição="Cidade dos Arcebispos", distrito="Braga", nome="Braga", população="140000"];
    bcl = iof => Cidade [descrição="Cidade do Galo", distrito="Braga", nome="Barcelos", população="60000"];
    ptl = iof => Cidade [descrição="Vila mais antiga de Portugal", distrito="Viana do Castelo", nome="Ponte de Lima", população="70000"];
    gmr = iof => Cidade [descrição="Cidade berço", distrito="Braga", nome="Guimarães", população="80000"];
    fml = iof => Cidade [descrição="Princesa do Ave", distrito="Braga", nome="Famalicão", população="90000"];
    prt = iof => Cidade [descrição="Cidade invicta", distrito="Porto", nome="Porto", população="100000"];
    vct = iof => Cidade [descrição="Cidade dos pescadores", distrito="Viana do Castelo", nome="Viana do Castelo", população="60000"];

    lig-ptl-bcl = iof => Ligação[distância= "19"];
    lig-ptl-bcl = temDestino => bcl;
    lig-ptl-bcl = temOrigem => ptl;
    .......
} .
                

It is possible to observe in OntoDL syntax, some of the entended commodities of the language. Such as:

  • Clear distinction of individuals, concepts, relations and triples.
  • Simple and easy to use syntax to enable a faster understanding of the language

The following ontology has incorporated the possibility to group triples starting with the same individual/concept.


triplos {
  brg =[ iof => Cidade [descrição="Cidade dos Arcebispos", distrito="Braga", nome="Braga", população="140000"];
  éDestinoDe => lig-ptl-brg;
  éOrigemDe => lig-brg-bcl,
            => lig-brg-gmr,
            => lig-brg-fml];

  ......
}.
              

One of the capabilities introduced to the OntoDL language, was the Grouping of triples. This improvement tries to adress the following issues:

  • Reduce code repetition and possibility of errors.
  • Boost productivity of the users.
  • Increase readability.

The following ontology has incorporated the possibility to add properties to the defined relations. This includes properties like declaration of the domain an codomain. As well as properties such as inverseOf, injective, surjective, and others. Also makes use of inference from the propertie inverseOf.


relacoes {
  temDestino[domain: Ligação, codomain: Cidade],
  temOrigem[domain: Ligação, codomain: Cidade],
  éDestinoDe[domain: Cidade, codomain: Ligação, props: inversaDe=temDestino],
  éOrigemDe[domain: Cidade, codomain: Ligação, props: inversaDe=temOrigem]
}
              

The relation properties were introduced in order to allow a more strict/structured construction of ontologies. It also introduced the usage of an inference system in order to enable further improvement to the compiler. The language improvements of this change allow:

  • A reduction code necessary to specify ontologies.
  • An increase in model-checking capabilities.
  • Improve ontology correction.

The following ontology has incorporated the possibility to add properties to the defined relations. This includes properties like declaration of the domain an codomain. As well as properties such as inverseOf, injective, surjective, and others. Also makes use of inference from the propertie inverseOf.


atributos {
  distância:string,
  descrição:string, 
  distrito:string, 
  nome:string, 
  população:string
}
              
conceitos {
  Ligação[distância],
  Cidade[descrição, distrito, nome, população]
}
              

The atributes were introduced to reduce redundant declarations of the same atribute for different concepts. The introduction of atributes as have enabled:

  • Removal of redundant code.
  • Increase readability of the language.

The following ontology has incorporated the possibility to import code from external files. This reduces the file length and enables a cleaner and more organized code.


Ontologia mapa

atributos {
    expand atributos.odlp;
}

conceitos {
    expand conceitos.odlp;
}

individuos {
    expand individuos.odlp;
}

relacoes {
    expand relacoes.odlp;
}
                
triplos {
  expand triplos.odlp;
} .
              

The expands function allows the construction of longer, modular ontologies. The introduction of modules looks to:

  • Improve readability and maintenance.
  • Introduce moduling capabilities.