use of org.openrdf.query.parser.QueryParser in project incubator-rya by apache.
the class SparqlToPigTransformVisitorTest method testStatementPatternContextVar.
public void testStatementPatternContextVar() throws Exception {
String query = "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" + " PREFIX ub: <urn:lubm:rdfts#>\n" + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n" + " SELECT * WHERE\n" + " {\n" + " GRAPH ?g {\n" + "\t?x rdf:type ub:UndergraduateStudent\n" + " }\n" + " ?x ub:pred ?g." + " }\n" + "";
QueryParser parser = new SPARQLParser();
ParsedQuery parsedQuery = parser.parseQuery(query, null);
// System.out.println(parsedQuery);
SparqlToPigTransformVisitor visitor = new SparqlToPigTransformVisitor();
visitor.setTablePrefix(tablePrefix);
visitor.setInstance(instance);
visitor.setZk(zk);
visitor.setUser(user);
visitor.setPassword(password);
visitor.meet(new QueryRoot(parsedQuery.getTupleExpr()));
// System.out.println(visitor.getPigScript());
}
use of org.openrdf.query.parser.QueryParser in project incubator-rya by apache.
the class SparqlToPigTransformVisitorTest method testStatementPatternContext.
public void testStatementPatternContext() throws Exception {
String query = "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" + " PREFIX ub: <urn:lubm:rdfts#>\n" + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n" + " SELECT * WHERE\n" + " {\n" + " GRAPH ub:g1 {\n" + "\t?x rdf:type ub:UndergraduateStudent\n" + " }\n" + " }\n" + "";
QueryParser parser = new SPARQLParser();
ParsedQuery parsedQuery = parser.parseQuery(query, null);
// System.out.println(parsedQuery);
SparqlToPigTransformVisitor visitor = new SparqlToPigTransformVisitor();
visitor.setTablePrefix(tablePrefix);
visitor.setInstance(instance);
visitor.setZk(zk);
visitor.setUser(user);
visitor.setPassword(password);
visitor.meet(new QueryRoot(parsedQuery.getTupleExpr()));
// System.out.println(visitor.getPigScript());
}
Aggregations