Builtin Definitions : XQuery 1.0 and XPath 2.0 Functions and Operators

(: XQuery 1.0 and XPath 2.0 Functions and Operators
 : W3C Recommendation 23 January 2007
 :
 : Reference: https://www.w3.org/TR/2007/REC-xpath-functions-20070123/
 :)
xquery version "3.0";

module  namespace fn = "http://www.w3.org/2005/xpath-functions";
declare namespace xs = "http://www.w3.org/2001/XMLSchema";

declare %private type numeric = ( xs:integer | xs:decimal | xs:float | xs:double );

declare function fn:QName($paramURI as xs:string?, $paramQName as xs:string) as xs:QName external; (: §11.1.2 :)
declare function fn:abs($arg as numeric?) as numeric? external; (: §6.4.1 :)
declare function fn:adjust-date-to-timezone($arg as xs:date?) as xs:date? external; (: §10.7.2 :)
declare function fn:adjust-date-to-timezone($arg as xs:date?, $timezone as xs:dayTimeDuration?) as xs:date? external; (: §10.7.2 :)
declare function fn:adjust-dateTime-to-timezone($arg as xs:dateTime?) as xs:dateTime? external; (: §10.7.1 :)
declare function fn:adjust-dateTime-to-timezone($arg as xs:dateTime?, $timezone as xs:dayTimeDuration?) as xs:dateTime? external; (: §10.7.1 :)
declare function fn:adjust-time-to-timezone($arg as xs:time?) as xs:time? external; (: §10.7.3 :)
declare function fn:adjust-time-to-timezone($arg as xs:time?, $timezone as xs:dayTimeDuration?) as xs:time? external; (: §10.7.3 :)
declare function fn:avg($arg as xs:anyAtomicType*) as xs:anyAtomicType? external; (: §15.4.2 :)
declare function fn:base-uri() as xs:anyURI? external; (: §2.5 :)
declare function fn:base-uri($arg as node()?) as xs:anyURI? external; (: §2.5 :)
declare function fn:boolean($arg as item()*) as xs:boolean external; (: §15.1.1 :)
declare function fn:ceiling($arg as numeric?) as numeric? external; (: §6.4.2 :)
declare function fn:codepoint-equal($comparand1 as xs:string?, $comparand2 as xs:string?) as xs:boolean? external; (: §7.3.3 :)
declare function fn:codepoints-to-string($arg as xs:integer*) as xs:string external; (: §7.2.1 :)
declare function fn:collection() as node()* external; (: §15.5.6 :)
declare function fn:collection($arg as xs:string?) as node()* external; (: §15.5.6 :)
declare function fn:compare($comparand1 as xs:string?, $comparand2 as xs:string?) as xs:integer? external; (: §7.3.2 :)
declare function fn:compare($comparand1 as xs:string?, $comparand2 as xs:string?, $collation as xs:string) as xs:integer? external; (: §7.3.2 :)
declare %variadic("xs:anyAtomicType?") function fn:concat($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as xs:string external; (: §7.4.1 :)
declare function fn:contains($arg1 as xs:string?, $arg2 as xs:string?) as xs:boolean external; (: §7.5.1 :)
declare function fn:contains($arg1 as xs:string?, $arg2 as xs:string?, $collation as xs:string) as xs:boolean external; (: §7.5.1 :)
declare function fn:count($arg as item()*) as xs:integer external; (: §15.4.1 :)
declare function fn:current-date() as xs:date external; (: §16.4 :)
declare function fn:current-dateTime() as xs:dateTime external; (: §16.3 :)
declare function fn:current-time() as xs:time external; (: §16.5 :)
declare function fn:data($arg as item()*) as xs:anyAtomicType* external; (: §2.4 :)
declare function fn:dateTime($arg1 as xs:date?, $arg2 as xs:time?) as xs:dateTime? external; (: §5.2 :)
declare function fn:day-from-date($arg as xs:date?) as xs:integer? external; (: §10.5.16 :)
declare function fn:day-from-dateTime($arg as xs:dateTime?) as xs:integer? external; (: §10.5.9 :)
declare function fn:days-from-duration($arg as xs:duration?) as xs:integer? external; (: §10.5.3 :)
declare function fn:deep-equal($parameter1 as item()*, $parameter2 as item()*) as xs:boolean external; (: §15.3.1 :)
declare function fn:deep-equal($parameter1 as item()*, $parameter2 as item()*, $collation as string) as xs:boolean external; (: §15.3.1 :)
declare function fn:default-collation() as xs:string external; (: §16.7 :)
declare function fn:distinct-values($arg as xs:anyAtomicType*) as xs:anyAtomicType* external; (: §15.1.6 :)
declare function fn:distinct-values($arg as xs:anyAtomicType*, $collation as xs:string) as xs:anyAtomicType* external; (: §15.1.6 :)
declare function fn:doc($uri as xs:string?) as document-node()? external; (: §15.5.4 :)
declare function fn:doc-available($uri as xs:string?) as xs:boolean external; (: §15.5.5 :)
declare function fn:document-uri($arg as node()?) as xs:anyURI? external; (: §2.6 :)
declare function fn:empty($arg as item()*) as xs:boolean external; (: §15.1.4 :)
declare function fn:encode-for-uri($uri-part as xs:string?) as xs:string external; (: §7.4.10 :)
declare function fn:ends-with($arg1 as xs:string?, $arg2 as xs:string?) as xs:boolean external; (: §7.5.3 :)
declare function fn:ends-with($arg1 as xs:string?, $arg2 as xs:string?, $collation as xs:string) as xs:boolean external; (: §7.5.3 :)
declare function fn:error() as none external; (: §3 :)
declare function fn:error($error as xs:QName) as none external; (: §3 :)
declare function fn:error($error as xs:QName?, $description as xs:string) as none external; (: §3 :)
declare function fn:error($error as xs:QName?, $description as xs:string, $error-object as item()*) as none external; (: §3 :)
declare function fn:escape-html-uri($uri as xs:string?) as xs:string external; (: §7.4.12 :)
declare function fn:exactly-one($arg as item()*) as item() external; (: §15.2.3 :)
declare function fn:exists($arg as item()*) as xs:boolean external; (: §15.1.5 :)
declare function fn:false() as xs:boolean external; (: §9.1.2 :)
declare function fn:floor($arg as numeric?) as numeric? external; (: §6.4.3 :)
declare function fn:hours-from-dateTime($arg as xs:dateTime?) as xs:integer? external; (: §10.5.10 :)
declare function fn:hours-from-duration($arg as xs:duration?) as xs:integer? external; (: §10.5.4 :)
declare function fn:hours-from-time($arg as xs:time?) as xs:integer? external; (: §10.5.18 :)
declare function fn:id($arg as xs:string*) as element()* external; (: §15.5.2 :)
declare function fn:id($arg as xs:string*, $node as node()) as element()* external; (: §15.5.2 :)
declare function fn:idref($arg as xs:string*) as node()* external; (: §15.5.3 :)
declare function fn:idref($arg as xs:string*, $node as node()) as node()* external; (: §15.5.3 :)
declare function fn:implicit-timezone() as xs:dayTimeDuration external; (: §16.6 :)
declare function fn:in-scope-prefixes($element as element()) as xs:string* external; (: §11.2.6 :)
declare function fn:index-of($seqParam as xs:anyAtomicType*, $srchParam as xs:anyAtomicType) as xs:integer* external; (: §15.1.3 :)
declare function fn:index-of($seqParam as xs:anyAtomicType*, $srchParam as xs:anyAtomicType, $collation as xs:string) as xs:integer* external; (: §15.1.3 :)
declare function fn:insert-before($target as item()*, $position as xs:integer, $inserts as item()*) as item()* external; (: §15.1.7 :)
declare function fn:iri-to-uri($iri as xs:string?) as xs:string external; (: §7.4.11 :)
declare function fn:lang($testlang as xs:string?) as xs:boolean external; (: §14.5 :)
declare function fn:lang($testlang as xs:string?, $node as node()) as xs:boolean external; (: §14.5 :)
declare function fn:last() as xs:integer external; (: §16.2 :)
declare function fn:local-name() as xs:string external; (: §14.2 :)
declare function fn:local-name($arg as node()?) as xs:string external; (: §14.2 :)
declare function fn:local-name-from-QName($arg as xs:QName?) as xs:NCName? external; (: §11.2.3 :)
declare function fn:lower-case($arg as xs:string?) as xs:string external; (: §7.4.8 :)
declare function fn:matches($input as xs:string?, $pattern as xs:string) as xs:boolean external; (: §7.6.2 :)
declare function fn:matches($input as xs:string?, $pattern as xs:string, $flags as xs:string) as xs:boolean external; (: §7.6.2 :)
declare function fn:max($arg as xs:anyAtomicType*) as xs:anyAtomicType? external; (: §15.4.3 :)
declare function fn:max($arg as xs:anyAtomicType*, $collation as string) as xs:anyAtomicType? external; (: §15.4.3 :)
declare function fn:min($arg as xs:anyAtomicType*) as xs:anyAtomicType? external; (: §15.4.4 :)
declare function fn:min($arg as xs:anyAtomicType*, $collation as string) as xs:anyAtomicType? external; (: §15.4.4 :)
declare function fn:minutes-from-dateTime($arg as xs:dateTime?) as xs:integer? external; (: §10.5.11 :)
declare function fn:minutes-from-duration($arg as xs:duration?) as xs:integer? external; (: §10.5.5 :)
declare function fn:minutes-from-time($arg as xs:time?) as xs:integer? external; (: §10.5.19 :)
declare function fn:month-from-date($arg as xs:date?) as xs:integer? external; (: §10.5.15 :)
declare function fn:month-from-dateTime($arg as xs:dateTime?) as xs:integer? external; (: §10.5.8 :)
declare function fn:months-from-duration($arg as xs:duration?) as xs:integer? external; (: §10.5.2 :)
declare function fn:name() as xs:string external; (: §14.1 :)
declare function fn:name($arg as node()?) as xs:string external; (: §14.1 :)
declare function fn:namespace-uri() as xs:anyURI external; (: §14.3 :)
declare function fn:namespace-uri($arg as node()?) as xs:anyURI external; (: §14.3 :)
declare function fn:namespace-uri-for-prefix($prefix as xs:string?, $element as element()) as xs:anyURI? external; (: §11.2.5 :)
declare function fn:namespace-uri-from-QName($arg as xs:QName?) as xs:anyURI? external; (: §11.2.4 :)
declare function fn:nilled($arg as node()?) as xs:boolean? external; (: §2.2 :)
declare function fn:node-name($arg as node()?) as xs:QName? external; (: §2.1 :)
declare function fn:normalize-space() as xs:string external; (: §7.4.5 :)
declare function fn:normalize-space($arg as xs:string?) as xs:string external; (: §7.4.5 :)
declare function fn:normalize-unicode($arg as xs:string?) as xs:string external; (: §7.4.6 :)
declare function fn:normalize-unicode($arg as xs:string?, $normalizationForm as xs:string) as xs:string external; (: §7.4.6 :)
declare function fn:not($arg as item()*) as xs:boolean external; (: §9.3.1 :)
declare function fn:number() as xs:double external; (: §14.4 :)
declare function fn:number($arg as xs:anyAtomicType?) as xs:double external; (: §14.4 :)
declare function fn:one-or-more($arg as item()*) as item()+ external; (: §15.2.2 :)
declare function fn:position() as xs:integer external; (: §16.1 :)
declare function fn:prefix-from-QName($arg as xs:QName?) as xs:NCName? external; (: §11.2.2 :)
declare function fn:remove($target as item()*, $position as xs:integer) as item()* external; (: §15.1.8 :)
declare function fn:replace($input as xs:string?, $pattern as xs:string, $replacement as xs:string) as xs:string external; (: §7.6.3 :)
declare function fn:replace($input as xs:string?, $pattern as xs:string, $replacement as xs:string, $flags as xs:string) as xs:string external; (: §7.6.3 :)
declare function fn:resolve-QName($qname as xs:string?, $element as element()) as xs:QName? external; (: §11.1.1 :)
declare function fn:resolve-uri($relative as xs:string?) as xs:anyURI? external; (: §8.1 :)
declare function fn:resolve-uri($relative as xs:string?, $base as xs:string) as xs:anyURI? external; (: §8.1 :)
declare function fn:reverse($arg as item()*) as item()* external; (: §15.1.9 :)
declare function fn:root() as node() external; (: §14.9 :)
declare function fn:root($arg as node()?) as node()? external; (: §14.9 :)
declare function fn:round($arg as numeric?) as numeric? external; (: §6.4.4 :)
declare function fn:round-half-to-even($arg as numeric?) as numeric? external; (: §6.4.5 :)
declare function fn:round-half-to-even($arg as numeric?, $precision as xs:integer) as numeric? external; (: §6.4.5 :)
declare function fn:seconds-from-dateTime($arg as xs:dateTime?) as xs:decimal? external; (: §10.5.12 :)
declare function fn:seconds-from-duration($arg as xs:duration?) as xs:decimal? external; (: §10.5.6 :)
declare function fn:seconds-from-time($arg as xs:time?) as xs:decimal? external; (: §10.5.20 :)
declare function fn:starts-with($arg1 as xs:string?, $arg2 as xs:string?) as xs:boolean external; (: §7.5.2 :)
declare function fn:starts-with($arg1 as xs:string?, $arg2 as xs:string?, $collation as xs:string) as xs:boolean external; (: §7.5.2 :)
declare function fn:static-base-uri() as xs:anyURI? external; (: §16.8 :)
declare function fn:string() as xs:string external; (: §2.3 :)
declare function fn:string($arg as item()?) as xs:string external; (: §2.3 :)
declare function fn:string-join($arg1 as xs:string*, $arg2 as xs:string) as xs:string external; (: §7.4.2 :)
declare function fn:string-length() as xs:integer external; (: §7.4.4 :)
declare function fn:string-length($arg as xs:string?) as xs:integer external; (: §7.4.4 :)
declare function fn:string-to-codepoints($arg as xs:string?) as xs:integer* external; (: §7.2.2 :)
declare function fn:subsequence($sourceSeq as item()*, $startingLoc as xs:double) as item()* external; (: §15.1.10 :)
declare function fn:subsequence($sourceSeq as item()*, $startingLoc as xs:double, $length as xs:double) as item()* external; (: §15.1.10 :)
declare function fn:substring($sourceString as xs:string?, $startingLoc as xs:double) as xs:string external; (: §7.4.3 :)
declare function fn:substring($sourceString as xs:string?, $startingLoc as xs:double, $length as xs:double) as xs:string external; (: §7.4.3 :)
declare function fn:substring-after($arg1 as xs:string?, $arg2 as xs:string?) as xs:string external; (: §7.5.5 :)
declare function fn:substring-after($arg1 as xs:string?, $arg2 as xs:string?, $collation as xs:string) as xs:string external; (: §7.5.5 :)
declare function fn:substring-before($arg1 as xs:string?, $arg2 as xs:string?) as xs:string external; (: §7.5.4 :)
declare function fn:substring-before($arg1 as xs:string?, $arg2 as xs:string?, $collation as xs:string) as xs:string external; (: §7.5.4 :)
declare function fn:sum($arg as xs:anyAtomicType*) as xs:anyAtomicType external; (: §15.4.5 :)
declare function fn:sum($arg as xs:anyAtomicType*, $zero as xs:anyAtomicType?) as xs:anyAtomicType? external; (: §15.4.5 :)
declare function fn:timezone-from-date($arg as xs:date?) as xs:dayTimeDuration? external; (: §10.5.17 :)
declare function fn:timezone-from-dateTime($arg as xs:dateTime?) as xs:dayTimeDuration? external; (: §10.5.13 :)
declare function fn:timezone-from-time($arg as xs:time?) as xs:dayTimeDuration? external; (: §10.5.21 :)
declare function fn:tokenize($input as xs:string?, $pattern as xs:string) as xs:string* external; (: §7.6.4 :)
declare function fn:tokenize($input as xs:string?, $pattern as xs:string, $flags as xs:string) as xs:string* external; (: §7.6.4 :)
declare function fn:trace($value as item()*, $label as xs:string) as item()* external; (: §4 :)
declare function fn:translate($arg as xs:string?, $mapString as xs:string, $transString as xs:string) as xs:string external; (: §7.4.9 :)
declare function fn:true() as xs:boolean external; (: §9.1.1 :)
declare function fn:unordered($sourceSeq as item()*) as item()* external; (: §15.1.11 :)
declare function fn:upper-case($arg as xs:string?) as xs:string external; (: §7.4.7 :)
declare function fn:year-from-date($arg as xs:date?) as xs:integer? external; (: §10.5.14 :)
declare function fn:year-from-dateTime($arg as xs:dateTime?) as xs:integer? external; (: §10.5.7 :)
declare function fn:years-from-duration($arg as xs:duration?) as xs:integer? external; (: §10.5.1 :)
declare function fn:zero-or-one($arg as item()*) as item()? external; (: §15.2.1 :)

error: pathspec 'src/main/resources/builtin/REC-xpath-functions-20070123/fn.xqy' did not match any file(s) known to git


Page containing SVGs to crawl for Clare's anniversary present.

error: pathspec 'scripts/server/svg/tags.xq' did not match any file(s) known to git


removing declaration of built-in lux namespace

git-svn-id: 70ea2e2438545e53c1a57116d9bc498ccdd9cff9@1343 d2cdb213-60f8-4f1b-b4b2-f6b941818144

xquery version "1.0";

declare namespace demo="http://luxproject.net/demo";

import module namespace layout="http://luxproject.net/layout" at "src/main/webapp/layout.xqy";
import module namespace search="http://luxproject.net/search" at "src/main/webapp/search-lib.xqy";

declare variable $lux:http as document-node() external;

(: Search Page

    TODO: document parameters, autocomplete behavior, pagination, view
          dispatcher, search results formatting :)

declare function demo:search-results ($query, $start as xs:int, $page-size as xs:int, $sort as xs:string?)
{
  for $doc in subsequence(lux:search ($query, (), $sort), $start, $page-size)
  let $doctype := name($doc/*)
  let $stylesheet-name := concat("file:src/main/webapp/", $doctype, "-result.xsl")
  let $result-markup :=
    if (doc-available ($stylesheet-name)) then
      lux:transform (doc($stylesheet-name), $doc)
    else
    {$doc/base-uri()}
    return
{$result-markup}

};

declare function demo:search ($params as element(param)*, $start as xs:integer, $page-size as xs:integer)
{
let $qname := $params[@name='qname']/value/string()
let $term := $params[@name='term']/value/string()
let $sort := $params[@name='sort']/value/string()
let $query := search:query ($qname, $term)
let $total := if ($query) then lux:count ($query) else 0
return
<search-results total="{$total}">{
  if ($query) then demo:search-results ($query, $start, $page-size, $sort) else ()
}</search-results>
};

declare function demo:search () {
let $page-size := 20
let $params := $lux:http/http/params/param
let $start as xs:integer := if (number($params[@name='start'])) then number($params[@name='start']) else 1
let $results := demo:search ($params, $start, $page-size)
let $next := $start + count($results/*)
let $body :=

    <form action="index.xqy" id="search" name="search">
      { search:search-controls ($params) }
      { search:search-description ($start, $results/@total, $next, $params) }
    </form>

{$results/*}

    { search:search-pagination ($start, $results/@total, $next, $page-size) }

titles: { subsequence (lux:field-terms ("title", "a"), 1, 10) }

    { search:javascript-postamble () }
    {
      let $qname := $params[@name='qname'] where not ($qname) return

    }
  /*

return layout:outer($lux:http/http/@uri, $body)
};

demo:search()

xquery version "1.0";

declare namespace lux="http://luxproject.net";
declare namespace demo="http://luxproject.net/demo";

import module namespace layout="http://luxproject.net/layout" at "src/main/webapp/layout.xqy";
import module namespace search="http://luxproject.net/search" at "src/main/webapp/search-lib.xqy";

declare variable $lux:http as document-node() external;

(: Search Page

    TODO: document parameters, autocomplete behavior, pagination, view
          dispatcher, search results formatting :)

declare function demo:search-results ($query, $start as xs:int, $page-size as xs:int, $sort as xs:string?)
{
  for $doc in subsequence(lux:search ($query, (), $sort), $start, $page-size)
  let $doctype := name($doc/*)
  let $stylesheet-name := concat("file:src/main/webapp/", $doctype, "-result.xsl")
  let $result-markup :=
    if (doc-available ($stylesheet-name)) then
      lux:transform (doc($stylesheet-name), $doc)
    else
    {$doc/base-uri()}
    return
{$result-markup}

};

declare function demo:search ($params as element(param)*, $start as xs:integer, $page-size as xs:integer)
{
let $qname := $params[@name='qname']/value/string()
let $term := $params[@name='term']/value/string()
let $sort := $params[@name='sort']/value/string()
let $query := search:query ($qname, $term)
let $total := if ($query) then lux:count ($query) else 0
return
<search-results total="{$total}">{
  if ($query) then demo:search-results ($query, $start, $page-size, $sort) else ()
}</search-results>
};

declare function demo:search () {
let $page-size := 20
let $params := $lux:http/http/params/param
let $start as xs:integer := if (number($params[@name='start'])) then number($params[@name='start']) else 1
let $results := demo:search ($params, $start, $page-size)
let $next := $start + count($results/*)
let $body :=

    <form action="index.xqy" id="search" name="search">
      { search:search-controls ($params) }
      { search:search-description ($start, $results/@total, $next, $params) }
    </form>

{$results/*}

    { search:search-pagination ($start, $results/@total, $next, $page-size) }

titles: { subsequence (lux:field-terms ("title", "a"), 1, 10) }

    { search:javascript-postamble () }
    {
      let $qname := $params[@name='qname'] where not ($qname) return

    }
  /*

return layout:outer($lux:http/http/@uri, $body)
};

demo:search()


Add tests

Add tests

fatal: unable to access 'https://github.com/xokomola/origami.git/': The requested URL returned error: 403


component code

component code

declare namespace ism = "urn:us:gov:ic:ism";
let $comp := fn:doc("/component-1.xml")
let $slide :=
  <p:sld xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
    <p:cSld>
      <p:spTree>
        <p:nvGrpSpPr>
          <p:cNvPr id="1" name=""/>
          <p:cNvGrpSpPr/>
          <p:nvPr/>
        </p:nvGrpSpPr>
        <p:grpSpPr>
          <a:xfrm>
            <a:off x="0" y="0"/>
            <a:ext cx="0" cy="0"/>
            <a:chOff x="0" y="0"/>
            <a:chExt cx="0" cy="0"/>
          </a:xfrm>
        </p:grpSpPr>
        <p:sp>
          <p:nvSpPr>
            <p:cNvPr id="2" name="Title 1"/>
            <p:cNvSpPr>
              <a:spLocks noGrp="1"/>
            </p:cNvSpPr>
            <p:nvPr>
              <p:ph type="ctrTitle"/>
            </p:nvPr>
          </p:nvSpPr>
          <p:spPr>
            <a:xfrm>
              <a:off x="990600" y="228600"/>
              <a:ext cx="7772400" cy="614728"/>
            </a:xfrm>
            <a:noFill/>
          </p:spPr>
          <p:txBody>
            <a:bodyPr>
              <a:normAutofit fontScale="90000"/>
            </a:bodyPr>
            <a:lstStyle/>
            <a:p>
              <a:r>
                <a:rPr dirty="0" lang="en-US" smtClean="0"/>
                <a:t>{$comp/*:component/*:name/text()}</a:t>
              </a:r>
              <a:endParaRPr dirty="0" lang="en-US"/>
            </a:p>
          </p:txBody>
        </p:sp>
        <p:sp>
          <p:nvSpPr>
            <p:cNvPr id="4" name="TextBox 3"/>
            <p:cNvSpPr txBox="1"/>
            <p:nvPr/>
          </p:nvSpPr>
          <p:spPr>
            <a:xfrm>
              <a:off x="1241321" y="1381240"/>
              <a:ext cx="7428829" cy="369332"/>
            </a:xfrm>
            <a:prstGeom prst="rect">
              <a:avLst/>
            </a:prstGeom>
            <a:noFill/>
          </p:spPr>
        </p:sp>
        <p:sp>
          <p:nvSpPr>
            <p:cNvPr id="3" name="Subtitle 3"/>
            <p:cNvSpPr>
              <a:spLocks noGrp="1"/>
            </p:cNvSpPr>
            <p:nvPr>
              <p:ph idx="1"/>
            </p:nvPr>
          </p:nvSpPr>
          <p:spPr>
            <a:xfrm>
              <a:off x="762000" y="914400"/>
              <a:ext cx="8229600" cy="2133600"/>
            </a:xfrm>
          </p:spPr>
          <p:txBody>
            <a:bodyPr>
              <a:normAutofit fontScale="85000" lnSpcReduction="20000"/>
            </a:bodyPr>
            <a:lstStyle/>
            <a:p>
              <a:r>
                <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1400"/>
                <a:t>NUMBER : {$comp/*:component/*:number/text()}</a:t>
              </a:r>
            </a:p>
            <a:p>
              <a:r>
                <a:rPr lang="en-US" smtClean="0" sz="1400"/>
                <a:t>CLASS</a:t>
              </a:r>
              <a:r>
                <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1400"/>
                <a:t>: </a:t>
              </a:r>
              <a:r>
                <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1400"/>
                <a:t>{$comp/*:component/*:class/text()}</a:t>
              </a:r>
            </a:p>
            <a:p>
              <a:r>
                <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1400"/>
                <a:t>SPONSORS: </a:t>
              </a:r>
              <a:r>
                <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1400"/>
                <a:t>{$comp/*:component/*:sponsors/text()}</a:t>
              </a:r>
              <a:endParaRPr dirty="0" lang="en-US" sz="1400"/>
            </a:p>
            <a:p>
              <a:r>
                <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1400"/>
                <a:t>CUSTOMERS </a:t>
              </a:r>
              <a:r>
                <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1400"/>
                <a:t>{$comp/*:component/*:customers/text()}</a:t>
              </a:r>
              <a:endParaRPr dirty="0" lang="en-US" sz="1400"/>
            </a:p>
            <a:p>
              <a:r>
                <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1400"/>
                <a:t>PARTNERS: </a:t>
              </a:r>
              <a:r>
                <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1400"/>
                <a:t>{$comp/*:component/*:partners/text()}</a:t>
              </a:r>
              <a:endParaRPr dirty="0" lang="en-US" sz="1400"/>
            </a:p>
            <a:p>
              <a:r>
                <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1400"/>
                <a:t>TRANSITION AGENT: </a:t>
              </a:r>
              <a:r>
                <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1400"/>
                <a:t>{$comp/*:component/*:transition-agent/text()}</a:t>
              </a:r>
              <a:endParaRPr dirty="0" lang="en-US" sz="1400"/>
            </a:p>
            <a:p>
              <a:r>
                <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1400"/>
                <a:t>CONTRACT: </a:t>
              </a:r>
              <a:r>
                <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1400"/>
                <a:t>{$comp/*:component/*:contract/text()}</a:t>
              </a:r>
              <a:endParaRPr dirty="0" lang="en-US" sz="1400"/>
            </a:p>
            <a:p>
              <a:r>
                <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1400"/>
                <a:t>STAKEHOLDERS: </a:t>
              </a:r>
              <a:r>
                <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1400"/>
                <a:t>{$comp/*:component/*:stakeholders/text()} </a:t>
              </a:r>
            </a:p>
            <a:p>
              <a:r>
                <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1400"/>
                <a:t>STATE</a:t>
              </a:r>
              <a:r>
                <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1400"/>
                <a:t>{$comp/*:component/*:state/text()} </a:t>
              </a:r>
            </a:p>
            <a:p>
              <a:r>
                <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1400"/>
                <a:t>STRATEGY</a:t>
              </a:r>
              <a:r>
                <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1400"/>
                <a:t>{$comp/*:component/*:strategy/text()} </a:t>
              </a:r>
            </a:p>
            <a:p>
              <a:r>
                <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1400"/>
                <a:t>ISSUES</a:t>
              </a:r>
              <a:r>
                <a:rPr dirty="0" lang="en-US" smtClean="0" sz="1400"/>
                <a:t>{$comp/*:component/*:issues/text()}</a:t>
              </a:r>
              <a:endParaRPr dirty="0" lang="en-US" smtClean="0" sz="1400"/>
            </a:p>
            <a:p>
              <a:pPr indent="0" marL="0">
                <a:buNone/>
              </a:pPr>
              <a:endParaRPr dirty="0" lang="en-US" sz="1400"/>
            </a:p>
          </p:txBody>
        </p:sp>
        <p:graphicFrame>
          <p:nvGraphicFramePr>
            <p:cNvPr id="11" name="Table 10"/>
            <p:cNvGraphicFramePr>
              <a:graphicFrameLocks noGrp="1"/>
            </p:cNvGraphicFramePr>
            <p:nvPr>
              <p:extLst>
                <p:ext uri="{{D42A27DB-BD31-4B8C-83A1-F6EECF244321}}">
                  <p14:modId val="1679982817" xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main"/>
                </p:ext>
              </p:extLst>
            </p:nvPr>
          </p:nvGraphicFramePr>
          <p:xfrm>
            <a:off x="838200" y="3352800"/>
            <a:ext cx="7924801" cy="1999380"/>
          </p:xfrm>
          <a:graphic>
            <a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/table">
              <a:tbl>
                <a:tblPr bandRow="1" firstRow="1">
                  <a:tableStyleId>{{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}} </a:tableStyleId>
                </a:tblPr>
                <a:tblGrid>
                  <a:gridCol w="1132114"/>
                  <a:gridCol w="1253848"/>
                  <a:gridCol w="1463227"/>
                  <a:gridCol w="1056640"/>
                  <a:gridCol w="1056640"/>
                  <a:gridCol w="830218"/>
                  <a:gridCol w="1132114"/>
                </a:tblGrid>
                <a:tr h="347579">
                  <a:tc>
                    <a:txBody>
                      <a:bodyPr/>
                      <a:lstStyle/>
                      <a:p>
                        <a:r>
                          <a:rPr dirty="0" lang="en-US" smtClean="0"/>
                          <a:t>Burn</a:t>
                        </a:r>
                        <a:r>
                          <a:rPr baseline="0" dirty="0" lang="en-US" smtClean="0"/>
                          <a:t>rate</a:t>
                        </a:r>
                        <a:endParaRPr dirty="0" lang="en-US"/>
                      </a:p>
                    </a:txBody>
                    <a:tcPr/>
                  </a:tc>
                  <a:tc>
                    <a:txBody>
                      <a:bodyPr/>
                      <a:lstStyle/>
                      <a:p>
                        <a:r>
                          <a:rPr dirty="0" lang="en-US" smtClean="0"/>
                          <a:t>Schedule</a:t>
                        </a:r>
                        <a:endParaRPr dirty="0" lang="en-US"/>
                      </a:p>
                    </a:txBody>
                    <a:tcPr/>
                  </a:tc>
                  <a:tc>
                    <a:txBody>
                      <a:bodyPr/>
                      <a:lstStyle/>
                      <a:p>
                        <a:r>
                          <a:rPr dirty="0" lang="en-US" smtClean="0"/>
                          <a:t>Performance</a:t>
                        </a:r>
                        <a:endParaRPr dirty="0" lang="en-US"/>
                      </a:p>
                    </a:txBody>
                    <a:tcPr/>
                  </a:tc>
                  <a:tc>
                    <a:txBody>
                      <a:bodyPr/>
                      <a:lstStyle/>
                      <a:p>
                        <a:r>
                          <a:rPr dirty="0" lang="en-US" smtClean="0"/>
                          <a:t>Funding</a:t>
                        </a:r>
                        <a:endParaRPr dirty="0" lang="en-US"/>
                      </a:p>
                    </a:txBody>
                    <a:tcPr/>
                  </a:tc>
                  <a:tc>
                    <a:txBody>
                      <a:bodyPr/>
                      <a:lstStyle/>
                      <a:p>
                        <a:r>
                          <a:rPr dirty="0" lang="en-US" smtClean="0"/>
                          <a:t>Sustain</a:t>
                        </a:r>
                        <a:endParaRPr dirty="0" lang="en-US"/>
                      </a:p>
                    </a:txBody>
                    <a:tcPr/>
                  </a:tc>
                  <a:tc>
                    <a:txBody>
                      <a:bodyPr/>
                      <a:lstStyle/>
                      <a:p>
                        <a:r>
                          <a:rPr dirty="0" lang="en-US" smtClean="0"/>
                          <a:t>Risk</a:t>
                        </a:r>
                        <a:endParaRPr dirty="0" lang="en-US"/>
                      </a:p>
                    </a:txBody>
                    <a:tcPr/>
                  </a:tc>
                  <a:tc>
                    <a:txBody>
                      <a:bodyPr/>
                      <a:lstStyle/>
                      <a:p>
                        <a:r>
                          <a:rPr dirty="0" lang="en-US" smtClean="0"/>
                          <a:t>Issues</a:t>
                        </a:r>
                        <a:endParaRPr dirty="0" lang="en-US"/>
                      </a:p>
                    </a:txBody>
                    <a:tcPr/>
                  </a:tc>
                </a:tr>

              </a:tbl>
            </a:graphicData>
          </a:graphic>
        </p:graphicFrame>
        <p:graphicFrame>
          <p:nvGraphicFramePr>
            <p:cNvPr id="5" name="Table 4"/>
            <p:cNvGraphicFramePr>
              <a:graphicFrameLocks noGrp="1"/>
            </p:cNvGraphicFramePr>
            <p:nvPr>
              <p:extLst>
                <p:ext uri="{{D42A27DB-BD31-4B8C-83A1-F6EECF244321}}">
                  <p14:modId val="3175131442" xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main"/>
                </p:ext>
              </p:extLst>
            </p:nvPr>
          </p:nvGraphicFramePr>
          <p:xfrm>
            <a:off x="838200" y="5638800"/>
            <a:ext cx="6096000" cy="741680"/>
          </p:xfrm>
          <a:graphic>
            <a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/table">
              <a:tbl>
                <a:tblPr bandRow="1" firstRow="1">
                  <a:tableStyleId>{{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}}</a:tableStyleId>
                </a:tblPr>
                <a:tblGrid>
                  <a:gridCol w="2032000"/>
                  <a:gridCol w="2032000"/>
                  <a:gridCol w="2032000"/>
                </a:tblGrid>
                <a:tr h="370840">
                  <a:tc>
                    <a:txBody>
                      <a:bodyPr/>
                      <a:lstStyle/>
                      <a:p>
                        <a:r>
                          <a:rPr dirty="0" lang="en-US" smtClean="0"/>
                          <a:t>Funding</a:t>
                        </a:r>
                        <a:r>
                          <a:rPr baseline="0" dirty="0" lang="en-US" smtClean="0"/>
                          <a:t>Type</a:t>
                        </a:r>
                        <a:endParaRPr dirty="0" lang="en-US"/>
                      </a:p>
                    </a:txBody>
                    <a:tcPr/>
                  </a:tc>
                  <a:tc>
                    <a:txBody>
                      <a:bodyPr/>
                      <a:lstStyle/>
                      <a:p>
                        <a:r>
                          <a:rPr dirty="0" lang="en-US" smtClean="0"/>
                          <a:t>Fiscal</a:t>
                        </a:r>
                        <a:r>
                          <a:rPr baseline="0" dirty="0" lang="en-US" smtClean="0"/>
                          <a:t>Year</a:t>
                        </a:r>
                        <a:endParaRPr dirty="0" lang="en-US"/>
                      </a:p>
                    </a:txBody>
                    <a:tcPr/>
                  </a:tc>
                  <a:tc>
                    <a:txBody>
                      <a:bodyPr/>
                      <a:lstStyle/>
                      <a:p>
                        <a:r>
                          <a:rPr dirty="0" lang="en-US" smtClean="0"/>
                          <a:t>Status</a:t>
                        </a:r>
                        <a:endParaRPr dirty="0" lang="en-US"/>
                      </a:p>
                    </a:txBody>
                    <a:tcPr/>
                  </a:tc>
                </a:tr>
                <a:tr h="370840">
                  <a:tc>
                    <a:txBody>
                      <a:bodyPr/>
                      <a:lstStyle/>
                      <a:p>
                        <a:endParaRPr lang="en-US"/>
                      </a:p>
                    </a:txBody>
                    <a:tcPr/>
                  </a:tc>
                  <a:tc>
                    <a:txBody>
                      <a:bodyPr/>
                      <a:lstStyle/>
                      <a:p>
                        <a:endParaRPr lang="en-US"/>
                      </a:p>
                    </a:txBody>
                    <a:tcPr/>
                  </a:tc>
                  <a:tc>
                    <a:txBody>
                      <a:bodyPr/>
                      <a:lstStyle/>
                      <a:p>
                        <a:endParaRPr dirty="0" lang="en-US"/>
                      </a:p>
                    </a:txBody>
                    <a:tcPr/>
                  </a:tc>
                </a:tr>
              </a:tbl>
            </a:graphicData>
          </a:graphic>
        </p:graphicFrame>
      </p:spTree>
      <p:extLst>
        <p:ext uri="{{BB962C8B-B14F-4D97-AF65-F5344CB8AC3E}}">
          <p14:creationId val="657778885" xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main"/>
        </p:ext>
      </p:extLst>
    </p:cSld>
    <p:clrMapOvr>
      <a:masterClrMapping/>
    </p:clrMapOvr>
  </p:sld>
return
(:xdmp:document-insert("/content/Users/adhavle/Demos/Q4-2015/marklogic-powerpoint-master/src/main/resources/powerpoint/ppt/slides/slide1.xml", $ppt-template-simple):)
  xdmp:save("/Users/adhavle/Demos/Q4-2015/powerpoint/marklogic-powerpoint/src/main/resources/powerpoint/ppt/slides/slide2.xml", $slide)

error: pathspec 'src/main/ml-modules/ext/component-transform.xqy' did not match any file(s) known to git


Fixed bezetting query

Fixed bezetting query

/bin/sh: 1: Middleware/Examen/XML/query_bezettingen.xq: not found
error: pathspec 'Databanken' did not match any file(s) known to git


added document management of local caches of remote services, merged remote services and sample directories.

(:~
: This is the Care Services Discovery stored query registry
: @version 1.0
: @see https://github.com/his-interop/openinfoman
:
:)
module namespace csd_dm = "https://github.com/his-interop/openinfoman/csd_dm";

declare namespace csd = "urn:ihe:iti:csd:2013";
declare default element  namespace   "urn:ihe:iti:csd:2013";

declare variable $csd_dm:document_manager := 'csd_docs.xml';

declare updating function csd_dm:init($db) {
  if ( not(csd_dm:dm_exists($db)))  then
    db:add($db, <documentLibrary/>,$csd_dm:document_manager)
  else
      ()
};

declare function csd_dm:dm_exists($db) {
  db:is-xml($db,$csd_dm:document_manager)
};

declare  function csd_dm:document_source_exists($db,$name) {
  let $source := csd_dm:document_source($db,$name)
  return  (db:is-xml($db,$source))

};

declare  function csd_dm:open_document($db,$name) {
  if (csd_dm:document_source_exists($db,$name)) then
    db:open($db,csd_dm:document_source($db,$name))
  else
    ()
};

declare updating function csd_dm:register_document($db,$name,$source) {
  let $dm :=  db:open($db,$csd_dm:document_manager)/documentLibrary
  let $reg_doc := <document name="{$name}" source="{$source}"/>
  let $existing := $dm/document[@name = $name]
  return if (not(exists($existing)))  then
      insert node $reg_doc into $dm
    else
      replace  node $existing with $reg_doc
};

declare  function csd_dm:is_registered($db,$name) {
  if (csd_dm:dm_exists($db)) then
    let $dm :=  db:open($db,$csd_dm:document_manager)/documentLibrary
    let $existing := $dm/document[@name = $name]
    return exists($existing)
  else
    false()

};

declare updating function csd_dm:deregister_document($db,$name) {
  if (csd_dm:dm_exists($db)) then
    let $dm :=  db:open($db,$csd_dm:document_manager)/documentLibrary
    let $existing := $dm/document[@name = $name]
    return if (exists($existing))  then
      delete node $existing
    else
      ()
  else ()

};

declare function csd_dm:registered_documents($db) {
  if (csd_dm:dm_exists($db)) then
    for $name in db:open($db,$csd_dm:document_manager)/documentLibrary/document/text{@name}
    where csd_dm:document_source_exists($db,$name)
      return $name
  else
    ()
};

declare function csd_dm:document_source($db,$name) {
    db:open($db,$csd_dm:document_manager)/documentLibrary/document[@name = $name]/@source
};

error: pathspec 'repo/csd_document_manager.xqm' did not match any file(s) known to git


Initial local structure with namespaces.

xquery version "3.1" encoding "UTF-8";

declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";
declare namespace map = "http://www.w3.org/2005/xpath-functions/map";
declare namespace array = "http://www.w3.org/2005/xpath-functions/array";
declare namespace mapping = "http://docs.rackspace.com/identity/api/ext/MappingRules";
declare namespace xs = "http://www.w3.org/2001/XMLSchema";

declare option output:method "xml";
declare option output:indent "yes";

(: declare variable $__JSON__ external; :)
declare variable $__JSON__ := "{"rules":[{"local":{"user":{"domain":"{D}","name":"{D}","email":"{D(name)}@rackspace.com","roles":"{D}","expire":"{D}"}}}],"namespaces":{"foo":"bar"}}";
declare variable $policyJSON := parse-json($__JSON__);

<rules xmlns="http://docs.rackspace.com/identity/api/ext/MappingRules"
       xmlns:xs="http://www.w3.org/2001/XMLSchema"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
       {
       if (map:contains($policyJSON,"namespaces")) then
         let $namespaces := $policyJSON?namespaces
         for $key in map:keys($namespaces) return namespace {$key} {$namespaces?($key)}
       else ()
       }

       {
         for $rule in $policyJSON?rules?* return
         <rule>
             <local>
                 {
                   let $local := $rule?local
                   for $localGroupName in map:keys($local) return element {$localGroupName} {
                     let $localGroup := $local?($localGroupName)
                     for $attributeName in map:keys($localGroup) return element {$attributeName}{}
                   }
                 }
             </local>
         </rule>
       }
</rules>

error: pathspec 'core/src/main/resources/xq/mapping2XML.xq' did not match any file(s) known to git


XQuery labs.

XQuery labs.

xquery version "1.0";
let $message := "Hello World!"
return <results>
  <message>{$message}</message>
</results>

error: pathspec 'xquery/hello.xq' did not match any file(s) known to git


Adding JS key file

Adding JS key file

xquery version "1.0-ml";

(:
 : This module was generated by MarkLogic Entity Services.
 : The source entity type document was Northwind-Ref-Combo-SameDocument-SubjectIri-0.0.1
 :
 : To use this module, examine how you wish to extract data from sources,
 : and modify the various extract-instance-{X} functions to
 : create the instances you wish.
 :
 : You may wish to/need to alter
 : 1.  values.  For example, creating duration values from decimal months.
 : 2.  references.  This conversion module assumes you want to denormalize
 :     instances when storing them in documents.  You may choose to remove
 :     code that denormalizes, and just include reference values in your instances
 :     instead.
 : 3.  Source XPath expressions.  The data coming into the extract-instance={X}
 :     functions will probably not be exactly what this module predicts.
 :
 : After modifying this file, put it in your project for deployment to the modules
 : database of your application, and check it into your source control system.
 :
 : Modification History:
 :   Generated at timestamp: 2016-05-20T11:56:59.612683-07:00
 :   Persisted by AUTHOR
 :   Date: DATE
 :)
module namespace northwind-Ref-Combo-SameDocument-SubjectIri = "http://refCombo#Northwind-Ref-Combo-SameDocument-SubjectIri-0.0.1";

import module namespace es = "http://marklogic.com/entity-services"
    at "/MarkLogic/entity-services/entity-services.xqy";

(:
 :  extract-instance-{entity-type} functions
 :
 :  These functions take together take a source document and create a nested
 :  map structure from it.
 :  The resulting map is used by instance-to-canonical-xml to create documents
 :  in the database.
 :
 :  There are numerous customizations you may wish to apply to this module.
 :)

(:~
 : Creates a map:map representation of an entity instance from some source
 : document.
 : @param $source-node  A document or node that contains data for populating a Customer
 : @return A map:map instance that holds the data for this entity type.
 :)
declare function northwind-Ref-Combo-SameDocument-SubjectIri:extract-instance-Customer(
    $source-node as node()
) as map:map
{
    json:object()
        (: This line identifies the type of this instance.  Do not change it. :)
        =>es:with(true(), '$type', 'Customer')
        (: This line adds the original source document as an attachment.
         : If this entity type is not the root of a document, you should remove this.
         : If the source document is JSON, you should wrap the $source-node in xdmp:quote()
         : because you cannot preserve JSON nodes with the XML envelope verbatim.
         :)
        =>es:with(true(), '$attachments', $source-node)
        (: The following lines are generated from the Customer entity type
         : You need to ensure that all of the property paths are correct for your source
         : data to populate instances.  You can also implement lookup functions, or
         : populate the instance with constants.
         :)
        =>es:with($source-node/Customer/CustomerId,   'CustomerId',                    data($source-node/Customer/CustomerId))
        =>es:with($source-node/Customer/CompanyName,  'CompanyName',                    data($source-node/Customer/CompanyName))
        =>es:with($source-node/Customer/Country,      'Country',                    data($source-node/Customer/Country))
        =>es:with($source-node/Customer/Address,      'Address',                    data($source-node/Customer/Address))

};

(:~
 : Creates a map:map representation of an entity instance from some source
 : document.
 : @param $source-node  A document or node that contains data for populating a Product
 : @return A map:map instance that holds the data for this entity type.
 :)
declare function northwind-Ref-Combo-SameDocument-SubjectIri:extract-instance-Product(
    $source-node as node()
) as map:map
{
    json:object()
        (: This line identifies the type of this instance.  Do not change it. :)
        =>es:with(true(), '$type', 'Product')
        (: This line adds the original source document as an attachment.
         : If this entity type is not the root of a document, you should remove this.
         : If the source document is JSON, you should wrap the $source-node in xdmp:quote()
         : because you cannot preserve JSON nodes with the XML envelope verbatim.
         :)
        =>es:with(true(), '$attachments', $source-node)
        (: The following lines are generated from the Product entity type
         : You need to ensure that all of the property paths are correct for your source
         : data to populate instances.  You can also implement lookup functions, or
         : populate the instance with constants.
         :)
        =>es:with($source-node/Product/ProductName,   'ProductName',                   data($source-node/Product/ProductName))
        =>es:with($source-node/Product/ProductID,     'ProductID',                   data($source-node/Product/ProductID))
        =>es:with($source-node/Product/UnitPrice,     'UnitPrice',                   data($source-node/Product/UnitPrice))
        =>es:with($source-node/Product/SupplierID,    'SupplierID',                   data($source-node/Product/SupplierID))
        =>es:with($source-node/Product/Discontinued,  'Discontinued',                   data($source-node/Product/Discontinued))

};

(:~
 : Creates a map:map representation of an entity instance from some source
 : document.
 : @param $source-node  A document or node that contains data for populating a Order
 : @return A map:map instance that holds the data for this entity type.
 :)
declare function northwind-Ref-Combo-SameDocument-SubjectIri:extract-instance-Order(
    $source-node as node()
) as map:map
{
    json:object()
        (: This line identifies the type of this instance.  Do not change it. :)
        =>es:with(true(), '$type', 'Order')
        (: This line adds the original source document as an attachment.
         : If this entity type is not the root of a document, you should remove this.
         : If the source document is JSON, you should wrap the $source-node in xdmp:quote()
         : because you cannot preserve JSON nodes with the XML envelope verbatim.
         :)
        =>es:with(true(), '$attachments', $source-node)
        (: The following lines are generated from the Order entity type
         : You need to ensure that all of the property paths are correct for your source
         : data to populate instances.  You can also implement lookup functions, or
         : populate the instance with constants.
         :)
        =>es:with($source-node/Order/OrderID,         'OrderID',                 data($source-node/Order/OrderID))
        =>es:with($source-node/Order/CustomerID,      'CustomerID',
            if ($source-node/Order/CustomerID/element())
            then json:to-array($source-node/Order/CustomerID ! northwind-Ref-Combo-SameDocument-SubjectIri:extract-instance-Customer(.))
            else data($source-node/Order/CustomerID))
        =>es:with($source-node/Order/OrderDate,       'OrderDate',                 data($source-node/Order/OrderDate))
        =>es:with($source-node/Order/ShipAddress,     'ShipAddress',                 data($source-node/Order/ShipAddress))
        =>es:with($source-node/Order/OrderDetails,    'OrderDetails',                 $source-node/Order/OrderDetails/node())

};

(:~
 : Creates a map:map representation of an entity instance from some source
 : document.
 : @param $source-node  A document or node that contains data for populating a OrderDetail
 : @return A map:map instance that holds the data for this entity type.
 :)
declare function northwind-Ref-Combo-SameDocument-SubjectIri:extract-instance-OrderDetail(
    $source-node as node()
) as map:map
{
    json:object()
        (: This line identifies the type of this instance.  Do not change it. :)
        =>es:with(true(), '$type', 'OrderDetail')
        (: This line adds the original source document as an attachment.
         : If this entity type is not the root of a document, you should remove this.
         : If the source document is JSON, you should wrap the $source-node in xdmp:quote()
         : because you cannot preserve JSON nodes with the XML envelope verbatim.
         :)
        =>es:with(true(), '$attachments', $source-node)
        (: The following lines are generated from the OrderDetail entity type
         : You need to ensure that all of the property paths are correct for your source
         : data to populate instances.  You can also implement lookup functions, or
         : populate the instance with constants.
         :)
        =>es:with($source-node/OrderDetail/ProductID, 'ProductID',
            if ($source-node/OrderDetail/ProductID/element())
            then json:to-array($source-node/OrderDetail/ProductID ! northwind-Ref-Combo-SameDocument-SubjectIri:extract-instance-Product(.))
            else data($source-node/OrderDetail/ProductID))
        =>es:with($source-node/OrderDetail/UnitPrice, 'UnitPrice',                       data($source-node/OrderDetail/UnitPrice))
        =>es:with($source-node/OrderDetail/Quantity,  'Quantity',                       data($source-node/OrderDetail/Quantity))

};

(:~
 : Turns an entity instance into an XML structure.
 : This out-of-the box implementation traverses a map structure
 : and turns it deterministically into an XML tree.
 : Using this function as-is should be sufficient for most use
 : cases, and will play well with other generated artifacts.
 : @param $entity-instance A map:map instance returned from one of the extract-instance
 :    functions.
 : @return An XML element that encodes the instance.
 :)
declare function northwind-Ref-Combo-SameDocument-SubjectIri:instance-to-canonical-xml(
    $entity-instance as map:map
) as element()
{
    (: Construct an element that is named the same as the Entity Type :)
    element { map:get($entity-instance, "$type") }  {
        for $key in map:keys($entity-instance)
        let $instance-property := map:get($entity-instance, $key)
        where ($key castable as xs:NCName and $key ne "$type")
        return
            typeswitch ($instance-property)
            (: This branch handles embedded objects.  You can choose to prune
               an entity's representation of extend it with lookups here. :)
            case json:object+
                return
                    for $prop in $instance-property
                    return element { $key } { northwind-Ref-Combo-SameDocument-SubjectIri:instance-to-canonical-xml($prop) }
            (: An array can also treated as multiple elements :)
            case json:array
                return
                    for $val in json:array-values($instance-property)
                    return
                        if ($val instance of json:object)
                        then element { $key } { northwind-Ref-Combo-SameDocument-SubjectIri:instance-to-canonical-xml($val) }
                        else element { $key } { $val }
            (: A sequence of values should be simply treated as multiple elements :)
            case item()+
                return
                    for $val in $instance-property
                    return element { $key } { $val }
            default return element { $key } { $instance-property }
    }
};

(:
 : Wraps a canonical instance (returned by instance-to-canonical-xml())
 : within an envelope patterned document, along with the source
 : document, which is stored in an attachments section.
 : @param $entity-instance an instance, as returned by an extract-instance
 : function
 : @return A document which wraps both the canonical instance and source docs.
 :)
declare function northwind-Ref-Combo-SameDocument-SubjectIri:instance-to-envelope(
    $entity-instance as map:map
) as document-node()
{
    document {
        element es:envelope {
            element es:instance {
                element es:info {
                    element es:title { "Northwind-Ref-Combo-SameDocument-SubjectIri" },
                    element es:version { "0.0.1" }
                },
                northwind-Ref-Combo-SameDocument-SubjectIri:instance-to-canonical-xml($entity-instance)
            },
            element es:attachments {
                map:get($entity-instance, "$attachments")
            }
        }
    }
};

error: pathspec 'entity-services-functionaltests/src/test/resources/test-js/js1.xqy' did not match any file(s) known to git


Added xq file expressing query 7 using XQuery

Web data management & xml (CSE 5335)/Programming assignment 7/Individual queries/7.xq

/bin/sh: 1: Syntax error: word unexpected (expecting ")")


Add BaseX ZIP Module function signatures.

xquery version "3.0";
(:~
: BaseX ZIP module functions
:
: @see http://docs.basex.org/wiki/ZIP_Module
:
:)
module namespace zip = "http://expath.org/ns/zip";

import module namespace a = "http://reecedunn.co.uk/xquery/annotations" at "res://reecedunn.co.uk/xquery/annotations.xqy";

declare %a:since("basex", "7.0") %a:deprecated("basex", "7.3", "archive:extract-binary") function zip:binary-entry($uri as xs:string, $path as xs:string) as xs:base64Binary external;
declare %a:since("basex", "7.0") %a:deprecated("basex", "7.3", "archive:extract-text") function zip:text-entry($uri as xs:string, $path as xs:string) as xs:string external;
declare %a:since("basex", "7.0") %a:deprecated("basex", "7.3", "archive:extract-text") function zip:text-entry($uri as xs:string, $path as xs:string, $encoding as xs:string) as xs:string external;
declare %a:since("basex", "7.0") %a:deprecated("basex", "7.3", "archive:extract-text") function zip:xml-entry($uri as xs:string, $path as xs:string) as document-node() external;
declare %a:since("basex", "7.0") %a:deprecated("basex", "7.3", "archive:extract-text") function zip:html-entry($uri as xs:string, $path as xs:string) as document-node() external;
declare %a:since("basex", "7.0") %a:deprecated("basex", "7.3", "archive:entries") function zip:entries($uri as xs:string) as element(zip:file) external;
declare %a:since("basex", "7.0") %a:deprecated("basex", "7.3", "archive:create") function zip:zip-file($zip as element(zip:file)) as empty-sequence() external;
declare %a:since("basex", "7.0") %a:deprecated("basex", "7.3", "archive:update") function zip:update-entries($zip as element(zip:file), $output as xs:string) as empty-sequence() external;

error: pathspec 'src/main/resources/builtin/expath.org/ns/zip.xqy' did not match any file(s) known to git