View Source

h2. Integrating ontology extensions

In order to integrate an ontology extension, you have to accomplish two steps:
# the new classes should subclass {{protons:Entity}}
# set the new classes' visibility level

h3. Subclass {{protons:Entity}}

h4. Inheritance
Make sure that the new classes inherit at least [http://proton.semanticweb.org/2006/05/protons#Entity], directly or indirectly.

{tip}We recommend that, if applicable, your classes inherit one of these PROTON Top classes:
* [http://proton.semanticweb.org/2006/05/protont#Person]
* [http://proton.semanticweb.org/2006/05/protont#Organization]
* [http://proton.semanticweb.org/2006/05/protont#Location]{tip}

h4. Configuration
By default, the ontology extension modules (\* .owl) are located in the *<KIM_HOME>/context/default/kb/owl* folder. You can place them somewhere else if you prefer, as long as you include them in the [OWLIM configuration file|Updating the OWLIM configuration] correctly.

h4. Schema specifics
All classes should have the "label" attribute set. You should pay special attention when using a third-party schema designer to create the ontology extension.

Here is an example extension module that defines "Robot" as a class and also defines the relation "createdBy":

*example:* in.space.owl
{code}
<!DOCTYPE owl [
<!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
<!ENTITY rdfs 'http://www.w3.org/2000/01/rdf-schema#'>
<!ENTITY owl 'http://www.w3.org/2002/07/owl#' >
<!ENTITY xsd 'http://www.w3.org/2001/XMLSchema#' >
<!ENTITY psys 'http://proton.semanticweb.org/2006/05/protons#'>
<!ENTITY ptop 'http://proton.semanticweb.org/2006/05/protont#'>
<!ENTITY protonkm 'http://proton.semanticweb.org/2006/05/protonkm#'>
]>
<rdf:RDF
xmlns:owl="&owl;"
xmlns:rdf="&rdf;"
xmlns:rdfs="&rdfs;"
xmlns:psys="&psys;"
xmlns:ptop="&ptop;"
xmlns:protonkm="&protonkm;"
xmlns="http://in.space#"
xml:base="http://in.space#">

<owl:AnnotationProperty rdf:about="&rdfs;comment"/>
<owl:AnnotationProperty rdf:about="&rdfs;label"/>
<owl:AnnotationProperty rdf:about="&owl;versionInfo"/>

<owl:Ontology rdf:about="#RobotOntology">
<rdfs:label rdf:datatype="&xsd;string">InSpace</rdfs:label>
<rdfs:comment>InSpace Ontology</rdfs:comment>
<owl:versionInfo>0.1</owl:versionInfo>
</owl:Ontology>

<owl:Class rdf:ID="Robot">
<rdfs:label>Robot</rdfs:label>
<rdfs:comment>
A mechanical or electronic device that resembles a living animal and
moves automatically or by remote control.
</rdfs:comment>
<rdfs:subClassOf rdf:resource="&ptop;Object"/>
</owl:Class>

<owl:ObjectProperty rdf:about="#createdBy" rdfs:label="createdBy">
<rdfs:domain rdf:resource="#Robot"/>
<rdfs:range rdf:resource="&ptop;Person"/>
</owl:ObjectProperty>

</rdf:RDF>
{code}

If you have an existing ontology in OWL, you can alternatively create a separate mapping file with only {{rdfs:subClass}} statements . Then add both your ontology and the mapping file to the KIM Server installation. See this step-by-step mapping from [DBPedia ontology integration case-study|Example - Integrating DBpedia in KIM] as an example:
{code}
@prefix protont: <http://proton.semanticweb.org/2006/05/protont#> .
@prefix dbp_ont: <http://dbpedia.org/ontology/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

dbp_ont:Place rdfs:subClassOf protont:Location .
dbp_ont:Person rdfs:subClassOf protont:Person .
dbp_ont:Organisation rdfs:subClassOf protont:Organization .
{code}

h3. KIM User Interface (UI) visibility

All new classes that should be visible in the class hierarchy in the web interface and in the Structure/Patterns screens must be declared "visible" in the *<KIM_HOME>/context/default/kb/visibility.nt* file like this:
Example: *visibility.nt* (addition)
{code}
<http://in.space#Robot> <http://www.ontotext.com/kim/2006/05/kimso#visibilityLevel1> "" .
{code}