Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
SEARCH AND JSEARCH APIS<br />
The Search API is a code-level XQuery library designed to make creating search<br />
applications easier. Used by the REST API, it combines searching, search parsing, an<br />
extensible/customizable search grammar, faceting, snippeting, search term completion,<br />
and other search application features into a single API. Even those who are expert in<br />
cts:query constructs can appreciate its help in transforming user-entered strings into<br />
cts:query hierarchies. For more information, see the Search API documentation.<br />
The JSearch API is a JavaScript library that makes it straightforward for JavaScript<br />
developers to execute complex searches in MarkLogic. JSearch includes many of the<br />
same features available through the Search API and cts: functions but also returns<br />
results as JavaScript objects, lets you chain your method calls, and offers convenience<br />
methods for snippet generation and faceting. For more information, see Creating<br />
JavaScript Search Applications.<br />
SPARQL FOR QUERYING TRIPLES<br />
You can access semantic data in MarkLogic with SPARQL, which is the standard<br />
language for querying for RDF triples. (For more information about semantic features,<br />
see the "Semantics" section.) SPARQL enables you to describe RDF triple patterns and<br />
then return the triples that match those patterns. Its syntax is similar to that of SQL.<br />
For example, the following SPARQL query returns a list of people born in Paris:<br />
SELECT ?s<br />
WHERE {<br />
?s <br />
<br />
}<br />
In MarkLogic, you can query using SPARQL in various ways:<br />
• Query Console can evaluate SPARQL directly, just like it can evaluate XQuery<br />
and JavaScript.<br />
• You can use server-side XQuery and JavaScript semantic functions, which accept<br />
SPARQL queries as arguments.<br />
• You can submit SPARQL queries to semantic endpoints to access triple data via the<br />
REST API.<br />
MarkLogic also supports SPARQL Update operations. SPARQL Update is a separate<br />
standard that lets you manage collections of semantic data (semantic graphs) by<br />
inserting and deleting RDF triples.<br />
For more information about SPARQL and MarkLogic, see the Semantics<br />
Developer's Guide.<br />
63