Class ContextUtils

java.lang.Object
fr.mines_stetienne.ci.sparql_generate.utils.ContextUtils

public class ContextUtils extends Object
Author:
Maxime Lefrançois
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
     
    static class 
    Forker class is used to create a new context from an existing one.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    addTaskOnClose(org.apache.jena.sparql.util.Context context, Runnable task)
     
    static <T> T
    awaitWithinLimits(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 an ExecutionLimitException.
     
    build(Consumer<org.apache.jena.query.ResultSet> output)
     
    build(org.apache.jena.atlas.io.IndentedWriter output)
     
    build(org.apache.jena.riot.system.StreamRDF output)
     
    static void
    checkLimits(org.apache.jena.sparql.util.Context context)
    Throws an ExecutionLimitException if the time limit of the execution is past, or if its thread was interrupted.
    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.
    static void
    countTriple(org.apache.jena.sparql.util.Context context)
    Counts a generated triple, and throws an ExecutionLimitException beyond the limit of the execution.
    static org.apache.jena.sparql.util.Context
     
    fork(org.apache.jena.sparql.util.Context context)
     
    fork(org.apache.jena.sparql.util.Context context, boolean isRoot)
     
    static String
    getBase(org.apache.jena.sparql.util.Context context)
     
    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.
    static org.apache.jena.query.Dataset
    getDataset(org.apache.jena.sparql.util.Context context)
     
    getExecutor(org.apache.jena.sparql.util.Context context)
    The executor of the stream iterators (MQTT, WebSocket).
    static org.apache.jena.riot.system.StreamRDF
    getGenerateOutput(org.apache.jena.sparql.util.Context context)
     
    static org.apache.jena.graph.Node[]
    getInfo(org.apache.jena.sparql.util.Context context, Node_List list)
     
    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 ).
    static org.apache.jena.shared.PrefixMapping
    getPrefixMapping(org.apache.jena.sparql.util.Context context)
     
    getQueryExecutor(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.IndentedWriter
    getTemplateOutput(org.apache.jena.sparql.util.Context context)
     
    static boolean
    isDebugStConcat(org.apache.jena.sparql.util.Context context)
     
    static boolean
    isFailOnException(org.apache.jena.sparql.util.Context context)
     
    static boolean
    isRootContext(org.apache.jena.sparql.util.Context context)
     
    static void
    loadGraph(org.apache.jena.sparql.util.Context context, String sourceURI, String baseURI, org.apache.jena.riot.system.StreamRDF dest)
     
    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.
    static org.apache.jena.atlas.web.TypedInputStream
    openStream(org.apache.jena.sparql.util.Context context, String sourceUri, String acceptHeader)
     
    static long
    remainingMillis(org.apache.jena.sparql.util.Context context)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      public static ExecutorService getExecutor(org.apache.jena.sparql.util.Context context)
      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

      public static QueryExecutor getQueryExecutor(org.apache.jena.sparql.util.Context context)
    • 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 an ExecutionLimitException if 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 an ExecutionLimitException.
      Throws:
      InterruptedException
      ExecutionException
    • countTriple

      public static void countTriple(org.apache.jena.sparql.util.Context context)
      Counts a generated triple, and throws an ExecutionLimitException beyond 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

      public static String getBase(org.apache.jena.sparql.util.Context context)
    • getPrefixMapping

      public static org.apache.jena.shared.PrefixMapping getPrefixMapping(org.apache.jena.sparql.util.Context context)
    • addTaskOnClose

      public static void addTaskOnClose(org.apache.jena.sparql.util.Context context, Runnable task)
    • 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

      public static void loadGraph(org.apache.jena.sparql.util.Context context, String sourceURI, String baseURI, org.apache.jena.riot.system.StreamRDF dest)
    • openStream

      public static org.apache.jena.atlas.web.TypedInputStream openStream(org.apache.jena.sparql.util.Context context, String sourceUri, String acceptHeader)
    • fork

      public static ContextUtils.Forker fork(org.apache.jena.sparql.util.Context context)
    • fork

      public static ContextUtils.Forker fork(org.apache.jena.sparql.util.Context context, boolean isRoot)
    • createSimple

      public static org.apache.jena.sparql.util.Context createSimple()
    • build

      public static ContextUtils.Builder build()
    • build

      public static ContextUtils.Builder build(org.apache.jena.atlas.io.IndentedWriter output)
    • build

      public static ContextUtils.Builder build(org.apache.jena.riot.system.StreamRDF output)
    • build

      public static ContextUtils.Builder build(Consumer<org.apache.jena.query.ResultSet> output)