jumpstart: the basics for getting started ......marklogic database through the java api or node.js...
TRANSCRIPT
![Page 1: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/1.jpg)
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Ruth Stryker, Senior Courseware Developer and Technical Instructor, MarkLogic
JUMPSTART: THE BASICS FOR GETTING STARTED WITH MARKLOGIC
![Page 2: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/2.jpg)
SLIDE: 2
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
So we know that MarkLogic… Is an enterprise NoSQL database
Can be used for storing and searching data in a wide variety of structures and types
Can be used for all sorts of applications
Can be used to integrate data from silos
![Page 3: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/3.jpg)
SLIDE: 3
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Let’s get started with MarkLogic as we go through… Deciding on a project
Thinking about your application code
Creating a database
Bringing your data in
Querying your data
Using your data in an application
![Page 4: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/4.jpg)
SLIDE: 4
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Yell.com Small business directory
![Page 5: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/5.jpg)
SLIDE: 5
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Aetna Large health insurer with 35,000 employees, integrating more than 140 data feeds
140+ DATA FEEDS 50+ SYSTEMS
REAL-TIME APP
BATCH ANALYTICS
HR DATA HUB
EMPLOYEE DATA
PAYROLL DATA
EVALUATION DATA
OTHER SYSTEMS
REAL-TIME APP
REAL-TIME APP
![Page 6: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/6.jpg)
SLIDE: 6
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
MLU Training registration system
![Page 7: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/7.jpg)
SLIDE: 7
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Organization for Economic Cooperation and Development 34 country organization that promotes policies for improving the economic and social well-being of people around the world
![Page 8: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/8.jpg)
SLIDE: 8
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Deciding on a project Have a clear vision for it
Ideal would be to spec it out
Perhaps start with a small project
![Page 9: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/9.jpg)
SLIDE: 9
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
News Source articles from BBC
![Page 10: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/10.jpg)
SLIDE: 10
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
News Source articles from BBC
![Page 11: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/11.jpg)
SLIDE: 11
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Steps Deciding on a project
Think about your application code
Creating a database
Bringing your data in
Querying your data
Using your data in an application
![Page 12: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/12.jpg)
SLIDE: 12
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Think about your application code Data will be in a MarkLogic database
Application code can be inside or outside of MarkLogic
REST API
Java API
Node.js API
XQuery or JavaScript code
code
![Page 13: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/13.jpg)
SLIDE: 13
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Steps Deciding on a project
Think about your application code
Creating a database
Bringing your data in
Querying your data
Using your data in an application
![Page 14: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/14.jpg)
SLIDE: 14
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Install MarkLogic and start it running
![Page 15: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/15.jpg)
SLIDE: 15
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Install MarkLogic and start it running
![Page 16: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/16.jpg)
SLIDE: 16
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Create a database Can do through graphical interface or programmatically
![Page 17: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/17.jpg)
SLIDE: 17
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Create a database
![Page 18: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/18.jpg)
SLIDE: 18
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Where data is stored The data for a database is stored on the file system in a
compressed format in one or more forests
A database must have at least one forest attached to it, to be able to load data into the database
Database is logical
Forests are physical (a forest is a directory, or folder, on the file system)
![Page 19: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/19.jpg)
SLIDE: 19
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Create a forest
![Page 20: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/20.jpg)
SLIDE: 20
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Attaching a forest to a database
![Page 21: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/21.jpg)
SLIDE: 21
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Steps Deciding on a project
Think about your application code
Creating a database
Bringing your data in
Querying your data
Using your data in an application
![Page 22: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/22.jpg)
SLIDE: 22
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Bringing your data in Data is modeled/stored as a document
Document types are JSON, XML, text, binary, and RDF triple
Different types can all be in the same database
Documents can be loaded into a database through a variety of MarkLogic interfaces
![Page 23: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/23.jpg)
SLIDE: 23
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Example: JSON document { "article": { "title": "Angelina Jolie mobbed by media on Greece migrant trip", "date": "2016-03-16", "content": "Angelina Jolie was mobbed by the media while visiting a migrant reception center in Piraeus, near Athens, Greece. The actor was there in her role as Special Envoy of the UN High Commissioner for Refugees, highlighting the migrant crisis." } }
![Page 24: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/24.jpg)
SLIDE: 24
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Example: XML document <article> <title>Angelina Jolie mobbed by media on Greece migrant trip</title> <date>2016-03-16</date> <content>Angelina Jolie was mobbed by the media while visiting a migrant reception centre in Piraeus, near Athens, Greece. The actor was there in her role as Special Envoy of the UN High Commissioner for Refugees, highlighting the migrant crisis.</content> </article>
![Page 25: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/25.jpg)
SLIDE: 25
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Text documents Have no structure
But can be searched
![Page 26: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/26.jpg)
SLIDE: 26
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Binary documents Includes most other types (e.g. images, video, etc.)
Cannot be searched
But any properties (e.g. metadata) included with the document can be searched
Documents in some binary formats (e.g. PDF or Word) can be converted to an XML document while being loaded into a MarkLogic database by using the Content Processing Framework
![Page 27: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/27.jpg)
SLIDE: 27
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Example: RDF triple (for semantics) <sem:triple>
<sem:subject> http://dbpedia.org/resource/Greece </sem:subject> <sem:predicate> http://www.w3.org/1999/02/22-rdf-syntax-ns#type </sem:predicate> <sem:object> http://dbpedia.org/ontology/Country </sem:object>
</sem:triple>
![Page 28: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/28.jpg)
SLIDE: 28
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
![Page 29: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/29.jpg)
SLIDE: 29
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
![Page 30: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/30.jpg)
SLIDE: 30
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
![Page 31: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/31.jpg)
SLIDE: 31
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
![Page 32: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/32.jpg)
SLIDE: 32
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
![Page 33: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/33.jpg)
SLIDE: 33
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Source documents to load
C:\mls-projects\news\docs_to_load
![Page 34: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/34.jpg)
SLIDE: 34
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Loading documents Can be done through a variety of MarkLogic interfaces, including:
MarkLogic Content Pump
Query Console (XQuery or JavaScript)
REST API
Node.js API or Java API
Content Processing Framework
![Page 35: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/35.jpg)
SLIDE: 35
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Using MarkLogic Content Pump Java-based command line tool
Requires:
JRE 1.6 or later
MLCP files (can be downloaded from developer.marklogic.com/products/mlcp)
A port for connecting to the database
![Page 36: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/36.jpg)
SLIDE: 36
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Creating a REST API Instance Basically, setting up a port for being able to connect to a MarkLogic database
Benefits of a REST API instance:
Can load documents through it
Can read documents
Can search the database
And more…
To create a REST API instance, need to send a configuration file to MarkLogic that specifies a port to set up
![Page 37: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/37.jpg)
SLIDE: 37
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Creating a REST API Instance Example configuration file: <rest-api xmlns="http://marklogic.com/rest-api"> <name>8011-news-rest</name> <database>news</database> <port>8011</port> </rest-api>
![Page 38: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/38.jpg)
SLIDE: 38
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Creating a REST API Instance Example of sending the configuration file to MarkLogic:
curl --anyauth --user admin:admin -X POST -d@"../mls-projects/news/rest-config.xml" -i -H "Content-type: application/xml" http://localhost:8002/v1/rest-apis
![Page 39: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/39.jpg)
SLIDE: 39
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Seeing that a REST API Instance has been set up
![Page 40: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/40.jpg)
SLIDE: 40
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Loading documents with MLCP
mlcp.bat import -host localhost -port 8011 -username admin -password admin -input_file_path C:\\mls-projects\\news\\docs_to_load -mode local -input_file_type documents -output_collections "http://www.bbc.co.uk/news/content" -output_uri_replace "C:/mls-projects/news/docs_to_load,'content/news'"
![Page 41: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/41.jpg)
SLIDE: 41
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Viewing database documents
![Page 42: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/42.jpg)
SLIDE: 42
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Steps Deciding on a project
Think about your application code
Creating a database
Bringing your data in
Querying your data
Using your data in an application
![Page 43: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/43.jpg)
SLIDE: 43
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Searching a database Can be done through any of the programming interfaces, including:
Query Console (XQuery or JavaScript, or SPARQL for triples)
REST API
Node.js API or Java API
Hosted XQuery or JavaScript application
![Page 44: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/44.jpg)
SLIDE: 44
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Using XQuery cts:search()
![Page 45: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/45.jpg)
SLIDE: 45
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Using XQuery cts:search() in a for loop
![Page 46: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/46.jpg)
SLIDE: 46
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Using XQuery cts:search()
![Page 47: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/47.jpg)
SLIDE: 47
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Using JavaScript cts.search()
![Page 48: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/48.jpg)
SLIDE: 48
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Using JavaScript cts.search()
![Page 49: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/49.jpg)
SLIDE: 49
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Using XQuery search:search()
![Page 50: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/50.jpg)
SLIDE: 50
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Snippets and highlighting in use
![Page 51: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/51.jpg)
SLIDE: 51
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Using JavaScript search.search()
![Page 52: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/52.jpg)
SLIDE: 52
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
JSearch Designed for JavaScript developers searching JSON documents
Features:
Input and output is in the form of JavaScript objects
A fluent call chain pattern that is natural for JavaScript
Powerful convenience methods for operations such as snippet generation and faceting
![Page 53: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/53.jpg)
SLIDE: 53
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Using the REST API for search
curl --anyauth --user admin:admin -X GET "http://localhost:8011/v1/search?q=earthquake"
![Page 54: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/54.jpg)
SLIDE: 54
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Steps Deciding on a project
Think about your application code
Creating a database
Bringing your data in
Querying your data
Using your data in an application
![Page 55: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/55.jpg)
SLIDE: 55
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Using your data in an application Understanding the application programming interfaces
Example: Standing up an XQuery application
Seeing the full-feature application
![Page 56: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/56.jpg)
SLIDE: 56
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Understanding the application programming interfaces If you write your application in XQuery or JavaScript, the application code can
be hosted by MarkLogic
If you write your application in Java or Node.js, it can communicate with your MarkLogic database through the Java API or Node.js API
If you write your application in any other language (that can make HTTP requests, such as C#, Python, PHP, etc.), it can communicate with your MarkLogic database through the REST API
![Page 57: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/57.jpg)
SLIDE: 57
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Example: Setting up an XQuery application Have a location for your XQuery application code
Create an HTTP App Server that:
Has a port
References the location of the application code
References the database
![Page 58: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/58.jpg)
SLIDE: 58
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Have a location for your XQuery application code
Can be on the file system, or in a second MarkLogic database (a.k.a. a ‘modules’ database)
![Page 59: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/59.jpg)
SLIDE: 59
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Create an HTTP App Server
![Page 60: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/60.jpg)
SLIDE: 60
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
See that the application page displays
![Page 61: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/61.jpg)
SLIDE: 61
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Add the rest of the application files
![Page 62: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/62.jpg)
SLIDE: 62
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Use the application
![Page 63: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/63.jpg)
SLIDE: 63
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Understand the application with semantics
![Page 64: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/64.jpg)
SLIDE: 64
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
![Page 65: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/65.jpg)
SLIDE: 65
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
![Page 66: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/66.jpg)
SLIDE: 66
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
![Page 67: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/67.jpg)
SLIDE: 67
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Can access the project files on GitHub
Simple project:
github.com/mlruthstryker/simple-news-app
Advanced project (with semantics functionality):
github.com/marklogic/semantic-news-search
![Page 68: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/68.jpg)
SLIDE: 68
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
Steps Deciding on a project
Thinking about your application code
Creating a database
Bringing your data in
Querying your data
Using your data in an application
![Page 69: JUMPSTART: THE BASICS FOR GETTING STARTED ......MarkLogic database through the Java API or Node.js API If you write your application in any other language (that can make HTTP requests,](https://reader033.vdocuments.us/reader033/viewer/2022042310/5ed7835f7bbb9f68866aa5d2/html5/thumbnails/69.jpg)
SLIDE: 69
© COPYRIGHT 2016 MARKLOGIC CORPORATION. ALL RIGHTS RESERVED.
What to do next Attend the MarkLogic Fundamentals course (hands-on) marklogic.com/training
Read the MarkLogic guides docs.marklogic.com
Watch feature-focused training videos mlu.marklogic.com/ondemand
Ask questions on the developer mailing list developer.marklogic.com/discuss