@Override public void visit(ElementUnion union) { ElementUnion ret = new ElementUnion(); for (Element elt: union.getElements()) { elt.visit(this); ret.addElement(result); } result = ret; }
@Override public void visit(ElementUnion union) { ElementUnion newunion = new ElementUnion(); for (Element e: union.getElements()) { e.visit(this); newunion.addElement(result); } result = newunion; }
@Override public void visit(ElementUnion union) { ElementUnion newunion = new ElementUnion(); for (Element e: union.getElements()) { e.visit(this); newunion.addElement(result); } result = newunion; }
@Override public void visit(ElementUnion union) { // remove nested unions ElementUnion ret = new ElementUnion(); for (Element elt : union.getElements()) { elt.visit(this); if (result instanceof ElementUnion) { ElementUnion nestedUnion = (ElementUnion) result; for (Element subelt: nestedUnion.getElements()) { assert !(subelt instanceof ElementUnion) : subelt +"\n"+ nestedUnion; ret.addElement(subelt); } } else { ret.addElement(result); } } if (ret.getElements().size() == 1) { result = ret.getElements().get(0); } else { result = ret; } }
@Override public void visit(P_Alt p) { p.getLeft().visit(this); Element left = result; if (left!=null) { p.getRight().visit(this); Element right = result; if (right!=null) { ElementUnion ret = new ElementUnion(left); ret.addElement(right); result = ret; } else { result = null; } } else { result = null; } }
final public Element GroupOrUnionGraphPattern() throws ParseException { Element el = null ; ElementUnion el2 = null ; el = GroupGraphPattern(); label_19: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case UNION: ; break; default: jj_la1[79] = jj_gen; break label_19; } jj_consume_token(UNION); if ( el2 == null ) { el2 = new ElementUnion() ; el2.addElement(el) ; } el = GroupGraphPattern(); el2.addElement(el) ; } {if (true) return (el2==null)? el : el2 ;} throw new Error("Missing return statement in function"); }
protected static Element processBoundFormula(AtomicFormula af) { assert af.getPredicate().getName().equals(Rule.BUILT_IN_BOUND_VAR) : af; assert af.getArity() >1 : af; assert af.getArguments().get(0).isVariable() : af; VariableExpr var = (VariableExpr) af.getArguments().get(0); Element ret; if (af.getArity() == 2) { Expr e1 = af.getArguments().get(1); ret = new ElementBind(Var.alloc(var.getName()), toJenaExpr(e1)); } else { assert af.getArguments().size() == af.getArity(); ElementUnion union = new ElementUnion(); for (int i=1;i<af.getArity();i++) { Expr e = af.getArguments().get(i); union.addElement(new ElementBind(Var.alloc(var.getName()), toJenaExpr(e))); } ret = union; } return ret; } protected static com.hp.hpl.jena.sparql.expr.Expr toJenaExpr(Expr e ) {
final public Element GroupOrUnionGraphPattern() throws ParseException { Element el = null ; ElementUnion el2 = null ; el = GroupGraphPattern(); label_10: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case UNION: ; break; default: jj_la1[33] = jj_gen; break label_10; } jj_consume_token(UNION); if ( el2 == null ) { el2 = new ElementUnion() ; el2.addElement(el) ; } el = GroupGraphPattern(); el2.addElement(el) ; } {if (true) return (el2==null)? el : el2 ;} throw new Error("Missing return statement in function"); }
final public Element GroupOrUnionGraphPattern() throws ParseException { Element el = null ; ElementUnion el2 = null ; el = GroupGraphPattern(); label_10: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case UNION: ; break; default: jj_la1[33] = jj_gen; break label_10; } jj_consume_token(UNION); if ( el2 == null ) { el2 = new ElementUnion() ; el2.addElement(el) ; } el = GroupGraphPattern(); el2.addElement(el) ; } {if (true) return (el2==null)? el : el2 ;} throw new Error("Missing return statement in function"); }
final public Element GroupOrUnionGraphPattern() throws ParseException { Element el = null ; ElementUnion el2 = null ; el = GroupGraphPattern(); label_21: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case UNION: ; break; default: jj_la1[89] = jj_gen; break label_21; } jj_consume_token(UNION); if ( el2 == null ) { el2 = new ElementUnion() ; el2.addElement(el) ; } el = GroupGraphPattern(); el2.addElement(el) ; } {if (true) return (el2==null)? el : el2 ;} throw new Error("Missing return statement in function"); }
final public Element GroupOrUnionGraphPattern() throws ParseException { Element el = null ; ElementUnion el2 = null ; el = GroupGraphPattern(); label_18: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case UNION: ; break; default: jj_la1[76] = jj_gen; break label_18; } jj_consume_token(UNION); if ( el2 == null ) { el2 = new ElementUnion() ; el2.addElement(el) ; } el = GroupGraphPattern(); el2.addElement(el) ; } {if (true) return (el2==null)? el : el2 ;} throw new Error("Missing return statement in function"); }
final public Element GroupOrUnionGraphPattern() throws ParseException { Element el = null ; ElementUnion el2 = null ; el = GroupGraphPattern(); label_21: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case UNION: ; break; default: jj_la1[80] = jj_gen; break label_21; } jj_consume_token(UNION); if ( el2 == null ) { el2 = new ElementUnion() ; el2.addElement(el) ; } el = GroupGraphPattern(); el2.addElement(el) ; } {if (true) return (el2==null)? el : el2 ;} throw new Error("Missing return statement in function"); }
ret = q; firstRuleHeadVars = rule.getHead().getArguments(); ElementUnion union = new ElementUnion(); Element elt = q.getQueryPattern(); union.addElement(elt);
public void visit(OpUnion opUnion) { Element eLeft = asElementGroup(opUnion.getLeft()) ; Element eRight = asElementGroup(opUnion.getRight()) ; if ( eLeft instanceof ElementUnion ) { ElementUnion elUnion = (ElementUnion)eLeft ; elUnion.addElement(eRight) ; return ; } // if ( eRight instanceof ElementUnion ) // { // ElementUnion elUnion = (ElementUnion)eRight ; // elUnion.getElements().add(0, eLeft) ; // return ; // } ElementUnion elUnion = new ElementUnion() ; elUnion.addElement(eLeft) ; elUnion.addElement(eRight) ; currentGroup().addElement(elUnion) ; }
@Override public void visit(OpUnion opUnion) { Element eLeft = asElementGroup(opUnion.getLeft()) ; Element eRight = asElementGroup(opUnion.getRight()) ; if ( eLeft instanceof ElementUnion ) { ElementUnion elUnion = (ElementUnion)eLeft ; elUnion.addElement(eRight) ; return ; } // if ( eRight instanceof ElementUnion ) // { // ElementUnion elUnion = (ElementUnion)eRight ; // elUnion.getElements().add(0, eLeft) ; // return ; // } ElementUnion elUnion = new ElementUnion() ; elUnion.addElement(eLeft) ; elUnion.addElement(eRight) ; currentGroup().addElement(elUnion) ; }
ElementUnion patterns = new ElementUnion(); NewVariableGenerator varGen = new NewVariableGenerator("var_"); for (OWLAxiom ax: getNegativeInclClosure()) {
final ElementUnion u = new ElementUnion(); u.addElement( a ); u.addElement( b );
ElementUnion elementUnion = new ElementUnion();
ElementUnion union = new ElementUnion();