Loading TOC...

MarkLogic 12 EA 2 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();
  

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