Zorba is an open source query processor written in
C++
C++ (pronounced "C plus plus") is a high-level general-purpose programming language created by Danish computer scientist Bjarne Stroustrup as an extension of the C programming language, or "C with Classes". The language has expanded significan ...
, implementing
* several
W3C
The World Wide Web Consortium (W3C) is the main international standards organization for the World Wide Web. Founded in 1994 and led by Tim Berners-Lee, the consortium is made up of member organizations that maintain full-time staff working to ...
XQuery
XQuery (XML Query) is a query and functional programming language that queries and transforms collections of structured and unstructured data, usually in the form of XML, text and with vendor-specific extensions for other data formats (JSON, bin ...
and
XML
Extensible Markup Language (XML) is a markup language and file format for storing, transmitting, and reconstructing arbitrary data. It defines a set of rules for encoding documents in a format that is both human-readable and machine-readable. T ...
specifications and
* the
JSONiq
JSONiq is a query and functional programming language that is designed to declaratively query and transform collections of hierarchical and heterogeneous data in format of JSON, XML, as well as unstructured, textual data.
JSONiq is an open speci ...
language for processing
JSON
JSON (JavaScript Object Notation, pronounced ; also ) is an open standard file format and data interchange format that uses human-readable text to store and transmit data objects consisting of attribute–value pairs and arrays (or other ser ...
data.
Zorba is distributed under
Apache License, Version 2.0.
The project is mainly supported by th
FLWOR Foundation Oracle
An oracle is a person or agency considered to provide wise and insightful counsel or prophetic predictions, most notably including precognition of the future, inspired by deities. As such, it is a form of divination.
Description
The word '' ...
, an
28msec
Specifications
Zorba provides the implementation of the following
W3C
The World Wide Web Consortium (W3C) is the main international standards organization for the World Wide Web. Founded in 1994 and led by Tim Berners-Lee, the consortium is made up of member organizations that maintain full-time staff working to ...
specifications:
XQuery 1.0XQuery 3.0
XQuery Update Facility 1.0XQuery and XPath Full Text 1.0XML Syntax for XQuery 1.0XML SchemaXSL Transformations (XSLT)XSL Formatting Objects
Zorba also provides implementations of:
*
JSONiq
JSONiq is a query and functional programming language that is designed to declaratively query and transform collections of hierarchical and heterogeneous data in format of JSON, XML, as well as unstructured, textual data.
JSONiq is an open speci ...
*
Scripting Extension
*
Data Definition Facility
In the pursuit of knowledge, data (; ) is a collection of discrete values that convey information, describing quantity, quality, fact, statistics, other basic units of meaning, or simply sequences of symbols that may be further interpreted. ...
Scripting
Scripting Extensionis an open specification that provides semantic for side-effects in XQuery or JSONiq programs.
It also provides a user-friendly syntax for
imperative programming
In computer science, imperative programming is a programming paradigm of software that uses statements that change a program's state. In much the same way that the imperative mood in natural languages expresses commands, an imperative program c ...
within such programs.
The following code snippet is an example of the Scripting syntax. It computes a sequence containing all the Fibonacci numbers that are less than 100.
(: this is a variable declaration statement :)
variable $a as xs:integer := 0;
variable $b as xs:integer := 1;
variable $c as xs:integer := $a + $b;
variable $fibseq as xs:integer* := ($a, $b);
while ($c lt 100) {
(: this is a variable assignment statement :)
$fibseq := ($fibseq, $c);
$a := $b;
$b := $c;
$c := $a + $b;
}
$fibseq
The following is an example of
CRUD operations using Scripting, XQuery, and XQuery Update.
variable $stores := doc("stores.xml")/stores;
(: Create :)
insert node 4NY into $stores;
(: Update :)
replace value of node $stores/store tate="NY"store-number with "5";
(: Delete :)
delete node $stores/store tate != "NY"
(: Read :)
$stores
Data Definition Facility
Data Definition Facilityprovides a semantic for persistent artifacts such as collections and indexes in XQuery or JSONiq programs.
For instance, the following code snippets declares a collection named ''entries'' and an index on that collection named ''entry''.
module namespace g = "http://www.zorba-xquery.com/guestbook";
import module namespace db = "http://www.zorba-xquery.com/modules/store/static/collections/dml";
declare namespace an = "http://www.zorba-xquery.com/annotations";
(: Declares a collection named entries :)
declare collection g:entries as element(entry);
(: Declares a variable that points to the g:entries collection :)
declare variable $g:entries := xs:QName('g:entries');
(: Declares an index named entry on top of the entries collection :)
declare %an:automatic %value-equality index g:entry
on nodes db:collection(xs:QName('g:entries'))
by xs:string(@id) as xs:string;
Storage
Zorba provides a pluggable store so it can be used on different kind of environments: disk, database, browser.
By default, Zorba is built with a main memory store
28msecimplements a store on top of
MongoDB
MongoDB is a source-available cross-platform document-oriented database program. Classified as a NoSQL database program, MongoDB uses JSON-like documents with optional schemas. MongoDB is developed by MongoDB Inc. and licensed under the Serve ...
.
Th
XQuery in the Browserproject has built a browser plugin for Zorba and leverages the DOM as its store.
APIs
Zorba is usable throug
different host languages C++, C,
XQJ / Java, PHP, Python, C#, Ruby, and eve
XQuery/JSONiq
Zorba is also available as
command-line toolXQDTis an XQuery plugin for the
Eclipse (IDE)
Eclipse is an integrated development environment (IDE) used in computer programming. It contains a base workspace and an extensible plug-in system for customizing the environment. It is the second-most-popular IDE for Java development, and, un ...
. It fully supports Zorba API and syntax.
Modules
Zorba provides more than 70 XQuery modules for building applications. Some of these modules are:
* File system, Email, HTTP client, OAuth client
* XQuery and JSONiq Data Model Processing: typing, atomic items, and nodes.
* Full-text: tokenizer, stemmer, thesaurus lookup.
* Data Cleaning: phonetic similarities, set similarities, conversions.
* Data Conversion: Base64, CSV, HTML, JSON, XML
* Data Formatting: XSL-FO
* Introspection and Reflection
* Cryptography
* Image processing
External links
Zorba websiteZorba live demoZorba modules
XQuery processors
XML