Java Code Examples for org.apache.jena.sparql.core.DatasetGraph#getDefaultGraph()
The following examples show how to use
org.apache.jena.sparql.core.DatasetGraph#getDefaultGraph() .
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: JenaUtil.java From shacl with Apache License 2.0 | 6 votes |
private static Node invokeFunction(Resource function, ExprList args, Dataset dataset) { if (dataset == null) { dataset = ARQFactory.get().getDataset(ModelFactory.createDefaultModel()); } E_Function expr = new E_Function(function.getURI(), args); DatasetGraph dsg = dataset.asDatasetGraph(); Context cxt = ARQ.getContext().copy(); cxt.set(ARQConstants.sysCurrentTime, NodeFactoryExtra.nowAsDateTime()); FunctionEnv env = new ExecutionContext(cxt, dsg.getDefaultGraph(), dsg, null); try { NodeValue r = expr.eval(BindingRoot.create(), env); if(r != null) { return r.asNode(); } } catch(ExprEvalException ex) { } return null; }
Example 2
Source File: TestRDFChangesGraph.java From rdf-delta with Apache License 2.0 | 5 votes |
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 3
Source File: DeltaLinkEvents.java From rdf-delta with Apache License 2.0 | 5 votes |
/** * 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 4
Source File: QueryIterTripleStarPatternTest.java From RDFstarTools with Apache License 2.0 | 4 votes |
protected ExecutionContext createTestExecCxt() { final DatasetGraph dsg = DatasetGraphFactory.create( createTestGraph() ); final Context context = ARQ.getContext(); return new ExecutionContext( context, dsg.getDefaultGraph(), dsg, QC.getFactory(context) ); }