Collaborative Code Workshop

This page is the portal to the collaborative projects hosted on the site. All are open source (with the exception of XDBC, a Mark Logic supported product that's listed at the end here only for the sake of helping people find it for download).

If you want to participate in one of the projects listed below, or would like to start a new project, please join the developer network mailing list and tell us about it.

Note the "Commons" project is a great place for sharing snippets of useful XQuery.

We use Subversion to manage our code repository. If you're not familiar with Subversion, the links below will get you started.

Active Workshop Projects

Mark Logic CQ

CQ is a web-based XQuery tool, which allow developers to write ad hoc queries without managing .xqy files. Leveraging the web browser's built-in XML tree view, html view, and JavaScript engine, CQ is almost an IDE. You can view the results of your queries as XHTML, XML, or plain text. You can also profile the performance of your queries. You can work on multiple queries at once, browse your query history, change content sources, and save your queries to multiple, persistent sessions.

CQ is designed for use with MarkLogic Server. It must be installed within the root of an HTTP Application Server. Supported browsers are Mozilla 1.0+ and Internet Explorer 6.0+. Some features may not work on other browsers.

The latest release requires MarkLogic Server 4.0-1 or later. Older releases are available for earlier versions of MarkLogic Server.

Significant changes in 4.0.1:

  • in-place editing of session names
  • improved textarea resizing
  • session cloning
  • improved database explorer

Significant changes in 3.2.1:

  • Fixed a session rename, delete bug.

Significant changes in 3.2.0:

  • Added performance profiling.

Significant changes in 3.1.0:

  • The 3.0 worksheet mechanism has been completely removed, and replaced with a new persistent-session implementation. Query buffers and query history are automatically saved to a document in the cq/sessions directory, under the cq application server root. The Query-History tab state is also saved to the session, as is the textarea size. This may be on the filesystem or in a database, as desired. Users may create an unlimited number of additional sessions. Sessions are locked on a per-user basis, but users with the admin role may break these locks.
    NB: Users may also disable sessions: to do so, simply remove the cq/sessions directory, or arrange the permissions so that cq cannot access the directory.
    NB: Old worksheets will still be in your existing database(s), but this version of cq cannot import them. You may install cq 3.1 and 3.0 in the same application server, if desired, and manually copy queries from older "worksheet" documents to a new persistent session.
    NB: Database-resident perisistent sessions will not work with non-admin users, unless care is taken to grant a uri-privilege on cq/sessions. Filesystem-resident sessions are governed entirely by filesystem permissions, as applied to the MarkLogic Server user.
  • Improved text/plain display with IE6 and IE7.
  • Users may now create any number of query buffers, by clicking on the + symbol in the Queries tab.
  • The list all link now displays the root node type for every document displayed.
  • Users may now add a site-specific title and accent color to cq. To activate this feature, copy policy-template.xml to policy.xml, and edit as desired.
  • Each query buffer now maintains its own content-source state. This is helpful when querying different databases within the same session. There is now a visual cue (flashing content-source) to draw the user's attention to a change in content-source state.

Significant changes in 3.0.3:

  • fixed another worksheet.xml bug.

Significant changes in 3.0.2:

  • Various bug fixes.

Significant changes in 3.0.1:

  • fixed a bug where Module-resident CQ would not find a worksheet.
  • fixed a bug where CQ would not correctly handle Windows application server root paths.
  • fixed a bug where the content-sources list would not default correctly.
  • improved query-worksheet import performance.
  • per user feedback, reversed meaning of resize arrows.
  • minor UI changes to make better use of available screen space.

Significant changes in 3.0.0:

  • streamlined UI, with tool-tips
  • improved database select-list, using configured application-server roots
  • improved error display, with line-number highlighting
  • display of caret position (line-number and character position)
  • CSS-based layout and frame-size autocalculation
  • query-history tab, with worksheet support
  • "list all" limits results to first 1000 documents
  • resizable text areas
  • requires MarkLogic Server 3.0-1 or later

A legacy release remains available for Mark Logic CIS 2.2.

Current Version: 4.0.1
Subversion URL: http://xqzone.marklogic.com/svn/cq/trunk
Distribution URL: http://xqzone.marklogic.com/svn/cq/releases
CQSH - An XQuery Shell

cqsh is a command line interface for Mark Logic. cqsh was built to be an alternative to the web interface cq that comes with Mark Logic. It has Readline capabilities and allows you to issue queries, load files, and interact with Mark Logic from a shell environment. cqsh can also be run in batch mode by reading from stdin or passing in a file path using the -f flag.

New in version 0.5.0:

  • Updated code to use new Java XCC connectivity library
  • New load command options --permission, --collection, --quality

This project was contributed by Andy Bruno of O'Reilly Media.

Current Version: 0.5.0
Subversion URL: http://xqzone.marklogic.com/svn/cqsh/trunk
Distribution URL: http://xqzone.marklogic.com/svn/cqsh/releases
Mark Logic XQRunner Java XQuery Executor

This project defines an execution framework for invoking XQuery from Java code. The API is defined by interfaces that decouple your Java code from the specific connector. As of version 0.8.0, any application written to the XQRunner API can switch to using the latest XCC without changing a line of code. In the future, other connectors such as XQJ may be usable as well.

New in 0.8.0: Runs with XCC as the connector (default). Will automatically use either XDBC or XCC if only one is in the classpath. If both are present, it picks XCC.

Both synchronous and asynchronous execution are supported. New in 0.7.0: External variables, streaming mode, document insert.

Current Version: 0.8.1
Subversion URL: http://xqzone.marklogic.com/svn/xqrunner/trunk
Distribution URL: http://xqzone.marklogic.com/svn/xqrunner/releases
Mark Logic XQuery JSP Tag Library

A custom Java Server Pages (JSP) Tag Library that can submit XQuery requests to a MarkLogic Server engine from within a J2EE container and receive the result.

This tag library simplifies integration with J2EE applications by encapsulating communication with the server into standardized JSP tag syntax. The tags can pass XQuery results to other J2EE components and/or generate XQuery scripts on the fly from information within a J2EE application.

Modeled after the JSP Standard Tag Library (JSTL) in general and the JSTL SQL tags in particular this powerful library can make it very easy to integrate MarkLogic Server-based content into a J2EE web application.

Version 0.9.3 includes the latest (1.1.2) JSTL jar files.

New in version 0.9.2: Make bundled xqrunner.jar 1.4 compatible, add explicit welcome file element to web.xml.

New in version 0.9.1: Activate links to JSP source in example webapp, bug fix in body tags that caused hangs in some containers, misc fixup.

New in version 0.9: external variables, XQRunner back-end

Note: Versions of xqrunner.jar and xcc.jar are included in this release to aid in compiling the tag library source. You should use the latest XQRunner and XCC releases when deploying this JSP tag library.

Current Version: 0.9.3
Subversion URL: http://xqzone.marklogic.com/svn/jsp/trunk
Distribution URL: http://xqzone.marklogic.com/svn/jsp/releases
MLSQL

MLSQL is an open source XQuery library (written by Jason Hunter of Mark Logic and Ryan Grimm of O'Reilly Media) that allows easy access to relational database systems from within the MarkLogic environment.

MLSQL lets you execute arbitrary SQL commands against any relational database (MySQL, Oracle, DB2, SQL Server, Derby, etc) and it captures the results as XML for processing within the MarkLogic environment. Using the library enables XQuery applications to leverage a relational database without having to resort to Java or C# glue code to manage the interaction.

MLSQL is distributed under the Apache License, Version 2.0.

Read the MLSQL Tutorial.

Current Version: 1.0
Subversion URL: http://xqzone.marklogic.com/svn/mlsql/trunk
Distribution URL: http://xqzone.marklogic.com/svn/mlsql/releases
MLJAM

MLJAM is an open source XQuery and Java library (written by Jason Hunter of Mark Logic and Ryan Grimm of O'Reilly Media) that enables the evaluation of Java code from the MarkLogic Server environment. MLJAM gives XQuery programs access to the vast libraries and extensive capabilities of Java, without any difficult glue coding. Example uses for MLJAM:

  • Extracting image metadata
  • Resizing and reformatting an image
  • Running an XSLT transformation
  • Generating a PDF from XSL-FO
  • Calculating an MD5 hash
  • Interfacting into a user authentication system
  • Accessing a credit card purchasing system
  • Connecting to a secure HTTPS web site
  • Re-encoding content as UTF-8

MLJAM is distributed under the Apache License, Version 2.0.

Read the MLJAM Tutorial.

Current Version: 1.2
Subversion URL: http://xqzone.marklogic.com/svn/mljam/trunk
Distribution URL: http://xqzone.marklogic.com/svn/mljam/releases
Feed

Feed is a library for accessing, subscribing to, and managing RSS and Atom Feeds.

Feed supports Atom 1.0, RSS 0.3, RSS 1.0, and RSS 2.0.

It requires the dates module from the commons library: http://xqzone.marklogic.com/svn/commons/trunk/dates/

Current Version: 1.0.0
Subversion URL: http://xqzone.marklogic.com/svn/feed/trunk
Distribution URL: http://xqzone.marklogic.com/svn/feed/releases
Facebook XQuery Library

This package includes an XQuery library for programming on the Facebook Platform. The Facebook Platform is a standards-based Web service with methods for accessing and contributing Facebook data.

Version 1.0.0:

  • An importable module for creating an application configuration and making Facebook API calls.
  • Basic example applications illustrating usage of the API.

The Facebook XQuery library is distributed under the Apache License, Version 2.0.

This project was contributed by David Amusin of Mark Logic.

Current Version: 1.0.0
Subversion URL: http://xqzone.marklogic.com/svn/facebook/trunk
Distribution URL: http://xqzone.marklogic.com/svn/facebook/releases
Dictionaries and Thesauri
This project contains three dictionaries (small, medium and large) and a thesaurus (very large) for use with MarkLogic Server. It also contains two non-English thesaurus documents: one for Arabic and one for Chinese.
Current Version: 1.0
Subversion URL: http://xqzone.marklogic.com/svn/dictionaries/trunk
Distribution URL: http://xqzone.marklogic.com/svn/dictionaries/releases
RecordLoader

RecordLoader is a Java-based tool, designed to load any number of arbitrary-sized input documents into a Mark Logic contentbase. To get started with RecordLoader, try the tutorial. Cababilities include:

  • load from input files or standard input
  • input files may be xml files, or zip archives of xml files
  • autosplit into new documents, using element name
  • add read-permissions for one or more roles
  • add collections
  • generate document uris from a prefix, suffix, and element or attribute value
  • up to one thread per input file
  • optionally specify document forest placement
  • optionally transform content using an XQuery module
  • plug in subclasses to customize functionality

The current release requires Mark Logic Server 3.0 or later.

Current Version: 2008-06-24.1
Subversion URL: http://xqzone.marklogic.com/svn/recordloader/trunk
Distribution URL: http://xqzone.marklogic.com/svn/recordloader/releases
Corb

Corb is a Java-based tool for content reprocessing in bulk. To get started with Corb, see the README file.

Corb requires Mark Logic Server 3.2-1 or later.

Current Version: 1.0.0
Subversion URL: http://xqzone.marklogic.com/svn/corb/trunk
Distribution URL: http://xqzone.marklogic.com/svn/corb/releases
PerformanceMeters

PerformanceMeters is a Java-based, XML-driven tool for testing XQuery with MarkLogic Server. To get started with PerformanceMeters, try the tutorial.

Capabilities include:

  • test arbitrary queries
  • test via XCC or HTTP
  • configure via XML
  • supports setup and tear-down queries
  • performance metrics, including percentile-response times
  • support for arbitrary query generator classes
  • support for arbitrary result formatter classes
Current Version: 1.0.0
Subversion URL: http://xqzone.marklogic.com/svn/performance-meters/trunk
Distribution URL: http://xqzone.marklogic.com/svn/performance-meters/releases
XQuery Commons

The Mark Logic XQuery Commons is an umbrella project that encompasses small, self-contained components. These small "bits and bobs" do not constitute complete applications in their own right, but can be re-used in many different contexts.

Subcategories include HTTP, Date, and Search utilities. If you have your own favorite functions, write the mailing list to contribute them!

Current Version: 0.0.1
Subversion URL: http://xqzone.marklogic.com/svn/commons/trunk
Distribution URL: http://xqzone.marklogic.com/svn/commons/releases
Versi Design Template

The Versi template is an HTML design template whose goal is to increase the productivity of developers when building or rapid prototyping applications. Because designing and wiring up a user interface is one of the most time consuming parts of the development cycle, Versi includes pre-wired XQuery example pages, UI modules, and widgets that can be customized to suit your application.

Versi also includes a host of features to begin wiring up AJAX applications without the tedious setup process. To setup Versi, see the included Getting Started Guide.

Features include:

  • Modular design
  • Sciptaculous Javascript framework
  • Global Javascript library
  • Design widgets
  • Prewired XQuery pages with supporting modules

The latest release requires MarkLogic Server 3.1 or later.

Current Version: 1.0.1
Subversion URL: http://xqzone.marklogic.com/svn/versi/trunk
Distribution URL: http://xqzone.marklogic.com/svn/versi/releases

lib-search is an XQuery library that dramatically reduces the time spent developing search and browse functionality in MarkLogic Server applications. Its primary purpose is to define an XML interface for cts:search semantics and extend cts:search's capabilities to include valuable features such as basic and Google-like syntax parsing, search facets, new search options, and results analysis. As a culmination of best practices compiled by Mark Logic Professional Services in search development, it is a highly customizable and tunable library that can serve as a foundation for many search and browse applications.

Features include:

  • 100% Schema Agnostic
  • Basic and Google-like search string parsers
  • Supports fielded search, sorting, directories, and other core search features
  • Faceted navigation support
  • Enhanced search options
  • Easily configurable and extensible
  • Search result statistics
  • Integrated Spell-check
  • Useful in Rapid Prototyping

Resources

The latest release requires MarkLogic Server 3.2 or later.

Current Version: 3.2-2008-05-13.1
Subversion URL: http://xqzone.marklogic.com/svn/lib-search/trunk
Distribution URL: http://xqzone.marklogic.com/svn/lib-search/releases
Shakespeare Demo Application

The Shakespeare demo application allows you to search across all of the Shakespeare plays and display the plays scene-by-scene. It includes a master table of contents, a search page allowing simple searches with 'and' boolean logic, and an advanced search page which adds near searches to the search options. In any search, you can enter double-quotes around a phrase to indicate a phrase search (for example, "to be or not to be" will return a single hit from Hamlet).

The application is written in XQuery, with some javascript to help with the table of contents tree control. The XQuery code sends xhtml pages to display on the browser. It is intended as a simple sample of an application you can write in MarkLogic Server, and demonstrates some common design patterns used in MarkLogic applications. It includes all of the code for the application. Feel free to play around and modify the code to suit your needs and to learn how it works. The README.txt file describes how to set up the application.

Some of the features and design patterns of the application include:

  • generating a table of contents from a content set
  • dynamically transforming content from its original XML structure to xhtml (using a recursive typeswitch)
  • full text search, including a search box and a search results page
  • proximity (cts:near-query) search page
  • a simple query parser (parses double-quoted text as phrases)
  • some interesting examples of text highlighting using cts:highlight
  • dynamically counts and displays the line numbers
  • and much more....
  • using properties to store metadata
Current Version: 3.1-1
Subversion URL: http://xqzone.marklogic.com/svn/bill/trunk
Distribution URL: http://xqzone.marklogic.com/svn/bill/releases
xqDoc Web Services

This project offers the ability to integrate the xqDoc web service on to your XQuery development workbench. We view this project as beneficial since it will help keep your XQuery code and xqDoc documentation synchronized. For example, imagine changing one of your XQuery modules and then have the xqDoc xml for that module automatically generated behind the scenes. This was the fundamental motivation for this project.

This project leverages the MarkLogic Trigger feature and introduces a general purpose core library module for accessing web services via SOAP. Since the current MarkLogic Trigger feature is "lightly" documented, this project (by offering numerous trigger examples) could help those developers attempting to leverage this new and powerful capability. Similarly, since the SOAP library module is very generic, it could be utilized as a starting point for accessing other web services (beyond xqDoc).

This project was contributed by the good folks at xqDoc.org.

Current Version: 1.1
Subversion URL: http://xqzone.marklogic.com/svn/xqdoc-ws/trunk
Distribution URL: http://xqzone.marklogic.com/svn/xqdoc-ws/releases
XQSync

XQSync is a command-line, Java-based tool, useful for synchronizing MarkLogic contentbases to and from other contentbases, filesystems, and zip-files. To get started using XQSync, try the tutorial.

The current release requires Mark Logic Server 3.0 or later.

Current Version: 1.0.0
Subversion URL: http://xqzone.marklogic.com/svn/xqsync/trunk
Distribution URL: http://xqzone.marklogic.com/svn/xqsync/releases
Mark Logic XFaqtor

An automated Frequently Asked Questions (FAQ) management tool written in XQuery for use with the MarkLogic Server. It has support for keyword-based search, user-submitted questions and answers, state management of questions and answers (submitted, live, dead), and a separate admin console for managing states. Consisting of about 1,000 lines of XQuery code, it's a useful sample application for learning how to program in XQuery -- while at the same time being robust enough to drive the FAQ at http://xqzone.marklogic.com/xfaqtor/.

Current Version: 1.0
Subversion URL: http://xqzone.marklogic.com/svn/xfaqtor/trunk
Distribution URL: http://xqzone.marklogic.com/svn/xfaqtor/releases
xqlog: XQuery Blogger

This project is derived from the xfaqtor project and implements a simple blog (web log) system written entirely in XQuery.

This project was contributed by Raffaele Sena.

Current Version: 1.0
Subversion URL: http://xqzone.marklogic.com/svn/xqlog/trunk
Distribution URL: http://xqzone.marklogic.com/svn/xqlog/releases
libmlxcc - Mark Logic Connector for C, PHP, Perl, Ruby, and Python

mlxcc is a C API for communicating with Mark Logic with bindings for perl, php, python, and ruby. It provides an implementation of the underlying wire protocol used to communicate with the server and is based off of the Java XCC/J libraries provided by Mark Logic. The goal of mlxcc is to provide a base interface into Mark Logic in which bindings into other popular languages can be built. You can download a copy here.

For more information see the project wiki at: http://mlxcc.qnot.org

This project was contributed by Andy Bruno of O'Reilly Media.

Current Version: 0.5.3
Subversion URL: http://xqzone.marklogic.com/svn/libmlxcc/trunk
Distribution URL: http://xqzone.marklogic.com/svn/libmlxcc/releases
AutoLoader

AutoLoader is a Java-based tool that monitors a directory for new files. These files are then automatically loaded into Mark Logic server via RecordLoader. For more information about the capabilities of RecordLoader, try the tutorial. Specifically, AutoLoader features include:

  • Monitor a directory for new files to be automatically loaded
  • Leverages the full power of RecordLoader for the actual loading of the files
  • Runs from the command line without a UI for ease of use on production servers

The current release packages a very slightly modified version of RecordLoader. As RecordLoader is updated AutoLoader will also be updated to stay in sync with the latest changes.

Current Version: 1.0.0
Subversion URL: http://xqzone.marklogic.com/svn/AutoLoader/trunk
Distribution URL: http://xqzone.marklogic.com/svn/AutoLoader/releases
SOAP Router

This project is a SOAP Router written in XQuery. The goal of the SOAP router is to provide a simple framework for accessing user defined XQuery functions via SOAP requests. See the SOAP.pdf document for details.

This project was contributed by Darin McBeath of Elsevier.

Current Version: 1.0
Subversion URL: http://xqzone.marklogic.com/svn/soaprouter/trunk
Distribution URL: http://xqzone.marklogic.com/svn/soaprouter/releases
jEdit XQuery Plugin

A Mark Logic XQuery plugin for the jEdit editor. This plugin is a development aid that takes XQuery code directly from your active edit buffer, submits it to MarkLogic Server and places the result in another edit buffer of your choosing. If an error is deteted in the XQuery code, the line containing the error is highlighted in the source.

This is a total rewrite that replaces the aXe adapter that was previously posted here. That plugin will no longer be supported going forward. If you're using it, please install this plugin and discontinue using the old one.

Included in this distribution is a syntax highlighting descriptor for XQuery code.

Current Version: 0.7.1
Subversion URL: http://xqzone.marklogic.com/svn/jedit/trunk
Distribution URL: http://xqzone.marklogic.com/svn/jedit/releases
jEdit WebDAV Plugin

This jEdit plugin enables you to load documents from a WebDAV server into a jEdit buffer and to save the content of a buffer to WebDAV. With this plugin you can directly edit documents in the database.

To use this plugin you must configure a WebDAV listener in the adminstration console. Additionally, directories must be present in the database -- either manually or automatically created, see the documentation -- because WebDAV clients can only see directories and documents that are in directories.

Current Version: 1.0.1
Subversion URL: http://xqzone.marklogic.com/svn/webdavjedit/trunk
Distribution URL: http://xqzone.marklogic.com/svn/webdavjedit/releases
User Login/Logout/Register XQuery Library

Example XQuery code that demonstrates how to handle user login and logout as well as self-registration. This code can serve as the basis for applications that require user authentication.

Current Version: 1.0
Subversion URL: http://xqzone.marklogic.com/svn/userlogin/trunk
Distribution URL: http://xqzone.marklogic.com/svn/userlogin/releases
JQEE

JQEE presents a simple, high-level interface on top of the lower-level XDBC classes. While not suitable for every job, the high-level interface makes common tasks -- such as executing a query and retrieving a sequence of strings -- into two liners. Within JQEE you'll find a Query class representing queries and a QueryExecuter that runs them with its various execute() methods. It's much simpler than the more robust XQRunner.

Includes a command line XQuery script executor. Requires XDBC.

Current Version: 0.8.1
Subversion URL: http://xqzone.marklogic.com/svn/jqee/trunk
Distribution URL: http://xqzone.marklogic.com/svn/jqee/releases
Loader

Loader holds simple Java-based document load and save scripts that demonstrate XDBC access from Java. They're considered simple because they don't load or save document metadata (properties, collections, quality, security, etc). They do however load from directories and ZIP files, and can convert HTML to XML before loading.

Current Version: 1.0
Subversion URL: http://xqzone.marklogic.com/svn/loader/trunk
Distribution URL: http://xqzone.marklogic.com/svn/loader/releases
phpxdbc: XDBC Connectivity for PHP

This project is PHP code that enables XDBC connectivity from PHP pages. This code requires a PHP installation that inludes curl. Simple examples are included.

This project was contributed by Raffaele Sena.

Current Version: 1.0
Subversion URL: http://xqzone.marklogic.com/svn/phpxdbc/trunk
Distribution URL: http://xqzone.marklogic.com/svn/phpxdbc/releases
perlxdbc: XDBC Connectivity for Perl

This project is a Perl module that enables XDBC connectivity from Perl scripts.

This project was contributed by Tony Stubblebine of O'Reilly Media.

WARNING: This project has not been actively maintained and does not work with the latest MarkLogic Server releases. It should now be considered sample code only.

Current Version: 0.04
Subversion URL: http://xqzone.marklogic.com/svn/perlxdbc/trunk
Distribution URL: http://xqzone.marklogic.com/svn/perlxdbc/releases
XDBC: XQuery Database Connectivity (Official and Supported) [Legacy]

This is the official distribution of the Mark Logic XDBC Distribution. XDBC is a Java library that lets your Java code submit queries to MarkLogic Server. An official .NET version is also available.

XDBC is the legacy connector. It has been replaced with XCC, a new and more featureful connector. XDBC has entered maintenance mode and will not be updated with new features. You should use XCC for new projects and you are encouraged to switch from XDBC to XCC if possible.

Current Version: 3.0-6
Subversion URL: http://xqzone.marklogic.com/svn/xdbc/trunk
Distribution URL: http://xqzone.marklogic.com/svn/xdbc/releases