org.apache.jena.sparql.core.DatasetGraph Java Examples

The following examples show how to use org.apache.jena.sparql.core.DatasetGraph. 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: DatasetDeclarationPlan.java    From sparql-generate with Apache License 2.0 6 votes vote down vote up
protected final Context prepareDataset(Binding binding, Context context) {
	if (fromClauses == null || fromClauses.isEmpty()) {
		return context;
	}
	final DatasetGraph dsg = DatasetGraphFactory.createGeneral();
	fromClauses.forEach((fromClause) -> {
		if (fromClause.getGenerate() == null) {
			if (!fromClause.isNamed()) {
				addDefaultGraph(binding, context, dsg, fromClause.getName());
			} else {
				addNamedGraph(binding, context, dsg, fromClause.getName());
			}
		} else {
			SPARQLExtQuery generate = fromClause.getGenerate();
			if (!fromClause.isNamed()) {
				addDefaultGraph(binding, context, dsg, generate);
			} else {
				addNamedGraph(binding, context, dsg, generate, fromClause.getName());
			}
		}
	});
	Dataset newDataset = DatasetFactory.wrap(dsg);
	return ContextUtils.fork(context).setDataset(newDataset).fork();
}
 
Example #2
Source File: DeltaAssembler.java    From rdf-delta with Apache License 2.0 6 votes vote down vote up
private static void UNUSED_CURRENTLY_forkUpdateFetcher(String source, DatasetGraph dsg) {
        if ( true ) {
            Log.warn(DeltaAssembler.class, "forkUpdateFetcher not set up");
            if ( true ) return;
            throw new NotImplemented("NEED THE STATE AREA; NEED THE DATASOURCE ID; NEED THE CLIENT ID");
        }
        DeltaLink dc = DeltaLinkHTTP.connect(source) ;
        DeltaConnection client = null;
        Runnable r = ()->{
            try { client.sync(); }
            catch (Exception ex) {
                Delta.DELTA_LOG.warn("Failed to sync with the change server: "+ex.getMessage()) ;
//                // Delay this task ; extra 3s + the time interval of 2s.
//                Dones not work as expected.
//                Lib.sleep(5*1000);
            }
        } ;
        ScheduledExecutorService executor = Executors.newScheduledThreadPool(1) ;
        executor.scheduleWithFixedDelay(r, 2, 2, TimeUnit.SECONDS) ;
    }
 
Example #3
Source File: AbstractTestDeltaConnection.java    From rdf-delta with Apache License 2.0 6 votes vote down vote up
private void change_read_new(Runnable betweenSections) {
    Quad quad = DeltaTestLib.freshQuad();

    String NAME = "DS-"+counter.incrementAndGet();
    DeltaClient dClient = createRegister(NAME);
    Id dsRef;

    try(DeltaConnection dConn = dClient.get(NAME)) {
        dConn.getPatchLogInfo().getDataSourceId();
        dsRef = dConn.getDataSourceId();
        Version version = dConn.getRemoteVersionLatest();
        DatasetGraph dsg = dConn.getDatasetGraph();
        Txn.executeWrite(dsg, ()->dsg.add(quad) );
    }

    betweenSections.run();

    // New client.
    // Rebuild.
    dClient = resetDeltaClient(NAME);
    try(DeltaConnection dConn = dClient.get(NAME)) {
        boolean b = dConn.getDatasetGraph().contains(quad);
        assertTrue(b);
    }
}
 
Example #4
Source File: AbstractTestDeltaConnection.java    From rdf-delta with Apache License 2.0 6 votes vote down vote up
@Test
public void change_2() {
    String NAME = "change_2";
    DeltaClient dClient = createRegister(NAME);
    try(DeltaConnection dConn = dClient.get(NAME)) {
        Id dsRef = dConn.getDataSourceId();
        Version version = dConn.getRemoteVersionLatest();

        DatasetGraph dsg = dConn.getDatasetGraph();
        Txn.executeWrite(dsg, ()->{
            Quad q = SSE.parseQuad("(_ :s1 :p1 :o1)");
            dsg.add(q);
        });
        // Rebuild directly.
        DatasetGraph dsg2 = DatasetGraphFactory.createTxnMem();
        Version ver = dConn.getRemoteVersionLatest();
        RDFPatch patch1 = dConn.getLink().fetch(dsRef, ver) ;
        RDFPatchOps.applyChange(dsg2, patch1);

        Set<Quad> set1 = Txn.calculateRead(dsg, ()->Iter.toSet(dsg.find()));
        Set<Quad> set2 = Txn.calculateRead(dsg2, ()->Iter.toSet(dsg2.find()));

        assertEquals(set1, set2);
    }
}
 
