Java Code Examples for org.apache.jena.query.QueryExecution#execAsk()
The following examples show how to use
org.apache.jena.query.QueryExecution#execAsk() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestDeltaFusekiBad.java From rdf-delta with Apache License 2.0 | 6 votes |
@Test public void fuseki_stop_start() { DeltaServer deltaServer = deltaServer(); FusekiServer server1 = fuseki1(); try { server1.stop(); RDFConnection conn1 = RDFConnectionFactory.connect("http://localhost:"+F1_PORT+ds1) ; QueryExecution qExec = conn1.query("ASK{}"); try { qExec.execAsk(); fail(); } catch(QueryExceptionHTTP ex) {} // Restart, same port. server1 = fuseki1(Start.RESTART); QueryExecution qExec1 = conn1.query("ASK{}"); qExec1.execAsk(); } finally { server1.stop(); deltaServer.stop(); } }
Example 2
Source File: SPARQL.java From NLIWOD with GNU Affero General Public License v3.0 | 5 votes |
/** * Executes an ask query for the given endpoint and query. * @param query * @param endpoint * @return */ public static Boolean executeAsk(final String query, final String endpoint) { QueryExecutionFactory qef = new QueryExecutionFactoryHttp(endpoint); QueryExecution qe = qef.createQueryExecution(query); closeExecFactory(qef); return qe.execAsk(); }
Example 3
Source File: SPARQL.java From NLIWOD with GNU Affero General Public License v3.0 | 5 votes |
/** * Checks if the given endpoint is alive. If fails, returns false. * @param endpoint * @return */ public static boolean isEndpointAlive(final String endpoint) { QueryExecutionFactory qef = new QueryExecutionFactoryHttp(endpoint); try { QueryExecution qe = qef.createQueryExecution("PREFIX foaf: <http://xmlns.com/foaf/0.1/> ASK { ?x foaf:name \"Alice\" }"); qe.execAsk(); return true; } catch (Exception e) { } finally { closeExecFactory(qef); } return false; }
Example 4
Source File: SPARQLExecutor.java From NLIWOD with GNU Affero General Public License v3.0 | 5 votes |
/** * An exact copy of this code is {@link SPARQL#isEndpointAlive(String)}. * @param endpoint * @return */ @Deprecated public static boolean isEndpointAlive(final String endpoint) { try { QueryExecution qeExe = QueryExecutionFactory.sparqlService(endpoint, "PREFIX foaf: <http://xmlns.com/foaf/0.1/> ASK { ?x foaf:name \"Alice\" }"); qeExe.execAsk(); return true; } catch (Exception e) { } return false; }
Example 5
Source File: TestDeltaFusekiBad.java From rdf-delta with Apache License 2.0 | 5 votes |
@Test(expected=QueryExceptionHTTP.class) public void fuseki_stop() { DeltaServer deltaServer = deltaServer(CLEAN); FusekiServer server1 = fuseki1(CLEAN); try { server1.stop(); RDFConnection conn1 = RDFConnectionFactory.connect("http://localhost:"+F1_PORT+ds1) ; QueryExecution qExec = conn1.query("ASK{}"); qExec.execAsk(); } finally { deltaServer.stop(); } }
Example 6
Source File: SPARQLExecutor.java From NLIWOD with GNU Affero General Public License v3.0 | 2 votes |
/** * An exact copy of this code is {@link SPARQL#executeAsk(String)}. * @param query * @param endpoint * @return */ @Deprecated public static Boolean executeAsk(final String query, final String endpoint) { QueryExecution qeExe = QueryExecutionFactory.sparqlService(endpoint, query); return qeExe.execAsk(); }