ElementTriplesBlock elementBGP = new ElementTriplesBlock();
Triple t = new Triple(nodeVar, RDFS.label.asNode(), var2) ;
elementBGP.addTriple(t) ;
// Regular expression for regex(?hiddenVar, "pattern", "i")
Expr regex = new E_Regex(new ExprVar(var2.getName()), pattern, "i") ;
ElementGroup elementGroup = new ElementGroup() ;
elementGroup.addElement(elementBGP) ;
elementGroup.addElement(new ElementFilter(regex)) ;
// Compile it.