doesn't sound like there have been any objections or reasons why hasKey()/values() shouldn't work this way....maybe just create an issue at this point.
On Sat, Jul 15, 2017 at 10:09 AM, Robert Dale <[email protected]> wrote: > What makes it very compelling is the fact that Element has `keys()` and > `values()` methods. It would be intuitive for `hasKey()` and `hasValue()` > to work on things that have key(s) and value(s) - Element, Property, and > even Map. > > Robert Dale > > On Fri, Jul 14, 2017 at 6:28 AM, Stephen Mallette <[email protected]> > wrote: > > > hasKey() and hasValue() are for vertex properties only . so technically - > > bad javadoc. > > > > on the other hand I can't say I like this - it's bitten me enough times > now > > that i know how to use it, but is there any reason why hasKey() shouldn't > > just work with any Element? > > > > On Thu, Jul 13, 2017 at 5:01 PM, Robert Dale <[email protected]> wrote: > > > > > hasKey/hasValue javadocs state: > > > > > > Filters vertices, edges and vertex properties based on their key. > > > > > > Am I misinterpreting, misusing, or misinformed? > > > > > > gremlin> graph = TinkerFactory.createModern() > > > ==>tinkergraph[vertices:6 edges:6] > > > gremlin> g = graph.traversal( > > > traversal( traversal() > > > gremlin> g = graph.traversal() > > > ==>graphtraversalsource[tinkergraph[vertices:6 edges:6], standard] > > > > > > // Does NOT appear to filter vertices > > > gremlin> g.V().valueMap() > > > ==>[name:[marko],age:[29]] > > > ==>[name:[vadas],age:[27]] > > > ==>[name:[lop],lang:[java]] > > > ==>[name:[josh],age:[32]] > > > ==>[name:[ripple],lang:[java]] > > > ==>[name:[peter],age:[35]] > > > gremlin> g.V().hasKey('name') > > > gremlin> g.V().hasValue('marko') > > > > > > // Does NOT appear to filter edges > > > gremlin> g.E().valueMap() > > > ==>[weight:0.5] > > > ==>[weight:1.0] > > > ==>[weight:0.4] > > > ==>[weight:1.0] > > > ==>[weight:0.4] > > > ==>[weight:0.2] > > > gremlin> g.E().hasKey('weight') > > > gremlin> g.E().hasValue(1.0) > > > > > > // Does NOT appear to filter edge properties (although was not claimed) > > > gremlin> g.E().properties().hasKey('weight') > > > org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerProperty > cannot > > > be > > > cast to org.apache.tinkerpop.gremlin.structure.Element > > > Type ':help' or ':h' for help. > > > Display stack trace? [yN] > > > gremlin> g.E().properties().hasValue(1.0) > > > org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerProperty > cannot > > > be > > > cast to org.apache.tinkerpop.gremlin.structure.Element > > > Type ':help' or ':h' for help. > > > Display stack trace? [yN] > > > > > > // Does filter Vertex Properties! > > > gremlin> g.V().properties().hasKey('name') > > > ==>vp[name->marko] > > > ==>vp[name->vadas] > > > ==>vp[name->lop] > > > ==>vp[name->josh] > > > ==>vp[name->ripple] > > > ==>vp[name->peter] > > > gremlin> g.V().properties().hasValue('marko') > > > ==>vp[name->marko] > > > > > > > > > > > > Robert Dale > > > > > >
