/** * Select everything in the kb using a GET. There will be no solutions * (assuming that we are using a told triple kb or quads kb w/o axioms). */ public void test_SELECT_ALL() throws Exception { final String queryStr = "select * where {?s ?p ?o}"; final TupleQuery query = cxn.prepareTupleQuery(QueryLanguage.SPARQL, queryStr); assertEquals(0, countResults(query.evaluate())); }
/** * Get everything matching an access path description. */ public void test_GET_accessPath_delete_all() throws Exception { doInsertbyURL("POST", packagePath + "test_delete_by_access_path.ttl"); final long result = countResults(doGetWithAccessPath(// // requestPath,// null,// s null,// p null )); assertEquals(7, result); }
/** * A GET query which should result in an error (the query is not well * formed). */ public void test_GET_SELECT_ERROR() throws Exception { final String queryStr = "select * where {?s ?p ?o} X {}"; final TupleQuery query = cxn.prepareTupleQuery(QueryLanguage.SPARQL, queryStr); try { assertEquals(0, countResults(query.evaluate())); fail("should be an error"); } catch (QueryEvaluationException ex) { // perfect } }
/** * Get everything with a specific subject. */ public void test_GET_accessPath_delete_s() throws Exception { doInsertbyURL("POST", packagePath + "test_delete_by_access_path.ttl"); final long result = countResults(doGetWithAccessPath(// // requestPath,// new URIImpl("http://www.bigdata.com/Mike"),// s null,// p null )); assertEquals(3, result); }
/** * Get everything with a specific predicate and object (a Literal). */ public void test_GET_accessPath_delete_p_o_Literal() throws Exception { doInsertbyURL("POST", packagePath + "test_delete_by_access_path.ttl"); final long result = countResults(doGetWithAccessPath(// // requestPath,// null,// s RDFS.LABEL,// p new LiteralImpl("Bryan")// o )); assertEquals(1, result); }
/** * Get everything with a specific object (a URI). */ public void test_GET_accessPath_delete_o_URI() throws Exception { doInsertbyURL("POST", packagePath + "test_delete_by_access_path.ttl"); final long result = countResults(doGetWithAccessPath(// // requestPath,// null,// s null,// p new URIImpl("http://xmlns.com/foaf/0.1/Person")// o )); assertEquals(3, result); }
/** * Get everything with a specific object (a Literal). */ public void test_GET_accessPath_delete_o_Literal() throws Exception { doInsertbyURL("POST", packagePath + "test_delete_by_access_path.ttl"); final long result = countResults(doGetWithAccessPath(// // requestPath,// null,// s null,// p new URIImpl("http://www.bigdata.com/Bryan")// o )); assertEquals(1, result); }
/** * Get everything with a specific predicate and object (a URI). */ public void test_GET_accessPath_delete_p_o_URI() throws Exception { doInsertbyURL("POST", packagePath + "test_delete_by_access_path.ttl"); final long result = countResults(doGetWithAccessPath(// // requestPath,// null,// s RDF.TYPE,// p new URIImpl("http://xmlns.com/foaf/0.1/Person")// o )); assertEquals(3, result); }
/** * Get using an access path which does not match anything. */ public void test_GET_accessPath_delete_NothingMatched() throws Exception { doInsertbyURL("POST", packagePath + "test_delete_by_access_path.ttl"); final long result = countResults(doGetWithAccessPath(// // requestPath,// null,// s null,// p new URIImpl("http://xmlns.com/foaf/0.1/XXX")// o )); assertEquals(0, result); }
/** * Get everything with a specific predicate. */ public void test_GET_accessPath_delete_p() throws Exception { doInsertbyURL("POST", packagePath + "test_delete_by_access_path.ttl"); final long result = countResults(doGetWithAccessPath(// // requestPath,// null,// s new URIImpl("http://www.w3.org/2000/01/rdf-schema#label"),// p null// o )); assertEquals(2, result); }
/** * Select everything in the kb using a GET. There will be no solutions * (assuming that we are using a told triple kb or quads kb w/o axioms). */ public void test_SELECT_ALL() throws Exception { final String queryStr = "select * where {?s ?p ?o}"; final TupleQuery query = cxn.prepareTupleQuery(QueryLanguage.SPARQL, queryStr); assertEquals(0, countResults(query.evaluate())); }
@Override protected void doInsertWithBodyTest(final String method, final int ntriples, /*final String servlet,*/ final RDFFormat format) throws Exception { final Graph g = genNTRIPLES2(ntriples); cxn.add(g); assertEquals(ntriples, getExactSize()); // Verify the expected #of statements in the store. { final String queryStr = "select * where {?s ?p ?o}"; final TupleQuery query = cxn.prepareTupleQuery(QueryLanguage.SPARQL, queryStr); assertEquals(ntriples, countResults(query.evaluate())); } }
/** * Get everything matching an access path description. */ public void test_GET_accessPath_delete_all() throws Exception { doInsertbyURL("POST", packagePath + "test_delete_by_access_path.ttl"); final long result = countResults(doGetWithAccessPath(// // requestPath,// null,// s null,// p null )); assertEquals(7, result); }
/** * Get everything with a specific predicate and object (a Literal). */ public void test_GET_accessPath_delete_p_o_Literal() throws Exception { doInsertbyURL("POST", packagePath + "test_delete_by_access_path.ttl"); final long result = countResults(doGetWithAccessPath(// // requestPath,// null,// s RDFS.LABEL,// p new LiteralImpl("Bryan")// o )); assertEquals(1, result); }
/** * Get using an access path which does not match anything. */ public void test_GET_accessPath_delete_NothingMatched() throws Exception { doInsertbyURL("POST", packagePath + "test_delete_by_access_path.ttl"); final long result = countResults(doGetWithAccessPath(// // requestPath,// null,// s null,// p new URIImpl("http://xmlns.com/foaf/0.1/XXX")// o )); assertEquals(0, result); }
/** * A GET query which should result in an error (the query is not well * formed). */ public void test_GET_SELECT_ERROR() throws Exception { final String queryStr = "select * where {?s ?p ?o} X {}"; final TupleQuery query = cxn.prepareTupleQuery(QueryLanguage.SPARQL, queryStr); try { assertEquals(0, countResults(query.evaluate())); fail("should be an error"); } catch (QueryEvaluationException ex) { // perfect } }
/** * Get everything with a specific object (a Literal). */ public void test_GET_accessPath_delete_o_Literal() throws Exception { doInsertbyURL("POST", packagePath + "test_delete_by_access_path.ttl"); final long result = countResults(doGetWithAccessPath(// // requestPath,// null,// s null,// p new URIImpl("http://www.bigdata.com/Bryan")// o )); assertEquals(1, result); }
/** * Get everything with a specific predicate and object (a URI). */ public void test_GET_accessPath_delete_p_o_URI() throws Exception { doInsertbyURL("POST", packagePath + "test_delete_by_access_path.ttl"); final long result = countResults(doGetWithAccessPath(// // requestPath,// null,// s RDF.TYPE,// p new URIImpl("http://xmlns.com/foaf/0.1/Person")// o )); assertEquals(3, result); }
/** * Get everything with a specific subject. */ public void test_GET_accessPath_delete_s() throws Exception { doInsertbyURL("POST", packagePath + "test_delete_by_access_path.ttl"); final long result = countResults(doGetWithAccessPath(// // requestPath,// new URIImpl("http://www.bigdata.com/Mike"),// s null,// p null )); assertEquals(3, result); }
@Override protected void doInsertWithBodyTest(final String method, final int ntriples, /*final String servlet,*/ final RDFFormat format) throws Exception { final Graph g = genNTRIPLES2(ntriples); cxn.add(g); assertEquals(ntriples, getExactSize()); // Verify the expected #of statements in the store. { final String queryStr = "select * where {?s ?p ?o}"; final TupleQuery query = cxn.prepareTupleQuery(QueryLanguage.SPARQL, queryStr); assertEquals(ntriples, countResults(query.evaluate())); } }