

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 匯出 `params` 頂層 JSON 物件中的參數欄位
<a name="export-params-fields"></a>

Neptune 匯出 `params` JSON 物件可讓您控制匯出，包括所匯出資料的類型和格式。

## 所匯出參數 `params` 物件中可能欄位的清單
<a name="export-params-fields-list"></a>

下面列出了可以出現在 `params` 物件中的所有可能頂層欄位。只有這些欄位的子集才會出現在任何一個物件中。

### 所有匯出類型通用的欄位清單
<a name="export-params-common-fields-list"></a>
+ [`cloneCluster`](#export-params-cloneCluster)
+ [`cloneClusterInstanceType`](#export-params-cloneClusterInstanceType)
+ [`cloneClusterReplicaCount`](#export-params-cloneClusterReplicaCount)
+ [`cloneClusterEnableAuditLogs`](#export-params-cloneClusterEnableAuditLogs)
+ [`clusterId`](#export-params-clusterId)
+ [`endpoint`](#export-params-endpoint)
+ [`endpoints`](#export-params-endpoints)
+ [`profile`](#export-params-profile)
+ [`useIamAuth`](#export-params-useIamAuth)
+ [`includeLastEventId`](#export-params-includeLastEventId)

### 屬性圖匯出的欄位清單
<a name="export-params-property-graph-fields-list"></a>
+ [`concurrency`](#export-params-concurrency)
+ [`edgeLabels`](#export-params-edgeLabels)
+ [`filter`](#export-params-filter)
+ [`filterConfigFile`](#export-params-filterConfigFile)
+ [`gremlinFilter`](#export-params-gremlinFilter)
+ [`gremlinNodeFilter`](#export-params-gremlinFilter)
+ [`gremlinEdgeFilter`](#export-params-gremlinFilter)
+ [`format`](#export-params-format-pg)
+ [`nodeLabels`](#export-params-nodeLabels)
+ [`scope`](#export-params-scope)

### RDF 匯出的欄位清單
<a name="export-params-RDF-fields-list"></a>
+ [`format`](#export-params-format-rdf)
+ [`rdfExportScope`](#export-params-rdfExportScope)
+ [`sparql`](#export-params-sparql)
+ [`namedGraph`](#namedgraph-params-sparql)

## 所有匯出類型通用的欄位
<a name="export-params-common-fields"></a>

### `params` 中的 `cloneCluster` 欄位
<a name="export-params-cloneCluster"></a>

*(選用)*。預設：`false`。

如果 `cloneCluster` 參數設為 `true`，則匯出程序會使用資料庫叢集的快速複製：

```
  "cloneCluster" : true
```

依預設，匯出程序會從您使用 `endpoint`、`endpoints` 或 `clusterId` 參數指定的資料庫叢集中匯出資料。不過，如果您的資料庫叢集在匯出進行時使用中，且資料正在變更，則匯出程序無法保證要匯出之資料的一致性。

若要確保匯出的資料一致，請改用 `cloneCluster` 參數，從資料庫叢集的靜態複製進行匯出。

複製的資料庫叢集是在與來源資料庫叢集相同的 VPC 中建立的，並繼承來源的安全群組、子網路群組和 IAM 資料庫身分驗證設定。匯出完成時，Neptune 會刪除複製的資料庫叢集。

根據預設，複製的資料庫叢集由與來源資料庫叢集中主要執行個體具有相同執行個體類型的單一執行個體組成。您可以變更用於所複製資料庫叢集的執行個體類型，方法為使用 `cloneClusterInstanceType` 指定不同的執行個體類型。

**注意**  
如果您沒有使用 `cloneCluster` 選項，而且要直接從主資料庫叢集匯出，則可能需要增加要從中匯出資料之執行個體上的逾時。對於大型資料集，逾時應設定為數小時。

### `params` 中的 `cloneClusterInstanceType` 欄位
<a name="export-params-cloneClusterInstanceType"></a>

*(選用)*。

如果 `cloneCluster` 參數存在且設為 `true`，您可以使用 `cloneClusterInstanceType` 參數，指定用於所複製資料庫叢集的執行個體類型：

根據預設，複製的資料庫叢集由與來源資料庫叢集中主要執行個體具有相同執行個體類型的單一執行個體組成。

```
  "cloneClusterInstanceType" : "(for example, r5.12xlarge)"
```

### `params` 中的 `cloneClusterReplicaCount` 欄位
<a name="export-params-cloneClusterReplicaCount"></a>

*(選用)*。

如果 `cloneCluster` 參數存在且設為 `true`，則您可以使用 `cloneClusterReplicaCount` 參數，指定所複製資料庫叢集中建立的僅供讀取複本數目：

```
  "cloneClusterReplicaCount" : (for example, 3)
```

根據預設，複製的資料庫叢集由單一主要執行個體組成。`cloneClusterReplicaCount` 參數可讓您指定應該建立多少個僅供讀取複本執行個體。

### `params` 中的 `cloneClusterEnableAuditLogs` 欄位
<a name="export-params-cloneClusterEnableAuditLogs"></a>

*（選用）*。預設：false。

如果 `cloneCluster` 參數存在且設為 true，您可以使用 `cloneClusterEnableAuditLogs` 參數來啟用或停用複製叢集中的稽核日誌。

預設會停用稽核記錄。

```
"cloneClusterEnableAuditLogs" : true
```

### `params` 中的 `clusterId` 欄位
<a name="export-params-clusterId"></a>

*(選用)*。

`clusterId` 參數會指定要使用之資料庫叢集的 ID：

```
  "clusterId" : "(the ID of your DB cluster)"
```

如果您使用 `clusterId` 參數，則匯出程序會使用該資料庫叢集中的所有可用執行個體來擷取資料。

**注意**  
`endpoint`、`endpoints` 和 `clusterId` 參數互斥。僅使用其中一個。

### `params` 中的 `endpoint` 欄位
<a name="export-params-endpoint"></a>

*(選用)*。

使用 `endpoint` 來指定資料庫叢集中 Neptune 執行個體的端點，匯出程序可以查詢該資料庫叢集來擷取資料 (請參閱 [端點連線](feature-overview-endpoints.md))。這僅是 DNS 名稱，不包括通訊協定或連接埠：

```
  "endpoint" : "(a DNS endpoint of your DB cluster)"
```

使用叢集或執行個體端點，但不使用主讀取器端點。

**注意**  
`endpoint`、`endpoints` 和 `clusterId` 參數互斥。僅使用其中一個。

### `params` 中的 `endpoints` 欄位
<a name="export-params-endpoints"></a>

*(選用)*。

使用 `endpoints` 來指定資料庫叢集中端點的 JSON 陣列，匯出程序可以查詢該資料庫叢集來擷取資料 (請參閱 [端點連線](feature-overview-endpoints.md))。這些僅是 DNS 名稱，不包括通訊協定或連接埠：

```
  "endpoints": [
    "(one endpoint in your DB cluster)",
    "(another endpoint in your DB cluster)",
    "(a third endpoint in your DB cluster)"
    ]
```

如果您的叢集中有多個執行個體 (主要和一個或多個僅供讀取複本)，則您可以使用 `endpoints` 參數，將查詢分發到這些端點的清單，以改善匯出效能。

**注意**  
`endpoint`、`endpoints` 和 `clusterId` 參數互斥。僅使用其中一個。

### `params` 中的 `profile` 欄位
<a name="export-params-profile"></a>

*(必須匯出 Neptune ML 的訓練資料，除非 `neptune_ml` 欄位存在於 `additionalParams` 欄位)*。

`profile` 參數為特定工作負載提供幾組預先設定的參數。目前，匯出程序僅支援 `neptune_ml` 設定檔

如果您要匯出 Neptune ML 的訓練資料，請將下列參數新增至 `params` 物件：

```
  "profile" : "neptune_ml"
```

### `params` 中的 `useIamAuth` 欄位
<a name="export-params-useIamAuth"></a>

*(選用)*。預設：`false`。

如果要從中匯出資料的資料庫[已啟用 IAM 身分驗證](iam-auth-enable.md)，則您必須將 `useIamAuth` 參數設為 `true`：

```
  "useIamAuth" : true
```

### `params` 中的 `includeLastEventId` 欄位
<a name="export-params-includeLastEventId"></a>

如果您將 `includeLastEventId` 設為 true，且您要從中匯出資料的資料庫已啟用 [Neptune 串流](streams-using.md)，則匯出程序會將 `lastEventId.json` 檔案寫入至您指定的匯出位置。此檔案包含串流中最後一個事件的 `commitNum` 和 `opNum`。

```
  "includeLastEventId" : true
```

由匯出程序建立的複製資料庫會繼承其父項的串流設定。如果父項已啟用串流，複製也會同樣啟用串流。複製上的串流內容將會反映建立複製時的父項內容 (包括相同的事件 ID)。

## 屬性圖匯出的欄位
<a name="export-params-property-graph-fields"></a>

### `params` 中的 `concurrency` 欄位
<a name="export-params-concurrency"></a>

*(選用)*。預設：`4`。

`concurrency` 參數會指定匯出程序應該使用的平行查詢數目：

```
  "concurrency" : (for example, 24)
```

一個好的指導方針是將並行層級設定為所有執行個體上 vCPU 數目的兩倍，而您要從這些執行個體中匯出資料。例如，一個 r5.xlarge 執行個體具有 4 個 vCPU。如果您要從 3 個 r5.xlarge 執行個體組成的叢集匯出，則可以將並行層級設為 24 (= 3 x 2 x 4)。

如果您使用的是 Neptune-Export 服務，則並行層級會受到 [JobSize](export-parameters.md#export-parameters-jobSize) 設定的限制。例如，小型工作支援並行層級 8。如果您嘗試使用 `concurrency` 參數，為小型工作指定並行層級 24，則有效層級保持在 8。

如果您從複製的叢集匯出，匯出程序會根據複製的執行個體大小和工作大小來計算適當的並行層次。

### `params` 中的 `edgeLabels` 欄位
<a name="export-params-edgeLabels"></a>

*(選用)*。

使用 `edgeLabels` 僅匯出這些具有所指定標籤的邊緣：

```
  "edgeLabels" : ["(a label)", "(another label"]
```

JSON 陣列中的每個標籤都須是單一的簡單標籤。

`scope` 參數的優先順序高於 `edgeLabels` 參數，因此如果 `scope` 值不包括邊緣，則 `edgeLabels` 參數沒有任何作用。

### `params` 中的 `filter` 欄位
<a name="export-params-filter"></a>

*(選用)*。

使用 `filter` 指定僅應該匯出具有特定標籤的節點和/或邊緣，並篩選針對每個節點或邊緣匯出的屬性。

`filter` 物件的一般結構 (無論是內嵌還是篩選器組態檔案) 如下所示：

```
  "filter" : {
    "nodes": [ (array of node label and properties objects) ],
    "edges": [ (array of edge definition an properties objects) ]
  }
```
+ **`nodes`** – 包含節點和節點屬性的 JSON 陣列，其形式如下：

  ```
      "nodes : [
        {
          "label": "(node label)",
          "properties": [ "(a property name)", "(another property name)", ( ... ) ]
        }
      ]
  ```
  + `label` – 節點的一或多個屬性圖標籤。

    採用單一值，或者，如果節點具有多個標籤，則採用值陣列。
  + `properties` – 包含您要匯出之節點屬性的名稱陣列。
+ **`edges`** – 包含邊緣定義的 JSON 陣列，其形式如下：

  ```
      "edges" : [
        {
          "label": "(edge label)",
          "properties": [ "(a property name)", "(another property name)", ( ... ) ]
        }
      ]
  ```
  + `label` – 邊緣的屬性圖標籤。採用單一值。
  + `properties` – 包含您要匯出之邊緣屬性的名稱陣列。

### `params` 中的 `filterConfigFile` 欄位
<a name="export-params-filterConfigFile"></a>

*(選用)*。

使用 `filterConfigFile` 以 `filter` 參數採用的相同形式指定包含篩選器組態的 JSON 檔案：

```
  "filterConfigFile" : "s3://(your Amazon S3 bucket)/neptune-export/(the name of the JSON file)"
```

如需 `filterConfigFile` 檔案的格式，請參閱 [篩選條件](#export-params-filter)。

### `params` 中用於屬性圖資料的 `format` 欄位
<a name="export-params-format-pg"></a>

*(選用)*。*預設值*：`csv` (逗號分隔值)

`format` 參數會指定所匯出屬性圖資料的輸出格式：

```
  "format" : (one of: csv, csvNoHeaders, json, neptuneStreamsJson)
```
+ **`csv`** – 逗號分隔值 (CSV) 格式化的輸出，具有根據 [Gremlin 載入資料格式](bulk-load-tutorial-format-gremlin.md)進行格式化的資料行標頭。
+ **`csvNoHeaders`** – 沒有資料列標頭的 CSV 格式化資料。
+ **`json`** – JSON 格式化資料。
+ **`neptuneStreamsJson`** – 使用 [GREMLIN\$1JSON 變更序列化格式](streams-change-formats.md)的 JSON 格式化資料。

### `params` 中的 `gremlinFilter` 欄位
<a name="export-params-gremlinFilter"></a>

*(選用)*。

`gremlinFilter` 參數可讓您提供 Gremlin 程式碼片段，例如用來同時篩選節點和邊緣的 `has()` 步驟：

```
  "gremlinFilter" : (a Gremlin snippet)
```

欄位名稱和字串值應以逸出雙引號括住。對於日期和時間，您可以使用 [datetime](best-practices-gremlin-datetime.md) 方法。

下列範例只會匯出這些其日期建立屬性值大於 2021-10-10 的節點和邊緣：

```
  "gremlinFilter" : "has(\"created\", gt(datetime(\"2021-10-10\")))"
```

### `params` 中的 `gremlinNodeFilter` 欄位
<a name="export-params-gremlinNodeFilter"></a>

*(選用)*。

`gremlinNodeFilter` 參數可讓您提供 Gremlin 程式碼片段，例如用來篩選節點的 `has()` 步驟：

```
  "gremlinNodeFilter" : (a Gremlin snippet)
```

欄位名稱和字串值應以逸出雙引號括住。對於日期和時間，您可以使用 [datetime](best-practices-gremlin-datetime.md) 方法。

下列範例只會匯出這些其 `deleted` 布林屬性值為 `true` 的節點：

```
  "gremlinNodeFilter" : "has(\"deleted\", true)"
```

### `params` 中的 `gremlinEdgeFilter` 欄位
<a name="export-params-gremlinEdgeFilter"></a>

*(選用)*。

`gremlinEdgeFilter` 參數可讓您提供 Gremlin 程式碼片段，例如用來篩選邊緣的 `has()` 步驟：

```
  "gremlinEdgeFilter" : (a Gremlin snippet)
```

欄位名稱和字串值應以逸出雙引號括住。對於日期和時間，您可以使用 [datetime](best-practices-gremlin-datetime.md) 方法。

下列範例只會匯出這些其 `strength` 數值屬性值為 5 的邊緣：

```
  "gremlinEdgeFilter" : "has(\"strength\", 5)"
```

### `params` 中的 `nodeLabels` 欄位
<a name="export-params-nodeLabels"></a>

*(選用)*。

使用 `nodeLabels` 僅匯出這些具有所指定標籤的節點：

```
  "nodeLabels" : ["(a label)", "(another label"]
```

JSON 陣列中的每個標籤都須是單一的簡單標籤。

`scope` 參數的優先順序高於 `nodeLabels` 參數，因此如果 `scope` 值不包括節點，則 `nodeLabels` 參數沒有任何作用。

### `params` 中的 `scope` 欄位
<a name="export-params-scope"></a>

*(選用)*。預設：`all`。

`scope` 參數會指定僅匯出節點、僅匯出邊緣，還是同時匯出節點和邊緣：

```
  "scope" : (one of: nodes, edges, or all)
```
+ `nodes` – 僅匯出節點及其屬性。
+ `edges` – 僅匯出邊緣及其屬性。
+ `all` – 同時匯出節點和邊緣及其性質 (預設值)。

## RDF 匯出的欄位
<a name="export-params-rdf-fields"></a>

### `params` 中用於 RDF 資料的 `format` 欄位
<a name="export-params-format-rdf"></a>

*(選用)*。*預設*：`turtle`

`format` 參數會指定所匯出 RDF 資料的輸出格式：

```
  "format" : (one of: turtle, nquads, ntriples, neptuneStreamsJson)
```
+ **`turtle`** – Turtle 格式化輸出。
+ **`nquads`** – 沒有資料列標頭的 N-Quads 格式化資料。
+ **`ntriples`** – N-Triples 格式化資料。
+ **`neptuneStreamsJson`** – 使用 [SPARQL NQUADS 變更序列化格式](streams-change-formats.md)的 JSON 格式化資料。

### `params` 中的 `rdfExportScope` 欄位
<a name="export-params-rdfExportScope"></a>

*(選用)*。預設：`graph`。

`rdfExportScope` 參數會指定 RDF 匯出的範圍：

```
  "rdfExportScope" : (one of: graph, edges, or query)
```
+ `graph` – 匯出所有 RDF 資料。
+ `edges` – 僅匯出這些代表邊緣的三元組。
+ `query` – 匯出使用 `sparql` 欄位提供之 SPARQL 查詢所擷取的資料。

### `params` 中的 `sparql` 欄位
<a name="export-params-sparql"></a>

*(選用)*。

`sparql` 參數可讓您指定 SPARQL 查詢以擷取要匯出的資料：

```
  "sparql" : (a SPARQL query)
```

如果使用 `sparql` 欄位提供查詢，您也必須將 `rdfExportScope` 欄位設為 `query`。

### `params` 中的 `namedGraph` 欄位
<a name="namedgraph-params-sparql"></a>

*（選用）*。

`namedGraph` 參數可讓您指定 IRI，將匯出限制為單一具名圖形：

```
  "namedGraph" : (Named graph IRI)
```

`namedGraph` 參數只能與 `rdfExportScope` 欄位設定為 搭配使用`graph`。