Loading TOC...

MarkLogic 9 Product Documentation
op.fromSPARQL

op.fromSPARQL(
   select as String,
   [qualifier as String]
) as ModifyPlan

Summary

This function dynamically constructs a row set based on a SPARQL SELECT query from triples.

Parameters
select A SPARQL SELECT query expressed as a string.
qualifier Specifies a name for qualifying the column names. An "@" in front of the name specifies a parameter placeholder. A parameter placeholder in the SPARQL string must be bound to a parameter value in the result() call.

Usage Notes

The fromSPARQL function is one of the Data Access Functions.

Example


// List all of the people born in Brooklyn.

const op = require('/MarkLogic/optic');

  op.fromSPARQL('PREFIX db: <http://dbpedia.org/resource/> \
                 PREFIX foaf: <http://xmlns.com/foaf/0.1/> \
                 PREFIX onto: <http://dbpedia.org/ontology/> \
                 SELECT ?person ?name WHERE { ?person onto:birthPlace db:Brooklyn; foaf:name @name .}')
    .result(null, {name:'Mae West'});

  

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