Example #5
Source File: AbstractTestDeltaConnection.java    From rdf-delta with Apache License 2.0 6 votes vote down vote up
@Test
public void change_1() {
    String NAME = "change_1s";
    DeltaClient dClient = createRegister(NAME);

    try(DeltaConnection dConn = dClient.get(NAME)) {
        Version verLocal0 = dConn.getLocalVersion();
        Version verRemotel0 = dConn.getRemoteVersionLatest();

        DatasetGraph dsg = dConn.getDatasetGraph();
        Txn.executeWrite(dsg, ()->{
            dsg.add(SSE.parseQuad("(:gx :sx :px :ox)"));
        });

        Version verLocal1 = dConn.getLocalVersion();
        Version verRemotel1 = dConn.getRemoteVersionLatest();
        assertEquals(verLocal1, dConn.getLocalVersion());
        assertEquals(verRemotel1, dConn.getRemoteVersionLatest());

        assertFalse(dConn.getDatasetGraph().isEmpty());
        if ( dConn.getStorage() != null )
            assertFalse(dConn.getStorage().isEmpty());
    }
}
 
Example #6
Source File: TestPatchFuseki.java    From rdf-delta with Apache License 2.0 6 votes vote down vote up
@Test
public void apply_1() {
    Pair<FusekiServer, DatasetGraph> p = create();
    FusekiServer server = p.getLeft();
    DatasetGraph dsg = p.getRight();

    server.start();
    String url = "http://localhost:"+server.getPort()+"/";
    try {
        assertFalse(dsg.contains(node(":g"), node(":s"), node(":p"), node(":o")));

        // Service name
        applyPatch(url+"/ds/patch", patch1());
        assertTrue(dsg.contains(node(":g"), node(":s"), node(":p"), node(":o")));

        // Content type.
        applyPatch(url+"/ds", patch2());
        assertFalse(dsg.contains(node(":g"), node(":s"), node(":p"), node(":o")));
        applyPatch(url+"/ds", patch1());
        assertTrue(dsg.contains(node(":g"), node(":s"), node(":p"), node(":o")));
    } finally { server.stop(); }
}
 
Example #7
Source File: DSG.java    From rdf-delta with Apache License 2.0 6 votes vote down vote up
static void deleteAny(DatasetGraph dsg, Node g, Node s, Node p, Node o, int sliceSize) {
    // Delete in slices rather than assume .remove() on the iterator is implemented.
    // We keep executing find(g, s, p, o) until we don't get a full slice.
    Quad[] buffer = new Quad[DeleteBufferSize];
    while (true) {
        Iterator<Quad> iter = dsg.find(g, s, p, o);
        // Get a slice
        int len = 0;
        for ( ; len < DeleteBufferSize ; len++ ) {
            if ( !iter.hasNext() )
                break;
            buffer[len] = iter.next();
        }
        // Delete them.
        for ( int i = 0 ; i < len ; i++ ) {
            dsg.delete(buffer[i]);
            buffer[i] = null;
        }
        // Finished?
        if ( len < DeleteBufferSize )
            break;
    }
}
 
Example #8
Source File: ExTDB_Txn3.java    From xcurator with Apache License 2.0 6 votes vote down vote up
public static void execQuery(String sparqlQueryString, DatasetGraph dsg)
{
    // Add a datset wrapper to conform with the query interface.
    // This should not be very expensive.
    Dataset dataset = DatasetFactory.create(dsg) ;
    
    Query query = QueryFactory.create(sparqlQueryString) ;
    QueryExecution qexec = QueryExecutionFactory.create(query, dataset) ;
    try {
        ResultSet results = qexec.execSelect() ;
        for ( ; results.hasNext() ; )
        {
            QuerySolution soln = results.nextSolution() ;
            int count = soln.getLiteral("count").getInt() ;
            System.out.println("count = "+count) ;
        }
      } finally { qexec.close() ; }
}
 
