public abstract class Fragment extends Object
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.
| Type | Property and Description |
|---|---|
abstract VarProperty |
var
Get the corresponding property
|
| Constructor and Description |
|---|
Fragment() |
| Modifier and Type | Method and Description |
|---|---|
org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal<org.apache.tinkerpop.gremlin.structure.Vertex,? extends org.apache.tinkerpop.gremlin.structure.Element> |
applyTraversal(org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal<org.apache.tinkerpop.gremlin.structure.Vertex,? extends org.apache.tinkerpop.gremlin.structure.Element> traversal,
GraknTx graph,
Collection<Var> vars,
Var currentVar) |
boolean |
canOperateOnEdges()
Indicates whether the fragment can be used on an
Edge as well as
a Vertex. |
Set<Var> |
dependencies() |
Set<Weighted<DirectedEdge<Node>>> |
directedEdges(Map<NodeId,Node> nodes,
Map<Node,Map<Node,Fragment>> edges)
Convert the fragment to a set of weighted edges for query planning
|
Var |
end() |
abstract double |
fragmentCost()
Get the cost for executing the fragment.
|
boolean |
hasFixedFragmentCost()
If a fragment has fixed cost, the traversal is done using index.
|
boolean |
isStartingFragment()
A starting fragment is a fragment that can start a traversal.
|
abstract String |
name()
The name of the fragment
|
abstract Var |
start() |
String |
toString() |
abstract VarProperty |
varProperty()
Get the corresponding property
|
Set<Var> |
vars()
Get all variables in the fragment including the start and end (if present)
|
@Nullable public abstract VarProperty varProperty
@Nullable public abstract VarProperty varProperty()
public abstract Var start()
@Nullable public Var end()
public Set<Var> dependencies()
public Set<Weighted<DirectedEdge<Node>>> directedEdges(Map<NodeId,Node> nodes, Map<Node,Map<Node,Fragment>> edges)
nodes - all nodes in the queryedges - a mapping from edge(child, parent) to its corresponding fragmentpublic final org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal<org.apache.tinkerpop.gremlin.structure.Vertex,? extends org.apache.tinkerpop.gremlin.structure.Element> applyTraversal(org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal<org.apache.tinkerpop.gremlin.structure.Vertex,? extends org.apache.tinkerpop.gremlin.structure.Element> traversal,
GraknTx graph,
Collection<Var> vars,
@Nullable
Var currentVar)
traversal - the traversal to extend with this Fragmentgraph - the graph to execute the traversal onpublic abstract String name()
public boolean isStartingFragment()
public abstract double fragmentCost()
public boolean hasFixedFragmentCost()
public boolean canOperateOnEdges()
Edge as well as
a Vertex.public final Set<Var> vars()
Copyright © 2017 Grakn Labs Ltd. All rights reserved.