@Override protected long doDeleteWithAccessPath(// // final String servlet,// final URI s,// final URI p,// final Value o,// final URI... c// ) throws Exception { final long start = getExactSize(); cxn.remove(s, p, o, c); return start - getExactSize(); }
@Override protected long doInsertByBody(final String method, /*final String servlet,*/ final RDFFormat rdfFormat, final Graph g, final URI defaultContext) throws Exception { final long start = getExactSize(); cxn.add(g, defaultContext != null ? new Resource[] { defaultContext } : new Resource[0]); return getExactSize() - start; }
@Override protected long doInsertByBody(final String method, /*final String servlet,*/ final RDFFormat rdfFormat, final Graph g, final URI defaultContext) throws Exception { final long start = getExactSize(); cxn.add(g, defaultContext != null ? new Resource[] { defaultContext } : new Resource[0]); return getExactSize() - start; }
@Override protected long doDeleteWithAccessPath(// // final String servlet,// final URI s,// final URI p,// final Value o,// final URI... c// ) throws Exception { final long start = getExactSize(); cxn.remove(s, p, o, c); return start - getExactSize(); }
/** * Test ability to load data from a URI. */ public void test_INSERT_LOAD_FROM_URI() throws Exception { // Verify nothing in the KB. { final String queryStr = "ASK where {?s ?p ?o}"; final BooleanQuery query = cxn.prepareBooleanQuery(QueryLanguage.SPARQL, queryStr); assertEquals(false, query.evaluate()); } // #of statements in that RDF file. final long expectedStatementCount = 4; // Load the resource into the KB. { cxn.add( this.getClass().getClassLoader().getResource("com/bigdata/rdf/rio/small.rdf"), "", RDFFormat.RDFXML); //cxn.add(new URL("file:bigdata-rdf/src/test/com/bigdata/rdf/rio/small.rdf"), "", RDFFormat.RDFXML); assertEquals(expectedStatementCount, getExactSize()); } /* * Verify KB has the loaded data. */ { final String queryStr = "SELECT * where {?s ?p ?o}"; final TupleQuery query = cxn.prepareTupleQuery(QueryLanguage.SPARQL, queryStr); assertEquals(expectedStatementCount, countResults(query.evaluate())); } }
public void test_INSERT_triples_with_URI_and_defaultContext() throws Exception { if(TestMode.quads != getTestMode()) return; // Load the resource into the KB. { final File file = new File(packagePath + "insert_triples_with_defaultContext.ttl"); cxn.add(file, "", RDFFormat.TURTLE, new URIImpl("http://example.org")); assertEquals(7, getExactSize()); } // Verify that the data were inserted into the appropriate context. { final String queryStr = "select * { GRAPH <http://example.org> {?s ?p ?p} }"; final TupleQuery query = cxn.prepareTupleQuery(QueryLanguage.SPARQL, queryStr); assertEquals(7, 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())); } }
assertEquals(7, getExactSize());
/** * Test ability to load data from a URI. */ public void test_INSERT_LOAD_FROM_URI() throws Exception { // Verify nothing in the KB. { final String queryStr = "ASK where {?s ?p ?o}"; final BooleanQuery query = cxn.prepareBooleanQuery(QueryLanguage.SPARQL, queryStr); assertEquals(false, query.evaluate()); } // #of statements in that RDF file. final long expectedStatementCount = 4; // Load the resource into the KB. { cxn.add( this.getClass().getClassLoader().getResource("com/bigdata/rdf/rio/small.rdf"), "", RDFFormat.RDFXML); //cxn.add(new URL("file:bigdata-rdf/src/test/com/bigdata/rdf/rio/small.rdf"), "", RDFFormat.RDFXML); assertEquals(expectedStatementCount, getExactSize()); } /* * Verify KB has the loaded data. */ { final String queryStr = "SELECT * where {?s ?p ?o}"; final TupleQuery query = cxn.prepareTupleQuery(QueryLanguage.SPARQL, queryStr); assertEquals(expectedStatementCount, countResults(query.evaluate())); } }
public void test_INSERT_triples_with_URI_and_defaultContext() throws Exception { if(TestMode.quads != getTestMode()) return; // Load the resource into the KB. { final File file = new File(packagePath + "insert_triples_with_defaultContext.ttl"); cxn.add(file, "", RDFFormat.TURTLE, new URIImpl("http://example.org")); assertEquals(7, getExactSize()); } // Verify that the data were inserted into the appropriate context. { final String queryStr = "select * { GRAPH <http://example.org> {?s ?p ?p} }"; final TupleQuery query = cxn.prepareTupleQuery(QueryLanguage.SPARQL, queryStr); assertEquals(7, 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())); } }
assertEquals(7, getExactSize());