Class PathSegment

java.lang.Object
dev.roanh.gmark.util.PathSegment

public class PathSegment extends Object
Path segment modelling a single edge of a path drawn in the selectivity graph. In the original gMark codebase a path segment is a called a tripple.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    The ending selectivity type of this path segment.
    private boolean
    Whether this path segment should be modelled with a Kleene star above it when generating a query.
    The starting selectivity type of this path segment.
  • Constructor Summary

    Constructors
    Constructor
    Description
    PathSegment(SelectivityType start, SelectivityType end, boolean star)
    Constructs a new path segment with the given start and end selectivity type and Kleene star status.
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the source selectivity type of this path segment.
    Gets the target selectivity type of this path segment.
    boolean
    Checks whether this path segment should be modelled with a Kleene star above it when generating a query.
    static final PathSegment
    of(Schema schema, int start, SelectivityClass sel, int end, boolean star)
    Constructs a new path segment with the given start and end nodes and Kleene star status.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • start

      private SelectivityType start
      The starting selectivity type of this path segment.
    • end

      private SelectivityType end
      The ending selectivity type of this path segment.
    • star

      private boolean star
      Whether this path segment should be modelled with a Kleene star above it when generating a query.
  • Constructor Details

    • PathSegment

      public PathSegment(SelectivityType start, SelectivityType end, boolean star)
      Constructs a new path segment with the given start and end selectivity type and Kleene star status.
      Parameters:
      start - The starting selectivity type.
      end - The ending selectivity type.
      star - True if this path segment can handle a Kleene star.
  • Method Details

    • getSource

      public SelectivityType getSource()
      Gets the source selectivity type of this path segment. This corresponds to a node from the selectivity graph the path was drawn from.
      Returns:
      The source selectivity type.
    • getTarget

      public SelectivityType getTarget()
      Gets the target selectivity type of this path segment. This corresponds to a node from the selectivity graph the path was drawn from.
      Returns:
      The target selectivity type.
    • hasStar

      public boolean hasStar()
      Checks whether this path segment should be modelled with a Kleene star above it when generating a query.
      Returns:
      True if this path segment should have a Kleene star above it in a query.
    • of

      public static final PathSegment of(Schema schema, int start, SelectivityClass sel, int end, boolean star)
      Constructs a new path segment with the given start and end nodes and Kleene star status. The given start and end node IDs will be resolve to types using the given schema. The given selectivity class denotes the selectivity of the target node. The selectivity of the start node will always be SelectivityClass.EQUALS.
      Parameters:
      schema - The schema to use to resolve types by ID.
      start - The type ID of the start node of the path segment.
      sel - The selectivity of the end node.
      end - The type ID of the end node of the path segment.
      star - True if this path segment can handle a Kleene star.
      Returns:
      The newly constructed path segment.
    • toString

      public String toString()
      Overrides:
      toString in class Object