Class ContextUtils
java.lang.Object
fr.mines_stetienne.ci.sparql_generate.utils.ContextUtils
- Author:
- Maxime Lefrançois
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classForker class is used to create a new context from an existing one. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddTaskOnClose(org.apache.jena.sparql.util.Context context, Runnable task) static <T> TawaitWithinLimits(org.apache.jena.sparql.util.Context context, Future<T> future) Waits for a future, such as the end of a stream, within the limits of the execution: when the time limit is reached, or the thread is interrupted, throws anExecutionLimitException.static ContextUtils.Builderbuild()static ContextUtils.Builderstatic ContextUtils.Builderbuild(org.apache.jena.atlas.io.IndentedWriter output) static ContextUtils.Builderbuild(org.apache.jena.riot.system.StreamRDF output) static voidcheckLimits(org.apache.jena.sparql.util.Context context) Throws anExecutionLimitExceptionif the time limit of the execution is past, or if its thread was interrupted.static voidclose(org.apache.jena.sparql.util.Context context) Runs the closing tasks of the execution (each one once, even if another one fails), and shuts the default executor down.static voidcountTriple(org.apache.jena.sparql.util.Context context) Counts a generated triple, and throws anExecutionLimitExceptionbeyond the limit of the execution.static org.apache.jena.sparql.util.Contextstatic ContextUtils.Forkerfork(org.apache.jena.sparql.util.Context context) static ContextUtils.Forkerfork(org.apache.jena.sparql.util.Context context, boolean isRoot) static StringgetBase(org.apache.jena.sparql.util.Context context) static org.apache.jena.graph.NodegetBlankNode(org.apache.jena.sparql.util.Context context, String label) Gets the blank node for a label, the same for the whole execution.static org.apache.jena.query.DatasetgetDataset(org.apache.jena.sparql.util.Context context) static ExecutorServicegetExecutor(org.apache.jena.sparql.util.Context context) The executor of the stream iterators (MQTT, WebSocket).static org.apache.jena.riot.system.StreamRDFgetGenerateOutput(org.apache.jena.sparql.util.Context context) static org.apache.jena.graph.Node[]static org.apache.jena.graph.Nodeget the node at position i in the LIST( expr ).static org.apache.jena.shared.PrefixMappinggetPrefixMapping(org.apache.jena.sparql.util.Context context) static QueryExecutorgetQueryExecutor(org.apache.jena.sparql.util.Context context) static Consumer<org.apache.jena.query.ResultSet> getSelectOutput(org.apache.jena.sparql.util.Context context) static org.apache.jena.atlas.io.IndentedWritergetTemplateOutput(org.apache.jena.sparql.util.Context context) static booleanisDebugStConcat(org.apache.jena.sparql.util.Context context) static booleanisFailOnException(org.apache.jena.sparql.util.Context context) static booleanisRootContext(org.apache.jena.sparql.util.Context context) static voidloadGraph(org.apache.jena.sparql.util.Context context, String sourceURI, String baseURI, org.apache.jena.riot.system.StreamRDF dest) static org.apache.jena.sparql.expr.NodeValuememoise(org.apache.jena.sparql.util.Context context, Object key, Supplier<org.apache.jena.sparql.expr.NodeValue> compute) Gets the value memoised for a key during the execution, or computes it.static org.apache.jena.atlas.web.TypedInputStreamopenStream(org.apache.jena.sparql.util.Context context, String sourceUri, String acceptHeader) static longremainingMillis(org.apache.jena.sparql.util.Context context)
-
Constructor Details
-
ContextUtils
public ContextUtils()
-
-
Method Details
-
getNode
public static org.apache.jena.graph.Node getNode(org.apache.jena.sparql.util.Context context, Node_List list, int position) get the node at position i in the LIST( expr ). Or rdf:nil if the position is equal to the number of bindings- Parameters:
context-list-position-- Returns:
-
getInfo
public static org.apache.jena.graph.Node[] getInfo(org.apache.jena.sparql.util.Context context, Node_List list) -
getBlankNode
public static org.apache.jena.graph.Node getBlankNode(org.apache.jena.sparql.util.Context context, String label) Gets the blank node for a label, the same for the whole execution. Outside of a SPARQL-Generate execution, returns a fresh blank node. -
memoise
public static org.apache.jena.sparql.expr.NodeValue memoise(org.apache.jena.sparql.util.Context context, Object key, Supplier<org.apache.jena.sparql.expr.NodeValue> compute) Gets the value memoised for a key during the execution, or computes it. Outside of a SPARQL-Generate execution, always computes it. -
getDataset
public static org.apache.jena.query.Dataset getDataset(org.apache.jena.sparql.util.Context context) -
getExecutor
The executor of the stream iterators (MQTT, WebSocket). By default, a single daemon thread, created when first needed and shut down when the context is closed. -
getQueryExecutor
-
isRootContext
public static boolean isRootContext(org.apache.jena.sparql.util.Context context) -
isFailOnException
public static boolean isFailOnException(org.apache.jena.sparql.util.Context context) -
checkLimits
public static void checkLimits(org.apache.jena.sparql.util.Context context) Throws anExecutionLimitExceptionif the time limit of the execution is past, or if its thread was interrupted. -
awaitWithinLimits
public static <T> T awaitWithinLimits(org.apache.jena.sparql.util.Context context, Future<T> future) throws InterruptedException, ExecutionException Waits for a future, such as the end of a stream, within the limits of the execution: when the time limit is reached, or the thread is interrupted, throws anExecutionLimitException. -
countTriple
public static void countTriple(org.apache.jena.sparql.util.Context context) Counts a generated triple, and throws anExecutionLimitExceptionbeyond the limit of the execution. -
remainingMillis
public static long remainingMillis(org.apache.jena.sparql.util.Context context) - Returns:
- the time left before the time limit, in milliseconds, or -1 if there is no limit.
-
isDebugStConcat
public static boolean isDebugStConcat(org.apache.jena.sparql.util.Context context) -
getBase
-
getPrefixMapping
public static org.apache.jena.shared.PrefixMapping getPrefixMapping(org.apache.jena.sparql.util.Context context) -
addTaskOnClose
-
close
public static void close(org.apache.jena.sparql.util.Context context) Runs the closing tasks of the execution (each one once, even if another one fails), and shuts the default executor down. -
getTemplateOutput
public static org.apache.jena.atlas.io.IndentedWriter getTemplateOutput(org.apache.jena.sparql.util.Context context) -
getSelectOutput
public static Consumer<org.apache.jena.query.ResultSet> getSelectOutput(org.apache.jena.sparql.util.Context context) -
getGenerateOutput
public static org.apache.jena.riot.system.StreamRDF getGenerateOutput(org.apache.jena.sparql.util.Context context) -
loadGraph
-
openStream
-
fork
-
fork
-
createSimple
public static org.apache.jena.sparql.util.Context createSimple() -
build
-
build
-
build
-
build
-