@Test public void makeVarOrders_fromSPARQL() throws MalformedQueryException { final String sparql = "SELECT ?a ?b ?c " + "WHERE { " + "?a <http: "?b <http: "}"; final PcjVarOrderFactory factory = new ShiftVarOrderFactory(); final Set<VariableOrder> varOrders = factory.makeVarOrders(sparql); final Set<VariableOrder> expected = Sets.newHashSet(); expected.add( new VariableOrder("a", "b", "c") ); expected.add( new VariableOrder("c", "a", "b") ); expected.add( new VariableOrder("b", "c", "a") ); assertEquals(expected, varOrders); }
@Override public Set<VariableOrder> makeVarOrders(final String sparql) throws MalformedQueryException { requireNonNull(sparql); final Set<String> bindingNames = new SPARQLParser().parseQuery(sparql, null) .getTupleExpr() .getBindingNames(); return makeVarOrders( new VariableOrder(bindingNames) ); }
ShiftVarOrderFactory implements PcjVarOrderFactory { @Override public Set<VariableOrder> makeVarOrders(final String sparql) throws MalformedQueryException { requireNonNull(sparql); final Set<String> bindingNames = new SPARQLParser().parseQuery(sparql, null) .getTupleExpr() .getBindingNames(); return makeVarOrders( new VariableOrder(bindingNames) ); } }
ShiftVarOrderFactory implements PcjVarOrderFactory { @Override public Set<VariableOrder> makeVarOrders(final String sparql) throws MalformedQueryException { requireNonNull(sparql); final Set<String> bindingNames = new SPARQLParser().parseQuery(sparql, null) .getTupleExpr() .getBindingNames(); return makeVarOrders( new VariableOrder(bindingNames) ); }  }
ShiftVarOrderFactory implements PcjVarOrderFactory { @Override public Set<VariableOrder> makeVarOrders(final String sparql) throws MalformedQueryException { requireNonNull(sparql); final Set<String> bindingNames = new SPARQLParser().parseQuery(sparql, null) .getTupleExpr() .getBindingNames(); return makeVarOrders( new VariableOrder(bindingNames) ); }  @Override Set<VariableOrder> makeVarOrders(final String sparql); @Override Set<VariableOrder> makeVarOrders(final VariableOrder varOrder); }
ShiftVarOrderFactory implements PcjVarOrderFactory { @Override public Set<VariableOrder> makeVarOrders(final String sparql) throws MalformedQueryException { requireNonNull(sparql); final Set<String> bindingNames = new SPARQLParser().parseQuery(sparql, null) .getTupleExpr() .getBindingNames(); return makeVarOrders( new VariableOrder(bindingNames) ); }  @Override Set<VariableOrder> makeVarOrders(final String sparql); @Override Set<VariableOrder> makeVarOrders(final VariableOrder varOrder);  }