Reputation: 20150
How do I create a BIND clause and add it to an ElementGroup
, For example, suppose I have a node and want to bind this to a variable. In SPARQL, such a statement would probably be represented as:
BIND ( IRI("http://www.example.com/x") as ?x)
suppose that I already have a node:
Node x = NodeFactory.createURI("http://www.example.com/x");
So, How can I create such a clause Programmatically and add it to an ElementGroup
Upvotes: 1
Views: 72
Reputation: 20150
Finally, it was not that difficult, except due to the lack of documentation,
Simple as:
ElementGroup elg = .... ;
Node mainSubjectNode = NodeFactory.createURI("http://www.example.com/x");
ElementBind x = new ElementBind(Var.alloc("asd"),NodeValue.makeNode(mainSubjectNode));
elg.addElement(x);
Upvotes: 2