Marko A. Rodriguez created TINKERPOP-1237:
---------------------------------------------
Summary: ProjectMap: For the Love of Die Faterland
Key: TINKERPOP-1237
URL: https://issues.apache.org/jira/browse/TINKERPOP-1237
Project: TinkerPop
Issue Type: Improvement
Components: process
Affects Versions: 3.1.1-incubating
Reporter: Marko A. Rodriguez
Assignee: Daniel Kuppitz
{code}
gremlin> g.V(1).out("knows").
project("a","b").by("name").by(outE().count())
==>{a:josh, b:2}
==>{a:vadas, b:0}
{code}
Its like {{select()}} by inverted -- thus, {{project()}}! Moreover, its a
generalization of {{valueMap()}} and {{propertyMap}}.
{code}
public class ProjectMapStep<S,E> extends MapStep<S,Map<String,E>> {
TraversalRing<S,E> ...
String... keys;
public Map<String,E> map(final Traverser.Admin<S> traverser) {
final Map<String,E> result = new HashMap<>(keys.length);
for(final String key : keys) {
result.put(key, TraversalUtil.apply(traverser, traversalRing.next());
}
traversalRing.reset();
return result;
}
}
{code}
cc/ Mein Obergruppenführer [~mbroecheler].
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)