@Test public void PatternBlock() { Iterable<Bindings> iterable = visitor.visit((PatternBlock) Blocks.SPO, context).getFirst(); List<Bindings> rows = IteratorAdapter.asList(iterable.iterator()); assertEquals(2, rows.size()); assertEquals(3, rows.get(0).toMap().size()); assertEquals(3, rows.get(1).toMap().size()); assertEquals(id, rows.get(0).get("s")); assertEquals(id, rows.get(1).get("s")); }
@Override public NODE visit(Constant<?> expr, Bindings bindings) { if (expr.getType().equals(String.class)) { return new LIT(expr.getConstant().toString()); } else if (NODE.class.isAssignableFrom(expr.getType())) { return (NODE) expr.getConstant(); } else { UID datatype = ConverterRegistryImpl.DEFAULT.getDatatype(expr.getType()); String value = ConverterRegistryImpl.DEFAULT.toString(expr.getConstant()); return new LIT(value, datatype); } }
QueryRDFVisitor implements RDFVisitor<Object, Bindings> { @Override public NODE visit(Constant<?> expr, Bindings bindings) { if (expr.getType().equals(String.class)) { return new LIT(expr.getConstant().toString()); } else if (NODE.class.isAssignableFrom(expr.getType())) { return (NODE) expr.getConstant(); } else { UID datatype = ConverterRegistryImpl.DEFAULT.getDatatype(expr.getType()); String value = ConverterRegistryImpl.DEFAULT.toString(expr.getConstant()); return new LIT(value, datatype); } } }
QueryRDFVisitor implements RDFVisitor<Object, Bindings> { @Override public NODE visit(Constant<?> expr, Bindings bindings) { if (expr.getType().equals(String.class)) { return new LIT(expr.getConstant().toString()); } else if (NODE.class.isAssignableFrom(expr.getType())) { return (NODE) expr.getConstant(); } else { UID datatype = ConverterRegistryImpl.DEFAULT.getDatatype(expr.getType()); String value = ConverterRegistryImpl.DEFAULT.toString(expr.getConstant()); return new LIT(value, datatype); } } QueryRDFVisitor(RDFConnection connection); }
QueryRDFVisitor implements RDFVisitor<Object, Bindings> { @Override public NODE visit(Constant<?> expr, Bindings bindings) { if (expr.getType().equals(String.class)) { return new LIT(expr.getConstant().toString()); } else if (NODE.class.isAssignableFrom(expr.getType())) { return (NODE) expr.getConstant(); } else { UID datatype = ConverterRegistryImpl.DEFAULT.getDatatype(expr.getType()); String value = ConverterRegistryImpl.DEFAULT.toString(expr.getConstant()); return new LIT(value, datatype); } } QueryRDFVisitor(RDFConnection connection); @Override NODE visit(Constant<?> expr, Bindings bindings); @Override Object visit(FactoryExpression<?> expr, Bindings bindings); @Override Pair<Iterable<Bindings>, Bindings> visit(GraphBlock expr, Bindings bindings); @Override Pair<Iterable<Bindings>, Bindings> visit(GroupBlock expr, Bindings bindings); @SuppressWarnings("unchecked") @Override Object visit(final Operation<?> expr, Bindings bindings); @Override Pair<Iterable<Bindings>, Bindings> visit(OptionalBlock expr, final Bindings bindings); @Override NODE visit(ParamExpression<?> expr, Bindings bindings); @Override NODE visit(Path<?> expr, Bindings bindings); @Override Pair<Iterable<Bindings>, Bindings> visit(final PatternBlock expr, final Bindings bindings); @SuppressWarnings("unchecked") @Override Object visit(QueryMetadata md, QueryLanguage<?, ?> queryType); @Override Object visit(SubQueryExpression<?> expr, Bindings bindings); @Override Object visit(TemplateExpression<?> expr, Bindings bindings); @SuppressWarnings("unchecked") @Override Pair<? extends Iterable<Bindings>, Bindings> visit(UnionBlock expr, Bindings bindings); }
QueryRDFVisitor implements RDFVisitor<Object, Bindings> { @Override public NODE visit(Constant<?> expr, Bindings bindings) { if (expr.getType().equals(String.class)) { return new LIT(expr.getConstant().toString()); } else if (NODE.class.isAssignableFrom(expr.getType())) { return (NODE) expr.getConstant(); } else { UID datatype = ConverterRegistryImpl.DEFAULT.getDatatype(expr.getType()); String value = ConverterRegistryImpl.DEFAULT.toString(expr.getConstant()); return new LIT(value, datatype); } } QueryRDFVisitor(RDFConnection connection); @Override NODE visit(Constant<?> expr, Bindings bindings); @Override Object visit(FactoryExpression<?> expr, Bindings bindings); @Override Pair<Iterable<Bindings>, Bindings> visit(GraphBlock expr, Bindings bindings); @Override Pair<Iterable<Bindings>, Bindings> visit(GroupBlock expr, Bindings bindings); @SuppressWarnings("unchecked") @Override Object visit(final Operation<?> expr, Bindings bindings); @Override Pair<Iterable<Bindings>, Bindings> visit(OptionalBlock expr, final Bindings bindings); @Override NODE visit(ParamExpression<?> expr, Bindings bindings); @Override NODE visit(Path<?> expr, Bindings bindings); @Override Pair<Iterable<Bindings>, Bindings> visit(final PatternBlock expr, final Bindings bindings); @SuppressWarnings("unchecked") @Override Object visit(QueryMetadata md, QueryLanguage<?, ?> queryType); @Override Object visit(SubQueryExpression<?> expr, Bindings bindings); @Override Object visit(TemplateExpression<?> expr, Bindings bindings); @SuppressWarnings("unchecked") @Override Pair<? extends Iterable<Bindings>, Bindings> visit(UnionBlock expr, Bindings bindings);  }