Loading TOC...

MarkLogic 9 Product Documentation
thsr:set-entry

thsr:set-entry(
   $uri as xs:string,
   $entry as item()
) as empty-sequence()

Summary

Adds the entry $entry to the thesaurus at $uri.

Parameters
uri The URI of a thesaurus document.
$entry An entry to add to the thesaurus, can either be an xml element or javascript object.

Usage Notes

set the entry $entry in the thesaurus at $uri. If $entry does not contain a valid entry node, an error will be raised. If an entry matching $entry does not exist in the thesaurus, $entry is added to the thesaurus. If $entry contains XML that does not conform to the thesaurus schema (located in install_dir/Config/thesaurus.xsd), an error is raised.

Example

  xquery version "1.0-ml";
  import module namespace 
	thsr="http://marklogic.com/xdmp/thesaurus" 
                             at "/MarkLogic/thesaurus.xqy";

  thsr:set-entry("/myThsrDocs/roget.xml", 
   <entry xmlns="http://marklogic.com/xdmp/thesaurus">
      <term>Car</term>
      <part-of-speech>noun</part-of-speech>
      <synonym>
        <term>Ford</term>
        <part-of-speech>noun</part-of-speech>
      </synonym>
      <synonym>
        <term>automobile</term>
        <part-of-speech>noun</part-of-speech>
      </synonym>
      <synonym>
        <term>Fiat</term>
        <part-of-speech>noun</part-of-speech>
      </synonym>
   </entry>)
  

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.