op.fromSPARQL( select as String, [qualifier as String], [options as String] ) as ModifyPlan
This function dynamically constructs a row set based on a SPARQL SELECT query from triples.
The fromSPARQL
function is one of the
Data Access Functions.
// 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'});
// List the firstname of the people with id <http://marklogicsparql.com/id#5555> const op = require('/MarkLogic/optic'); op.fromSPARQL('PREFIX ad: <http://marklogicsparql.com/addressbook#> '+ 'SELECT ?firstName '+ 'WHERE {<#5555> ad:firstName ?firstName .}' , 'sparql', {dedup:'on',base:'http://marklogicsparql.com/id#'}) .result();
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.