| XQUERY/XSLT API DOCUMENTATION 4.2 |
All XQuery & XSLT Functions MarkLogic Built-In Functions Admin (xdmp:) AppServer (xdmp:) Classifier (cts:) Debug (dbg:) Document Conversion (xdmp:) Extension (xdmp:) Documents, Directories, Properties, and Locks Functions Extension Functions Function Values Functions HTTP Functions JSON Functions MarkLogic Server Functions Search Functions XML Functions XQuery Context Functions XSLT Functions map (map:) Math (math:) Profile (prof:) Search (cts:) cts:query Constructors Functions Geospatial Functions Geospatial Lexicon Functions Lexicon Functions Search Functions Search Clustering Functions Security (xdmp:) Server Monitoring (xdmp:) Spell (spell:) Update (xdmp:) XQuery Library Modules Admin Library (admin:) Actions Functions Appserver Functions Database Functions Forest Functions Group Functions Host Functions Mimetypes Functions Scheduler Functions Alerting (alert:) Elastic Compute Cloud (ec2:) Entity Enrichment (entity:) Flexible Replication (flexrep:) Geospatial Supporting Functions GEO Functions GeoRSS Functions GML Functions KML Functions MCGM Functions Information Studio (info:) Information Studio Developer (infodev:) Library Services (dls:) cts:query Constructor Functions Document Management Functions Document Update Functions Retention Policy Functions XInclude Functions Modular Documents XInclude Functions XPointer Functions PKI (pki:) Plugin (plugin:) Search (search:) Security-sec (sec:) Spelling Dictionary Management (spell:) Thesaurus (thsr:) Triggers (trgr:) Triggers Library (trgr:) WordProcessingML (ooxml:) ZIP Package (ooxml:) CPF Functions Content Processing Framework (cpf:) CSS Conversion (css:) DocBook Conversion (dbk:) Domains (dom:) Excel Conversion (excel:) Generic Conversion (cvt:) Links (lnk:) MSWord Conversion (msword:) PDF Conversion (pdf:) Pipelines (p:) Powerpoint Conversion (ppt:) XHTML Conversion (xhtml:) W3C-Standard Functions Accessor (fn:) AnyURI (fn:) Boolean (fn:) Context (fn:) DurationDateTime (fn:) Error and Trace (fn:) Node (fn:) Numeric (fn:) QName (fn:) Sequence (fn:) String (fn:) XSLT (fn:) W3C XQuery/XSLT Reference W3C XQuery Functions W3C XQuery Language W3C XSLT Language
This page was generated September 12, 2012 6:00 AM | XQuery & XSLT Built-In & Modules Function Reference
Module: Links
The links module is installed as part of the Content Processing Framework. These functions are used to manage the relationships among documents in the database, for example, as between a binary source document and an XML document generated by a conversion process from that source document. The Content Processing Framework will use links to determine if related documents should also be removed when a document is deleted from the database. To use the links module as part of your own XQuery module, include the following line in your XQuery prolog: `import module namespace lnk = "http://marklogic.com/cpf/links" at "/MarkLogic/cpf/links.xqy";` The library namespace prefix `lnk` is not predefined in the server.
Function Summary
lnk:create | Create a link between the two given documents with the given role labels and strength.
lnk:from | Find and return all the links from the given document to some other.
lnk:get | Find and return the link between the two documents, if any.
lnk:insert | Insert the given link.
lnk:remove | Remove the link between the two given documents and return the removed link.
lnk:to | Find and return all the links to the given document from some other.
Function Detail
lnk:create(
| $from as xs:string,
| $to as xs:string,
| $role as xs:string,
| $rev-role as xs:string,
| $strength as xs:string
) as empty-sequence()
Summary: Create a link between the two given documents with the given role labels and strength. An error is raised if either of the documents involved does not exist or if the link would be invalid for some reason. This function will replace any existing link between those two documents with the new link.
Parameters:
$from : The URI of the document at the tail of the link.
$to : The URI of the document at the head of the link.
$role : A label for the relationship of the head of the link to the tail of the link, one of "source", "consumer", "container", "variant", and "related".
$rev-role : A label for the reverse relationship of the tail of the link to the head of the link.
$strength : An indicator of the strength of the relationship between the two documents, either "strong" or "weak".
Example:
      xquery version "1.0-ml";
      import module namespace lnk = "http://marklogic.com/cpf/links"
    		  at "/MarkLogic/cpf/links.xqy";

      lnk:create( "/myDocs/example.xhtml", "/myDocs/example.doc",
                  "source", "conversion", "strong" )
lnk:from(
| $from as xs:string
) as element(lnk:link)*
Summary: Find and return all the links from the given document to some other. This function will check the properties of the link and raise an error if they are inconsistent or incomplete in some way.
Parameters:
$from : The URI of the document at the tail of the link.
Example:
      xquery version "1.0-ml";
      import module namespace lnk = "http://marklogic.com/cpf/links"
    		  at "/MarkLogic/cpf/links.xqy";

      for $link in lnk:from( "/myDocs/example.xhtml" )
      return $link/@to
lnk:get(
| $from as xs:string,
| $to as xs:string
) as element(lnk:link)?
Summary: Find and return the link between the two documents, if any. This function will check the properties of link and raise an error if they are inconsistent or incomplete in some way.
Parameters:
$from : The URI of the document at the tail of the link.
$to : The URI of the document at the head of the link.
Example:
      xquery version "1.0-ml";
      import module namespace lnk = "http://marklogic.com/cpf/links"
    		  at "/MarkLogic/cpf/links.xqy";

      lnk:get( "/myDocs/fr/example.xhtml", "/myDocs/example.xhtml" )
lnk:insert(
| $link as element(lnk:link)
) as empty-sequence()
Summary: Insert the given link. An error is raised if either of the documents involved does not exist or if the link is invalid in some way. This function will replace any existing link between those two documents.
Parameters:
$link : The link element.
Example:
      xquery version "1.0-ml";
      import module namespace lnk = "http://marklogic.com/cpf/links"
    		  at "/MarkLogic/cpf/links.xqy";

      lnk:insert( lnk:get( "/myDocs/fr/example.xhtml", "/myDocs/example.xhtml" ) )
lnk:remove(
| $from as xs:string,
| $to as xs:string
) as element(lnk:link)
Summary: Remove the link between the two given documents and return the removed link. An error is raised if no such link exists.
Parameters:
$from : The URI of the document at the tail of the link.
$to : The URI of the document at the head of the link.
Example:
      xquery version "1.0-ml";
      import module namespace lnk = "http://marklogic.com/cpf/links"
    		  at "/MarkLogic/cpf/links.xqy";

      lnk:remove( "/myDocs/example.xhtml", "/myDocs/example.doc" )
lnk:to(
| $to as xs:string
) as element(lnk:link)*
Summary: Find and return all the links to the given document from some other. This function will check the properties of the link and raise an error if they are inconsistent or incomplete in some way.
Parameters:
$to : The URI of the document at the head of the link.
Example:
      xquery version "1.0-ml";
      import module namespace lnk = "http://marklogic.com/cpf/links"
    		  at "/MarkLogic/cpf/links.xqy";

      for $link in lnk:from( "/myDocs/example.xhtml" )
      return $link/@to

© Copyright 2002-2012 MarkLogic Corporation. All rights reserved.