MarkLogic Data Hub Service

Fast data integration + improved data governance and security, with no infrastructure to buy or manage.

Learn More


Stay On Top Of Everything MarkLogic

Be the first to know! News, product information, and events delivered straight to your inbox.

Sign Me Up


Stay On Top Of Everything MarkLogic

Be the first to know! News, product information, and events delivered straight to your inbox.

Sign Me Up


Stay On Top Of Everything MarkLogic

Be the first to know! News, product information, and events delivered straight to your inbox.

Sign Me Up

Where did the W3C XQuery Use Cases go?

by Evan Lenz

Some of you may have noticed that as of release 5, MarkLogic has a new entry page on port 8000:

Machine generated alternative text: Mark ? Information Studio ‘ ApplIcation BuIld.r lE] Qu.iy Consol. I Configuration M.nag.r ll Monitoring D..tiboard Admin J Enterprise Edition, Development License - Welcome, admin Use Learn Guides Load Content Build an Application Create Code ¶ Getting Started Load content Into a new Create a customized Develop, test, and or existing database search application with profile XQuery and Application Development using Information Studio. Application Builder. XSLT In your browser. tZJ Search Development Administration Load new content Build an application Begin coding More References Manage Configuration Monitor Status Administer XQueri Module and Built-In API QueryPerformanceandTunlng Inspect configuration and Visualize real-time Update low-level copy settings between status measures settings and security ScalabilltY Availability, and Failover environments with using the Monitoring set-up in the Admin Configuration Manager. Dashboard. Interface. f Content Processing Framework More Explore Configuration View status Administer MarkLogic Server 5.0 ¶,l Release Notes Installation Guide Integrate Download all Big Data Monitoring Leverage MarkLogic for real- Connector for Hadoop Plugin for Nagios® Support time applications and batch Perform Big Data N Integrate MarkLoglc status + Create a new support case ‘ analytics on MarkLogic monitoring into Naglos. analytics. data with Hadoop Download Generate diagnostic Information MapReduce. Download For additional support information Smart Plug-in for please visit our support site HP Operations Manager® Ø Integrate MarkLoglc status monitoring into Developer Mailing List Operations Manager. Search P Learn more Better to always check for equality or sometimes redundantly... (3) Connector to SharePoint® Toolkits for Office® XCC for Java and .NET Today 6:43 am Connect to MarkLogic Performance Meters (10) Mirron content from Build rich information SharePointto MarkLogic applications for Microsoft 0 Server from Java or .NET Today 2:50 am for search,analytics, and Otfice. applications. Issue in cts:element-values with delivery, multiple Oname (2) Get started Download for Java Get started Today 2:35 am Download for .NET Limit and sort facets In searcsearch function in ML 4.2 (1)

From this page you can access all the goodies like: Information Studio (for flexible content-loading), Application Builder (for automatic generation of search applications), Query Console (for running and profiling code from the browser), Configuration Manager (for browsing and exporting admin settings), and Monitoring Dashboard (for visualizing server performance in real-time).

In previous releases, port 8000 had a simple application for exploring and running the W3C XQuery Use Cases, which provided a decent overview of what XQuery can do. Now that you've upgraded to MarkLogic 5 (you have, haven't you?), things have changed. Fortunately, you can still play around with these XQuery examples—this time using an even better interface: Query Console. Just follow these steps (these assume you're running MarkLogic on the same machine as your browser):

  1. Go to the Query Console, by clicking the link at the top of the entry page or going straight to http://localhost:8000/qconsole/.
  2. In Query Console, click the "Workspace" drop-down at the top right of the window, and select "Import Workspace…".
  3. In the resulting dialog, browse to this file: <marklogic-dir>/Samples/w3c-use-cases.xml (where <marklogic-dir> is the installation directory for MarkLogic: C:\Program Files\MarkLogic on Windows, /opt/MarkLogic on Linux, or ~/Library/MarkLogic on OS X).
  4. Click the "Import" button.

Now you're ready to get started. You should see all the queries loaded under your new workspace, which will look something like this:

Machine generated alternative text: Workspace I w Load Source XML k Ql.OE Exemplars ... X Ql.l: Value Cons... X Ql .2: Element re... Ql.3: Nested que... Ql.4: Nested gro... 1.5: Join by tit... 1.6: Element ran... 1.7: Result orde... 1.8: Tag-value c... IS: Text search 1.10: Minimum va... l.ll:Elementst... j V ini I I9 flnan ar..sI

The first query, "Load Source XML," is the one you'll want to run first, since it does just what it says: it loads all the sample data into the database of your choice. Select the database you want to use, using the "Content Source" drop-down. In the following screenshot, I selected the "Documents" database. Then click the "Run" button and wait for all the documents to load:

The source XML has been sucessfully loaded into the database.

Now you're ready to start exploring the queries. For example, the following screenshot shows the result of me running the "Nested query" example (Q1.3):

query and results

NOTE: Be sure to check the content source drop-down each time you run a query. If you get empty results, it may be because the wrong database is selected.

Thanks to our excellent Documentation team for making this easy to find (in the "Exploring the Use Cases" section of the Getting Started guide)!

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.


The commenting feature on this page is enabled by a third party. Comments posted to this page are publicly visible.
  • In OSX 10.7 the Library folder is now hidden by default. Use the Library for software, but not samples.