This documents a simple example of using OWL to import data into a shared "interface" ontology.

@prefix vs: <http://www.w3.org/2013/05/11179/VS#> .
@prefix vss: <http://www.w3.org/2013/05/11179/VS-shared#> .
@prefix system1: <http://codesystem1.example/ex#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@base <http://www.w3.org/2013/05/11179/VS> .
<http://www.w3.org/2013/05/11179/VS> a owl:Ontology .

Mapping Rules

With SPARQL, you can translate assertions in one value set to another with a "rule" like

CONSTRUCT { ?s vs:gender :Female }
    WHERE { ?s system1:sex "F" }

Rules like this can be written in OWL. The RDF in this section is from VS.ttl. Here, I declare the vs:gender and system1:sex properties and then say that everything which has a system1:sex of "F" must have a vs:gender of vs:Female:

vs:gender a owl:ObjectProperty .
system1:sex a owl:DatatypeProperty .
system1:sex_to_gender_F rdfs:subClassOf [ owl:onProperty vs:gender ; owl:hasValue vs:Female ] ;
    owl:equivalentClass [ owl:onProperty system1:sex ; owl:hasValue "F" ] .

The last two lines can be read as:

In principle, it's unnecessary to label system1:sex_to_gender_F, which is the class of things with a system1:sex of "F". We could replace that label with a fresh blank node [ ].

[ ] rdfs:subClassOf [ owl:onProperty vs:gender ; owl:hasValue vs:Female ] ;
    owl:equivalentClass [ owl:onProperty system1:sex ; owl:hasValue "F" ] .

The OWL API whines when there's no label, calling the class instead  <http://org.semanticweb.owlapi#Error1> . In the interest of aesthetics, we'll keep a label, but once we build up a shared ontology, we'll pick a name from it.

We can provide some test data:

<Sue> system1:sex "F" .

and look in protégé's Individuals tab for Sue under members of owl:Thing. You should see a pane called Property assertions: Sue which, after you've run the reasoner (control R) should include the inferred object property assertion:       gender Female 

Shared Ontology

The RDF in this document is from VS-shared.ttl.

In the interest of describing our value set, we can write down some rules:

Given this, if we have a concept system1:sex which we want to re-express as vss:gender, we no longer have to invent a label like system1:sex_to_gender_F as we did above. Instead, we can use the classes vss:MaleThing and vss:FemaleThing.

vss:MaleThing owl:equivalentClass [ owl:onProperty system1:sex ; owl:hasValue "M" ] .
vss:FemaleThing owl:equivalentClass [ owl:onProperty system1:sex ; owl:hasValue "F" ] .

Again, we test our rules with some data using system1:sex:

# Some test data.
<Bob> system1:sex "M" .
<Sue> system1:sex "F" .

Protégé infers that <Bob> vss:gender vss:Male and <Sue> vss:gender vss:Female, as we'd expect.


$Revision: 1.5 $ of $Date: 2013/05/11 21:29:09 $ by $Author: eric $