Example #9
Source File: Matrix.java    From rdf-delta with Apache License 2.0 6 votes vote down vote up
private static void setupFuseki(int fusekiPort, String dsName, String zoneDir, DeltaLink deltaLink) {
    //deltaLink.register(Id.create());
    FileOps.ensureDir(zoneDir);
    FileOps.clearAll(zoneDir);

    DeltaClient dClient = setup_dataset(dsName, zoneDir, deltaLink);
    Zone zone = dClient.getZone();
    DataSourceDescription dsd = deltaLink.getDataSourceDescriptionByName(dsName);
    Id dsRef = dsd.getId();
    SyncPolicy syncPolicy = SyncPolicy.TXN_RW;


    LocalStorageType storage = LocalStorageType.MEM;
    dClient.register(dsRef, storage, syncPolicy);
    DeltaConnection deltaConnection = dClient.getLocal(dsRef);
    DatasetGraph dsg = deltaConnection.getDatasetGraph();

    FusekiServer server =
        FusekiServer.create()
            .loopback(true)
            .port(fusekiPort)
            .add(dsName, dsg)
            .build();
    server.start();
}
 
Example #10
Source File: DatasetDeclarationPlan.java    From sparql-generate with Apache License 2.0 6 votes vote down vote up
private void addNamedGraph(Binding binding, Context context, DatasetGraph dsg, Expr sourceExpr) {
	String sourceURI = evalSourceURI(binding, context, sourceExpr);
	final String absURI = baseURI(sourceURI, baseURI);
	Dataset dataset = ContextUtils.getDataset(context);
	Node n = NodeFactory.createURI(absURI);
	Graph g = dsg.getGraph(n);
	if (g == null) {
		g = GraphFactory.createJenaDefaultGraph();
		dsg.addGraph(n, g);
	}
	// default: check the dataset
	if (dataset.containsNamedModel(absURI)) {
		Graph dg = dataset.getNamedModel(absURI).getGraph();
		GraphUtil.addInto(g, dg);
		return;
	}
	// fallback: load as RDF graph
	StreamRDF dest = StreamRDFLib.graph(g);
	ContextUtils.loadGraph(context, sourceURI, absURI, dest);
}
 
Example #11
Source File: DeltaEx06_LocalDatasetToFuseki.java    From rdf-delta with Apache License 2.0 5 votes vote down vote up
public static void main2(String ...args) {
    // ---- Fuseki server with patch operation.
    int PORT = 2020 ;
    // In-memory dataset
    DatasetGraph dsgFuseki = DatasetGraphFactory.createTxnMem();

    String serviceName = "patch";
    FusekiServer server = fusekiServerWithPatch("/ds", PORT, dsgFuseki, serviceName);
    server.start();

    // ---- Destination for changes is the Fuseki patch opration.
    String url = "http://localhost:"+PORT+"/ds/"+serviceName;

    RDFChanges changeSender = DeltaClientLib.destination(url);
    // In the case of http/https URLs, this is done with
    //    RDFChanges changeSender = new RDFChangesHTTP(url);

    // ---- Local dataset.
    DatasetGraph dsgLocal = DatasetGraphFactory.createTxnMem();
    // Combined datasetgraph and changes.
    // Changes will be POSTed to the URL.
    DatasetGraph dsg = RDFPatchOps.changes(dsgLocal, changeSender);

    // ---- Do something. Read in data.ttl inside a transaction.
    // (data.ttl is in src/main/resources/)
    Txn.executeWrite(dsg,
        ()->RDFDataMgr.read(dsg, "data.ttl")
        );

    // ---- Query Fuseki
    RDFConnection conn = RDFConnectionFactory.connect("http://localhost:"+PORT+"/ds");
    try( QueryExecution qExec = conn.query("PREFIX ex: <http://example.org/> SELECT * { ?s ?p ?o }") ) {
        ResultSet rs = qExec.execSelect();
        ResultSetFormatter.out(rs, qExec.getQuery());
    }
}
 
Example #12
Source File: DatasetGraphChanges.java    From rdf-delta with Apache License 2.0 5 votes vote down vote up
/** Create a {@code DatasetGraphChanges} which calls different patch log synchronization
 *  handlers on {@link #sync} and {@link #begin}.
 *  {@code syncHandler} defaults (with null) to "no action".
 *
 *  Transactional usage preferred.
 */
public DatasetGraphChanges(DatasetGraph dsg, RDFChanges monitor, Runnable syncHandler, Consumer<ReadWrite> txnSyncHandler) {
    super(dsg);
    this.monitor = monitor;
    this.syncHandler = syncHandler == null ? identityRunnable : syncHandler;
    this.txnSyncHandler = txnSyncHandler == null ? identityConsumer() : txnSyncHandler;
}
 
Example #13
Source File: DeltaEx06_LocalDatasetToFuseki.java    From rdf-delta with Apache License 2.0 5 votes vote down vote up
private static FusekiServer fusekiServerWithPatch(String dsName, int port, DatasetGraph dsgFuseki, String serviceName) {
    Operation patchOp = DeltaFuseki.patchOp;
    String patchContentType = "application/rdf-patch";
    ActionService handler = new PatchApplyService();
    FusekiServer server =  FusekiServer.create()
        .registerOperation(patchOp, patchContentType, handler)
        .port(port)
        .add(dsName, dsgFuseki)
        .addOperation(dsName, DeltaFuseki.patchOp)
        .build();
    return server ;
}
 
Example #14
Source File: GraphColoringHashingFamily.java    From quetzal with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Initialize hashing family from predicate mappings in supplied file
 * 
 * @param predicateMappingFileName
 * @param isDirect
 * @param familySize
 */
public GraphColoringHashingFamily(File nquadFile, boolean isDirect,
		int familySize) {
	predHashes = new HashMap<String, ArrayList<Integer>>();
	this.size = familySize;
	DatasetGraph dsg = loadDataset(nquadFile);
	initializeFamily(dsg, isDirect);
}
 
Example #15
Source File: DeltaLinkEvents.java    From rdf-delta with Apache License 2.0 5 votes vote down vote up
/**
 * Enable graph events from applying patches to this dataset.
 * Depends on the DatasetGraph returning the same (or at least "right")
 * graph java object each time which is
 */
public static void enableGraphEvents(DeltaLink dLink, Id dsRef, DatasetGraph dsg) {
    DatasetGraph dsg2 = DSG.stableViewGraphs(dsg);
    Function<Node, Graph> router = gn->
        (gn==null) ? dsg2.getDefaultGraph() : dsg2.getGraph(gn);
    enableGraphEvents(dLink, dsRef, router);
}
 
Example #16
Source File: DeltaEx09_CreateDataSourceHTTP.java    From rdf-delta with Apache License 2.0 5 votes vote down vote up
public static void main2(String... args) {
    // The local state of the server.
    Location loc = Location.create("DeltaServer");
    LocalServer localServer = LocalServers.createFile(loc.getDirectoryPath());
    DeltaLink serverState = DeltaLinkLocal.connect(localServer);
    DeltaServer server = DeltaServer.create(1066, serverState);
    // --------
    // Connect to a server
    DeltaLink dLink = DeltaLinkHTTP.connect("http://localhost:1066/");
    // One one zone supported currently.
    Zone zone = Zone.connect("Zone");
    Id clientId = Id.create();

    // Create a new patch log.
    dLink.newDataSource("TEST", "http://example/test");

    // Put it under client management.
    DeltaClient dClient = DeltaClient.create(zone, dLink);
    Id dsRef = dClient.register("TEST", LocalStorageType.MEM, SyncPolicy.TXN_RW);

    // and now connect to it
    try ( DeltaConnection dConn = dClient.get(dsRef) ) {
        Version version1 = dConn.getRemoteVersionLatest();
        System.out.println("Version = "+version1);

        // Change the dataset
        DatasetGraph dsg = dConn.getDatasetGraph();
        Txn.executeWrite(dsg, ()->{
            dsg.add(quad);
        });

        Version version2 = dConn.getRemoteVersionLatest();
        System.out.println("Version = "+version2);
    }

    System.out.println("DONE");
}
 
Example #17
Source File: TestDatasetGraphWithAbort.java    From rdf-delta with Apache License 2.0 5 votes vote down vote up
public void abort_data_1() {
    DatasetGraph dsg = create().asDatasetGraph() ;
    Txn.executeWrite(dsg, ()->dsg.add(q1)) ;
    Assert.assertTrue(dsg.contains(q1)) ;
    Assert.assertFalse(dsg.contains(q2)) ;
    dsg.begin(ReadWrite.WRITE);
    dsg.add(q2) ;
    dsg.abort();
    dsg.end();
    Assert.assertTrue(dsg.contains(q1)) ;
    Assert.assertFalse(dsg.contains(q2)) ;
}
 
Example #18
Source File: TestRDFChangesDataset.java    From rdf-delta with Apache License 2.0 5 votes vote down vote up
@Test public void record_graph_1() {
    Txn.executeWrite(dsg, ()-> {
        Graph g = dsg.getDefaultGraph();
        g.add(triple1);
    });
    DatasetGraph dsg2 = replay();
    check(dsg2, Quad.create(Quad.defaultGraphIRI, triple1));
}
 
Example #19
Source File: DSG.java    From rdf-delta with Apache License 2.0 5 votes vote down vote up
/**
     * Ensure the same graph object is returned by each of {@link DatasetGraph#getDefaultGraph()}
     * and {@link DatasetGraph#getGraph(Node)} each call.
     * This function does not "double wrap" a :@code DatasetGraph};
     * if the argument already provides "stable graphs" then the argument is returned unchanged.
     */
    public static DatasetGraph stableViewGraphs(DatasetGraph dsgBase) {
        if ( dsgBase instanceof DatasetGraphStableGraphs )
            return dsgBase;
        // No harm wrapping one of these so let's not rely on the
        // implementation details of DatasetGraphMapLink.
//        if ( dsgBase instanceof DatasetGraphMapLink )
//            return dsgBase;
        DatasetGraph dsg1 = new DatasetGraphStableGraphs(dsgBase);
        return dsg1;
    }
 
Example #20
Source File: TestAssemblerFileLog.java    From rdf-delta with Apache License 2.0 5 votes vote down vote up
@Test public void assemData() {
    Dataset ds = (Dataset)AssemblerUtils.build(ADIR+"/assem-logged.ttl", VocabPatch.tLoggedDataset);
    Txn.executeWrite(ds, ()->RDFDataMgr.read(ds, ADIR+"/data.ttl"));

    String patchfile = "target/filelog/log.rdfp.0001";
    assertTrue("Patch file does not exist: "+patchfile, FileOps.exists(patchfile));
    RDFPatch patch = RDFPatchOps.read(patchfile);
    DatasetGraph dsg1 = DatasetGraphFactory.createTxnMem();
    RDFPatchOps.applyChange(dsg1, patch);
    // Same term, no bnode isomorphism.
    boolean b = IsoMatcher.isomorphic(ds.asDatasetGraph(), dsg1);
    assertTrue(b);
}
 
Example #21
Source File: LibBuildDC.java    From rdf-delta with Apache License 2.0 5 votes vote down vote up
/** Build a Delta-backed datasets at a zone location. */
public static DatasetGraph setupDataset(String dsName, Location zoneLocation, LocalStorageType storage, DatasetGraph externalDataset, List<String> destURLs) {
    // Link to log server.
    DeltaLink deltaLink;
    if ( destURLs.size() == 1 )
        deltaLink = DeltaLinkHTTP.connect(destURLs.get(0));
    else {
        List<DeltaLink> links = new ArrayList<>(destURLs.size());
        for ( String destURL  : destURLs )
            links.add(DeltaLinkHTTP.connect(destURL));
        deltaLink = new DeltaLinkSwitchable(links);
    }

    Zone zone = Zone.connect(zoneLocation);
    DeltaClient deltaClient = DeltaClient.create(zone, deltaLink);
    SyncPolicy syncPolicy = SyncPolicy.TXN_RW;
    try { deltaLink.ping(); }
    catch (HttpException ex) {
        // rc < 0 : failed to connect - ignore?
        if ( ex.getStatusCode() > 0 )
            throw ex;
    }

    DatasetGraph dsg = ManagedDatasetBuilder.create()
        .deltaLink(deltaLink)
        .logName(dsName)
        .zone(zone)
        .syncPolicy(syncPolicy)
        .storageType(storage)
        .externalDataset(externalDataset)
        .build();
    return dsg;
 }
 
Example #22
Source File: TestRDFChangesDataset.java    From rdf-delta with Apache License 2.0 5 votes vote down vote up
@Test public void record_add_delete_3() {
    Txn.executeWrite(dsg, ()-> {
        dsg.delete(quad2);
        dsg.add(quad1);
    });
    DatasetGraph dsg2 = replay();
    check(dsg2, quad1);
}
 
Example #23
Source File: DeltaClient.java    From rdf-delta with Apache License 2.0 5 votes vote down vote up
/**
 * Connect to an existing {@code DataSource} providing the local state in an external database.
 * The caller is responsible for this external state being correct for the version recorded in the zone.
 * This operation does not fail if it can not contact the patch log server.
 *
 * @param datasourceId
 * @param dsg
 * @param syncPolicy
 */
