.http("http://dbpedia.org/sparql", Lists.newArrayList("http://dbpedia.org")) .config().withPostProcessor(qe -> ((QueryEngineHTTP) ((QueryExecutionHttpWrapper) qe).getDecoratee()) .setModelContentType(WebContent.contentTypeRDFXML)) .withCache(cacheFrontend) .end()
public static void main(final String[] args) throws IOException { .withPostProcessor(qe -> ((QueryEngineHTTP) ((QueryExecutionHttpWrapper) qe).getDecoratee()).setModelContentType(WebContent.contentTypeRDFXML)).end().create();
public SymmetricConciseBoundedDescriptionGeneratorImpl(SparqlEndpoint endpoint, CacheFrontend cache) { qef = FluentQueryExecutionFactory .http(endpoint.getURL().toString(), endpoint.getDefaultGraphURIs()) .config().withPostProcessor(qe -> ((QueryEngineHTTP) ((QueryExecutionHttpWrapper) qe).getDecoratee()) .setModelContentType(WebContent.contentTypeRDFXML)) .end() .create(); if(cache != null){ qef = new QueryExecutionFactoryCacheEx(qef, cache); } qef = new QueryExecutionFactoryPaginated(qef, 10000); }
/** * @deprecated Will be removed in next release as it is redundant. Please use {@link ConciseBoundedDescriptionGeneratorImpl#ConciseBoundedDescriptionGeneratorImpl(QueryExecutionFactory)} * @param endpoint * @param cacheDir */ @Deprecated() public ConciseBoundedDescriptionGeneratorImpl(SparqlEndpoint endpoint, String cacheDir) { this(FluentQueryExecutionFactory .http(endpoint.getURL().toString(), endpoint.getDefaultGraphURIs()) .config().withPostProcessor(qe -> ((QueryEngineHTTP) ((QueryExecutionHttpWrapper) qe).getDecoratee()) .setModelContentType(WebContent.contentTypeRDFXML)) .end() .create()); if(cacheDir != null){ long timeToLive = TimeUnit.DAYS.toMillis(30); CacheFrontend cacheFrontend = CacheUtilsH2.createCacheFrontend(cacheDir, true, timeToLive); qef = new QueryExecutionFactoryCacheEx(qef, cacheFrontend); } qef = new QueryExecutionFactoryPaginated(qef, 10000); }
public String sparql(String subject) { // First query takes the most specific class from a given resource. String ontology_service = endpoint; String endpointsSparql = "select ?label where {<" + subject + "> <http://www.w3.org/2000/01/rdf-schema#label> ?label FILTER (lang(?label) = 'en')} LIMIT 100"; Query sparqlQuery = QueryFactory.create(endpointsSparql, Syntax.syntaxARQ); QueryEngineHTTP qexec = (QueryEngineHTTP) QueryExecutionFactory.sparqlService(ontology_service, sparqlQuery); qexec.setModelContentType(WebContent.contentTypeRDFXML); ResultSet results = qexec.execSelect(); String property = null; while (results.hasNext()) { QuerySolution qs = results.next(); property = qs.getLiteral("?label").getLexicalForm(); } return property; }
.http(endpoint.getURL().toString(), endpoint.getDefaultGraphURIs()) .config().withPostProcessor(qe -> ((QueryEngineHTTP) ((QueryExecutionHttpWrapper) qe).getDecoratee()) .setModelContentType(WebContent.contentTypeRDFXML)) .end() .create();
@Override protected QueryExecution createQueryExecution(Query q) throws SQLException { if (this.remoteConn.getQueryEndpoint() == null) throw new SQLException("This statement is backed by a write-only connection, read operations are not supported"); // Create basic execution QueryEngineHTTP exec = (QueryEngineHTTP) QueryExecutionFactory.sparqlService(this.remoteConn.getQueryEndpoint(), q); // Apply HTTP settings if (this.client != null) { exec.setClient(client); } // Apply default and named graphs if appropriate if (this.remoteConn.getDefaultGraphURIs() != null) { exec.setDefaultGraphURIs(this.remoteConn.getDefaultGraphURIs()); } if (this.remoteConn.getNamedGraphURIs() != null) { exec.setNamedGraphURIs(this.remoteConn.getNamedGraphURIs()); } // Set result types if (this.remoteConn.getSelectResultsType() != null) { exec.setSelectContentType(this.remoteConn.getSelectResultsType()); } if (this.remoteConn.getModelResultsType() != null) { exec.setModelContentType(this.remoteConn.getModelResultsType()); } // Return execution return exec; }
@Override protected QueryExecution createQueryExecution(Query q) throws SQLException { if (this.remoteConn.getQueryEndpoint() == null) throw new SQLException("This statement is backed by a write-only connection, read operations are not supported"); // Create basic execution QueryEngineHTTP exec = (QueryEngineHTTP) QueryExecutionFactory.sparqlService(this.remoteConn.getQueryEndpoint(), q); // Apply HTTP settings if (this.client != null) { exec.setClient(this.client); } // Apply default and named graphs if appropriate if (this.remoteConn.getDefaultGraphURIs() != null) { exec.setDefaultGraphURIs(this.remoteConn.getDefaultGraphURIs()); } if (this.remoteConn.getNamedGraphURIs() != null) { exec.setNamedGraphURIs(this.remoteConn.getNamedGraphURIs()); } // Set result types if (this.remoteConn.getSelectResultsType() != null) { exec.setSelectContentType(this.remoteConn.getSelectResultsType()); } if (this.remoteConn.getModelResultsType() != null) { exec.setModelContentType(this.remoteConn.getModelResultsType()); } // Return execution return exec; }
.http(endpoint.getURL().toString(), endpoint.getDefaultGraphURIs()) .config().withPostProcessor(qe -> ((QueryEngineHTTP) ((QueryExecutionHttpWrapper) qe).getDecoratee()) .setModelContentType(WebContent.contentTypeRDFXML)) .end() .create();
.http(endpoint.getURL().toString(), endpoint.getDefaultGraphURIs()).config() .withPostProcessor(qe -> ((QueryEngineHTTP) ((QueryExecutionHttpWrapper) qe).getDecoratee()) .setModelContentType(WebContent.contentTypeRDFXML)) .withCache(CacheUtilsH2.createCacheFrontend("/tmp/cache", false, TimeUnit.DAYS.toMillis(60))) .withPagination(10000).withDelay(50, TimeUnit.MILLISECONDS).end().create();
.withPostProcessor(qe -> ((QueryEngineHTTP)((QueryExecutionHttpWrapper)qe).getDecoratee()) .setModelContentType(WebContent.contentTypeRDFXML)) .withPostProcessor(aoeu -> System.out.println("a" + aoeu)) .withParser(SparqlQueryParserImpl.create(Syntax.syntaxARQ))
.http(endpoint.getURL().toString(), endpoint.getDefaultGraphURIs()) .config().withPostProcessor(qe -> ((QueryEngineHTTP) ((QueryExecutionHttpWrapper) qe).getDecoratee()) .setModelContentType(WebContent.contentTypeRDFXML)) .end() .create();
.http(endpoint.getURL().toString(), endpoint.getDefaultGraphURIs()) .config().withPostProcessor(qe -> ((QueryEngineHTTP) ((QueryExecutionHttpWrapper) qe).getDecoratee()) .setModelContentType(WebContent.contentTypeRDFXML)) .end() .create();
.http(endpoint.getURL().toString(), endpoint.getDefaultGraphURIs()) .config().withPostProcessor(qe -> ((QueryEngineHTTP) ((QueryExecutionHttpWrapper) qe).getDecoratee()) .setModelContentType(WebContent.contentTypeRDFXML)) .end() .create();
.http(endpoint.getURL().toString(), endpoint.getDefaultGraphURIs()) .config().withPostProcessor(qe -> ((QueryEngineHTTP) ((QueryExecutionHttpWrapper) qe).getDecoratee()) .setModelContentType(WebContent.contentTypeRDFXML)) .end() .create();