Trait cayley::path::Path
[-]
[+]
[src]
pub trait Path: Compile { fn Out(&mut self, predicates: PredicateSelector, tags: TagSelector) -> &mut Self { ... } fn OutP(&mut self, predicates: PredicateSelector) -> &mut Self { ... } fn OutT(&mut self, tags: TagSelector) -> &mut Self { ... } fn In(&mut self, predicates: PredicateSelector, tags: TagSelector) -> &mut Self { ... } fn InP(&mut self, predicates: PredicateSelector) -> &mut Self { ... } fn InT(&mut self, tags: TagSelector) -> &mut Self { ... } fn Both(&mut self, predicates: PredicateSelector, tags: TagSelector) -> &mut Self { ... } fn BothP(&mut self, predicates: PredicateSelector) -> &mut Self { ... } fn BothT(&mut self, tags: TagSelector) -> &mut Self { ... } fn Is(&mut self, nodes: NodeSelector) -> &mut Self { ... } fn Has(&mut self, predicates: PredicateSelector, nodes: NodeSelector) -> &mut Self { ... } fn HasP(&mut self, predicates: PredicateSelector) -> &mut Self { ... } fn HasN(&mut self, nodes: NodeSelector) -> &mut Self { ... } fn Tag(&mut self, tags: TagSelector) -> &mut Self { ... } fn As(&mut self, tags: TagSelector) -> &mut Self { ... } fn Back(&mut self, tags: TagSelector) -> &mut Self { ... } fn Save(&mut self, predicates: PredicateSelector, tags: TagSelector) -> &mut Self { ... } fn SaveP(&mut self, predicates: PredicateSelector) -> &mut Self { ... } fn SaveT(&mut self, tags: TagSelector) -> &mut Self { ... } fn Intersect(&mut self, query: &Query) -> &mut Self { ... } fn And(&mut self, query: &Query) -> &mut Self { ... } fn Union(&mut self, query: &Query) -> &mut Self { ... } fn Or(&mut self, query: &Query) -> &mut Self { ... } fn Follow(&mut self, reusable: &Reuse) -> &mut Self { ... } fn FollowR(&mut self, reusable: &Reuse) -> &mut Self { ... } }
The trait which covers all the methods from Gremlin API Path specification, but in a Rust way.
Some methods requiring two parameters like predicate and tags have a siblings to help you in the
cases when you need only one, like Out(<Predicate>, <Tag>)
has a sibling OutP(<Predicate>)
(alias for Out(<Predicate>, AnyTag)
and a sibling OutT(<Tag>)
(alias for Out(AnyPredicate, <Tag>)
.
The rules of conversion are like that:
For .Out
, .In
, .Both
, .Save
methods, using .Out
as an example:
.Out(AnyPredicate, AnyTag)
is equivalent to Gremlin.Out()
;.Out(Predicate("foo"), AnyTag)
is equivalent to Gremlin.Out("foo")
;.Out(Predicate("foo"), Tag("bar"))
is equivalent to Gremlin.Out("foo", "bar")
;.Out(Predicates(vec!("foo", "bar")), AnyTag)
is equivalent to Gremlin.Out(["foo", "bar"])
;.Out(AnyPredicate, Tag("foo"))
is equivalent to Gremlin.Out(null, "foo")
;.Out(AnyPredicate, Tags(vec!("foo", "bar")))
is equivalent to Gremlin.Out(null, ["foo", "bar"])
;.Out(Predicates(vec!("foo", "bar")), Tags(vec!("bar", "foo")))
is equivalent to Gremlin.Out(["foo", "bar"], ["bar", "foo"])
;
For .OutP
, .InP
, .BothP
, .SaveP
methods, using .OutP
as an example:
.OutP(AnyPredicate)
is equivalent to Gremlin.Out()
;.OutP(Predicate("foo"))
is equivalent to Gremlin.Out("foo")
;.OutP(Predicates(vec!("foo", "bar")))
is equivalent to Gremlin.Out(["foo", "bar"])
;
For .OutT
, .InT
, .BothT
, .SaveT
methods, using .OutT
as an example:
.OutT(AnyTag)
is equivalent to Gremlin.Out()
;.OutT(Tag("foo"))
is equivalent to Gremlin.Out(null, "foo")
;.OutT(Tags(vec!("foo", "bar")))
is equivalent to Gremlin.Out(null, ["foo", "bar"])
;
For .Has
, .HasP
, .HasN
methods it is the same as for three types above,
just replace TagSelector
with NodeSelector
For .Tag
, .As
, .Back
methods, using .As
as an example:
.As(AnyTag)
is equivalent to Gremlin.As()
(which has no sense, but allowed);.As(Tag("foo"))
is equivalent to Gremlin.As("foo")
;.As(Tags(vec!("foo", "bar")))
is equivalent to Gremlin.As("foo", "bar")
;
For .Is
method:
.Is(AnyNode)
is equivalent to Gremlin.Is()
(which has no sense, but allowed);.Is(Node("foo"))
is equivalent to Gremlin.Is("foo")
;.Is(Nodes(vec!("foo", "bar")))
is equivalent to Gremlin.Is("foo", "bar")
;
For .Intersect
, .And
, .Union
, .Or
methods, using .Intersect
as example:
let some_v = Vertex(AnyNode).OutT(Tag("follows")).All();
graph.find(Vertex::start(Node("C")).Intersect(&some_v).All());
is equivalent to Gremling.V("C").Intersect(g.V.Out("follows").All()).All();
;
For Follow
and FollowR
methods:
let m = Morphism::start("foo")...;
graph.save(m);
graph.find(Vertex::start(AnyNode).Follow(&m).All());
is equivalent to Gremlinvar foo = g.M()...; g.V().Follow(foo).All();
;
Provided Methods
fn Out(&mut self, predicates: PredicateSelector, tags: TagSelector) -> &mut Self
.Out
Path method. Follow forwards the quads with given predicates.
fn OutP(&mut self, predicates: PredicateSelector) -> &mut Self
OutP
, an alias for Out(<Predicate>, AnyTag)
fn OutT(&mut self, tags: TagSelector) -> &mut Self
OutT
, an alias for Out(AnyPredicate, <Tag>)
fn In(&mut self, predicates: PredicateSelector, tags: TagSelector) -> &mut Self
.In
Path method. Follow backwards the quads with given predicates.
fn InP(&mut self, predicates: PredicateSelector) -> &mut Self
InP
, an alias for In(<Predicate>, AnyTag)
fn InT(&mut self, tags: TagSelector) -> &mut Self
InT
, an alias for In(AnyPredicate, <Tag>)
fn Both(&mut self, predicates: PredicateSelector, tags: TagSelector) -> &mut Self
.Both
Path method.
fn BothP(&mut self, predicates: PredicateSelector) -> &mut Self
BothP
, an alias for Both(<Predicate>, AnyTag)
fn BothT(&mut self, tags: TagSelector) -> &mut Self
BothT
, an alias for Both(AnyPredicate, <Tag>)
fn Is(&mut self, nodes: NodeSelector) -> &mut Self
.Is
Path method. Filter all paths which are on the given node(-s).
fn Has(&mut self, predicates: PredicateSelector, nodes: NodeSelector) -> &mut Self
.Has
Path method. Filter all paths which are on the subject, but do not follow the path.
fn HasP(&mut self, predicates: PredicateSelector) -> &mut Self
HasP
, an alias for Has(<Predicate>, AnyNode)
fn HasN(&mut self, nodes: NodeSelector) -> &mut Self
HasN
, an alias for Has(AnyPredicate, <Node>)
fn Tag(&mut self, tags: TagSelector) -> &mut Self
.Tag
, an alias for .As
fn As(&mut self, tags: TagSelector) -> &mut Self
.As
Path method. Mark items with a tag.
fn Back(&mut self, tags: TagSelector) -> &mut Self
.Back
Path method. Follow backwards the tagged quads.
fn Save(&mut self, predicates: PredicateSelector, tags: TagSelector) -> &mut Self
.Save
Path method. Save all quads with predicate into tag, without traversal.
fn SaveP(&mut self, predicates: PredicateSelector) -> &mut Self
SaveP
, an alias for Save(<Predicate>, AnyTag)
fn SaveT(&mut self, tags: TagSelector) -> &mut Self
SaveT
, an alias for Save(AnyPredicate, <Tag>)
fn Intersect(&mut self, query: &Query) -> &mut Self
.Intersect
, an alias for .And
fn And(&mut self, query: &Query) -> &mut Self
.And
Path method. Intersect the results from one query with another.
fn Union(&mut self, query: &Query) -> &mut Self
.Union
, an alias for .Or
fn Or(&mut self, query: &Query) -> &mut Self
.Or
Path method. Join the results from one query with another.
fn Follow(&mut self, reusable: &Reuse) -> &mut Self
.Follow
Path method. Applies the path chain on the Morphism
object to the current path.
fn FollowR(&mut self, reusable: &Reuse) -> &mut Self
.FollowR
Path method. Applies the path chain on the Morphism
object to the current path.