Posts

Indexing in Marklogic

Image
MarkLogic makes use of multiple types of indexes to resolve queries. Index Topics: The Universal Index Other Types of Indexes Index Size Fields Reindexing Relevance Indexing Document Metadata Fragmentation of XML Documents The Universal Index The universal index that indexes the XML or JSON structure(data) by default to make without any changes in Database or server configuration.  Universal Index is: Word Indexing Phrase Indexing Relationship Indexing Value Indexing Word and Phrase Indexing Word Indexing: Marklogic indexes every word or character during the ingestion of any document into Marklogic.  Inverted index feature enables MarkLogic Server to resolve word queries, which is a list of all of the words in all the documents in the database and, for each word, a list of which documents have that word. Inverted index: MarkLogic server index the XML or JSON data in form of a document-word relationship. An inverted index is called "inverted" because it inverts the relationshi

HTTP Servers, Database, Forest

Image
       HTTP Server(Hypertext Transfer Protocol): An HTTP Server is an application server with HTTP support and XQuery support, providing a server from which you execute XQuery programs via HTTP. You can create an HTTP server through the Admin UI page of the MarkLogic server. Please refer the screenshot-1 for the same. Screenshot-1: Or, You can also create an HTTP server with the help of the admin API function, (:Import admin api:) import module namespace admin = "http://marklogic.com/xdmp/admin"  at "/MarkLogic/admin.xqy"; (:Get the Config file of server:) let $config := admin:get-configuration() (: Get the Group ID file of server, if have created multiple Groups, please specify the Group name else it will be 'Default':) let $groupid := admin:group-get-id($config, "Default") (: Below is the function for creating the Server, It will take 7 parameters as mentioned below. 1. config file of Marklogic server. 2. Group ID 3. Server name which you want t

Marklogic Fundamentals

Image
 What is the MarkLogic server? Marklogic is an enterprise NoSQL multi-model database management system. It is a document-centric, transactional, search-centric, structure-aware, schema-agnostic, XQuery- and JavaScript-driven, high-performance, clustered, database server. NoSQL:           Flexibility and scalability Multi-Model:    We believe it stores all types of data in any format or shape. Enterprise : Marklogic provides ACID transactions, government-grade security.  Atomicity : Either all the data modifications in a transaction are performed or not being performed. Consistency :  When a transaction is completed, a transaction leaves all data in a consistent state.  Isolation :  Transactions run in isolation from one another.  Durability : After a transaction is completed, its effects remain even in cases of unexpected interruptions.      The Only Enterprise NoSQL Database Search & Query ACID Transactions Government-grade Security Scalability & Elasticity On-premises or Clou

Xquery Quiz

  Xquery Quiz Q1. What will be the output for the below query? Please do not execute this query on ML Qconsole for the answer, just think yourself the answer.  xquery version "1.0-ml"; let $a  := 'abc' let $b  := concat($a, if(fn:true()) then 'd' else 'e') return $b   Q2.  Please download attached XML ( sample_rentable_feed.xml ) and find the last 20 'Address' element where attribute value is ' AddressType="property" from the XML and create a table with below elements. <City>  <State>  <PostalCode> <Country> <CountyName>                    Q3. Use the above-shared XML and create a new XML for element 'Property' and save it with attribute IDValue if the last digit of element 'APN' should not be greater than ' 0061 '.  I'm talking about highlighted value <APN>08.032.21.32. 0061 </APN> i.e.  output name ' 2181740.xml ' and file content should be:   <Pr

Xquery functions

Xquery functions: Functions are a set of instructions bundled together to achieve a specific outcome. Functions are a good alternative to having repeating blocks of code in a program. Values can be passed to a function using variables – we call these parameters or arguments. XQuery provides the capability to write custom functions. Listed below are the guidelines to create a custom function. We can use predefined XQuery functions in code. We can also declare custom functions as per our requirements. Method overloading can be used in Xquery. Method recursion can be used in Xquery also. Below is the syntax to create custom functions in Xquery: declare function  prefix:function_name ($ parameter as datatype ) as  returnDatatype {  ... function code here ... }; Recursive functions example: 1. declare function local:check-num($num as xs:int) {  let $result :=   if($num gt 2) then ( let $cal := ($num - 1) return local:check-num($cal)      ) else(                  if($num eq

Xquery

Image
XQuery XQuery is a functional programming query language that is used to transform or querying XML or JSON, binary. etc., data. The language is developed by the XML Query a working group of the W3C. XQuery 1.0 [2003] became a W3C Recommendation on January 23, 2007.[4] All XQuery functions and types are written in lower-case. Case-sensitive language The string value can be in single or double code. Variable name defined with $ and cannot start with number Comment (::) A Complete query always follows the FLOWR expressions, without FLOWR expressions query will never be complete. F: for – Behave like Loop as for loop in java L: let – Uses for creating a variable O: order by – sort the result    W: where – filter the nodes/result R: return – return evaluated query result   👉 for / let and return are must keywords for creating any query. Example:               let $a := "abc" return $a              or              for $each in (1 to 10) return $each   Variables: There are t