/** Calculate a dataset based on FROM and FROM NAMED in the query */ protected DatasetGraph dynamicDataset(DatasetDescription dsDesc, DatasetGraph dataset, boolean unionDftGraph) { return DynamicDatasets.dynamicDataset(dsDesc, dataset, unionDftGraph) ; }
@Override protected DatasetGraph dynamicDataset(DatasetDescription dsDesc, DatasetGraph dataset, boolean unionDftGraph) { boolean union = unionDftGraph || isUnionDefaultGraph(context); return DynamicDatasets.dynamicDataset(dsDesc, dataset, union ) ; }
@Override protected DatasetGraph dynamicDataset(DatasetDescription dsDesc, DatasetGraph dataset, boolean unionDftGraph) { boolean union = unionDftGraph || context.isTrue(TDB.symUnionDefaultGraph); return DynamicDatasets.dynamicDataset(dsDesc, dataset, union ) ; }
public Dataset specifyDataset(Dataset dataset, List<URI> defaultGraphUris, List<URI> namedGraphUris) { if (defaultGraphUris == null) throw new IllegalArgumentException("List<URI> cannot be null"); if (namedGraphUris == null) throw new IllegalArgumentException("List<URI> cannot be null"); List<String> defaultGraphUriStrings = new ArrayList<>(); for (URI defaultGraphUri : defaultGraphUris) defaultGraphUriStrings.add(defaultGraphUri.toString()); List<String> namedGraphUriStrings = new ArrayList<>(); for (URI namedGraphUri : namedGraphUris) namedGraphUriStrings.add(namedGraphUri.toString()); DatasetDescription desc = DatasetDescription.create(defaultGraphUriStrings, namedGraphUriStrings); return DynamicDatasets.dynamicDataset(desc, dataset, false); }
/** * Given a DatasetDescription, form a Dataset that is the dynamic dataset over the * base dataset. Returns the original Dataset if the dataset description is null or * empty. */ public static Dataset dynamicDataset(DatasetDescription description, Dataset ds, boolean defaultUnionGraph) { DatasetGraph dsg = ds.asDatasetGraph() ; DatasetGraph dsg2 = dynamicDataset(description, dsg, defaultUnionGraph) ; if ( dsg == dsg2 ) return ds ; return DatasetFactory.wrap(dsg2) ; }
protected DatasetGraph processUsing(UpdateModify update) { if ( update.getUsing().size() == 0 && update.getUsingNamed().size() == 0 ) return null; return DynamicDatasets.dynamicDataset(update.getUsing(), update.getUsingNamed(), datasetGraph, false); }
/** Decide the dataset - this modifies the query * If the query has a dataset description. */ @Override protected DatasetGraph decideDataset(HttpAction action, Query query, String queryStringLog) { DatasetGraph dsg = action.getActiveDSG() ; DatasetDescription dsDesc = getDatasetDescription(action, query) ; if ( dsDesc != null ) { dsg = DynamicDatasets.dynamicDataset(dsDesc, dsg, false) ; if ( query.hasDatasetDescription() ) { query.getGraphURIs().clear() ; query.getNamedGraphURIs().clear() ; } } return dsg ; } }
/** Decide the dataset - this modifies the query * If the query has a dataset description. */ @Override protected DatasetGraph decideDataset(HttpAction action, Query query, String queryStringLog) { DatasetGraph dsg = action.getActiveDSG() ; DatasetDescription dsDesc = getDatasetDescription(action, query) ; if ( dsDesc != null ) { dsg = DynamicDatasets.dynamicDataset(dsDesc, dsg, false) ; if ( query.hasDatasetDescription() ) { query.getGraphURIs().clear() ; query.getNamedGraphURIs().clear() ; } } return dsg ; } }
/** * Given a DatasetDescription, form a Dataset that is the dynamic dataset over the * base dataset. Returns the original DatasetGraph if the dataset description is null * or empty. */ public static DatasetGraph dynamicDataset(DatasetDescription description, DatasetGraph dsg, boolean defaultUnionGraph) { if ( description == null ) return dsg ; //An empty description means leave the dataset as-is if (description.isEmpty() ) return dsg; Set<Node> defaultGraphs = convertToSetNodes(description.getDefaultGraphURIs()) ; Set<Node> namedGraphs = convertToSetNodes(description.getNamedGraphURIs()) ; return dynamicDataset(defaultGraphs, namedGraphs, dsg, defaultUnionGraph) ; }
private DatasetGraph dynamicDataset(HttpAction action, Query query, DatasetGraph dsg0, DatasetDescription dsDesc0, SecurityContext sCxt) { if ( dsDesc0 == null ) return dsg0; if ( ! ALLOW_FROM ) ServletOps.errorBadRequest("Use GRAPH. (FROM/FROM NAMED is not compatible with data access control.)"); DatasetDescription dsDesc1 = DatasetDescription.create( mask(dsDesc0.getDefaultGraphURIs(), sCxt), mask(dsDesc0.getNamedGraphURIs(), sCxt)); if ( dsDesc1.isEmpty() ) return DatasetGraphZero.create(); // Fix up the union graph in the graphs if in FROM. // (FROM NAMED <union graph> is done by DynamicDatasets). if ( dsDesc1.getDefaultGraphURIs().contains(Quad.unionGraph.getURI())) { dsDesc1.getDefaultGraphURIs().remove(Quad.unionGraph.getURI()); dsDesc1.getDefaultGraphURIs().addAll(sCxt.visibleGraphNames()); } DatasetGraph dsg1 = DynamicDatasets.dynamicDataset(dsDesc1, dsg0, false) ; if ( query.hasDatasetDescription() ) { query.getGraphURIs().clear() ; query.getNamedGraphURIs().clear() ; } return dsg1 ; }
super.dataset = DynamicDatasets.dynamicDataset(dsDesc, dataset, context.isTrue(SDB.unionDefaultGraph) ) ;