Previous Topic

Next Topic

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 Kowari server and list the contents of a Kowari model.

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

// Kowari packages
import org.kowari.itql.ItqlInterpreterBean;
import org.kowari.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 (answer.next()) {

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

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

See Also

System Architecture

JavaServer Pages Tag Library

iTQL Shell

Simple Object Access Protocol (SOAP)

Mulgara Driver

Java RDF (JRDF)

Open Source logo

© 2001-2004 Tucana Technologies, Inc. Some rights reserved.

© 2006 The Mulgara Project. Some rights reserved.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".