Introduction to MarkLogic NoSQL
-
Upload
vishal-punjabi -
Category
Technology
-
view
211 -
download
4
Transcript of Introduction to MarkLogic NoSQL
Agenda
0XML 0XML Namespaces0XSLT0XPATH0XQUERY0Questions0 Intro to Mark Logic DB
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.
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>
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
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>
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>
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.
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']
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()
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.
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>
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>
Questions ??
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.
Installation and Setup
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
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.
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]).
Twitter Feeds Search Example Application
Thank You