mulgara - semantic store

skip navigation


iTQL Bean

The iTQLTM bean provides a level of abstraction above that of the iTQL interpreter, providing convenience methods for executing commands and queries on Mulgara servers, and obtaining their results. It is a JavaBeanTM that implements the JavaBeans 1.01 specification making it the ideal choice for graphical development using Integrated Development Environments (IDEs).

The iTQL bean is suitable for integration with text-based console applications, graphical user interfaces (swing applications, for example) and JavaServer PagesTM (JSP).

As well as the standard JavaBean properties and methods, the iTQL bean exposes the methods as listed in the file ItqlInterpreterBean.

The following example uses the iTQL bean to query a Mulgara server and list the contents of a Mulgara model.

// Standard Java Packages
import java.sql.*;

// Mulgara packages
import org.mulgara.itql.ItqlInterpreterBean;
import org.mulgara.query.Answer;

try {

// Query to select all subject-predicate-object statements from the model
String query = "select $s $p $o from <"+modelName+"> where $s $p $o ;";

// Do the query
Answer answer = interpreter.executeQuery(query);

// Print out the results

System.out.println("Query Results:");

while ( {

Object subject = answer.getObject(0);
Object predicate = answer.getObject(1);
Object object = answer.getObject(2);

System.out.println("Subject: "+subject+", Predicate:"+predicate+
", Object: "+object);
catch (Exception e) {
System.out.println("An Exception occurred: "+e);

Valid XHTML 1.0 TransitionalValid CSS 3.0!