

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

# Amazon Neptune의 네이티브 Gremlin 단계 지원
<a name="gremlin-step-support"></a>

[Gremlin 쿼리 조정](gremlin-traversal-tuning.md)에서 설명한 것처럼 Amazon Neptune 엔진은 현재 모든 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 또는 속성값 집합을 펼친 버전을 반환하는 경우에만 단계가 변환됩니다. 이 예제에서 `cap()`는 `.unfold()` 다음에 오기 때문에 변환됩니다.

  ```
  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)   –   단계가 `by()`, `from()` 또는 `to()` 복조기와 함께 사용되지 않는 한, 일반적으로 `cyclicPath()` 단계는 네이티브 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)   –   `sideEffect(`) 또는 `optional()` 단계 내에서 단계를 사용하지 않는 한, `drop()` 단계는 일반적으로 네이티브 Neptune 엔진 작업으로 변환할 수 있습니다.
+ [fold( )](http://tinkerpop.apache.org/docs/current/reference/#fold-step)   –   fold() 단계를 변환할 수 있는 상황은 두 가지뿐입니다. 즉, [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()`의 변형들도 `P` 인스턴스가 네이티브로 변환됨을 암시하므로, `hasId(‘id1234’)`와 같이 `has(eq, T.id, ‘id1234’)`와 동등한 경우도 네이티브로 변환됩니다.
+ [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) - `mergeE()` 단계는 파라미터(병합 조건, `onCreate` 및 `onMatch`)가 상수(`null`, 상수 `Map` 또는 `select()`의 `Map`)인 경우 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()`)인 경우 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)   –   범위의 하한이 0인 경우(예: `range(0,3)`)에만 `range()` 단계가 변환됩니다.
+ [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 엔진 작업으로 변환할 수 있습니다.
  + 숫자가 아닌 sack 연산자를 사용하는 경우.
  + `+`, `-`, `mult`, `div`, `min`, `max` 이외의 숫자형 sack 연산자를 사용하는 경우.
  + 다음과 같이 sack 값을 기준으로 필터링하는 `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)   –   [TinkerPop 레시피 페이지](http://tinkerpop.apache.org/docs/current/recipes/)에서 권장하는 [업서트 패턴](http://tinkerpop.apache.org/docs/current/recipes/#element-existence)으로 사용하고 다음과 같이 `cap()`을 함께 사용하는 경우에만 `unfold()` 단계를 네이티브 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)
+ [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()`에는 사용할 수 없다는 점을 고려하면 부분적으로 지원된다고 할 수 있습니다.