+ All Categories
Home > Technology > Introduction to MarkLogic NoSQL

Introduction to MarkLogic NoSQL

Date post: 16-Jan-2017
Category:
Upload: vishal-punjabi
View: 192 times
Download: 4 times
Share this document with a friend
22
Intro to MarkLogic NoSQL XML,XPATH,XQUERY BASICS Visha l Pu njabi [email protected]
Transcript
Page 1: Introduction to MarkLogic NoSQL

Intro to MarkLogic NoSQL

XML,XPATH,XQUERYBASICS

Vishal Punjabi

[email protected]

Page 2: Introduction to MarkLogic NoSQL

Agenda

0XML 0XML Namespaces0XSLT0XPATH0XQUERY0Questions0 Intro to Mark Logic DB

Page 3: Introduction to MarkLogic NoSQL

XML

0XML stands for eXtensible Markup Language.0XML was designed to carry and store data, not to

display data.0XML tags are not predefined. You must define your

own tags.0XML is designed to be self-descriptive.

Page 4: Introduction to MarkLogic NoSQL

XML-An Example<?xml version="1.0" encoding="ISO-8859-1"?><bookstore>  <book category="COOKING">    <title lang="en">Everyday Italian</title>    <author>Giada De Laurentiis</author>    <year>2005</year>    <price>30.00</price>  </book>  <book category="CHILDREN">    <title lang="en">Harry Potter</title>    <author>J K. Rowling</author>    <year>2005</year>    <price>29.99</price>  </book>  <book category="WEB">    <title lang="en">Learning XML</title>    <author>Erik T. Ray</author>    <year>2003</year>    <price>39.95</price>  </book></bookstore>

Page 5: Introduction to MarkLogic NoSQL

Transforming XML

0Using CSShttp://www.w3schools.com/xml/cd_catalog_with_css.xmlhttp://www.w3schools.com/xml/cd_catalog.txt

0Using XSLThttp://www.w3schools.com/xml/tryxslt.asp?xmlfile=simple&xsltfile=simple

Page 6: Introduction to MarkLogic NoSQL

XML-Namespaces

0XML Namespaces provide a method to avoid element name conflicts.

<table>  <name>African Coffee Table</name>  <width>80</width>  <length>120</length></table>

<table>  <tr>    <td>Apples</td>    <td>Bananas</td>  </tr></table>

Page 7: Introduction to MarkLogic NoSQL

XML-Namespaces (cont..)

<h:table xmlns:h="http://www.w3.org/TR/html5/">  <h:tr>    <h:td>Apples</h:td>    <h:td>Bananas</h:td>  </h:tr></h:table>

<f:table xmlns:f="http://www.w3schools.com/furniture">  <f:name>African Coffee Table</f:name>  <f:width>80</f:width>  <f:length>120</f:length></f:table>

Page 8: Introduction to MarkLogic NoSQL

XPATH

0XPATH is a language for finding information in an XML document.

0XPATH uses path expressions to navigate in XML documents.

0XPATH contains a library of standard functions.

Page 9: Introduction to MarkLogic NoSQL

XPATH-Examples

0 /bookstore0 bookstore/book0 //book0 bookstore//book0 //@lang0 /bookstore/book[1] 0 /bookstore/book[last()]0 /bookstore/book[last()-1]0 /bookstore/book[position()<3]0 //title[@lang]0 //title[@lang='eng']

Page 10: Introduction to MarkLogic NoSQL

XPATH-Examples (cont..)

0/bookstore/book[price>35.00]0/bookstore/book[price>35.00]/title0/bookstore/*0//*0//title[@*]0//book/title | //book/price0//title | //price0/bookstore/book/title | //price0/bookstore/book/price/text()

Page 11: Introduction to MarkLogic NoSQL

XQUERY

0XQuery is the language for querying XML data

0XQuery for XML is like SQL for databases

0XQuery is built on XPATH expressions

0XQuery is a language for finding and extracting elements and attributes from XML documents.

Page 12: Introduction to MarkLogic NoSQL

XQUERY-FLWOR

0 FLWOR is an acronym for "For, Let, Where, Order by, Return".

0 for $x in doc("books.xml")/bookstore/bookwhere $x/price>30order by $x/titlereturn $x/title

0 Result:<title lang="en">Learning XML</title><title lang="en">XQuery Kick Start</title>

Page 13: Introduction to MarkLogic NoSQL

XQUERY-Examples (cont..)

0 declare function local:minPrice($p as xs:decimal?,$d as xs:decimal?)AS xs:decimal?{let $disc := ($p * $d) div 100return ($p - $disc)}

Below is an example of how to call the function above:

<minPrice>{local:minPrice($book/price,$book/discount)}</minPrice>

Page 14: Introduction to MarkLogic NoSQL

Questions ??

Page 15: Introduction to MarkLogic NoSQL

Mark Logic DB

0Next Generation Big Data database.0Proven at Petabyte scale (store and build applications

on billions of documents like log files, xmls, tweets, blogs, articles, journals, images etc)

0Usecases : Zinio, Wiley custom select, TR eReader.

Page 16: Introduction to MarkLogic NoSQL

Installation and Setup

Page 17: Introduction to MarkLogic NoSQL

Content Loading and Updates

0Loading0 Admin Bulk Load0 From Filesystem using xdmp:document-load0 From memory using xdmp:document-insert0 Webdav

0Updates0 xdmp-functions : node-insert-child, node-insert-after,

node-insert-before0 xdmp:save0 xdmp:document-delete

Page 18: Introduction to MarkLogic NoSQL

Mark Logic Search

0Find term/phrase in given set of content .0Relevance, order by a particular term.0Pagination, Snippets, Highlighting.0Facets.0Visualizations (tag clouds, heat map etc..)0Geospatial search.

Page 19: Introduction to MarkLogic NoSQL

Search API’s

0 cts: for core text search functions, such as cts:search() and cts:query.

for $plays in cts:search(fn:doc(),”kingdom”)[1 to 5] return $plays

0 search: for using the search API functions, such as search:search(“kingdom”,[<options></options]).

Page 20: Introduction to MarkLogic NoSQL
Page 21: Introduction to MarkLogic NoSQL

Twitter Feeds Search Example Application

Page 22: Introduction to MarkLogic NoSQL

Thank You


Recommended