

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# Amazon Neptune でのネイティブ Gremlin ステップサポート
<a name="gremlin-step-support"></a>

Amazon Neptune エンジンでは、[Gremlin クエリのチューニング](gremlin-traversal-tuning.md) で説明されているように、すべての Gremlin ステップに対する完全なネイティブサポートはありません。。現在のサポートは 4 つのカテゴリに分類されます。
+ [常にネイティブ Neptune エンジンオペレーションに変換できる Gremlin ステップ](#gremlin-steps-always)
+ [場合によってはネイティブ Neptune エンジンオペレーションに変換できる Gremlin ステップ](#gremlin-steps-sometimes) 
+ [ネイティブ Neptune エンジンオペレーションに変換されない Gremlin ステップ](#gremlin-steps-never) 
+ [Neptune ではまったくサポートされていない Gremlin ステップ](#neptune-gremlin-steps-unsupported) 

## 常にネイティブ Neptune エンジンオペレーションに変換できる Gremlin ステップ
<a name="gremlin-steps-always"></a>

多くの Gremlin ステップは、次の条件を満たす限り、ネイティブ Neptune エンジンオペレーションに変換できます。
+ クエリでは、変換できないステップの前には表示されません。
+ 親ステップがあれば、その親ステップは変換できます。
+ もしあれば、すべての子トラバーサルは変換できます。

以下の Gremlin ステップは、次の条件を満たす限り、ネイティブ Neptune エンジンオペレーションに変換できます。
+ [and( )](http://tinkerpop.apache.org/docs/current/reference/#and-step)
+ [as( )](http://tinkerpop.apache.org/docs/current/reference/#as-step)
+ [count( )](http://tinkerpop.apache.org/docs/current/reference/#count-step)
+ [E( )](http://tinkerpop.apache.org/docs/current/reference/#graph-step)
+ [emit( )](http://tinkerpop.apache.org/docs/current/reference/#emit-step)
+ [explain( )](http://tinkerpop.apache.org/docs/current/reference/#explain-step)
+ [group( )](http://tinkerpop.apache.org/docs/current/reference/#group-step)
+ [groupCount( )](http://tinkerpop.apache.org/docs/current/reference/#groupcount-step)
+ [identity( )](http://tinkerpop.apache.org/docs/current/reference/#identity-step)
+ [is( )](http://tinkerpop.apache.org/docs/current/reference/#is-step)
+ [key( )](http://tinkerpop.apache.org/docs/current/reference/#key-step)
+ [label( )](http://tinkerpop.apache.org/docs/current/reference/#label-step)
+ [limit( )](http://tinkerpop.apache.org/docs/current/reference/#limit-step)
+ [local( )](http://tinkerpop.apache.org/docs/current/reference/#local-step)
+ [loops( )](http://tinkerpop.apache.org/docs/current/reference/#loops-step)
+ [not( )](http://tinkerpop.apache.org/docs/current/reference/#not-step)
+ [or( )](http://tinkerpop.apache.org/docs/current/reference/#or-step)
+ [profile( )](http://tinkerpop.apache.org/docs/current/reference/#profile-step)
+ [properties( )](http://tinkerpop.apache.org/docs/current/reference/#properties-step)
+ [subgraph( )](http://tinkerpop.apache.org/docs/current/reference/#subgraph-step)
+ [until( )](http://tinkerpop.apache.org/docs/current/reference/#until-step)
+ [V( )](http://tinkerpop.apache.org/docs/current/reference/#graph-step)
+ [value( )](http://tinkerpop.apache.org/docs/current/reference/#value-step)
+ [valueMap( )](http://tinkerpop.apache.org/docs/current/reference/#valuemap-step)
+ [values( )](http://tinkerpop.apache.org/docs/current/reference/#values-step)

## 場合によってはネイティブ Neptune エンジンオペレーションに変換できる Gremlin ステップ
<a name="gremlin-steps-sometimes"></a>

一部の Gremlin ステップは、状況によってはネイティブ Neptune エンジンオペレーションに変換できますが、他の状況では変換できません。
+ [addE( )](http://tinkerpop.apache.org/docs/current/reference/#addedge-step)   –   トラバーサルをキーとして含む `property()` ステップが直後に続く場合を除き、`addE()` ステップは、通常ネイティブ Neptune エンジンオペレーションに変換できます。
+ [addV( )](http://tinkerpop.apache.org/docs/current/reference/#addvertex-step)   –   トラバーサルをキーとして含む `property()` ステップが直後に続く場合を除き、または複数のラベルが割り当てられる場合を除き、`addV()` ステップは、通常ネイティブ Neptune エンジンオペレーションに変換できます。
+ [aggregate( )](http://tinkerpop.apache.org/docs/current/reference/#store-step)   –   子トラバーサルまたはサブトラバーサルで使用されている場合を除き、または格納される値が頂点、エッジ、ID、ラベル、またはプロパティ値以外のものでない限り、通常 `aggregate()` ステップは、ネイティブ Neptune エンジンオペレーションに変換できます。

  次の例では、子トラバーサルで使用されているため、`aggregate()` は変換されません。

  ```
  g.V().has('code','ANC').as('a')
       .project('flights').by(select('a')
       .outE().aggregate('x'))
  ```

  この例では、格納される値が `min()` であるため、aggregate () は変換されません。

  ```
  g.V().has('code','ANC').outE().aggregate('x').by(values('dist').min())
  ```
+ [barrier( )](http://tinkerpop.apache.org/docs/current/reference/#barrier-step)   –   `barrier()`ステップは、その後のステップが変換されない限り、通常ネイティブ Neptune エンジンオペレーションに変換できます。
+ [cap( )](http://tinkerpop.apache.org/docs/current/reference/#cap-step)   –   `cap()` ステップが変換される唯一のケースは、`unfold()` ステップと組み合わせて頂点、エッジ、ID、またはプロパティ値の集約の展開バージョンを返す場合です。この例では、次に `.unfold()` が後続するので、`cap()` は変換されます。

  ```
  g.V().has('airport','country','IE').aggregate('airport').limit(2)
       .cap('airport').unfold()
  ```

  ただし、`.unfold()` を削除すると、`cap()` は変換されません。

  ```
  g.V().has('airport','country','IE').aggregate('airport').limit(2)
       .cap('airport')
  ```
+ [coalesce( )](http://tinkerpop.apache.org/docs/current/reference/#coalesce-step)   –   `coalesce()` ステップが変換される唯一のケースは、[TinkerPop レシピページ](http://tinkerpop.apache.org/docs/current/recipes/)で推奨される[アップサートパターン](http://tinkerpop.apache.org/docs/current/recipes/#element-existence)に続く場合です。その他の coalesce() パターンは使用できません。変換は、すべての子トラバーサルが変換できる場合に限られ、それらはすべて出力と同じタイプ (頂点、エッジ、ID、値、キー、またはラベル) を生成し、新しい要素にトラバースし、`repeat()` ステップは含みません。
+ [constant( )](http://tinkerpop.apache.org/docs/current/reference/#constant-step)   –   constant () ステップは現在、次のように、定数値を割り当てるためのトラバーサルの `sack().by()` 一部内で使われる場合にのみ変換されます。

  ```
  g.V().has('code','ANC').sack(assign).by(constant(10)).out().limit(2)
  ```
+ [cyclicPath( )](http://tinkerpop.apache.org/docs/current/reference/#cyclicpath-step)   –   `cyclicPath()` ステップは、それが `by()`、`from()`、`to()` モジュレータのいずれかと使われている場合を除き、通常ネイティブ Neptune エンジンオペレーションに変換できます。次のクエリでは、たとえば、`cyclicPath()` は変換されません。

  ```
  g.V().has('code','ANC').as('a').out().out().cyclicPath().by('code')
  g.V().has('code','ANC').as('a').out().out().cyclicPath().from('a')
  g.V().has('code','ANC').as('a').out().out().cyclicPath().to('a')
  ```
+ [drop( )](http://tinkerpop.apache.org/docs/current/reference/#drop-step)   –   `drop()` ステップは、それが `sideEffect(` または `optional()` ステップのいずれかで使われている場合を除き、通常、ネイティブ Neptune エンジンオペレーションに変換できます。
+ [fold( )](http://tinkerpop.apache.org/docs/current/reference/#fold-step)   –   fold () ステップを変換できる状況は2つしかありません。つまり、[TinkerPop レシピページ](http://tinkerpop.apache.org/docs/current/recipes/)で推奨されている[アップサートパターン](http://tinkerpop.apache.org/docs/current/recipes/#element-existence)で使われる場合と、次のような `group().by()` コンテキストでそれが使われる場合です。

  ```
  g.V().has('code','ANC').out().group().by().by(values('code', 'city').fold())
  ```
+  [has( )](http://tinkerpop.apache.org/docs/current/reference/#has-step) – 「has()」ステップは、通常、「T」が述語「P.eq」、「P.neq」、または「P.contains」を使用したクエリで指定されるネイティブ Neptune エンジンオペレーションに変換できます。「has()」のバリエーションを想定します。「hasId('id1234')」は「has(eq, T.id, 'id1234')」と同等であり、「P」のインスタンスはネイティブに変換されます。
+ [id( )](http://tinkerpop.apache.org/docs/current/reference/#id-step)   –   `id()` ステップは、プロパティで使用されない限り、次のように変換されます。

  ```
  g.V().has('code','ANC').properties('code').id()
  ```
+  [mergeE()](https://tinkerpop.apache.org/docs/current/reference/#mergeedge-step) – パラメータ (マージ条件、`onCreate` および `onMatch`) が定数 (`null`、定数 `Map` または `Map` の`select()` のいずれか) である場合は、`mergeE()` ステップをネイティブ Neptune エンジンオペレーションに変換できます。[エッジのアップサート](https://docs.aws.amazon.com//neptune/latest/userguide/gremlin-efficient-upserts.html#gremlin-upserts-edges)のすべての例を変換できます。
+  [mergeV()](https://tinkerpop.apache.org/docs/current/reference/#mergevertex-step) – パラメータ (マージ条件、`onCreate` および `onMatch`) が定数 (`null`、定数 `Map`、または `Map` の `select()`のいずれか) である場合は、mergeV() ステップをネイティブ Neptune エンジンオペレーションに変換できます。[頂点のアップサート](https://docs.aws.amazon.com//neptune/latest/userguide/gremlin-efficient-upserts.html#gremlin-upserts-vertices)のすべての例を変換できます。
+ [order( )](http://tinkerpop.apache.org/docs/current/reference/#order-step)   –   `order()` ステップは、その後のステップが変換されない限り、通常 ネイティブ Neptune エンジンオペレーションに変換できます。
  + `order()` ステップは、次のようにネストされた子トラバーサル内にあります。

    ```
    g.V().has('code','ANC').where(V().out().order().by(id))
    ```
  + たとえば、`order(local)` で、ローカル順序付けが使用されています。
  + カスタムコンパレータは、`by()` モジュレーションで順序付けするために使われます。一例として、この使用法`sack()`があります。

    ```
    g.withSack(0).
      V().has('code','ANC').
          repeat(outE().sack(sum).by('dist').inV()).times(2).limit(10).
          order().by(sack())
    ```
  + 同じ要素に複数の順序があります。
+ [project( )](http://tinkerpop.apache.org/docs/current/reference/#project-step)   –   `project()`に従う`by()`ステートメントの数が、次のように、指定されたラベルの数と一致しないのでなければ、`project()`ステップは、通常ネイティブ Neptune エンジンオペレーションに変換できます。

  ```
  g.V().has('code','ANC').project('x', 'y').by(id)
  ```
+ [range( )](http://tinkerpop.apache.org/docs/current/reference/#range-step)   –   `range()`ステップは、対象範囲の下端がゼロの場合にのみ変換されます (たとえば、`range(0,3)`)。
+ [repeat( )](http://tinkerpop.apache.org/docs/current/reference/#repeat-step)   –   次のように別の`repeat()`ステップノード内にネストされている場合を除き、`repeat()`ステップは、通常ネイティブ Neptune エンジンオペレーションに変換できます。

  ```
  g.V().has('code','ANC').repeat(out().repeat(out()).times(2)).times(2)
  ```
+ [sack( )](http://tinkerpop.apache.org/docs/current/reference/#sack-step)   –   `sack()`ステップは、次の場合を除き、通常ネイティブ Neptune エンジンオペレーションに変換できます。
  + 数値以外のサック演算子が使用されている場合。
  + `+`、`-`、`mult`、`div`、`min` および `max` 以外の数値サック演算子が使用されている場合。
  + 次のように、サック値に基づいてフィルタリングするために `where()` ステップの中で `sack()` が使われる場合。

    ```
    g.V().has('code','ANC').sack(assign).by(values('code')).where(sack().is('ANC'))
    ```
+ [sum( )](http://tinkerpop.apache.org/docs/current/reference/#sum-step)   –   `sum()` ステップは、通常、ネイティブ Neptune エンジンオペレーションに変換できますが、次のようにグローバル総和の計算に使用される場合は変換できません。

  ```
  g.V().has('code','ANC').outE('routes').values('dist').sum()
  ```
+ [union()](http://tinkerpop.apache.org/docs/current/reference/#union-step) — `union()` ステップは、ターミナルステップ以外のクエリの最後のステップである限り、ネイティブ Neptune エンジン操作に変換できます。
+ [unfold( )](http://tinkerpop.apache.org/docs/current/reference/#unfold-step)   –   `unfold()` ステップは、[TinkerPop レシピページ](http://tinkerpop.apache.org/docs/current/recipes/)で推奨される[アップサートパターン](http://tinkerpop.apache.org/docs/current/recipes/#element-existence)で使われる場合と、次のように `cap()` と併用される場合にのみ、ネイティブ Neptune エンジンオペレーションに変換できます。

  ```
  g.V().has('airport','country','IE').aggregate('airport').limit(2)
       .cap('airport').unfold()
  ```
+ [where( )](http://tinkerpop.apache.org/docs/current/reference/#where-step)   –   `where()` ステップは、次の場合を除き、通常 ネイティブ Neptune エンジンオペレーションに変換できます。
  + 次のように、by () モジュレーションを使用する場合。

    ```
    g.V().hasLabel('airport').as('a')
         .where(gt('a')).by('runways')
    ```
  + `eq`、`neq`、`within`、および `without` 以外の比較演算子が用いられる場合。
  + ユーザー指定の集計が使用される場合。

## ネイティブ Neptune エンジンオペレーションに変換されない Gremlin ステップ
<a name="gremlin-steps-never"></a>

次の Gremlin ステップは Neptune でサポートされていますが、ネイティブ Neptune エンジンオペレーションに変換されることはありません。代わりに、Gremlin サーバーによって実行されます。
+ [choose( )](http://tinkerpop.apache.org/docs/current/reference/#choose-step)
+ [coin( )](http://tinkerpop.apache.org/docs/current/reference/#coin-step)
+ [fail( )](http://tinkerpop.apache.org/docs/current/reference/#fail-step)
+ [inject( )](http://tinkerpop.apache.org/docs/current/reference/#inject-step)
+ [match( )](http://tinkerpop.apache.org/docs/current/reference/#match-step)
+ [math( )](http://tinkerpop.apache.org/docs/current/reference/#math-step)
+ [max( )](http://tinkerpop.apache.org/docs/current/reference/#max-step)
+ [mean( )](http://tinkerpop.apache.org/docs/current/reference/#mean-step)
+ [min( )](http://tinkerpop.apache.org/docs/current/reference/#min-step)
+ [option( )](http://tinkerpop.apache.org/docs/current/reference/#option-step)
+ [optional( )](http://tinkerpop.apache.org/docs/current/reference/#optional-step)
+ [path( )](http://tinkerpop.apache.org/docs/current/reference/#path-step)
+ [propertyMap( )](http://tinkerpop.apache.org/docs/current/reference/#propertymap-step)
+ [sample( )](http://tinkerpop.apache.org/docs/current/reference/#sample-step)
+ [skip( )](http://tinkerpop.apache.org/docs/current/reference/#skip-step)
+ [tail( )](http://tinkerpop.apache.org/docs/current/reference/#tail-step)
+ [timeLimit( )](http://tinkerpop.apache.org/docs/current/reference/#timelimit-step)
+ [tree( )](http://tinkerpop.apache.org/docs/current/reference/#tree-step)

## Neptune ではまったくサポートされていない Gremlin ステップ
<a name="neptune-gremlin-steps-unsupported"></a>

次の Gremlin ステップは、Neptune ではまったくサポートされていません。ほとんどの場合、これは `GraphComputer` が必要なためで、これは Neptune が現在サポートしていません。
+ [connectedComponent( )](http://tinkerpop.apache.org/docs/current/reference/#connectedcomponent-step)
+ [io( )](http://tinkerpop.apache.org/docs/current/reference/#io-step)
+ [shortestPath( )](http://tinkerpop.apache.org/docs/current/reference/#shortestpath-step)
+ [withComputer( )](http://tinkerpop.apache.org/docs/current/reference/#with-step)
+ [pageRank( )](http://tinkerpop.apache.org/docs/current/reference/#pagerank-step)
+ [peerPressure( )](http://tinkerpop.apache.org/docs/current/reference/#peerpressure-step)
+ [program( )](http://tinkerpop.apache.org/docs/current/reference/#program-step)

`io()` ステップは実際には部分的にサポートされていて、URL からの `read()` には使用できますが、`write()` には使用できません。