| 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:01 AM | XQuery & XSLT Built-In & Modules Function Reference
Module: Entity Enrichment
The entity enrichment function module is installed as the following file: `install_dir/Modules/MarkLogic/entity.xqy` where `install_dir` is the directory in which MarkLogic Server is installed. To use the `entity.xqy` module in your own XQuery modules, include the following line in your XQuery prolog: `import module namespace entity="http://marklogic.com/entity" at "/MarkLogic/entity.xqy"` The entity enrichment functions are used to add markup to XML for people, places, and other entities.
Function Summary
entity:enrich | Returns the entity-enriched XML for the given XML node.
Function Detail
entity:enrich(
| $node as node()
) as node()
Summary: Returns the entity-enriched XML for the given XML node. The entities conform to the MarkLogic-recommended entity markup. If a text node that is being enriched has a parent element with a schema definition that does not allow element children, then that text node is not enriched (for example, `style` elements in an xhtml document).
Parameters:
$node : The XML node to be enriched.
Usage Notes: The elements that are returned are in the `http://marklogic.com/entity` namespace, bound to the prefix `e`. The names and descriptions of the marked-up elements are as follows: `e:credit-card-number` A number representing a credit card number. `e:coordinate` Latitude and longitude coordinates. `e:date` Date-related. `e:distance` A distance. `e:email` Identifies an email address. `e:gpe` Geo-political entity. Differs from location because it has a person-made aspect to it (for example, California is a GPE because its boundaries were defined by a government). `e:facility` A place used as a facility. `e:id` A number identifying a social security number or other ID number. `e:location` A geographic location (Mount Everest, for example). `e:money` Identifies currency (dollars, euros, and so on). `e:nationality` The nationality of someone or something (for example, American). `e:number` A number. `e:organization` An organization. `e:person` A person. `e:phone-number` A number identifying a telephone number. `e:religion` A religion. `e:title` A title or honorific. `e:url` A URL on the world wide web. `e:utm` A point in the Universal Transverse Mercator (UTM) coordinate system. `e:time` Time-related.
Example:
    xquery version "1.0-ml";

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

    let $myxml := <node>George Washington never visited Norway.</node>
    return
    entity:enrich($myxml)

    => <node xmlns:e="http://marklogic.com/entity">
    	<e:person>George Washington</e:person> never visited
    	<e:gpe>Norway</e:gpe>.
       </node>
Example:
    xquery version "1.0-ml";

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

    let $myxhtml :=
      <p xmlns="http://www.w3.org/1999/xhtml">George
       Washington never visited
       <style>Norway</style>.
      </p>
    return
    entity:enrich($myxhtml)
    (:
       The text inside the style tag is not enriched because
       the xhtml schema does not allow element children
       inside style tags.
    :)

    =>
    <p xmlns="http://www.w3.org/1999/xhtml">
       <e:person xmlns:e="http://marklogic.com/entity">George
       Washington</e:person> never visited
      <style>Norway</style>.
    </p>

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