Package dev.roanh.gmark.util
Class PathSegment
java.lang.Object
dev.roanh.gmark.util.PathSegment
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
Modifier and TypeFieldDescriptionprivate SelectivityType
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.private SelectivityType
The starting selectivity type of this path segment. -
Constructor Summary
ConstructorDescriptionPathSegment
(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 TypeMethodDescriptionGets the source selectivity type of this path segment.Gets the target selectivity type of this path segment.boolean
hasStar()
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.toString()
-
Field Details
-
start
The starting selectivity type of this path segment. -
end
The ending selectivity type of this path segment. -
star
private boolean starWhether this path segment should be modelled with a Kleene star above it when generating a query.
-
-
Constructor Details
-
PathSegment
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
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
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 beSelectivityClass.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
-