public BigdataGraphClient(final RemoteRepository repo, final BlueprintsValueFactory factory) { this(repo.getBigdataSailRemoteRepository(), factory); }
@Override public void setUp() throws Exception { super.setUp(); repo = m_repo.getBigdataSailRemoteRepository(); cxn = repo.getConnection(); }
/** * Connect to a remote bigdata instance. * * @param sparqlEndpointURL * The URL of the SPARQL end point. * * FIXME This does not support the HA load balancer pattern. See #1148. * * FIXME This does not parameterize the value of the ContextPath. See * {@link com.bigdata.BigdataStatics#getContextPath()}. * * FIXME This MIGHT leak HttpClient or Executor resources. */ public static BigdataSailRemoteRepository connect( final String sparqlEndpointURL) { return new RemoteRepositoryManager().getRepositoryForURL( sparqlEndpointURL).getBigdataSailRemoteRepository(); }
@Override public void setUp() throws Exception { super.setUp(); repo = m_repo.getBigdataSailRemoteRepository(); cxn = repo.getConnection(); }
sparqlEndpointURL).getBigdataSailRemoteRepository();
.getBigdataSailRemoteRepository().getConnection();
/** * Test supposed to check if constants in BIND expressions will be resolved */ public void test_ticket_1717() throws Exception { { // Clear DB per task description (Executing the query over the empty database) m_repo.remove(new RemoveOp(null, null, null)); String query = "SELECT ?z ?s1 { ?s ?p ?o . BIND(?o+1 AS ?z) BIND(?z+1 AS ?z2) }"; final TupleQuery tq = m_repo.getBigdataSailRemoteRepository().getConnection().prepareTupleQuery(QueryLanguage.SPARQL, query, null); final TupleQueryResult tqr = tq.evaluate(); try { int count = 0; while (tqr.hasNext()) { System.out.println(tqr.next()); count++; } assertEquals(0,count); // asserting successful execution of the query, as it was failing while parsing } finally { tqr.close(); } } }
qb.append(" } \n"); final BigdataSailRemoteRepositoryConnection conn = m_repo.getBigdataSailRemoteRepository().getConnection();
public void testServiceNodeBindings() throws Exception { final BigdataSailRemoteRepository repo = m_repo.getBigdataSailRemoteRepository(); final BigdataSailRemoteRepositoryConnection cxn = (BigdataSailRemoteRepositoryConnection) repo.getConnection(); try { String queryStr = "select * where {SERVICE <http://DBpedia.org/sparql> { <http://dbpedia.org/resource/Tonga_(Nyasa)_language> rdfs:label ?langLabel. }}"; // String queryStr = "SELECT * WHERE { BIND (<http://dbpedia.org/resource/Tonga_(Nyasa)_language> AS ?ref) . SERVICE <http://DBpedia.org/sparql> { ?ref rdfs:label ?langLabel. } }"; final org.openrdf.query.TupleQuery tq = cxn.prepareTupleQuery(QueryLanguage.SPARQL, queryStr); final TupleQueryResult tqr = tq.evaluate(); try { int cnt = 0; while (tqr.hasNext()) { tqr.next(); cnt++; } assertEquals(cnt, 2); } finally { tqr.close(); } } finally { cxn.close(); } } }
sparqlEndpointURL).getBigdataSailRemoteRepository();
.getBigdataSailRemoteRepository().getConnection();
.getBigdataSailRemoteRepository().getConnection();
/** * Execute an ASK query including a SERVICE keyword which gets sent back to this server. * The test succeeeds if the query returns true, and fails otherwise * @param args * @throws IOException */ public void test_simple() throws Exception { setMethodisPostUrlEncodedData(); // m_repo.getRemoteRepositoryManager().createRepository(namespace, properties); BigdataSailRemoteRepositoryConnection conn = m_repo.getBigdataSailRemoteRepository().getConnection(); conn.prepareUpdate(QueryLanguage.SPARQL, "INSERT { <http://s1> <http://p> \"Test123\" } WHERE { }").execute(); checkResults(conn, 1); conn.prepareUpdate(QueryLanguage.SPARQL, "INSERT { <http://s2> <http://p> \"Test234\"^^xsd:string } WHERE { }").execute(); checkResults(conn, 2); conn.prepareUpdate(QueryLanguage.SPARQL, "INSERT { <http://s3> <http://p> \"Test345\" } WHERE { }").execute(); checkResults(conn, 3); m_repo.getRemoteRepositoryManager().rebuildTextIndex(namespace, true); checkResults(conn, 3); }
/** * Test supposed to check if constants in BIND expressions will be resolved */ public void test_ticket_1717() throws Exception { { // Clear DB per task description (Executing the query over the empty database) m_repo.remove(new RemoveOp(null, null, null)); String query = "SELECT ?z ?s1 { ?s ?p ?o . BIND(?o+1 AS ?z) BIND(?z+1 AS ?z2) }"; final TupleQuery tq = m_repo.getBigdataSailRemoteRepository().getConnection().prepareTupleQuery(QueryLanguage.SPARQL, query, null); final TupleQueryResult tqr = tq.evaluate(); try { int count = 0; while (tqr.hasNext()) { System.out.println(tqr.next()); count++; } assertEquals(0,count); // asserting successful execution of the query, as it was failing while parsing } finally { tqr.close(); } } }
qb.append(" } \n"); final BigdataSailRemoteRepositoryConnection conn = m_repo.getBigdataSailRemoteRepository().getConnection();
final TupleQuery tq = m_repo.getBigdataSailRemoteRepository().getConnection().prepareTupleQuery(QueryLanguage.SPARQL, "SELECT * {?s ?p ?o} LIMIT 100", null); tq.setBinding("s", s); tq.setIncludeInferred(true); final TupleQuery tq = m_repo.getBigdataSailRemoteRepository().getConnection().prepareTupleQuery(QueryLanguage.SPARQL, "SELECT * {?s ?p ?o} LIMIT 100", null); tq.setBinding("s", s); tq.setIncludeInferred(false);
public void testServiceNodeBindings() throws Exception { final BigdataSailRemoteRepository repo = m_repo.getBigdataSailRemoteRepository(); final BigdataSailRemoteRepositoryConnection cxn = (BigdataSailRemoteRepositoryConnection) repo.getConnection(); try { String queryStr = "select * where {SERVICE <http://DBpedia.org/sparql> { <http://dbpedia.org/resource/Tonga_(Nyasa)_language> rdfs:label ?langLabel. }}"; // String queryStr = "SELECT * WHERE { BIND (<http://dbpedia.org/resource/Tonga_(Nyasa)_language> AS ?ref) . SERVICE <http://DBpedia.org/sparql> { ?ref rdfs:label ?langLabel. } }"; final org.openrdf.query.TupleQuery tq = cxn.prepareTupleQuery(QueryLanguage.SPARQL, queryStr); final TupleQueryResult tqr = tq.evaluate(); try { int cnt = 0; while (tqr.hasNext()) { tqr.next(); cnt++; } assertEquals(cnt, 2); } finally { tqr.close(); } } finally { cxn.close(); } } }
.getBigdataSailRemoteRepository().getConnection();
/** * Execute an ASK query including a SERVICE keyword which gets sent back to this server. * The test succeeeds if the query returns true, and fails otherwise * @param args * @throws IOException */ public void test_simple() throws Exception { setMethodisPostUrlEncodedData(); // m_repo.getRemoteRepositoryManager().createRepository(namespace, properties); BigdataSailRemoteRepositoryConnection conn = m_repo.getBigdataSailRemoteRepository().getConnection(); conn.prepareUpdate(QueryLanguage.SPARQL, "INSERT { <http://s1> <http://p> \"Test123\" } WHERE { }").execute(); checkResults(conn, 1); conn.prepareUpdate(QueryLanguage.SPARQL, "INSERT { <http://s2> <http://p> \"Test234\"^^xsd:string } WHERE { }").execute(); checkResults(conn, 2); conn.prepareUpdate(QueryLanguage.SPARQL, "INSERT { <http://s3> <http://p> \"Test345\" } WHERE { }").execute(); checkResults(conn, 3); m_repo.getRemoteRepositoryManager().rebuildTextIndex(namespace, true); checkResults(conn, 3); }
final TupleQuery tq = m_repo.getBigdataSailRemoteRepository().getConnection().prepareTupleQuery(QueryLanguage.SPARQL, "SELECT * {?s ?p ?o} LIMIT 100", null); tq.setBinding("s", s); tq.setIncludeInferred(true); final TupleQuery tq = m_repo.getBigdataSailRemoteRepository().getConnection().prepareTupleQuery(QueryLanguage.SPARQL, "SELECT * {?s ?p ?o} LIMIT 100", null); tq.setBinding("s", s); tq.setIncludeInferred(false);