Csc 8711, Databases and the Web - Project 4

Due: Sunday, April 12th
Individual Assignment.

RDF/Jena API/SPARQL/Web Browser

This project introduces you to Jena API (a Java API for RDF/OWL Ontologies) and SDB/TDB RDF Storage Engine.
  1. Visit Jena API and study the Tutorial.
  2. Visit SDB - A SPARQL Database for Jena or TDB - RDF Storage and query and study the Tutorial.
  3. Load the Periodic Table Ontology Data into SDB. Protege IDE (use this to open the OWL files and browse the Ontology).
  4. Build a Java servlets or PhP (http://www.easyrdf.org/) based Web site to browse the Periodic Table Ontology.

Jena TDB and Servlets - Sample code and instructions

TDB setup and loading KB

Here is the command to load a TDB triple store with KB:
tdbloader2 --loc NOBELDB nobeldata.owl
The above command loads the nobeldata.owl ontology to a TDB database which is stored in the local directory named NOBELDB. Since nobeldata.owl imports nobel.owl, we need not load nobel.owl.

Java Servlet to Query KB

TDB.java (Source) and Servlet in action

Jena SDB and Servlets - Sample code and instructions

SDB setup and loading KB

Here are the commands to configure and load a SDB triple store with KB:
  • Step 1: Create a configuration file sdb-mysql.ttl with the following contents:
    @prefix sdb:     <http://jena.hpl.hp.com/2007/sdb#> .
    @prefix rdfs:	 <http://www.w3.org/2000/01/rdf-schema#> .
    @prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
    @prefix ja:      <http://jena.hpl.hp.com/2005/11/Assembler#> .
    
    <store> rdf:type sdb:Store ;
        sdb:layout     "layout2" ;
        sdb:connection <conn> ;
        sdb:engine     "InnoDB" ;      # MySQL specific
    .
    
    <conn> rdf:type sdb:SDBConnection ;
        sdb:sdbType       "MySQL" ;    # Needed for JDBC URL
        sdb:sdbHost       "localhost" ;
        sdb:sdbName       "your-mysql-database-name" ;
        sdb:driver        "com.mysql.jdbc.Driver" ;
        sdb:sdbUser        "your-mysql-id" ;
        sdb:sdbPassword    "your-mysql-password" ;
        .
    
    Please replace sdbName, sdbUser, and sdbPassword values with your mysql account information.
  • Step 2: Then, run the following commands:
    $ sdbconfig --sdb=sdb-mysql.ttl --create
    $ sdbload --sdb=sdb-mysql.ttl nobel.owl
    $ sdbload --sdb=sdb-mysql.ttl nobeldata.owl
    

Java Servlet to Query KB

SDB.java