Learn XQuery |
Home:Learn XQuery:XQuery Examples:Update on XQJ Update on XQJ: XQuery API for JavaThe XQuery API for Java specification (JSR 225) is now in Early Draft Review, which is part of the Java Community Process (JCP) for developing and publishing new specifications. See http://jcp.org/en/introduction/timeline for the steps and timeline in this process. Early Draft Review makes the XQuery API for Java (XQJ) available to the public to review and submit comments to the Expert Panel. (DataDirect Technologies is a member of the Expert Panel for XQJ.) The review for XQJ is available through July 9, 2004. You can download it from: http://jcp.org/aboutJava/communityprocess/edr/jsr225/index.html. What is XQuery?XQuery is a new query language for XML that is being developed by the W3C XML Query Language Work Group (of which DataDirect is a member). Just as SQL is a query language that queries relational tables to create new relational tables, XQuery queries XML documents and relational sources to create XML documents. Just as SQL queries can return many different representations of the same data, XQuery queries can return many different XML documents from the same data. XQuery allows you to work in one common model no matter what type of data you're working with – relational, XML or object data. XQuery is ideal for queries that must represent results as XML, to query XML stored inside or outside the database, or to span relational and XML sources. What is XQJ?XQJ enables a Java application to submit XQuery queries to an XML data source and process the results. XQJ is analogous to JDBC, which in conventional SQL environments, a Java application uses to connect to a database, issue SQL queries, and obtain result sets. So, XQJ is to XQuery what JDBC is to SQL. The difference is that XQuery uses a completely different data model; it has no concept of tables, rows, or the datatypes used in SQL. XQJ is designed to support XML queries for both XML sources and XML views of relational databases. The result of an XQuery is always XML. Here's an architectural diagram that shows how XQJ and XQuery are used for querying relational and XML sources together. Querying with XQuery and XQJ
The following example, modified from the XQJ Early Draft Review, shows that the current pre-release version of XQJ is similar to JDBC. Example - A query using XQuery and XQJXQConnection conn = XQDS.getConnection();
XQExpression expr = conn.createExpression();
String es = "for $n in fn:doc('catalog.xml')//item
return fn:data($n/name)";
XQResultSequence result = expr.executeQuery(es);
while (result.next())
{
String str = result.getString();
System.out.println("Product name: " + str);
}
result.close();
expr.close();
conn.close();
An application that uses XQJ would use an XQuery implementation to connect, process and execute the XML query. DataDirect Technologies is developing an implementation of XQuery called DataDirect XQuery™, which implements the XQJ API. Click here to learn more. |
Are You Ready for the XQuery Revolution?XQuery is poised to change the data integration application landscape. This first-ever informative industry survey will let you know what your peers are up to and how they are putting XQUery to work today. After reading the survey try DataDirect XQuery® for free and see for yourself. Back to School with DataDirect XQuery®Getting your mind around the possibilities of a data integration technology as promising as XQuery can be difficult, but our XML developers Webinars will help you understand the power and versatility of XQuery, and our favorite XQuery processor, DataDirect XQuery®. From information about how to leverage relational data to real-world use cases, our Webinars will help you see why DataDirect XQuery® is the best choice for today's tough data integration and aggregation challenges. Free XQuery Development Resources |






