Have the Capsule of XQuery in a single shot.
The technical lingual mechanism for the restoration of the data stored in the format of XML is how we define XQuery.
Specializations of XQuery
- Functional and Practically Implementable
- Similar to SQL
- Gridded on XPath
- Universally Invited
- W3C parameterized
Benefits of XQuery
- Query tree and graphical structures
- Query web pages
- Transformation of XML documents
- XML based Databases
- Object based Databases
Environment Set UP of XQuery
This chapter gives you a detail account about how to adapt XQuery library in the local development environment.
- Execution of XQuery counter XML
Your first XQuery App- Deploy your first app
- XQuery Expressions-
- How the Path Expressions are used?In order to trace the location of the portion of XML on which search is to be implemented Path Expressions are used.
- Iteration of the Objects-XML data is considered as XQuery objects.
- Application of the condition-
- Producing the output
The XQuery Layout and algorithm protocol
F- For- For the selection of a group of nodes
L-Let-position the output in the XQuery Variable form
W-Where- Selects the nodes satisfying specific constraints
O-Order BY- Sequences the nodes as per the given condition
R-Return- Gives the final output
XQuery –HTML Structure
The conversion of XML document into an HTML page becomes a cinch with XQuery.
Unlock the key whole with the suitable examples.
XQuery Path- XPath Flexible
XQuery follows the regulations of XPath. XPath Expressions are employed to constrict the search output on XML collections.
An array or ordered assimilation of data item of similar or different types.
- Creation of a SequenceSequences are built up using parenthesis and string in place of quotes and double quotes or XML elements can also comprise a sequence.
- Observing the items of the sequenceUsing the value or index the objects can be iterated sequentially. The Sequence Functions
- count($seq as item()*)It counts the number of items in the sequence.
- Sum($seq as item()*)It outputs the sum of the number of the items in the sequence.
- Avg($seq as item()*)It outputs the average value of the number of items in the sequence.
- Min($seq as item()*)It outputs the lowest valued item in the sequence.
- Distinct-values($seq as item()*)It returns selected distinct items from any sequence.
- Max($ seq as item()*)It outputs the highest value of the sequence.
- Subsequence($seq as item()*, $startingLoc as xs:double, $length as XS:DOUBLE)It returns the subset of the sequence.
- Insert-before($seq as item()*, $position as: integer, $inserts as item()*)Inserts any data item in the given sequence
- Remove($seq as item()*)It removes the data item from the given sequence.
- Reverse($ser as item()*)IT outputs the reverse of the sequence.
- Index-of($seq asbanyAtomicType()*, $target as anyAtomicTYpe())It outputs the index as integer to show the availability of any item within the given sequence.
- Last()It outputs the last element of the sequence when employed in predicate expression.
- Position()It is used in the FLOWR expressions to get the positions of the items in any sequence.
XML String Functions- The Manipulators
- string-length($string as xs:string) as xs:integerIt outputs the length of the given string.
- Concat($input as xs: anyAtomicType?) as xs:stringFor the concatenation of the string returned as output.
- String-join($sequence as xs:string*, $delimiter as xs:string) as xs:string
It outputs the combination of the data items which are separated by the delimiter in a sequence.
XQuery Date Functions
- Current-date()It generates the current date
- Current-time()It returns the present or the current time.
- It generates both current date and time.XQuery Regular Expressions
- Matches($input, $regex)It generates true if the input coordinates with the offered regular expression.
- Replace($input, $regex, $string)It replaces the given string with the matched input string.
- Tokenize($Input, $regex)It outputs a sequenceof data items which matches the regular expression.
XQuery –If-Then Else
XQuery offers a robust framework of if-then else which are the constraint which the input has to satisfy.
XQuery Customized Functions
You can write user end customized functions apart from inbuilt function in XQuery.