Posts

Showing posts with the label X-Query interview questions

FOR, SOME, EVERY, quantifiers in Xquery : Marklogic Quantified Expressions

 Let below XML file is stored in Marklogic DB.    <? xml version="1.0" encoding="UTF-8" ?> < catalog > < product dept =" WMN " commenced =" 2009-02-04 " > < number > 557 </ number > < name language =" en " > Linen Shirt </ name > < colorChoices > beige sage </ colorChoices > </ product > < product dept =" ACC " commenced =" 2009-02-04 " > < number > 563 </ number > < name language =" en " > Ten-Gallon Hat </ name > </ product > < product dept =" ACC " commenced =" 2012-01-01 " > < number > 443 </ number > < name language =" en " > Golf Umbrella </ name > </ product > < product dept =" MEN " commenced =" 2010-08-09 " > < number > 784 </ number > < name language =" en " > Rugby Shirt ...

Which type of triggers in MarkLogic?

When we want to automate some tasks when some CRUD operation performs on the Document. We use the trigger in Marklogic. There are two types of triggers in Marklogic. 1. Pre-commit Trigger 2. Post-commit Trigger 1. Pre-commit trigger:  Trigger fire before the transaction commits, if any error is found during transaction commit, the trigger is rolled back. 2. Post-commit trigger:  Trigger fire after the transaction commits, if any error is found during transaction commit, the trigger is not rolled back.

Database in MarkLogic and Forest?

Image
  Ans :   A database as a layer of abstraction between forests and HTTP, WebDAV, or XDBC servers. A database is made up of data forests that are configured on hosts within the same cluster but not necessarily in the same group. Multiple HTTP, XDBC, and WebDAV servers can be connected to the same database. Modules Database : The modules database is an auxiliary database that is used to store executable XQuery, JavaScript, and REST code.  During installation, a database named Modules is created, but any database can be used as a modules database, as long as the HTTP or XDBC server is configured to use it as a modules database.  Also, it is possible to use the same database to store executable modules, to store queryable documents, and/or store triggers. Forest : A forest is a collection of XML, JSON, text, or binary documents. Forest are physically stored inside the data folder of installed MarkLogic directory: Below is the screenshot: A forest can only be attached to ...

What is MarkLogic Server?

  Marklogic is an enterprise NoSQL multi-model database management system. Enterprise:  Marklogic provides ACID transactions and government-grade security.   Atomicity:   Either all the data modifications in a transaction are performed or none are performed. Consistency:     When completed, a transaction leaves all data in a consistent state.  Isolation:     Transactions run in isolation from one another.  Durability:   A fter a transaction is completed, its effects remain even in cases of unexpected interruptions.  No SQL:              Flexibility and scalability Multi-Model:   We believe it stores all type of data in any format or shape. Management System :

What is universal index and range index?

  Universal index : The universal index is the indexing process of MarkLogic that Marklogic performs automatically when data is loaded into MarkLogic. By default MarkLogic indexing below universal index: Word Indexing Phrase Indexing Relationship Indexing Value Indexing Word and Phrase Indexing Inverted index: An inverted index inverts the document-word relationship into a word-documents relationship.  Each entry in the inverted index is called a  term list .  Range Index:  Ranges index is also an indexing process in Marklogic but this index is created by the developer based on project requirements. When we need a fast result in the project, we create ranges indexes.   Path range index Element range index Element attribute range index etc...

The security model in Marklogic

  Ans: Three main principles used in MarkLogic Server security: Authentication and Access Control Authorization Administration Authentication and Access Control: Authentication is the process of verifying user credentials for a named user. Authorization: Authorization provides the mechanism to control document access, XQuery and JavaScript code execution, and document creation.  Administration: The administration is the process of defining, configuring, and managing the security objects, such as users, roles, privileges, and permissions that implement your security policies.  Role-Based Security Model (Authorization) Roles are the central point of authorization in the MarkLogic Server security model. Privileges, users, other roles, and document permissions all relate directly to roles. 

What is the difference between cts:API and search:search API?

  The Search API (e.g. search:search()) is an XQuery library that provides a high-level interface for some of the core capabilities of MarkLogic, such as search, facets, and aggregates. It uses the lower-level cts:* (and other) libraries under the covers but will save most developers a bunch of typing and debugging.

What is database replication in MarkLogic

  Database replication is a process to maintain the data of the current forest into another master MarkLogic database. 

MarkLogic server architecture.

Image
There are two layers that work in the complete Marklogic application.  The first is the  Data layer . Second  Query layer .   In the  Data layer : Marklogic stores data (in any format, XML, JSON, text, binary data, semantics ) at the bottom of the data layer. On bottom data, Marklogic creates universal index and range index also if defined. Marklogic also creates a cache and journal in the data layer. In all of this, there is also a transaction controller in the data layers. On came in the second layer.  This is the query layer where we evaluate the x query programs.

What is the basic difference between xdmp:spawn and xdmp:invoke a function in Marklogic.

 Aha..... Before understanding  xdmp:spawn-function and xdmp:invoke-function in Marklogic, we need to understand synchronous & asynchronous terms. Also, we need to know what is the main server, task server, and Transactions in the Marklogic. So I'm posting here the simple definition of each term that I mentioned here.  Synchronous and Asynchronous Task: Synchronous : In synchronous operations tasks are performed one at a time and you can't move the following task until the current task is finished. Asynchronous : In asynchronous operations, you can move to another task before the previous one finishes. Main Server : Task server: Transactions: Now,  We need to know what  asynchronous  functions &  asynchronous  functions in Marklogic are: Asynchronous Functions: xdmp:spawn : Place the specified module/query on the task queue for evaluation. This function places the specified module in the task queue to be processed. The module will be eva...

What is difference between xdmp:estimate and fn:count?

  Ans: Both functions are used for counting the fragments in Marklogic. The xdmp:estimate is fast because it measures through the index and fn:count function also counts the item but also validates in the index and document. But it is not guaranteed that xdmp:estimate & fn:count give the same result. Sometimes xdmp:estimate can give a false result. So fn:count function works slowly as compared to xdmp:estimate. Let's understand in deep, why fn:count & xdmp:estimate results are not the same.  Step-1: Upload below book catalog XML in Marklogic DB. <? xml version="1.0" encoding="UTF-8" ?> < catalog > < book id =" bk101 " > < author > Ralls, Kim </ author > < title > XML Developer's Guide </ title > < genre > Computer </ genre > < price > 44.95 </ price > < publish_date > 2000-10-01 </ publish_date > < description > An in-depth loo...