Skip to Content
MarkLogic Cookbook
book

MarkLogic Cookbook

by Dave Cassel
March 2018
Intermediate to advanced
34 pages
1h 33m
English
O'Reilly Media, Inc.
Content preview from MarkLogic Cookbook

Part III. Transforming Data

MarkLogic offers multiple ways to represent data. At one level, everything is represented as a document, but due to a wide variety of indexes, MarkLogic also supports SPARQL queries and updates on RDF triples, as well as SQL queries on rows extracted from document data.

This flexible representation provides one of MarkLogic’s biggest benefits: data modeling is not an up-front activity, but rather an iterative one. With a relational database, a schema must be built before data can be ingested. This means that for each data field, its type, format, cardinality, and relationships to other pieces of data must be established before the meaningful work of building an application—and delivering business value—can be started.

Iterative data modeling means that we load data in the form in which it is made available, then make adjustments to it as needed to address current requirements.

The Envelope Pattern

A common design pattern for integrating data from multiple sources into MarkLogic is called the Envelope Pattern. The content is preserved in its original form, but is wrapped in an extra layer of XML or JSON (depending on how it’s being stored). We can then identify a common piece of information that is represented differently across different sources and record a common form in each document. The approach often looks something like this:

<envelope>
  <canonical>
    <published>2017-11-02</published>
  </canonical>
  <article>
    <title>The Title of an Article</title> ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

XSLT Cookbook

XSLT Cookbook

Sal Mangano
XQuery

XQuery

Priscilla Walmsley

Publisher Resources

ISBN: 9781491994610