Peruser SQL integration pathways

Both Cocoon and Jena offer toolsets for working with SQL data repositories.  Peruser users should become familiar with these facilities and determine how to best address application SQL connectivity needs.   

Configuring SQL Connections

All peruser communication with SQL databases is done using JDBC drivers which you must place into your classpath (in PERUSER_LIB/local/jdbc).
We currently do not distribute any JDBC drivers with the Peruser distribution.  However, if you configure the peruser
(or some other component of your application) to connect to your database using JDBC, then there are a number of
things you can do with it.

Cocoon JDBC configuration

The easiest way to use JDBC with peruser is to make use of Cocoon's JDBC connection management.

To do this you will need to configure JDBC settings for your SQL databases using this file, as discussed in the system configuration doc:.

  • PERUSER_SRC/conf/cocoon/pre_build/xconf_patch/peruser_jdbc.xconf

Other JDBC configuration

If you do not use cocoon, then you will need to fetch JDBC connections directly or using some other library, and connect them to your application in a Module-specific way.

SQL Operations in Peruser Applications

RDF models can be stored, queried and updated using SQL.  They can also be stored, queried, and updated without SQL.

Also, an application which is based on RDF and XSLT can use SQL queries opportunistically without being entirely bound into RDBMS ideas.

Peruser supports several kinds of integration with SQL databases, which we'll outline briefly before discussing each pathway.

  1. Direct Application SQL
    1. Using Cocoon SQLTransformer
      1. Using the Abbott module to explore "flat" data with "smart" queries.
    2. Using Hibernate, Castor or other OR-mapping software.
    3. Using JDBC directly.
  2. Storing/Querying/Updating  RDF using SQL
    1. Using Jena mechanisms
    2. Using Peruser Quad Module

Application SQL access using Cocoon SQL Transformer

To send SQL statements to (non-RDF) application databases, one easy pathway is to use the Cocoon SQLTransformer, which is the sweetest piece of sweet code there ever was, particularly for issuing queries against repositories with simple security requirements (e.g. published content).  When it is desriable

One good design pattern for Peruser + SQLTransformer here is to use SQL stored procedures to make database updates.  In Model-View-Controller terminology, this means that SQL stored procedures (under peruser control) are being used as an important part of the Controller which updates your model.  The Model is your SQL database itself, and the View is composed of queries that you either store in the database or construct dynamically using SQLTransformer, XSLT, and RDF knowledge operations.

Abbot was removed from the Peruser 2.1.1 release.  Please ignore the rest of this section.  But the Cocoon SQLTransformer works great  - try it!

Using the Abbott pattern to explore "flat" data with "smart" queries.

When you are doing data-mining operations requiring complex queries, it is often useful to be able to derive the queries from knowledge models, which may be constructed using RDF mechanisms.

The Abbott pattern is designed to support this type of operation within the Peruser framework.  Have a look at PERUSER_SRC/app/abbott.

RDF/ SQL Using Jena

Jena RDF model storage in SQL

Standalone Jena applications can make use of the Jena RDF management tools, optionally using the Peruser ant tasks for this purpose

jena-db-cmd
jena-db-model-reload
jena-rdfcat

In Peruser 2.1.1, These ant tasks might be working, and you can use the Jena Assembler to get at these models from within your java code, but the integration pathways to the Peruser query machines are broken.

RDF/ SQL Using Peruser Quad Module

The Peruser-Quad (PQuad) module (net.peruser.module.quad) is a minimalist RDF-storage facility that we use for teaching, experimentation, and low-volume production purposes.

Quad is not included in Peruser 2.1.1