queryTimeout SPARQL 查询提示 - Amazon Neptune
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

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

queryTimeout SPARQL 查询提示

queryTimeout 查询提示指定超时,该值短于在数据库参数组中设置的 neptune_query_timeout 值。

如果查询因为此提示而终止,则会引发 TimeLimitExceededException,并显示 Operation terminated (deadline exceeded) 消息。

queryTimeout SPARQL 提示语法

PREFIX hint: <http://aws.amazon.com/neptune/vocab/v01/QueryHints#> SELECT ... WHERE { hint:Query hint:queryTimeout 10 . # OR hint:Query hint:queryTimeout "10" . # OR hint:Query hint:queryTimeout "10"^^xsd:integer . ... }

该超时值以毫秒表示。

该超时值必须小于数据库参数组中设置的 neptune_query_timeout 值。否则,将会引发带 Malformed query: Query hint 'queryTimeout' must be less than neptune_query_timeout DB Parameter Group 消息的 MalformedQueryException 异常。

queryTimeout 查询提示应在主查询的 WHERE 子句中指定,或者在某个子查询的 WHERE 子句中指定,如下例所示。

它必须在所有查询/子查询和 SPARQL 更新部分(例如 INSERT 和 DELETE)中只设置一次。否则,将会引发带 Malformed query: Query hint 'queryTimeout' must be set only once 消息的 MalformedQueryException 异常。

可用范围

queryTimeout 提示可以应用于 SPARQL 查询和更新。

  • 在 SPARQL 查询中,它可以出现在主查询或子查询的 WHERE 子句中。

  • 在 SPARQL 更新中,可以在 INSERT、DELETE 或 WHERE 子句中对其进行设置。如果有多个 update 子句,则只能在其中一个中进行设置。

有关查询提示范围的更多信息,请参阅 Neptune 中的 SPARQL 查询提示范围

queryTimeout SPARQL 提示示例

此处是在 UPDATE 主查询的 WHERE 子句中使用 hint:queryTimeout 的示例。

PREFIX hint: <http://aws.amazon.com/neptune/vocab/v01/QueryHints#> INSERT { ?s ?p ?o } WHERE { hint:Query hint:queryTimeout 100 . ?s ?p ?o . }

此处,hint:queryTimeout 位于子查询的 WHERE 子句中:

PREFIX hint: <http://aws.amazon.com/neptune/vocab/v01/QueryHints#> SELECT * { ?s ?p ?o . { SELECT ?s WHERE { hint:Query hint:queryTimeout 100 . ?s ?p1 ?o1 . } } }