Interface Relation

All Superinterfaces:
AutoCloseable, Realized, SelfDescribingScalarData
All Known Implementing Classes:
EmptyRelation

public interface Relation extends Realized, SelfDescribingScalarData
  • Method Details

    • getType

      Struct getType()
    • iterator

      TupleIterator iterator()
    • project

      ResultOrProblems<Relation> project(Projection projection)
    • restrict

      ResultOrProblems<Relation> restrict(Restriction restriction)
    • stream

      default Stream<Tuple> stream()
    • getSpatialMetadata

      default Optional<SpatialMetadata> getSpatialMetadata()
      Returns:
      SpatialMetadata for this relation. Should return Optional.empty() if not a spatial layer.
    • skipInvalid

      Relation skipInvalid(ProblemSink sendProblemsTo)
      Returns:
      a new relation that skips rows that are invalid for some reason TODO consider whether we need some sort of 'cloneWithOptions' method, that returns a new relation if the options are supported
    • hasSkipOnInvalid

      boolean hasSkipOnInvalid()
      Returns:
      true if invalid rows will be skipped for this relation
    • getSourceInformation

      String getSourceInformation()
    • calculateBounds

      default Optional<org.geotools.geometry.jts.ReferencedEnvelope> calculateBounds()
      Returns:
      a freshly computed ReferencedEnvelope for this relation which covers all of the geometry in the relation identified by its SpatialMetadata, or empty if no SpatialMetadata or for an empty Relation.
    • getLimit

      long getLimit()
      Returns:
      The maximum number of Tuples this Relation will yield via an iterator it produces. If the underlying data set is not ordered, this could be a completely arbitrary set of results.
    • getOffset

      long getOffset()
      Returns:
      The number of Tuples that will be skipped before an iterator starts yielding results. If the underlying data set is not ordered, this could be a completely arbitrary set of results.
    • limit

      default Relation limit(long newLimit)

      Convenience version of limitAndOffset(long, long) with offset set to the Relation's current offset

    • offset

      default Relation offset(long newOffset)

      Convenience version of limitAndOffset(long, long) with limit set to the Relation's current limit

    • limitAndOffset

      Relation limitAndOffset(long newLimit, long newOffset)

      Returns a new relation that yields a subset of tuples this relation would normally return. This should apply after any filtering that's applied to the relation, even if those filters are applied after a limit and offset.

      Returns:
      a new Relation with the limit and offset applied
    • getScalarDataType

      default Type getScalarDataType()
      Description copied from interface: SelfDescribingScalarData

      Returns the RiskScape type that describes this data when extracted from a project and added in to a pipeline as a scalar value.

      It is referred to as the scalar type to make it clear it's not the same as the Type of the data contained within it, e.g. the Struct type of the relation (non-scalar) vs RelationType that represents the relation itself (scalar).

      Specified by:
      getScalarDataType in interface SelfDescribingScalarData
    • size

      default Optional<Long> size()

      Get a rough count of the untransformed tuples in the relation. This may include tuples that are skipped because they are invalid or removed by a filter bookmark parameter. A rule of thumb is this should match the number of tuples produced by BaseRelation#rawIterator().

      Returns:
      the number of tuples present in the underlying data (if easily known).