/** * Create a operations wrapper around {@code dsg}. * The {@link Context} of the wrapper is the context of the {@code dsg}. */ public DatasetGraphWrapper(DatasetGraph dsg) { this(dsg, (dsg == null) ? null : dsg.getContext()); }
@Override public Context getContext() { return dsg.getContext(); }
public DatasetGraphSwitchable(Path base, Location location, DatasetGraph dsg) { // Don't use the slot in datasetGraphWrapper - use the AtomicReference super(null, dsg.getContext()) ; dsgx.set(dsg); this.basePath = base; this.location = location; }
/** * Add data access control information on a {@link DatasetGraph}. This modifies the * {@link DatasetGraph}'s {@link Context}. */ private static void addAuthorizatonService(DatasetGraph dsg, AuthorizationService authService) { //dsg.getContext().set(symControlledAccess, true); dsg.getContext().set(symAuthorizationService, authService); }
/** * Return whether a {@code DatasetGraph} has access control, either because it is wrapped in * {@link DatasetGraphAccessControl} or because it has the context settings. */ public static boolean isAccessControlled(DatasetGraph dsg) { if ( dsg instanceof DatasetGraphAccessControl ) return true; // if ( dsg.getContext().isDefined(DataAccessCtl.symControlledAccess) ) // return true; if ( dsg.getContext().isDefined(DataAccessCtl.symAuthorizationService) ) return true; return false; }
public DynamicDatasetGraph(DatasetGraph viewDSG, DatasetGraph baseDSG) { super(viewDSG, baseDSG.getContext().copy()); this.projected = baseDSG; }
/** Get the {@link AuthorizationService} for an action/query/dataset */ static AuthorizationService getAuthorizationService(HttpAction action, DatasetGraph dsg) { if ( dsg instanceof DatasetGraphAccessControl ) return ((DatasetGraphAccessControl)dsg).getAuthService(); return dsg.getContext().get(DataAccessCtl.symAuthorizationService); }
private static Context setupContext(Context context, DatasetGraph dataset) { // To many copies? if ( context == null ) // Copy of global context to protect against change. context = ARQ.getContext() ; context = context.copy() ; if ( dataset.getContext() != null ) context.putAll(dataset.getContext()) ; context.set(ARQConstants.sysCurrentTime, NodeFactoryExtra.nowAsDateTime()) ; return context ; } }
/** Create a text-indexed dataset */ public static DatasetGraph create(DatasetGraph dsg, SpatialIndex spatialIndex) { SpatialDocProducer producer = new SpatialDocProducerTriples(spatialIndex) ; DatasetGraph dsgt = new DatasetGraphSpatial(dsg, spatialIndex, producer) ; // Also set on dsg dsgt.getContext().set(SpatialQuery.spatialIndex, spatialIndex) ; return dsgt ; }
/** Create a text-indexed DatasetGraph, optionally allowing the text index to be closed if the DatasetGraph is */ public static DatasetGraph create(DatasetGraph dsg, TextIndex textIndex, boolean closeIndexOnDSGClose, TextDocProducer producer) { if (producer == null) producer = new TextDocProducerTriples(textIndex) ; DatasetGraph dsgt = new DatasetGraphText(dsg, textIndex, producer, closeIndexOnDSGClose) ; // Also set on dsg Context c = dsgt.getContext() ; c.set(TextQuery.textIndex, textIndex) ; return dsgt ; }
/** Create a text-indexed dataset */ public static DatasetGraph create(DatasetGraph dsg, SpatialIndex spatialIndex) { SpatialDocProducer producer = new SpatialDocProducerTriples(spatialIndex) ; DatasetGraph dsgt = new DatasetGraphSpatial(dsg, spatialIndex, producer) ; // Also set on dsg dsgt.getContext().set(SpatialQuery.spatialIndex, spatialIndex) ; return dsgt ; }
/** Create a text-indexed DatasetGraph, optionally allowing the text index to be closed if the DatasetGraph is */ public static DatasetGraph create(DatasetGraph dsg, TextIndex textIndex, boolean closeIndexOnDSGClose, TextDocProducer producer) { if (producer == null) producer = new TextDocProducerTriples(textIndex) ; DatasetGraph dsgt = new DatasetGraphText(dsg, textIndex, producer, closeIndexOnDSGClose) ; // Also set on dsg Context c = dsgt.getContext() ; c.set(TextQuery.textIndex, textIndex) ; return dsgt ; }
/** Minimum initialization using just a dataset. * <p> * the HTTP Action will change its transactional state and * {@link Transactional} instance according to its base dataset graph. * </p> * <p>There is no associated DataAccessPoint or DataService set by this operation.</p> * * @param dsg DatasetGraph */ private void setDataset(DatasetGraph dsg) { this.dsg = dsg ; this.context = Context.mergeCopy(Fuseki.getContext(), dsg.getContext()); if ( dsg == null ) return ; setTransactionalPolicy(dsg) ; }
public static Dataset makeDataset() { DatasetGraph dsg = TDBFactory.createDatasetGraph(); dsg.getContext().set(TDB.symUnionDefaultGraph, new NodeValueBoolean(true)); return DatasetFactory.wrap(dsg); } }
public Dataset retrieveDataset(String graphName) { DatasetGraph dsg = TDBFactory.createDatasetGraph(); dsg.getContext().set(TDB.symUnionDefaultGraph, new NodeValueBoolean(true)); Dataset ds = DatasetFactory.create(dsg); Model model = retrieveModel(graphName); ds.addNamedModel(graphName, model); return ds; }
private static UpdateProcessor make(UpdateRequest updateRequest, DatasetGraph datasetGraph, Binding inputBinding, Context context) { if ( context == null ) { context = ARQ.getContext().copy(); context.putAll(datasetGraph.getContext()) ; } UpdateEngineFactory f = UpdateEngineRegistry.get().find(datasetGraph, context) ; if ( f == null ) return null ; UpdateProcessorBase uProc = new UpdateProcessorBase(updateRequest, datasetGraph, inputBinding, context, f) ; return uProc ; }
private static UpdateProcessorStreaming makeStreaming(DatasetGraph datasetGraph, Binding inputBinding, Context context) { if ( context == null ) { context = ARQ.getContext().copy(); context.putAll(datasetGraph.getContext()) ; } UpdateEngineFactory f = UpdateEngineRegistry.get().find(datasetGraph, context) ; if ( f == null ) return null ; UpdateProcessorStreamingBase uProc = new UpdateProcessorStreamingBase(datasetGraph, inputBinding, context, f) ; return uProc; }
protected static QueryExecution make(Query query, Model model) { Dataset dataset = DatasetFactory.wrap(model); Graph g = unwrap(model.getGraph()); if ( g instanceof GraphView ) { GraphView gv = (GraphView)g; // Copy context of the storage dataset to the wrapper dataset. dataset.getContext().putAll(gv.getDataset().getContext()); } return make(query, dataset); }
/** Add triples from src to dest */ protected static void gsAddTriples(DatasetGraph dsg, Target src, Target dest) { Graph gSrc = graph(dsg, src); Graph gDest = graph(dsg, dest); // Avoids concurrency problems by reading fully before writing ThresholdPolicy<Triple> policy = ThresholdPolicyFactory.policyFromContext(dsg.getContext()); DataBag<Triple> db = BagFactory.newDefaultBag(policy, SerializationFactoryFinder.tripleSerializationFactory()); try { Iterator<Triple> triples = gSrc.find(null, null, null); db.addAll(triples); Iter.close(triples); GraphOps.addAll(gDest, db.iterator()); } finally { db.close(); } }
public void setup() { DatasetGraph dsg = TDBFactory.createDatasetGraph(); dsg.getContext().set(TDB.symUnionDefaultGraph, true); Dataset myDataset = DatasetFactory.wrap(dsg); baseModel = myDataset.getNamedModel("http://example.com/baseModel"); baseModel = QueryEngineTest.populateModel(baseModel); dftModel = Factory.getInstance(eval, "http://example.com/securedModel", baseModel); dataset = DatasetFactory.create(); dataset.setDefaultModel(dftModel); }