Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example of MarkLogic 7 Semantic triple query, emitting as custom XML
xquery version "1.0-ml";
let $out:=sem:sparql('
SELECT *
WHERE { <http://dbpedia.org/resource/Debbie_Harry> ?p ?o }
')
for $i in $out
let $p:=map:get($i,"p")
let $o:=map:get($i,"o")
return <node name="{$p}">{$o}</node>
<node name="http://dbpedia.org/ontology/birthPlace">http://dbpedia.org/resource/Florida</node>
<node name="http://dbpedia.org/ontology/birthPlace">http://dbpedia.org/resource/Miami</node>
<node name="http://www.w3.org/1999/02/22-rdf-syntax-ns#type">http://xmlns.com/foaf/0.1/Person</node>
<node name="http://xmlns.com/foaf/0.1/givenName">Deborah</node>
<node name="http://xmlns.com/foaf/0.1/name">Deborah Harry</node>
<node name="http://xmlns.com/foaf/0.1/surname">Harry</node>
<node name="http://dbpedia.org/ontology/birthDate">1945-07-01</node>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment