01: package org.openrdf.query.algebra.evaluation.impl;
02:
03: import junit.framework.TestCase;
04:
05: import org.openrdf.model.vocabulary.RDF;
06: import org.openrdf.query.QueryLanguage;
07: import org.openrdf.query.TupleQuery;
08: import org.openrdf.query.TupleQueryResult;
09: import org.openrdf.repository.Repository;
10: import org.openrdf.repository.RepositoryConnection;
11: import org.openrdf.repository.sail.SailRepository;
12: import org.openrdf.sail.memory.MemoryStore;
13:
14: public class CascadeValueExceptionTest extends TestCase {
15: private static String queryStr1 = "SELECT *\n"
16: + "WHERE {\n"
17: + " ?s ?p ?o FILTER( !(\"2002\" < \"2007\"^^<http://www.w3.org/2001/XMLSchema#gYear>))\n"
18: + "}";
19:
20: private static String queryStr2 = "SELECT *\n"
21: + "WHERE {\n"
22: + " ?s ?p ?o FILTER( !(\"2002\" = \"2007\"^^<http://www.w3.org/2001/XMLSchema#gYear>))\n"
23: + "}";
24:
25: private RepositoryConnection conn;
26:
27: private Repository repository;
28:
29: public void testValueExceptionLessThan() throws Exception {
30: TupleQuery query = conn.prepareTupleQuery(QueryLanguage.SPARQL,
31: queryStr1);
32: TupleQueryResult evaluate = query.evaluate();
33: try {
34: assertFalse(evaluate.hasNext());
35: } finally {
36: evaluate.close();
37: }
38: }
39:
40: public void testValueExceptionEqual() throws Exception {
41: TupleQuery query = conn.prepareTupleQuery(QueryLanguage.SPARQL,
42: queryStr2);
43: TupleQueryResult evaluate = query.evaluate();
44: try {
45: assertFalse(evaluate.hasNext());
46: } finally {
47: evaluate.close();
48: }
49: }
50:
51: @Override
52: protected void setUp() throws Exception {
53: repository = new SailRepository(new MemoryStore());
54: repository.initialize();
55: conn = repository.getConnection();
56: conn.add(RDF.NIL, RDF.TYPE, RDF.LIST);
57: }
58:
59: @Override
60: protected void tearDown() throws Exception {
61: conn.close();
62: repository.shutDown();
63: }
64:
65: }
|