Basic Concepts

Documents

The basic unit of organization in MarkLogic is a Document and the Java API enables you to store and search documents. The Java API supports documents encoded in JSON like

and XML like

The set of JSON keys, objects, and arrays, or XML elements and attributes you use in your documents is up to you. MarkLogic does not require adherence to any schemas.

MarkLogic also supports documents encoded in binary form or plain text as well. We refer to this encoding (JSON, XML, text, or binary) as the document's Format.

URIs

A document's URI is a key that you choose when you insert a document into the database. Each document has a unique URI. You use this URI to retrieve or refer to the document later. Typically document URIs begin with a slash like /beer.

Beyond the URI, MarkLogic maintains some additional metadata associated with each document including properties, permissions, and quality.

Organization

How does MarkLogic organize documents in the database? Logically, MarkLogic provides two concepts: Collections and Directories. You can think of collections as unordered sets. If you have a notion of tag as well, that may help. Collections can hold multiple documents and documents can belong to multiple collections.

Directories are similar in concept to the notion of directories or folders in file systems. They are hierarchical and membership is implicit based on the path syntax of URIs.

API basics

Ok, so that's what is stored in MarkLogic. What does the API look like? The first step whenever you want to interact with MarkLogic is to get a DatabaseClient instance:

The host and port (localhost and 8003 above) will be given to you by your database administrator.

You will also need some credentials (username and password) to access the server. You should get these from your database administrator as well. .

Introduction

CRUD APIs

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