Thank you Geert, Great that was exactly what I was looking for!
Maybe the example should be added to the documentation of the function sure would have saved me some time. Regards and thanks again, Erik Från: [email protected] [mailto:[email protected]] För Geert Josten Skickat: den 20 februari 2018 15:17 Till: MarkLogic Developer Discussion <[email protected]> Ämne: Re: [MarkLogic Dev General] short question about result of sem:sparql-values Hi Erik, Correct. The function returns a sequence of sem:binding objects. A sem:binding is a special type of map:map, so you can use map functions on them. Here is a working example that returns concrete values: xquery version "1.0-ml"; import module namespace sem = "http://marklogic.com/semantics" at "/MarkLogic/semantics.xqy"; sem:sparql-values("select * { ?s ?p ?o } limit 50", map:map()) ! map:get(., "o") Note: the ! Is the iterator operator from XQuery 3. You could also use a more old fashion FLWOR is that would be clearer to you.. Cheers, Geert From: <[email protected]<mailto:[email protected]>> on behalf of Erik Zander <[email protected]<mailto:[email protected]>> Reply-To: MarkLogic Developer Discussion <[email protected]<mailto:[email protected]>> Date: Tuesday, February 20, 2018 at 9:02 AM To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>> Subject: [MarkLogic Dev General] short question about result of sem:sparql-values Hi, I have what I feel should be a simple question but I yet to understand how it's done. When calling sem:sparql-values how do I get the result? In the documentation it says it's a sequence http://docs.marklogic.com/guide/semantics/semantic-searches - id_90139<http://docs.marklogic.com/guide/semantics/semantic-searches#id_90139> but that is as I understand it a sequence of sem:binding Output of xdmp:describe sem:binding(<json:object xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:json="http://marklogic.com/xdmp/json"><json:entry<http://marklogic.com/xdmp/json%22%3e%3cjson:entry> key="notEmpty"><json:value xsi:type="sem:iri" xmlns:...</json:object>) Raw Output [{"notEmpty":"<http://www.example.org/entity/Q9235>","label":"\"Friedrich<http://www.example.org/entity/Q9235%3e%22,%22label%22:%22/%22Friedrich> Hegel\"@sv"}] In this case I just want to get the value Friedrich Hegel. Doing sem:sparql-values($sparql,$bindings)/label doesn't work as it says not a node Any pointers on how I should go about would be welcome. Regards Erik
_______________________________________________ General mailing list [email protected] Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general
