langchain_community.graphs.neptune_rdf_graph.NeptuneRdfGraph

class langchain_community.graphs.neptune_rdf_graph.NeptuneRdfGraph(host: str, port: int = 8182, use_https: bool = True, use_iam_auth: bool = False, client: Any = None, credentials_profile_name: Optional[str] = None, region_name: Optional[str] = None, service: str = 'neptunedata', sign: bool = True)[source]

Neptune用于RDF图操作的包装器。

Parameters
  • host (str) – 数据库实例的端点

  • port (int) – 数据库实例的端口号,默认为8182

  • use_iam_auth (bool) – 布尔值,指示Neptune集群中是否启用了IAM身份验证

  • use_https (bool) – 是否使用安全连接,默认为True

  • client (Any) – 可选的boto3 Neptune客户端

  • credentials_profile_name (Optional[str]) – 可选的AWS配置文件名称

  • region_name (Optional[str]) – 可选的AWS区域,例如,us-west-2

  • service (str) – 可选的服务名称,默认为neptunedata

  • sign (bool) – 可选的,是否对请求有效载荷进行签名,默认为True

Return type

None

示例:

graph = NeptuneRdfGraph(

host=’<SPARQL host’>, port=<SPARQL port>

) schema = graph.get_schema()

或 graph = NeptuneRdfGraph(

host=’<SPARQL host’>, port=<SPARQL port>

) schema_elem = graph.get_schema_elements() #… 更改schema_elements … graph.load_schema(schema_elem)

安全注意事项: 确保数据库连接使用的凭据仅限于包含必要权限。如果未这样做,可能会导致数据损坏或丢失,因为调用代码可能会尝试执行会导致删除、变异数据的命令,如果适当提示或读取敏感数据,如果数据库中存在这样的数据。防范这些负面结果的最佳方法是(根据需要)限制授予此工具使用的凭据的权限。

有关更多信息,请参见https://python.langchain.com/docs/security。

Attributes

get_schema

返回图数据库的模式。

get_schema_elements

Methods

__init__(host[, port, use_https, ...])

get_summary()

获取图中类和谓词的Neptune统计摘要。

load_schema(schema_elements)

从schema_elements生成并设置模式。在需要修剪内省模式的情况下很有帮助。

query(query)

运行 Neptune 查询。

__init__(host: str, port: int = 8182, use_https: bool = True, use_iam_auth: bool = False, client: Any = None, credentials_profile_name: Optional[str] = None, region_name: Optional[str] = None, service: str = 'neptunedata', sign: bool = True) None[source]
Parameters
  • host (str) –

  • port (int) –

  • use_https (bool) –

  • use_iam_auth (bool) –

  • client (Any) –

  • credentials_profile_name (Optional[str]) –

  • region_name (Optional[str]) –

  • service (str) –

  • sign (bool) –

Return type

None

get_summary() Dict[str, Any][source]

获取图中类和谓词的Neptune统计摘要。

Return type

Dict[str, Any]

load_schema(schema_elements: Dict[str, Any]) None[source]

从schema_elements生成并设置模式。在需要修剪内省模式的情况下很有帮助。

Parameters

schema_elements (Dict[str, Any]) –

Return type

None

query(query: str) Dict[str, Any][source]

运行 Neptune 查询。

Parameters

query (str) –

Return type

Dict[str, Any]

Examples using NeptuneRdfGraph