目录
(三)ProviderOptimizationStrategy
一、TraversalStrategy类型
上一篇提到了StandardJanusGraph在实例话之前就加入了六个strategies,但是他们是同一种。下面我们看看五类strategy分别是什么。
(一)DecorationStrategy
Implemented by strategies that adds "application logic" to the traversal
为traversal加入“应用策略”,具体什么事应用策略,可以看到它的实现类中是一些关于事务、链接、ID生成等策略。
(二)OptimizationStrategy
Implemented by strategies that rewrite the traversal to be more efficient, but with the same semantics (e.g. CountStrategy). During a re-write ONLY TinkerPop steps should be used. For strategies that utilize provider specific steps, use TraversalStrategy.ProviderOptimizationStrategy.
只有属于TinkerPop的step类型可以在这里被修改,但是只限于在保证语义(姑且认为是gremlin语句)的情况下提高效率。对于特定步骤(自定义step),使用下面的的 TraversalStrategy.ProviderOptimizationStrategy。
(三)ProviderOptimizationStrategy
Implemented by strategies that rewrite the traversal to be more efficient, but with the same semantics. This is for graph system/language/driver providers that want to rewrite a traversal using provider specific steps.
同样是保证语义的情况下,让不同的图系统,语言,驱动拥有自定义step的能力。在上一篇中加入的六个strategy就是JanusGraph用这个接口对TingkerPop传过来的traversal做修改。
(四)FinalizationStrategy
Implemented by strategies that do final behaviors that require a fully compiled traversal to work (e.g. ProfileStrategy).
为traversal增加一个最终行为