@Test public void To_String() { Block block = Blocks.optional(Blocks.SPOC); assertEquals("OPTIONAL { {s} {p} {o} {c} . }", block.toString()); }
@Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("OPTIONAL { "); for (Block block : blocks) { builder.append(block.toString()).append(" "); } if (filters != null) { builder.append(" FILTER(").append(filters).append(")"); } builder.append(" }"); return builder.toString(); }
OptionalBlock implements ContainerBlock { @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("OPTIONAL { "); for (Block block : blocks) { builder.append(block.toString()).append(" "); } if (filters != null) { builder.append(" FILTER(").append(filters).append(")"); } builder.append(" }"); return builder.toString(); } }
OptionalBlock implements ContainerBlock { @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("OPTIONAL { "); for (Block block : blocks) { builder.append(block.toString()).append(" "); } if (filters != null) { builder.append(" FILTER(").append(filters).append(")"); } builder.append(" }"); return builder.toString(); } OptionalBlock(List<Block> blocks, Predicate... filters); }
OptionalBlock implements ContainerBlock { @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("OPTIONAL { "); for (Block block : blocks) { builder.append(block.toString()).append(" "); } if (filters != null) { builder.append(" FILTER(").append(filters).append(")"); } builder.append(" }"); return builder.toString(); } OptionalBlock(List<Block> blocks, Predicate... filters); @Override Predicate not(); @SuppressWarnings("unchecked") @Override R accept(Visitor<R, C> v, C context); @Override Class<? extends Boolean> getType(); List<Block> getBlocks(); @Nullable Predicate getFilters(); @Override BooleanExpression exists(); @Override int hashCode(); @Override boolean equals(Object o); @Override String toString(); }
OptionalBlock implements ContainerBlock { @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("OPTIONAL { "); for (Block block : blocks) { builder.append(block.toString()).append(" "); } if (filters != null) { builder.append(" FILTER(").append(filters).append(")"); } builder.append(" }"); return builder.toString(); } OptionalBlock(List<Block> blocks, Predicate... filters); @Override Predicate not(); @SuppressWarnings("unchecked") @Override R accept(Visitor<R, C> v, C context); @Override Class<? extends Boolean> getType(); List<Block> getBlocks(); @Nullable Predicate getFilters(); @Override BooleanExpression exists(); @Override int hashCode(); @Override boolean equals(Object o); @Override String toString();  }