Loading TOC...

sem:bnode

sem:bnode(
   [$value as xs:anyAtomicType]
) as sem:blank

Summary

This function returns an identifier for a blank node, allowing the construction of a triple that refers to a blank node. This XQuery function backs up the SPARQL BNODE() function.

This function is a built-in.

Parameters
$value If provided, the same blank node identifier is returned for the same argument value passed to the function.

Example


xquery version "1.0-ml";
import module namespace sem = "http://marklogic.com/semantics"
      at "/MarkLogic/semantics.xqy";

let $person1 := sem:bnode()
let $person2 := sem:bnode()
let $t1 := sem:triple($person1,
         sem:iri("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"),
	       sem:iri("http://xmlns.com/foaf/0.1/Person"))
let $t2 := sem:triple($person2,
	       sem:iri("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"),
	       sem:iri("http://xmlns.com/foaf/0.1/Person"))
let $t3 := sem:triple($person1,
	       sem:iri("http://xmlns.com/foaf/0.1/knows"), $person2) return ($t1,$t2,$t3)

 => (: returns identifiers for blank nodes :)
sem:triple(
  sem:blank("http://marklogic.com/semantics/blank/3098376212503391907"),
  sem:iri("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"),
  sem:iri("http://xmlns.com/foaf/0.1/Person"))

sem:triple(
  sem:blank("http://marklogic.com/semantics/blank/3280643260770921296"),
  sem:iri("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"),
  sem:iri("http://xmlns.com/foaf/0.1/Person"))

sem:triple(
  sem:blank("http://marklogic.com/semantics/blank/3098376212503391907"),
  sem:iri("http://xmlns.com/foaf/0.1/knows"),
  sem:blank("http://marklogic.com/semantics/blank/3280643260770921296"))

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.