Search in sources :

Example 11 with QueryParser

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());
}
Also used : QueryParser(org.openrdf.query.parser.QueryParser) SPARQLParser(org.openrdf.query.parser.sparql.SPARQLParser) QueryRoot(org.openrdf.query.algebra.QueryRoot) ParsedQuery(org.openrdf.query.parser.ParsedQuery)

Example 12 with QueryParser

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());
}
Also used : QueryParser(org.openrdf.query.parser.QueryParser) SPARQLParser(org.openrdf.query.parser.sparql.SPARQLParser) QueryRoot(org.openrdf.query.algebra.QueryRoot) ParsedQuery(org.openrdf.query.parser.ParsedQuery)

Aggregations

ParsedQuery (org.openrdf.query.parser.ParsedQuery)12 QueryParser (org.openrdf.query.parser.QueryParser)12 SPARQLParser (org.openrdf.query.parser.sparql.SPARQLParser)12 QueryRoot (org.openrdf.query.algebra.QueryRoot)11 TupleExpr (org.openrdf.query.algebra.TupleExpr)2 IOException (java.io.IOException)1 Range (org.apache.accumulo.core.data.Range)1 SimilarVarJoinOptimizer (org.apache.rya.accumulo.pig.optimizer.SimilarVarJoinOptimizer)1 ByteRange (org.apache.rya.api.query.strategy.ByteRange)1 QueryJoinOptimizer (org.apache.rya.rdftriplestore.evaluation.QueryJoinOptimizer)1 InverseOfVisitor (org.apache.rya.rdftriplestore.inference.InverseOfVisitor)1 SymmetricPropertyVisitor (org.apache.rya.rdftriplestore.inference.SymmetricPropertyVisitor)1 TransitivePropertyVisitor (org.apache.rya.rdftriplestore.inference.TransitivePropertyVisitor)1 MalformedQueryException (org.openrdf.query.MalformedQueryException)1 StatementPattern (org.openrdf.query.algebra.StatementPattern)1 Var (org.openrdf.query.algebra.Var)1