public DeltaConnection connectExternal(Id datasourceId, DatasetGraph dsg, SyncPolicy syncPolicy) {
    Objects.requireNonNull(datasourceId);
    DeltaConnection dConn = get(datasourceId);
    if ( dConn != null )
        return dConn;
    zone.externalStorage(datasourceId, dsg);
    DataState dataState = zone.get(datasourceId);
    dConn = DeltaConnection.create(dataState, dsg, dLink, syncPolicy);
    putCache(datasourceId, dConn);
    return dConn;
}
 
Example #24
Source File: TestRDFChangesDataset.java    From rdf-delta with Apache License 2.0 5 votes vote down vote up
@Test public void record_add_delete_1() {
    Txn.executeWrite(dsg, ()-> {
        dsg.add(quad1);
        dsg.delete(quad1);
    });
    DatasetGraph dsg2 = replay();
    check(dsg2);
}
 
Example #25
Source File: TestRDFChangesDataset.java    From rdf-delta with Apache License 2.0 5 votes vote down vote up
@Test public void record_add_add_2() {
    Txn.executeWrite(dsg, ()-> {
        dsg.add(quad1);
        dsg.add(quad1);
    });
    DatasetGraph dsg2 = replay();
    check(dsg2, quad1);
}
 
Example #26
Source File: DeltaConnection.java    From rdf-delta with Apache License 2.0 5 votes vote down vote up
/**
 * Connect to an existing {@code DataSource} with the {@link DatasetGraph} as local state.
 * The {@code DatasetGraph} must be in-step with the zone.
 * {@code DeltaConnection} objects are normal obtained via {@link DeltaClient}.
 * {@code TxnSyncPolicy} controls when the {@code DeltaConnection} synchronizes with the patch log.
 */

/*package*/ static DeltaConnection create(DataState dataState, DatasetGraph dsg, DeltaLink dLink, SyncPolicy syncTxnBegin) {
    Objects.requireNonNull(dataState,           "Null data state");
    Objects.requireNonNull(dLink,               "DeltaLink is null");
    Objects.requireNonNull(syncTxnBegin,        "SyncPolicy is null");
    Objects.requireNonNull(dataState.getDataSourceId(),     "Null data source Id");
    Objects.requireNonNull(dataState.getDatasourceName(),   "Null data source name");

    DeltaConnection dConn = new DeltaConnection(dataState, dsg, dLink, syncTxnBegin);
    dConn.start();
    return dConn;
}
 
Example #27
Source File: TestRDFChangesDataset.java    From rdf-delta with Apache License 2.0 5 votes vote down vote up
private DatasetGraph replay() {
    IO.close(bout);
    try(ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray())) {
        DatasetGraph dsg2 = DatasetGraphFactory.createTxnMem();
        RDFPatchOps.applyChange(dsg2, bin);
        return dsg2;
    } catch (IOException ex) { IO.exception(ex); return null; }
}
 
Example #28
Source File: TestRDFChangesGraph.java    From rdf-delta with Apache License 2.0 5 votes vote down vote up
private static Graph txnGraph(String graphName) {
        DatasetGraph dsg = DatasetGraphFactory.createTxnMem();
        Node gn = NodeFactory.createURI(graphName);
        Graph g = dsg.getGraph(gn);
        // Jena 3.5.0 and earlier.
//      g = new GraphWrapper(g) {
//          @Override public TransactionHandler getTransactionHandler() { return new TransactionHandlerView(dsg); }
//      };
        return g;
    }
 
Example #29
Source File: TestRDFChangesGraph.java    From rdf-delta with Apache License 2.0 5 votes vote down vote up
private static Graph txnGraph() {
        DatasetGraph dsg = DatasetGraphFactory.createTxnMem();
        Graph g = dsg.getDefaultGraph();
        // Jena 3.5.0 and earlier.
//        g = new GraphWrapper(g) {
//            @Override public TransactionHandler getTransactionHandler() { return new TransactionHandlerViewX(dsg); }
//        };
        return g;
    }
 
Example #30
Source File: ExecuteSPARQLStar.java    From RDFstarTools with Apache License 2.0 5 votes vote down vote up
@Override
public Dataset createDataset()
{
	final DatasetGraph dsg = DatasetGraphFactory.createTxnMem();
	final DatasetGraph dsgWrapped = new DatasetGraphWrapperStar(dsg);
	final Dataset ds = DatasetFactory.wrap(dsgWrapped);
	addGraphs(ds);
	dataset = ds;
	return dataset;
}