java.lang.Object
org.apache.jena.geosparql.spatial.index.v2.SpatialIndexLib

public class SpatialIndexLib extends Object
ARQ-level utils for Dataset and Context.
  • Constructor Details

    • SpatialIndexLib

      public SpatialIndexLib()
  • Method Details

    • getPreferredSRS

      public static final String getPreferredSRS(org.apache.jena.sparql.util.Context context)
      Set the preferred SRS for the given (dataset) context.
    • setPreferredSRS

      public static final void setPreferredSRS(org.apache.jena.sparql.util.Context context, String srsUri)
      Set a preferred SRS for the given (dataset) context. This SRS will be used when constructing a spatial index for the first time.
    • setSpatialIndex

      public static final void setSpatialIndex(org.apache.jena.query.Dataset dataset, SpatialIndex spatialIndex)
      Set the SpatialIndex into the Context of the Dataset for later retrieval and use in spatial functions.
      Parameters:
      dataset -
      spatialIndex -
    • setSpatialIndex

      public static final void setSpatialIndex(org.apache.jena.sparql.core.DatasetGraph datasetGraph, SpatialIndex spatialIndex)
    • setSpatialIndex

      public static final void setSpatialIndex(org.apache.jena.sparql.util.Context context, SpatialIndex spatialIndex)
    • getSpatialIndex

      public static final <T extends SpatialIndex> T getSpatialIndex(org.apache.jena.sparql.util.Context cxt)
    • getSpatialIndex

      public static final <T extends SpatialIndex> T getSpatialIndex(org.apache.jena.sparql.core.DatasetGraph dsg)
    • isDefined

      public static final boolean isDefined(org.apache.jena.sparql.engine.ExecutionContext execCxt)
      Parameters:
      execCxt -
      Returns:
      True if a SpatialIndex is defined in the ExecutionContext.
    • require

      public static final SpatialIndex require(org.apache.jena.sparql.engine.ExecutionContext execCxt) throws SpatialIndexException
      Get the SpatialIndex from the Context. Fail if absent.
      Parameters:
      execCxt -
      Returns:
      SpatialIndex contained in the Context.
      Throws:
      SpatialIndexException
    • wrapModel

      public static final org.apache.jena.query.Dataset wrapModel(org.apache.jena.rdf.model.Model model, String srsURI) throws SpatialIndexException
      Wrap Model in a Dataset and build SpatialIndex.
      Parameters:
      model -
      srsURI -
      Returns:
      Dataset with default Model and SpatialIndex in Context.
      Throws:
      SpatialIndexException
    • wrapModel

      public static final org.apache.jena.query.Dataset wrapModel(org.apache.jena.rdf.model.Model model) throws SpatialIndexException
      Wrap Model in a Dataset and build SpatialIndex.
      Parameters:
      model -
      Returns:
      Dataset with default Model and SpatialIndex in Context.
      Throws:
      SpatialIndexException
    • buildSpatialIndex

      public static SpatialIndex buildSpatialIndex(org.apache.jena.sparql.core.DatasetGraph datasetGraph) throws SpatialIndexException
      Build Spatial Index from all graphs in Dataset.
      Dataset contains SpatialIndex in Context.
      SRS URI based on most frequent found in Dataset.
      Parameters:
      datasetGraph -
      Returns:
      SpatialIndex constructed.
      Throws:
      SpatialIndexException
    • buildSpatialIndex

      public static SpatialIndexPerGraph buildSpatialIndex(org.apache.jena.sparql.core.DatasetGraph datasetGraph, String srsURI) throws SpatialIndexException
      Build Spatial Index from all graphs in Dataset.
      Dataset contains SpatialIndex in Context.
      Parameters:
      datasetGraph -
      srsURI -
      Returns:
      SpatialIndex constructed.
      Throws:
      SpatialIndexException
    • buildSpatialIndexPerGraph

      public static SpatialIndexPerGraph buildSpatialIndexPerGraph(org.apache.jena.sparql.core.DatasetGraph datasetGraph, String srsURI) throws SpatialIndexException
      Throws:
      SpatialIndexException
    • unwrapGraphName

      public static org.apache.jena.graph.Node unwrapGraphName(org.apache.jena.graph.Graph graph)
    • scheduleOnceIndexTask

      public static BasicTask scheduleOnceIndexTask(org.apache.jena.sparql.core.DatasetGraph dsg, SpatialIndexerComputation indexComputation, Path targetFile, boolean isReplaceTask, BasicTask.TaskListener<BasicTask> taskListener)
    • createIndexerTask

      public static TaskThread createIndexerTask(org.apache.jena.sparql.core.DatasetGraph dsg, Predicate<org.apache.jena.graph.Node> isAuthorizedGraph, SpatialIndexerComputation indexComputation, BasicTask.TaskListener<BasicTask> taskListener, Path targetFile, boolean isReplaceTask)
    • scheduleOnceCleanTask

      public static BasicTask scheduleOnceCleanTask(org.apache.jena.sparql.core.DatasetGraph dsg, BasicTask.TaskListener<BasicTask> taskListener)
      Attempt to start a spatial index task that cleans the index of graphs not present in the given dataset. This method fails if there is already another spatial index task running.
    • createCleanTask

      public static TaskThread createCleanTask(org.apache.jena.sparql.core.DatasetGraph dsg, Predicate<org.apache.jena.graph.Node> isAuthorizedGraph, BasicTask.TaskListener<BasicTask> taskListener)
    • accGraphNodes

      public static <C extends Collection<org.apache.jena.graph.Node>> C accGraphNodes(C accGraphs, org.apache.jena.sparql.core.DatasetGraph dsg)