Provides a connection to a Neo4j database for various graph operations.
The detailed information about Neo4j is available at:
Neo4j https://neo4j.com/docs/getting-started
This module referred to the work of Langchian and Llamaindex.
Parameters:
neo4j
.None
.LIST_LIMIT
elements from results. Defaults to False
.Create a new Neo4j graph instance.
Get the underlying graph storage client.
Retrieve the schema of the Neo4jGraph store.
Parameters:
False
.Returns:
str: The schema of the Neo4jGraph store.
Returns:
Dict[str, Any]: The structured schema of the graph.
Truncates the input raw value by removing entries that is
dictionary or list with values resembling embeddings and containing
more than LIST_LIMIT
elements. This method aims to reduce unnecessary
computational cost and noise in scenarios where such detailed data
structures are not needed. If the input value is not dictionary or
list then give the raw value back.
Parameters:
Returns:
Any: The truncated value, with embedding-like dictionaries and oversized lists handled.
Executes a Neo4j Cypher declarative query in a database.
Parameters:
None
.Returns:
List[Dict[str, Any]]: A list of dictionaries, each dictionary represents a row of results from the Cypher query.
Refreshes the Neo4j graph schema information by querying the database for node properties, relationship properties, and relationships.
Adds a relationship (triplet) between two entities in the database with a timestamp.
Parameters:
Deletes a specific relationship between two nodes in the Neo4j database.
Parameters:
Deletes an entity from the Neo4j database based on its unique identifier.
Parameters:
Checks if the given entity has any relationships in the graph database.
Parameters:
Returns:
bool: True if the entity has at least one edge (relationship), False otherwise.
Deletes a specific triplet from the graph, comprising a subject, object and relationship.
Parameters:
Constructs a Cypher query string for importing nodes into a Neo4j database.
Parameters:
Returns:
str: A Cypher query string tailored based on the provided flags.
Constructs a Cypher query string for importing relationship into a Neo4j database.
Parameters:
Returns:
str: A Cypher query string tailored based on the provided flags.
Adds nodes and relationships from a list of GraphElement objects to the graph storage.
Parameters:
id
property from the source element metadata if available; otherwise it calculates the MD5 hash of page_content
for merging process. Defaults to False
.BASE_ENTITY_LABEL
label, which is indexed and improves import speed and performance. Defaults to False
.Runs the Random Walk with Restarts (RWR) sampling algorithm.
Parameters:
0.1
.False
.None
.Returns:
Dict[str, Any]: A dictionary with the results of the RWR sampling.
Runs the Common Neighbour Aware Random Walk (CNARW) sampling algorithm.
Parameters:
False
.None
.Returns:
Dict[str, Any]: A dictionary with the results of the CNARW sampling.
Query triplet information. If subj, obj, or rel is not specified, returns all matching triplets.
Parameters:
None
)None
)None
)Returns:
List[Dict[str, Any]]: A list of matching triplets, each containing subj, obj, rel, and timestamp.
Provides a connection to a Neo4j database for various graph operations.
The detailed information about Neo4j is available at:
Neo4j https://neo4j.com/docs/getting-started
This module referred to the work of Langchian and Llamaindex.
Parameters:
neo4j
.None
.LIST_LIMIT
elements from results. Defaults to False
.Create a new Neo4j graph instance.
Get the underlying graph storage client.
Retrieve the schema of the Neo4jGraph store.
Parameters:
False
.Returns:
str: The schema of the Neo4jGraph store.
Returns:
Dict[str, Any]: The structured schema of the graph.
Truncates the input raw value by removing entries that is
dictionary or list with values resembling embeddings and containing
more than LIST_LIMIT
elements. This method aims to reduce unnecessary
computational cost and noise in scenarios where such detailed data
structures are not needed. If the input value is not dictionary or
list then give the raw value back.
Parameters:
Returns:
Any: The truncated value, with embedding-like dictionaries and oversized lists handled.
Executes a Neo4j Cypher declarative query in a database.
Parameters:
None
.Returns:
List[Dict[str, Any]]: A list of dictionaries, each dictionary represents a row of results from the Cypher query.
Refreshes the Neo4j graph schema information by querying the database for node properties, relationship properties, and relationships.
Adds a relationship (triplet) between two entities in the database with a timestamp.
Parameters:
Deletes a specific relationship between two nodes in the Neo4j database.
Parameters:
Deletes an entity from the Neo4j database based on its unique identifier.
Parameters:
Checks if the given entity has any relationships in the graph database.
Parameters:
Returns:
bool: True if the entity has at least one edge (relationship), False otherwise.
Deletes a specific triplet from the graph, comprising a subject, object and relationship.
Parameters:
Constructs a Cypher query string for importing nodes into a Neo4j database.
Parameters:
Returns:
str: A Cypher query string tailored based on the provided flags.
Constructs a Cypher query string for importing relationship into a Neo4j database.
Parameters:
Returns:
str: A Cypher query string tailored based on the provided flags.
Adds nodes and relationships from a list of GraphElement objects to the graph storage.
Parameters:
id
property from the source element metadata if available; otherwise it calculates the MD5 hash of page_content
for merging process. Defaults to False
.BASE_ENTITY_LABEL
label, which is indexed and improves import speed and performance. Defaults to False
.Runs the Random Walk with Restarts (RWR) sampling algorithm.
Parameters:
0.1
.False
.None
.Returns:
Dict[str, Any]: A dictionary with the results of the RWR sampling.
Runs the Common Neighbour Aware Random Walk (CNARW) sampling algorithm.
Parameters:
False
.None
.Returns:
Dict[str, Any]: A dictionary with the results of the CNARW sampling.
Query triplet information. If subj, obj, or rel is not specified, returns all matching triplets.
Parameters:
None
)None
)None
)Returns:
List[Dict[str, Any]]: A list of matching triplets, each containing subj, obj, rel, and timestamp.