This repository contains some working examples to help programming with Semantika API.
Download the latest distribution package and unpack it into your local directory.
$ unzip semantika-dist-<version>.zip
We're going to use some Git commands to get the example source code. Don't worry if you are not familiar with Git, just make sure your computer has it installed.
Follow the commands below to append the example files into your local Semantika distribution folder. We have them tested using Git 1.8.x:
$ cd semantika-dist-<version>
$ git init
$ git remote add origin https://github.com/obidea/semantika-example.git
$ git fetch origin master
$ git reset --hard FETCH_HEAD
Check in the Semantika directory a folder named empdb/
. This folder contains a sample Employee data in H2 database. To run the database:
$ cd empdb
$ ./h2.sh
Follow the instructions for each example code: queryanswer, rdb2rdf and emp-app.
Source code for query answering shows you how we setup the ApplicationManager
and then getting the QueryEngine
to start the SPARQL query answering service. It contains 9 sample queries to show you what are the SPARQL features that are currently supported by Semantika.
Source code for RDB2RDF export shows you how we setup the ApplicationManager
and then getting the MaterializerEngine
to start data export service. The code gives you 4 format flavours: NTriples, Turtle, RDF/XML and RDF/JSON.
Source code EmployeeApp shows you how to setup the ApplicationManager
using programmatic configuration. This is a simple query answer application where you can type freely any SPARQL query to be evaluated against the underlying database.
These examples demonstrate how Semantika can seamlessly connect to a relational database and answers SPARQL queries based on the semantic mapping model provided by users. There are three main parts that you need to learn:
- The mapping model. Take a look inside the
model/
folder and study how mapping modelling works. Find out more about the syntax here and here. - The
application.cfg.xml
file. The configuration file is the place where you glue everything together (i.e., connection settings, domain model resources and mapping model resources). Find out the parameters here. - The Java code. This is your application code! Check the
example/
folder and study the source code.
The Semantika API source code is distributed under Apache License 2.0 and it is available here.
Please go through our user guide to read some specification details about the system, or if you have any questions, please post them to OBDA Semantika discussion group and we are ready to give you a hand.