NeptuneRdfGraph#
- class langchain_aws.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: str | None = None, region_name: str | None = None, service: str = 'neptunedata', sign: bool = True)[source]#
Neptune wrapper for RDF graph operations.
- Parameters:
host (str) β endpoint for the database instance
port (int) β port number for the database instance, default is 8182
use_iam_auth (bool) β boolean indicating IAM auth is enabled in Neptune cluster
use_https (bool) β whether to use secure connection, default is True
client (Any) β optional boto3 Neptune client
credentials_profile_name (str | None) β optional AWS profile name
region_name (str | None) β optional AWS region, e.g., us-west-2
service (str) β optional service name, default is neptunedata
sign (bool) β optional, whether to sign the request payload, default is True
Example
- graph = NeptuneRdfGraph(
host=β<SPARQL hostβ>, port=<SPARQL port>
) schema = graph.get_schema()
OR graph = NeptuneRdfGraph(
host=β<SPARQL hostβ>, port=<SPARQL port>
) schema_elem = graph.get_schema_elements() #β¦ change schema_elements β¦ graph.load_schema(schema_elem)
- Security note: Make sure that the database connection uses credentials
that are narrowly-scoped to only include necessary permissions. Failure to do so may result in data corruption or loss, since the calling code may attempt commands that would result in deletion, mutation of data if appropriately prompted or reading sensitive data if such data is present in the database. The best way to guard against such negative outcomes is to (as appropriate) limit the permissions granted to the credentials used with this tool.
See https://python.langchain.com/docs/security for more information.
Attributes
get_schema
Returns the schema of the graph database.
get_schema_elements
Methods
__init__
(host[,Β port,Β use_https,Β ...])Obtain Neptune statistical summary of classes and predicates in the graph.
load_schema
(schema_elements)Generates and sets schema from schema_elements.
query
(query)Run Neptune query.
- __init__(host: str, port: int = 8182, use_https: bool = True, use_iam_auth: bool = False, client: Any = None, credentials_profile_name: str | None = None, region_name: str | None = 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 (str | None)
region_name (str | None)
service (str)
sign (bool)
- Return type:
None
- get_summary() Dict[str, Any] [source]#
Obtain Neptune statistical summary of classes and predicates in the graph.
- Return type:
Dict[str, Any]
Examples using NeptuneRdfGraph