

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 导出 `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 导出训练数据，除非 `additionalParams` 字段中存在 `neptune_ml` 字段）*。

`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](streams-using.md)，则导出过程会将 `lastEventId.json` 文件写入您指定的导出位置。此文件包含流中最后一个事件的 `commitNum` 和 `opNum`。

```
  "includeLastEventId" : true
```

导出过程创建的克隆数据库会继承其父数据库的流设置。如果父级启用了流，则克隆同样会启用流。克隆上流的内容将反映创建克隆时父流的内容（包括相同的事件 IDs）。

## 用于属性图导出的字段
<a name="export-params-property-graph-fields"></a>

### `params` 中的 `concurrency` 字段
<a name="export-params-concurrency"></a>

*（可选）*。默认值：`4`。

`concurrency` 参数指定导出过程应使用的并行查询数量：

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

一个好的指导方针是，在要从中导出数据的所有实例CPUs上，将并发级别设置为 v 数的两倍。例如，一个 r5.xlarge 实例有 4 v。CPUs 如果您要从包含 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`用于指定只应导出带有特定标签的节点 and/or 边，并用于筛选为每个节点或边缘导出的属性。

`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` 指定包含筛选条件配置的 JSON 文件，其格式与 `filter` 参数采用的格式相同：

```
  "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) 方法。

以下示例仅导出具有 date-created 属性且属性值晚于 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` 参数只能用于设置为 `graph` 的 `rdfExportScope` 字段。