Example: Converting the Kennedys Ontology to schema.org with SPINMap » TopQuadrant, Inc

+1 919.300.7945     Blog     Downloads     Purchase     Contact

Example: Converting the Kennedys Ontology to schema.org with SPINMap

Posted by Holger Knublauch on May 6, 2013

With schema.org's growing popularity, I thought it was a good idea to validate and illustrate how it can be used as a shared base ontology for various use cases. At TopQuadrant we have been using a Kennedys Ontology in training and example material for many years. It consists of instances of a class kennedys:Person with various properties ranging from names to educational background and family relationships. Looking at schema.org/Person we can see property definitions for very similar, if not identical, things.

Here is how to convert the kennedys ontology into schema.org with TopBraid Composer and SPINMap. SPINMap is a powerful rule-based transformation language with a graphical notation that can be used to create target RDF triples from a collection of source instances. As the first step, we create an empty RDF file called schemakennedys that imports schema.org. Then we create a new SPIN file that imports schemakennedys and the SPINMap namespace:

Using drag-and-drop, we can add the imports of schemakennedys (the target file) and kennedys (the source file) into that SPINMap file:

Now we need to select the source class of our mapping with a double-click on kennedys:Person. We switch to the Diagram tab of that class and drag the target class schema:Person from the class tree onto the Diagram area. Now we establish a link from the top of the kennedys:Person box to the top of the schema:Person box. We have various options there to convert URIs but since we want to reuse the same URIs, we simply use spinmapl:self as the transformation context function. Now we can use drag and drop to establish links from the properties on the left to the properties on the right:

Most mappings are straight-forward one-to-one mappings because the properties such as spouse and parent are almost identical. The only “interesting” cases are kennedys:gender and kennedys:profession, which are objects in the left model but simple string properties in the right one. In order to convert the objects to strings, we can use any SPARQL or SPIN function, and here the function spif:name is doing exactly what we need. The properties kennedys:deathYear and kennedys:birthYear cannot be mapped to schema:birthDate and schema:deathDate because they do not contain enough information for month and day. We do not map kennedys:child because it can be derived from schema:parent and it would be unnecessary to have the same information stored twice.

Then we create a similar SPINMap for kennedys:College:

The mapping above is very simple because the original kennedys ontology does not contain much information about colleges. Now we can trigger the execution of the rules with a single click on the Run Inferences button. This will create new RDF triples that can be explored in various ways, including the Inferences View as shown below:

The context menu of the Inferences View has a menu item “Assert all to graph…” in which we select the schemakennedys target graph. The content of this file is now the set of schema:Person instances with exactly the same family relationships like the original ontology:

The resulting ontology is now present at http://topbraid.org/examples/schemakennedys

Archives

About TopQuadrant | Glossary | Privacy Statement | Legal | Terms of Use
© Copyright 2001-2017 TopQuadrant, Inc. All Rights Reserved.