I am currently trying to see if it's possible to extract a certain value from a document and bind it to a variable in SPARQL
For example if i have such a document in MarkLogic.
/person/John
<person_data>
<name>John</name>
<age>25</age>
</person_data>
using this data I attempted various ways to bind it such as using XPath in sem:sparql as shown below
xquery version "1.0-ml";
import module namespace sem = "http://marklogic.com/semantics" at "/MarkLogic/semantics.xqy";
sem:sparql('
PREFIX fn : <http://www.w3.org/2005/xpath-functions>
SELECT *
WHERE {
?s ?p ?o .
BIND (fn:doc("/person/John")//name/text() AS ?name)
}
',
(),
(),
()
)
However, this resulted in an error. Hence, I greatly appreciate any advise given on accomplishing this.