public static DatasetDescription create(List<String> defaultGraphURIs , List<String> namedGraphURIs) { return new DatasetDescription(defaultGraphURIs, namedGraphURIs) ; }
public UpdateExecutionFactoryHttp(String remoteEndpoint, HttpClient httpClient) { this(remoteEndpoint, new DatasetDescription(), httpClient); }
public QueryExecutionFactoryHttp(String service, Collection<String> defaultGraphs) { this(service, new DatasetDescription(new ArrayList<String>(defaultGraphs), Collections.<String>emptyList()), null); }
public DatasetDescription convert(String defaultGraphUri) { DatasetDescription result = new DatasetDescription(); result.addDefaultGraphURI(defaultGraphUri); return result; } }
public static DatasetDescription createDefaultGraph(String defaultGraph) { DatasetDescription result = new DatasetDescription(); result.addDefaultGraphURI(defaultGraph); return result; }
public DatasetDescription convert(List<String> defaultGraphUris) { DatasetDescription result = new DatasetDescription(); result.addAllDefaultGraphURIs(defaultGraphUris); return result; } }
public static FluentSparqlService<?> http(String service, String defaultGraph, HttpClient httpClient) { return http(service, new DatasetDescription(Collections.singletonList(defaultGraph), Collections.<String>emptyList()), httpClient); }
public static FluentSparqlService<?> http(String service, List<String> defaultGraphs) { DatasetDescription datasetDescription = new DatasetDescription(defaultGraphs, Collections.<String>emptyList()); return http(service, datasetDescription, null); }
public static FluentQueryExecutionFactory<?> alwaysFail(String serviceUrl) { return alwaysFail(serviceUrl, new DatasetDescription()); }
public static FluentQueryExecutionFactory<?> alwaysFail(String serviceUrl, String ... defaultGraphs) { DatasetDescription dd = new DatasetDescription(); dd.addAllDefaultGraphURIs(Arrays.asList(defaultGraphs)); return alwaysFail(serviceUrl, dd); }
@Bean @JobScope //@StepScope public QueryExecutionFactory sparqlService( @Value("#{jobParameters[serviceUri]}") String serviceUri, @Value("#{jobParameters[defaultGraphUris]}") String defaultGraphUris) { String[] tmp = defaultGraphUris.split(" "); List<String> dgus = Arrays.asList(tmp); // TODO Add named graph support List<String> ngus = new ArrayList<String>(); // TODO Add authenticator support DatasetDescription datasetDescription = new DatasetDescription(dgus, ngus); SparqlService sparqlService = sparqlServiceFactory.createSparqlService(serviceUri, datasetDescription, null); QueryExecutionFactory qef = sparqlService.getQueryExecutionFactory(); return qef; }
@Override protected QueryExecutionFactory initQueryFactory() { QueryExecutionFactory qef; // if empty if (username.isEmpty() && password.isEmpty()) { qef = new QueryExecutionFactoryHttp(getSparqlEndpoint(), getSparqlGraphs()); } else { DatasetDescription dd = new DatasetDescription(new ArrayList<>(getSparqlGraphs()), Collections.emptyList()); CredentialsProvider provider = new BasicCredentialsProvider(); UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(username, password); provider.setCredentials(AuthScope.ANY, credentials); HttpClient client = HttpClientBuilder.create() .setDefaultCredentialsProvider(provider) .build(); qef = new QueryExecutionFactoryHttp(getSparqlEndpoint(), dd, client); } return masqueradeQEF(qef, this); }
public static DatasetDescription extractDatasetDescriptionCommon(HttpServletRequest req, String dguParamName, String nguParamName) { DatasetDescription result = new DatasetDescription(); result.addAllDefaultGraphURIs(Arrays.asList(ServletRequestUtils.getStringParameters(req, dguParamName))); result.addAllNamedGraphURIs(Arrays.asList(ServletRequestUtils.getStringParameters(req, nguParamName))); return result; } }
@Override protected QueryExecutionFactory initQueryFactory() { QueryExecutionFactory qef; // if empty if (username.isEmpty() && password.isEmpty()) { qef = new QueryExecutionFactoryHttp(getSparqlEndpoint(), getSparqlGraphs()); } else { DatasetDescription dd = new DatasetDescription(new ArrayList<>(getSparqlGraphs()), Collections.emptyList()); CredentialsProvider provider = new BasicCredentialsProvider(); UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(username, password); provider.setCredentials(AuthScope.ANY, credentials); HttpClient client = HttpClientBuilder.create() .setDefaultCredentialsProvider(provider) .build(); qef = new QueryExecutionFactoryHttp(getSparqlEndpoint(), dd, client); } return masqueradeQEF(qef, this); }
@Override public Object open(Assembler a, Resource root, Mode mode) { DatasetDescription ds = new DatasetDescription() ; // -------- Default graph // Can use ja:graph or ja:defaultGraph List<String> dftGraphs1 = GraphUtils.multiValueString(root, DatasetAssemblerVocab.pDefaultGraph) ; List<String> dftGraphs2 = GraphUtils.multiValueString(root, DatasetAssemblerVocab.pGraph) ; ds.getDefaultGraphURIs().addAll(dftGraphs1) ; ds.getDefaultGraphURIs().addAll(dftGraphs2) ; // -------- Named graphs List<String> namedGraphURIs = GraphUtils.multiValueString(root, DatasetAssemblerVocab.pNamedGraph) ; ds.getNamedGraphURIs().addAll(namedGraphURIs) ; return ds ; } }
public static UpdateProcessor createUpdateProcessor(SparqlServiceFactory ssf, String serviceUri, String requestStr, List<String> usingGraphUris, List<String> usingNamedGraphUris, HttpClient httpClient) { // TODO Should we use UsingList or DatasetDescription? The latter feels more natural to use. // UsingList usingList = new UsingList(); // usingList.addAllUsing(NodeUtils.convertToNodes(usingGraphUris)); // usingList.addAllUsingNamed(NodeUtils.convertToNodes(usingNamedGraphUris)); DatasetDescription datasetDescription = new DatasetDescription(usingGraphUris, usingNamedGraphUris); SparqlService sparqlService = ssf.createSparqlService(serviceUri, datasetDescription, httpClient); UpdateExecutionFactory uef = sparqlService.getUpdateExecutionFactory(); UpdateRequest updateRequest = UpdateRequestUtils.parse(requestStr); UpdateProcessor result = uef.createUpdateProcessor(updateRequest); return result; }
/** Return a dataset description (FROM/FROM NAMED clauses) for the query. */ public DatasetDescription getDatasetDescription() { if ( ! hasDatasetDescription() ) return null; DatasetDescription description = new DatasetDescription() ; description.addAllDefaultGraphURIs(getGraphURIs()) ; description.addAllNamedGraphURIs(getNamedGraphURIs()) ; return description ; }
datasetDescription = new DatasetDescription();
DatasetDescription datasetDescription = new DatasetDescription(defaultGraphUris, namedGraphUris); DatasetDescription jsDs = new DatasetDescription(jss, Collections.<String>emptyList());