You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by Jonathan Kelsey <jk...@semblent.com> on 2015/08/07 14:01:42 UTC
Re: [TinkerPop3] Has step got a boost!
Hi Marko,
I have a query about hasKey. From the documentation I assume it will
exclude the traversals upon vertices or edges which do not have properties
with keys given as arguments to hasKey. Should it work like an OR for the
existence of property keys.
I've tried the following with Tinkerpop and Titan but it does not work as I
expected, can anyone tell me if I'm missing something?
In 3.0.0.M9-incubating:
gremlin> graph = TinkerGraph.open()
==>tinkergraph[vertices:0 edges:0]
gremlin> moon = graph.addVertex(T.label,"moon")
==>v[0]
gremlin> moon.property("a",1)
==>vp[a->1]
gremlin> moon.property("b",2)
==>vp[b->2]
gremlin> g = graph.traversal()
==>graphtraversalsource[tinkergraph[vertices:1 edges:0], standard]
gremlin> g.V().hasKey("a")
gremlin> g.V().hasKey("a","b")
No results from these.
In titan 0.9.0M2:
gremlin> moon = graph.addVertex(T.label,"moon")
==>v[4104]
gremlin> moon.property("a",1)
==>vp[a->1]
gremlin> moon.property("b",2)
==>vp[b->2]
gremlin> graph.tx().commit()
==>null
gremlin> g.V().hasKey("a","b")
12:31:51 WARN com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx
- Query requires iterating over all vertices [((~key = a OR ~key = b))].
For better performance, use indexes
null value for property key ~key
Display stack trace? [yN] y
java.lang.NullPointerException: null value for property key ~key
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:236)
at
com.thinkaurelius.titan.graphdb.relations.AbstractVertexProperty.<init>(AbstractVertexProperty.java:24)
.........
On Friday, February 6, 2015 at 5:25:46 PM UTC, Marko A. Rodriguez wrote:
>
> Hello,
>
> Bryn Cooke has been pushing for hasLabel(), etc. It has been added along
> with some other niceties -- hasValue(), hasKey(), hasId()...
>
> http://www.tinkerpop.com/docs/3.0.0-SNAPSHOT/#has-step
>
> Note that has(label,'person') still works, but we have updated all the
> docs to use hasLabel('person'). Moreover, realize that it is generalized
> such that:
>
> * hasLabel('person') <=> has(label,'person')
> * hasLabel('person','dog') <=> has(label,within,['person','dog'])
>
> Enjoy!,
> Marko.
>
> http://markorodriguez.com
>
>
--
-------------------------
The information in this message is private and confidential and may be
legally privileged. If you have received this message in error, please
notify us and remove it from your system. If you are not the intended
recipient, any disclosure, copying, distribution or any action taken or
omitted to be taken in reliance on it, is prohibited and may be unlawful.
For more information:
Twitter: @semblent1
LinkedIn: https://www.linkedin.com/company/semblent
The Internet: www.semblent.com
--
-------------------------
The information in this message is private and confidential and may be
legally privileged. If you have received this message in error, please
notify us and remove it from your system. If you are not the intended
recipient, any disclosure, copying, distribution or any action taken or
omitted to be taken in reliance on it, is prohibited and may be unlawful.
For more information:
Twitter: @semblent1
LinkedIn: https://www.linkedin.com/company/semblent
The Internet: www.semblent.com
Re: [TinkerPop3] Has step got a boost!
Posted by Matt Frantz <ma...@gmail.com>.
Perhaps you want to use the "has" step.
g.V().has('a')
g.V().or(has('a'), has('b'))