Gremlin step兼容情况

使用限制

iGraph在SDK接口的使用规则上与TinkerPop的差异如下:

  • 目前仅支持API方式构建query,不支持明文

  • 构建traversal时需要以内置方法g开头,并指明图名,形如g("graph_name"),等同于tinkerPop中的Graph.traversal()

  • 不支持游走中的插入和删除

  • 扩展结果集数据类型,详见查询结果获取

对TinkerPop Gremlin的Step接口支持情况

  • 下表中 代表支持, 代表不支持。

  • iGraph Gremlin语法及算子介绍

step

开源

iGraph

GraphTraversalSource

g("graph_name")

getStrategies()

getGraph()

getBytecode()

with(String key, Object value)等2个接口

withComputer()

withSideEffect(String key, A initialValue)等4个接口

clone()

withStrategies(TraversalStrategy... traversalStrategies)等

withStrategies(final StrategyBase... strategies)

withoutStrategies(Class<? extends TraversalStrategy>... traversalStrategyClasses)

withComputer(final Computer computer)等3个接口

withSideEffect(final String key, final A initialValue)等4个接口

withSack(final A initialValue)等8个接口

withSack(final Supplier supplier, final Splitter sackSpliter, final Operator sackMerger)

withBulk( boolean useBulk)

withPath()

addV(String label)

addV(final Traversal<?, String> vertexLabelTraversal)

addV()

addE(final String label)

addE(final Traversal<?, String> edgeLabelTraversal)

inject(T... starts)

V(Object... vertexIds)

V(final String... keys)

V(@NonNull List<KeyList> keyLists)

V(@NonNull KeyList keyList)

E(Object... edgesIds)

E(final String... keys)

E(@NonNull List<KeyList> keyLists)

E(@NonNull KeyList keyList)

noSupportedStep(final String stepName, final Object... parameters)

Traversal

asAdmin()

tryNext()

next(final int amount)

List<E> toList()

toSet()

toBulkSet()

toStream()

promise(final Function<Traversal<S, E>, T> traversalFunction)

fill(final C collection)

none()

Traversal<S, TraversalMetrics> profile()

TraversalExplanation explain()

forEachRemaining(final Class<E2> endType, final Consumer<E2> consumer)

close()

Map Step

map(final Function<Traverser<E>, E2> function)

map(final Traversal<?, E2> mapTraversal)

flatMap(final Function<Traverser<E>, Iterator<E2>> function)

flatMap(final Traversal<?, E2> flatMapTraversal)

id()

label()

identity()

constant(final E2 e)

V(final Object... vertexIdsOrElements)

to(final Direction direction, final String... edgeLabels)

out(final String... edgeLabels)

in(final String... edgeLabels)

both(final String... edgeLabels)

toE(final Direction direction, final String... edgeLabels)

outE(final String... edgeLabels)

inE(final String... edgeLabels)

bothE(final String... edgeLabels)

toV(final Direction direction)

inV()

outV()

bothV()

otherV()

order()

order(final Scope scope)

properties(final . String... propertyKeys)

values(final String... propertyKeys)

propertyMap(final String... propertyKeys)

elementMap(final String... propertyKeys)

valueMap(final String... propertyKeys)

valueMap(final boolean includeTokens, final String... propertyKeys)

key()

value()

path()

match(final Traversal<?, ?>... matchTraversals)

sack()

loops()

loops(final String loopName)

project(final String projectKey, final String... otherProjectKeys)

select(final Pop pop, final String selectKey1, final String selectKey2, String... otherSelectKeys)

select(final String selectKey1, final String selectKey2, String... otherSelectKeys)

select(final Pop pop, final String selectKey)

select(final String selectKey)

select(final Pop pop, final Traversal<S, E2> keyTraversal)

select(final Traversal<S, E2> keyTraversal)

select(final Column column)

unfold()

fold()

fold(final E2 seed, final BiFunction<E2, E, E2> foldFunction)

count()

count(final Scope scope)

sum()

sum(final Scope scope)

max()

max(final Scope scope)

min();

min(final Scope scope)

mean();

mean(final Scope scope)

group()

groupCount()

tree()

addV(final String vertexLabel)等3个接口

addE(final String edgeLabel)等2个接口

to(final String toStepLabel)

from(final String fromStepLabel)

to(final Traversal<?, Vertex> toVertex)

from(final Traversal<?, Vertex> fromVertex);

to(final Vertex toVertex)

from(final Vertex fromVertex);

math(final String expression)

Filter Step

filter(final Predicate<Traverser<E>> predicate)

filter(final Traversal<?, ?> filterTraversal)

or(final Traversal<?, ?>... orTraversals)

and(final Traversal<?, ?>... andTraversals)

inject(final E... injections)

dedup(final Scope scope, final String... dedupLabels)

dedup(final String... dedupLabels)

