Loading TOC...

MarkLogic 9 Product Documentation
sem:curie-shorten

sem:curie-shorten(
   $iri as sem:iri,
   [$mapping as map:map]
) as xs: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

xquery version "1.0-ml"; 
 
import module namespace sem = "http://marklogic.com/semantics" 
      at "/MarkLogic/semantics.xqy";
      
sem:curie-shorten(sem:iri("http://xmlns.com/foaf/0.1/person2"))

  (: shortens and returns the CURIE (Compact URI) as a string :)
  =>
foaf:person2
    

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