public interface Fragment
A fragment is composed of four things:
Variable names refer to Graql variables. Some of these variable names may be randomly-generated UUIDs, such as for castings.
A Fragment is usually contained in a EquivalentFragmentSet, which contains multiple fragments describing
the different directions the traversal can be followed in, with different starts and ends.
A gremlin traversal is created from a Query by appending together fragments in order of priority, one from
each EquivalentFragmentSet describing the Query.
| Modifier and Type | Method and Description |
|---|---|
org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal<org.apache.tinkerpop.gremlin.structure.Element,? extends org.apache.tinkerpop.gremlin.structure.Element> |
applyTraversal(org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal<org.apache.tinkerpop.gremlin.structure.Element,? extends org.apache.tinkerpop.gremlin.structure.Element> traversal,
GraknGraph graph) |
default boolean |
canOperateOnEdges()
Indicates whether the fragment can be used on an
Edge as well as
a Vertex. |
double |
fragmentCost()
Get the cost for executing the fragment.
|
Set<Var> |
getDependencies() |
Set<Weighted<DirectedEdge<Node>>> |
getDirectedEdges(Map<NodeId,Node> nodes,
Map<Node,Map<Node,Fragment>> edgeToFragment)
Convert the fragment to a set of weighted edges for query planning
|
Optional<Var> |
getEnd() |
EquivalentFragmentSet |
getEquivalentFragmentSet() |
String |
getName()
The name of the fragment
|
Var |
getStart() |
Set<Var> |
getVariableNames()
Get all variable names in the fragment - the start and end (if present)
|
VarProperty |
getVarProperty()
Get the corresponding property
|
default boolean |
hasFixedFragmentCost()
If a fragment has fixed cost, the traversal is done using index.
|
default boolean |
isStartingFragment()
A starting fragment is a fragment that can start a traversal.
|
void |
setEquivalentFragmentSet(EquivalentFragmentSet equivalentFragmentSet) |
EquivalentFragmentSet getEquivalentFragmentSet()
void setEquivalentFragmentSet(EquivalentFragmentSet equivalentFragmentSet)
equivalentFragmentSet - the EquivalentFragmentSet that contains this Fragmentorg.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal<org.apache.tinkerpop.gremlin.structure.Element,? extends org.apache.tinkerpop.gremlin.structure.Element> applyTraversal(org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal<org.apache.tinkerpop.gremlin.structure.Element,? extends org.apache.tinkerpop.gremlin.structure.Element> traversal,
GraknGraph graph)
traversal - the traversal to extend with this Fragmentgraph - the graph to execute the traversal onString getName()
Var getStart()
Optional<Var> getEnd()
Set<Var> getDependencies()
Set<Var> getVariableNames()
VarProperty getVarProperty()
default boolean isStartingFragment()
double fragmentCost()
default boolean hasFixedFragmentCost()
Set<Weighted<DirectedEdge<Node>>> getDirectedEdges(Map<NodeId,Node> nodes, Map<Node,Map<Node,Fragment>> edgeToFragment)
nodes - all nodes in the queryedgeToFragment - a mapping from edge(child, parent) to its corresponding fragmentdefault boolean canOperateOnEdges()
Edge as well as
a Vertex.Copyright © 2017 Grakn Labs Ltd. All rights reserved.