ValidateQ4Recommendations { public static void process(ASTQueryContainer ast) throws VisitorException { final ASTValidateAST validate = new ASTValidateAST(); if ((Integer) validate.visit(ast, 0) == 0) { throw new DGSException("No Point Of Focus found"); } } private  ValidateQ4Recommendations(); static void process(ASTQueryContainer ast);  }
@Test(expected=DGSException.class) public void testNoPOF() throws Exception { final String q = "SELECT * { ?s ?p ?o }"; ast = SyntaxTreeBuilder.parseQuery(q); ValidateQ4Recommendations.process(ast); }
@Test(expected=DGSException.class) public void testPOFGraph() throws Exception { final String q = "SELECT ?s WHERE { GRAPH <http: ast = SyntaxTreeBuilder.parseQuery(q); ValidateQ4Recommendations.process(ast); }
@Test public void testPOFGraph2() throws Exception { final String q = "SELECT ?s WHERE { GRAPH < }"; ast = SyntaxTreeBuilder.parseQuery(q); ValidateQ4Recommendations.process(ast); }
@Test(expected=DGSException.class) public void testDuplicatePOF() throws Exception { final String q = "SELECT ?s WHERE { ?s < ?o ; a < }"; ast = SyntaxTreeBuilder.parseQuery(q); ValidateQ4Recommendations.process(ast); }
@Test(expected=DGSException.class) public void testDuplicateFillVar() throws Exception { final String q = "SELECT ?s WHERE { ?s < ; ?p }"; ast = SyntaxTreeBuilder.parseQuery(q); ValidateQ4Recommendations.process(ast); }
@Test(expected=DGSException.class) public void testWrongFillVar() throws Exception { final String q = "SELECT ?s WHERE { ?s ?p }"; ast = SyntaxTreeBuilder.parseQuery(q); ValidateQ4Recommendations.process(ast); }
@Test(expected=DGSException.class) public void testWrongFillVar2() throws Exception { final String q = "SELECT ?s WHERE { ?s <name> }"; ast = SyntaxTreeBuilder.parseQuery(q); ValidateQ4Recommendations.process(ast); }
@Test public void testGoodFillVar() throws Exception { final String q = "SELECT ?s WHERE { ?s < }"; ast = SyntaxTreeBuilder.parseQuery(q); ValidateQ4Recommendations.process(ast); }