private static TupleExpr getJoin(TupleExpr oldJoin, TupleExpr newArg) { if (newArg instanceof FlattenedOptional) { return new LeftJoin(oldJoin, ((FlattenedOptional) newArg).getRightArg()); } else { return new Join(oldJoin, newArg); } }
private TupleExpr merge(List<Block> blocks, QueryMetadata md) { List<TupleExpr> tuples = new ArrayList<TupleExpr>(blocks.size()); boolean asLeftJoin = false; for (Block block : blocks) { if (block instanceof OptionalBlock) { if (!tuples.isEmpty()) { TupleExpr right = toTuple(block, md); LeftJoin lj = new LeftJoin(tuples.size() == 1 ? tuples.get(0) : join(tuples), right); tuples = new ArrayList<TupleExpr>(); tuples.add(lj); } else { asLeftJoin = true; tuples.add(toTuple(block, md)); } } else if (asLeftJoin) { LeftJoin lj = new LeftJoin(toTuple(block, md), tuples.get(0)); tuples = new ArrayList<TupleExpr>(); tuples.add(lj); asLeftJoin = false; } else { tuples.add(toTuple(block, md)); } } return join(tuples); }
private TupleExpr merge(List<Block> blocks, QueryMetadata md){ List<TupleExpr> tuples = new ArrayList<TupleExpr>(blocks.size()); boolean asLeftJoin = false; for (Block block : blocks){ if (block instanceof OptionalBlock){ if (!tuples.isEmpty()){ TupleExpr right = toTuple(block, md); LeftJoin lj = new LeftJoin(tuples.size() == 1 ? tuples.get(0) : new Join(tuples), right); tuples = new ArrayList<TupleExpr>(); tuples.add(lj); }else{ asLeftJoin = true; tuples.add(toTuple(block, md)); } }else if (asLeftJoin){ LeftJoin lj = new LeftJoin(toTuple(block,md), tuples.get(0)); tuples = new ArrayList<TupleExpr>(); tuples.add(lj); asLeftJoin = false; }else{ tuples.add(toTuple(block, md)); } } if (tuples.size() > 1){ return new Join(tuples); }else{ return tuples.get(0); } }
private TupleExpr merge(List<Block> blocks, QueryMetadata md) { List<TupleExpr> tuples = new ArrayList<TupleExpr>(blocks.size()); boolean asLeftJoin = false; for (Block block : blocks) { if (block instanceof OptionalBlock) { if (!tuples.isEmpty()) { TupleExpr right = toTuple(block, md); LeftJoin lj = new LeftJoin(tuples.size() == 1 ? tuples.get(0) : new Join(tuples), right); tuples = new ArrayList<TupleExpr>(); tuples.add(lj); } else { asLeftJoin = true; tuples.add(toTuple(block, md)); } } else if (asLeftJoin) { LeftJoin lj = new LeftJoin(toTuple(block, md), tuples.get(0)); tuples = new ArrayList<TupleExpr>(); tuples.add(lj); asLeftJoin = false; } else { tuples.add(toTuple(block, md)); } } if (tuples.size() > 1) { return new Join(tuples); } else { return tuples.get(0); } }
BinaryTupleOperator aJoin = aGroup.isOptional() ? new LeftJoin() : new Join();
QueryRoot groupRoot = new QueryRoot(tupleNode); visitGroupGraphPattern((Resource)elements); LeftJoin leftJoin = new LeftJoin(); currentNode.replaceWith(leftJoin); leftJoin.setLeftArg(currentNode);
LeftJoin lj = new LeftJoin();