op.prefixer( baseUri as String ) as Plan
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. |
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();