where(final String startKey, final P<String> predicate

where(final P<String> predicate)

where(final Traversal<?, ?> whereTraversal)

has(final String propertyKey, final P<?> predicate)

has(final T accessor, final P<?> predicate)

has(final String propertyKey, final Object value)

has(final T accessor, final Object value)

has(final String label, final String propertyKey, final P<?> predicate)

has(final String label, final String propertyKey, final Object value)

has(final T accessor, final Traversal<?, ?> propertyTraversal)

has(final String propertyKey, final Traversal<?, ?> propertyTraversal)

has(final String propertyKey)

hasNot(final String propertyKey)

hasLabel(final String label, final String... otherLabels)

hasLabel(final P<String> predicate)

hasId(final Object id, final Object... otherIds)

hasId(final P predicate)

hasKey(final String label, final String... otherLabels)

hasKey(final P<String> predicate)

hasValue(final Object value, final Object... otherValues)

hasValue(final P<Object> predicate)

is(final P<E> predicate)

is(final Object value)

not(final Traversal<?, ?> notTraversal)

coin(final double probability)

range(final long low, final long high)

range(final Scope scope, final long low, final long high)

limit(final long limit)

limit(final Scope scope, final long limit)

tail()

tail(final long limit)

tail(final Scope scope)

tail(final Scope scope, final long limit)

skip(final long skip)

skip(final Scope scope, final long skip)

timeLimit(final long timeLimit)

simplePath()

cyclicPath()

sample(final int amountToSample)

sample(final Scope scope, final int amountToSample)

sample(final Sample sampleOption, final int amountToSample)

sample(final Sample sampleOption, final Sample sampleOption2, final int amountToSample)

drop()

distinct()

Side-Effect Steps

alias(String sideEffectKey)

sideEffect(final Consumer<Traverser<E>> consumer)

sideEffect(final Traversal<?, ?> sideEffectTraversal)

cap(final String sideEffectKey, final String... sideEffectKeys)

subgraph(final String sideEffectKey)

aggregate(final String sideEffectKey)

aggregate(final Scope scope, final String sideEffectKey)

group(final String sideEffectKey)

groupCount(final String sideEffectKey)

tree(final String sideEffectKey)

sack(final BiFunction<V, U, V> sackOperator)

store(final String sideEffectKey)

profile(final String sideEffectKey)

profile()

property(final VertexProperty.Cardinality cardinality, final Object key, final Object value, final Object... keyValues)

property(final Object key, final Object value, final Object... keyValues)

branch(final Traversal<?, M> branchTraversal);

branch(final Function<Traverser<E>, M> function)

choose(final Traversal<?, M> choiceTraversal)

choose(final Traversal<?, ?> traversalPredicate, final Traversal<?, E2> trueChoice, final Traversal<?, E2> falseChoice);

choose(final Traversal<?, ?> traversalPredicate, final Traversal<?, E2> trueChoice)

choose(final Function<E, M> choiceFunction)

choose(final Predicate<E> choosePredicate, final Traversal<?, E2> trueChoice, final Traversal<?, E2> falseChoice)

choose(final Predicate<E> choosePredicate, final Traversal<?, E2> trueChoice)

optional(final Traversal<?, E2> optionalTraversal)

union(final Traversal<?, E2>... unionTraversals)

coalesce(final Traversal<?, E2>... coalesceTraversals)

repeat(final Traversal<?, E> repeatTraversal)

repeat(final String loopName, final Traversal<?, E> repeatTraversal)

emit(final Traversal<?, ?> emitTraversal)

emit(final Predicate<Traverser<E>> emitPredicate)

emit()

until(final Traversal<?, ?> untilTraversal)

until(final Predicate<Traverser<E>> untilPredicate)

times(final int maxLoops)

local(final Traversal<?, E2> localTraversal)

Vertex Program Steps

pageRank()

pageRank(final double alpha)

peerPressure()

connectedComponent()

shortestPath()

program(final VertexProgram<?> vertexProgram)

Utility Steps

as(final String stepLabel, final String... stepLabels)

barrier()

barrier(final int maxBarrierSize)

index()

barrier(final Consumer<TraverserSet<Object>> barrierConsumer)

barrier(final Barrier barrierOption)

with(final String key)

with(final String key, final Object value)

by()

by(final Traversal<?, ?> traversal)

by(final T token)

by(final String key)

by(final Function<V, Object> function)

by(final Traversal<?, ?> traversal, final Comparator<V> comparator)

by(final Comparator<E> comparator)

by(final Order order)

by(final String key, final Comparator<V> comparator)

by(final Function<U, Object> function, final Comparator comparator)

by(final String table, final String field)

by(final Traversal traversal, final Order order)

by(final T accessor, final Order order)

by(final String key, final Order order)

by(final Column column, final Order order)

option(final M pickToken, final Traversal<?, E2> traversalOption)

option(final Traversal<?, E2> traversalOption)

option(final int pick, final Traversal optionTraversal)

option(final String pick, final Traversal optionTraversal)

option(final Pick pick, final Traversal optionTraversal)

bulk()

withBulk()

withSack()

needFold()

fields(final String... fieldNames)

IO Steps

read()

write()

iterate()