MarkLogic Server 11.0 Product Documentation
op.prefixer

op.prefixer(
   baseUri as String
) as Plan

Summary

This function factory returns a new function that takes a name parameter and prepends the specified base URI onto the name.

Parameters
baseUri The base URI to be prepended to the name.

Example

const op = require('/MarkLogic/optic');
// prefixer is a factory for sem:iri() constructors in a namespace
const resource   = op.prefixer('http://dbpedia.org/resource/');
const foaf   = op.prefixer('http://xmlns.com/foaf/0.1/');
const onto = op.prefixer('http://dbpedia.org/ontology/');

const person = op.col('person');

const Plan =
    op.fromTriples([
        op.pattern(person, onto('birthPlace'), resource('Brooklyn')),
        op.pattern(person, foaf("name"), op.col("name"))
    ])
    .select();
Plan.result();
  
Powered by MarkLogic Server | Terms of Use | Privacy Policy