@Override public Void visit(GroupBlock expr, Void context) { handle(expr.getBlocks()); handle(expr.getFilters()); return null; }
public static GroupBlock group(Block... blocks) { return new GroupBlock(Arrays.asList(blocks)); }
@Override @SuppressWarnings("unchecked") public <R, C> R accept(Visitor<R, C> v, C context) { if (v instanceof RDFVisitor) { return (R) ((RDFVisitor) v).visit(this, context); } else if (v instanceof ToStringVisitor) { return (R) toString(); } else if (v.getClass().getName().equals("com.mysema.query.types.ExtractorVisitor")) { return (R) this; } else { throw new IllegalArgumentException(v.toString()); } }
blocks.addAll(((GroupBlock)bl).getBlocks());
@Test public void Exists() { assertEquals("exists { {s} {p} {o} . }", Blocks.group(Blocks.SPO).exists().toString()); }
blocks.addAll(((GroupBlock) bl).getBlocks());
@Nullable public Void visit(GroupBlock expr, @Nullable Void context) { lastPattern = null; append("{ "); visitBlocks(expr.getBlocks()); visitFilter(expr.getFilters()); append("} "); lastPattern = null; return null; }
blocks.addAll(((GroupBlock) bl).getBlocks());
public static GroupBlock filter(Block block, Predicate... filters) { return new GroupBlock(Collections.singletonList(block), filters); }
public Block asBlock() { List<Block> b = new ArrayList<Block>(); List<Predicate> f = new ArrayList<Predicate>(); for (Predicate filter : filters) { if (filter instanceof Block) { b.add((Block) filter); } else { f.add(filter); } } return new GroupBlock(b, f.toArray(new Predicate[f.size()])); }
public static GroupBlock group(Collection<Predicate> predicates) { List<Block> blocks = new ArrayList<Block>(); BooleanBuilder filters = new BooleanBuilder(); handle(predicates, blocks, filters); if (filters.getValue() == null) { return new GroupBlock(blocks); } else { return new GroupBlock(blocks, filters.getValue()); } }
protected void aggregateFilters() { if (!blocks.isEmpty()) { if (filters.getValue() == null) { super.where(new GroupBlock(blocks)); } else { super.where(new GroupBlock(blocks, filters.getValue())); } } blocks = new ArrayList<Block>(); filters = new BooleanBuilder(); }
@Override public String toString() { QueryMetadata metadata = queryMixin.getMetadata().clone(); if (!blocks.isEmpty()) { if (filters.getValue() == null) { metadata.addWhere(new GroupBlock(blocks)); } else { metadata.addWhere(new GroupBlock(blocks, filters.getValue())); } } SPARQLVisitor visitor = new SPARQLVisitor(); visitor.setInlineAll(true); visitor.visit(metadata, QueryLanguage.TUPLE); return visitor.toString(); }