MarkLogic 12 EA 1 Product Documentation
sem.curieShorten

sem.curieShorten(
   iri as sem.iri,
   [mapping as Object]
) as String

Summary

This function shortens an IRI into a CURIE (Compact URI) into a sem:iri object. Returns the IRI string unchanged if no mapping is available.

Parameters
iri An IRI.
mapping An optional set of prefix mappings. If not specified, a default set of prefixes is used.

Example

const sem = require("/MarkLogic/semantics.xqy");
      
sem.curieShorten(sem.iri("http://xmlns.com/foaf/0.1/person2"));

// shortens and returns the CURIE (Compact URI) as a string 
=>
foaf:person2
    
Powered by MarkLogic Server | Terms of Use | Privacy Policy