15.07.2016 Views

MARKLOGIC SERVER

Inside-MarkLogic-Server

Inside-MarkLogic-Server

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

other transactions as the documents are being read (preventing non-repeatable<br />

reads). MarkLogic prevents some types of phantom reads by taking read locks on<br />

the documents in a search result. This prevents one transaction from removing or<br />

updating a document that another transaction has previously searched. However, this<br />

does not prevent a transaction from inserting a document into a results set that another<br />

transaction previously searched. That's the one loophole.<br />

How can a system guard against every possible phantom read? Usually it's not<br />

necessary. But when two transactions have to be fully Serializable, they can each<br />

programmatically get a lock on a sentinel document to ensure serialized execution.<br />

You can take read locks on a synthetic URI with fn:doc() and write locks with<br />

xdmp:lock-for-update().<br />

CODING AND CONNECTING TO <strong>MARKLOGIC</strong><br />

Now that we've covered MarkLogic's data model, indexing system, update model, and<br />

operational behaviors, let's look at the various options you have for programming and<br />

interacting with MarkLogic. First we'll look at the server-side language options (XQuery,<br />

XSLT, and JavaScript) that enable you to develop single-tier applications on MarkLogic.<br />

Then we'll look at multi-tier options that are based on communicating with MarkLogic's<br />

REST API. These include the Java and Node.js Client APIs, which enable you to build<br />

standard three-tier applications on MarkLogic.<br />

XQUERY AND XSLT<br />

MarkLogic includes support for XQuery 1.0 and XSLT 2.0. These are W3C-standard,<br />

XML-centric languages designed for processing, querying, and transforming XML.<br />

The server actually speaks three dialects of XQuery:<br />

1.0-ml<br />

The most common language choice. It's a full implementation of XQuery 1.0 with<br />

MarkLogic-specific extensions to support search, update, try/catch error handling, and<br />

other features that aren't in the XQuery 1.0 language.<br />

1.0<br />

Also called "strict." It's an implementation of XQuery 1.0 without any extensions,<br />

provided for compatibility with other XQuery 1.0 processors. You can still use<br />

MarkLogic-specific functions with 1.0 but you have to declare the function namespaces<br />

yourself, and of course those calls won't be portable. Language extensions such as the<br />

try/catch error handling aren't available.<br />

0.9-ml<br />

Included for backward compatibility. It's based on the May 2003 XQuery pre-release<br />

specification, which MarkLogic implemented in the years prior to XQuery 1.0.<br />

57

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!