Ontologies Are Not Scary

FOAF offers great description of what an Ontology is:

FOAF describes the world using simple ideas inspired by the Web. In FOAF descriptions, there are only various kinds of things and links, which we call properties. The types of the things we talk about in FOAF are called classes. FOAF is therefore defined as a dictionary of terms, each of which is either a class or a property. Other projects alongside FOAF provide other sets of classes and properties, many of which are linked with those defined in FOAF.

In the D2RQ world, the key is the mapping.ttl file, which maps the relational world (tables and columns) to the Ontology world (classes and properties).

Given the above, and a bit of reading, you can define your own ontology, or use readily available open source ontologies:

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

@prefix mydatalake: <http://www.something.com/mydatalake-schema#> .

mydatalake:SomeThing a owl:Class;
 rdfs:label "Something label"

iondatalake:SomeThingProperty a owl:FunctionalProperty;
 rdfs:label "SomeThingProperty label"
 rdfs:domain mydatalake:SomeThing
rdfs:range rdfs:Literal

<br data-mce-bogus="1">

Followed by a D2RQ mapping.ttl to allow SPARSQL against your datastore:

@prefix mydatalake: <http://www.something.com/mydatalake-schema#> .
@prefix db: <> .
@prefix vocab: <vocab/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix d2rq: <http://www.wiwiss.fu-berlin.de/suhl/bizer/D2RQ/0.1#> .
@prefix jdbc: <http://d2rq.org/terms/jdbc/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .

mydatalake:database a d2rq:Database;
 d2rq:jdbcDriver "org.apache.phoenix.jdbc.PhoenixDriver";
 d2rq:jdbcDSN "jdbc:phoenix:localhost";
 jdbc:autoReconnect "true";
 jdbc:zeroDateTimeBehavior "convertToNull";

mydatalake:STOCK_SYMBOL a d2rq:ClassMap;
 d2rq:dataStorage mydatalake:database;
 d2rq:uriPattern "STOCK_SYMBOL";
 d2rq:class mydatalake:SomeThing;
mydatalake:STOCK_SYMBOL_SYMBOL a d2rq:PropertyBridge;
 d2rq:belongsToClassMap mydatalake:STOCK_SYMBOL;
 d2rq:property foaf:name;
 d2rq:column "STOCK_SYMBOL.SYMBOL";

Which then opens up the world to reasoners and rule engines thought the Apache Jena project.

~ by mdavey on May 13, 2016.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: