The entity enrichment function module is installed as the following file:
install_dir/Modules/MarkLogic/enity.xqy
where install_dir is the directory in which MarkLogic Server is installed.
install_dir
To use the entity.xqy module in your own XQuery modules, include the following line in your XQuery prolog:
entity.xqy
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.
style
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:
http://marklogic.com/entity
e
e:credit-card-number
e:coordinate
e:date
e:email
e:gpe
e:facility
e:id
e:location
e:money
e:nationality
e:organization
e:percent
e:person
e:phone-number
e:religion
e:url
e:utm
e:time
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>
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:e="http://marklogic.com/entity"><e:person>George Washington</e:person> never visited <style xmlns="http://www.w3.org/1999/xhtml">Norway</style>. </p>