
op:from-sparql( $select as xs:string, [$qualifier as xs:string?] ) as map:map
This function dynamically constructs a row set based on a SPARQL SELECT query from triples.
(: List all of the people born in Brooklyn. :)
xquery version "1.0-ml";
import module namespace op="http://marklogic.com/optic"
at "/MarkLogic/optic.xqy";
op:from-sparql('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 .}')
=> op:result((), map:entry("name", "Mae West"))
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.