ConstructGraph { public ConstructGraph(Set<ConstructProjection> projections) { Preconditions.checkNotNull(projections); Preconditions.checkArgument(projections.size() > 0); this.projections = projections; this.bNodeNames = getBNodeNames(projections); } ConstructGraph(Set<ConstructProjection> projections);  ConstructGraph(Collection<StatementPattern> patterns); Set<ConstructProjection> getProjections(); Set<RyaStatement> createGraphFromBindingSet(VisibilityBindingSet bs); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void testConstructGraph() throws MalformedQueryException, UnsupportedEncodingException { String query = "select ?x where { ?x <uri:talksTo> <uri:Bob>. ?y <uri:worksAt> ?z }"; SPARQLParser parser = new SPARQLParser(); ParsedQuery pq = parser.parseQuery(query, null); List<StatementPattern> patterns = StatementPatternCollector.process(pq.getTupleExpr()); ConstructGraph graph = new ConstructGraph(patterns); QueryBindingSet bs = new QueryBindingSet(); bs.addBinding("x", VF.createIRI("uri:Joe")); bs.addBinding("y", VF.createIRI("uri:Bob")); bs.addBinding("z", VF.createIRI("uri:BurgerShack")); VisibilityBindingSet vBs = new VisibilityBindingSet(bs,"FOUO"); Set<RyaStatement> statements = graph.createGraphFromBindingSet(vBs); RyaStatement statement1 = new RyaStatement(new RyaIRI("uri:Joe"), new RyaIRI("uri:talksTo"), new RyaIRI("uri:Bob")); RyaStatement statement2 = new RyaStatement(new RyaIRI("uri:Bob"), new RyaIRI("uri:worksAt"), new RyaIRI("uri:BurgerShack")); Set<RyaStatement> expected = Sets.newHashSet(Arrays.asList(statement1, statement2)); expected.forEach(x-> x.setColumnVisibility("FOUO".getBytes())); ConstructGraphTestUtils.ryaStatementSetsEqualIgnoresTimestamp(expected, statements); }