
    Ng                     $   d dl mZ d dlmZmZmZmZ d dlmZ d dl	m
Z
 d dlmZ d dlmZ dZdd	gZd
gZdZdZdZdZdZdZdZ eddd          dedefd            Z eddd          dedefd            Z eddd          dededefd            Z eddd           dedefd!            Z eddd"          d#ed$edefd%            Z eddd&          dedefd'            Z  eddd(           G d) d*e                      Z!d+S ),    )md5)AnyDictListOptional)
deprecated)get_from_dict_or_env)GraphDocument)
GraphStore
__Entity___Bloom_Perspective__Bloom_Scene__Bloom_HAS_SCENE_i'     
   a4  
CALL apoc.meta.data()
YIELD label, other, elementType, type, property
WHERE NOT type = "RELATIONSHIP" AND elementType = "node" 
  AND NOT label IN $EXCLUDED_LABELS
WITH label AS nodeLabels, collect({property:property, type:type}) AS properties
RETURN {labels: nodeLabels, properties: properties} AS output

a<  
CALL apoc.meta.data()
YIELD label, other, elementType, type, property
WHERE NOT type = "RELATIONSHIP" AND elementType = "relationship"
      AND NOT label in $EXCLUDED_LABELS
WITH label AS nodeLabels, collect({property:property, type:type}) AS properties
RETURN {type: nodeLabels, properties: properties} AS output
a8  
CALL apoc.meta.data()
YIELD label, other, elementType, type, property
WHERE type = "RELATIONSHIP" AND elementType = "node"
UNWIND other AS other_node
WITH * WHERE NOT label IN $EXCLUDED_LABELS
    AND NOT other_node IN $EXCLUDED_LABELS
RETURN {start: label, type: property, end: toString(other_node)} AS output
zuMERGE (d:Document {id:$document.metadata.id}) SET d.text = $document.page_content SET d += $document.metadata WITH d z0.3.8z1.0z6langchain_neo4j.graphs.neo4j_graph.clean_string_values)sinceremovalalternative_importtextreturnc                 V    |                      dd                               dd          S )zClean string values for schema.

    Cleans the input text by replacing newline and carriage return characters.

    Args:
        text (str): The input text to clean.

    Returns:
        str: The cleaned text.
    
 replacer   s    b/var/www/html/ai-engine/env/lib/python3.11/site-packages/langchain_community/graphs/neo4j_graph.pyclean_string_valuesr   7   s(      <<c""**4555    z1langchain_neo4j.graphs.neo4j_graph.value_sanitizedc                    t          | t                    ri }|                                 D ]z\  }}t          |t                    rt          |          }||||<   1t          |t                    r/t          |          t          k     rt          |          }||||<   u|||<   {|S t          | t                    r&t          |           t          k     rd | D             S dS | S )a  Sanitize the input dictionary or list.

    Sanitizes the input by removing embedding-like values,
    lists with more than 128 elements, that are mostly irrelevant for
    generating answers in a LLM context. These properties, if left in
    results, can occupy significant context space and detract from
    the LLM's performance by introducing unnecessary noise and cost.

    Args:
        d (Any): The input dictionary or list to sanitize.

    Returns:
        Any: The sanitized dictionary or list.
    Nc                 J    g | ] }t          |          t          |          !S )Nvalue_sanitize).0items     r   
<listcomp>z"value_sanitize.<locals>.<listcomp>t   s4       )-nT6J6J6Vt$$6V6V6Vr    )
isinstancedictitemsr%   listlen
LIST_LIMIT)r!   new_dictkeyvaluesanitized_values        r   r%   r%   J   s   ( !T '')) 	& 	&JC%&& &"0"7"7#/$3HSME4(( 	&u::
**&4U&;&;O'3(7 !&	At		 q66J 12    4r    z9langchain_neo4j.graphs.neo4j_graph._get_node_import_querybaseEntityLabelinclude_sourcec                 j    | r|rt           nd dt           d|rdnd dS |rt           nd d|rdnd dS )	N #UNWIND $data AS row MERGE (source:`z-` {id: row.id}) SET source += row.properties z MERGE (d)-[:MENTIONS]->(source) zmWITH source, row CALL apoc.create.addLabels( source, [row.type] ) YIELD node RETURN distinct 'done' AS resultzbUNWIND $data AS row CALL apoc.merge.node([row.type], {id: row.id}, row.properties, {}) YIELD node zMERGE (d)-[:MENTIONS]->(node) z RETURN distinct 'done' AS result)include_docs_queryBASE_ENTITY_LABEL)r3   r4   s     r   _get_node_import_queryr:   }   s      
%3;!! / /// / 6DK11	/ / /		
 &4;!! / / 4BI//r	/ / /	
r    z8langchain_neo4j.graphs.neo4j_graph._get_rel_import_queryc                 2    | rdt            dt            dS 	 dS )Nr7   z#` {id: row.source}) MERGE (target:`z` {id: row.target}) WITH source, target, row CALL apoc.merge.relationship(source, row.type, {}, row.properties, target) YIELD rel RETURN distinct 'done'a-  UNWIND $data AS row CALL apoc.merge.node([row.source_label], {id: row.source},{}, {}) YIELD node as source CALL apoc.merge.node([row.target_label], {id: row.target},{}, {}) YIELD node as target CALL apoc.merge.relationship(source, row.type, {}, row.properties, target) YIELD rel RETURN distinct 'done'r9   )r3   s    r   _get_rel_import_queryr=      sD      
%/% %/% % %	
%		
 		
r    z1langchain_neo4j.graphs.neo4j_graph._format_schemaschemais_enhancedc           
      x   g }g }|r| d                                          D ]\  }}|                    d| d           |D ]_}d}|d         dk    r~|                    d          ri|                    dd	          t          k    r*|d         rd
t	          |d         d                    dnd}n|d         rdd |d         D              nd}n|d         dv rT|                    d          d|d          d|d          }nr|                    d          rd
|d         d          dnd}nH|d         dk    r<|                    d          r|d         t
          k    r!d|d          d|d          }|                    d|d          d|d          d|            a| d                                          D ]_\  }}|                    d| d           |D ]<}d}|d         dk    ri|                    dd	          t          k    r*|d         rd
t	          |d         d                    dnd}n|d         rdd |d         D              nd}n|d         dv rG|                    d          rd|d          d|d          }nd|d         rd
|d         d          dnd}nG|d         dk    r;|                    d          r|d         t
          k    rd|d          d|d          }|                    d|d          d |d          d!|            >an| d                                          D ]?\  }	}
d"                    d# |
D                       }|                    |	 d$| d%           @| d                                          D ]?\  }}
d"                    d& |
D                       }|                    | d$| d%           @d' | d(         D             }d)                    d*d)                    |          d+d)                    |          d,d)                    |          g          S )-N
node_propsz- **z**r6   typeSTRINGvaluesdistinct_count   z
Example: "r   "zAvailable options: c                 ,    g | ]}t          |          S  r   r&   els     r   r(   z"_format_schema.<locals>.<listcomp>   !    #U#U#U$7$;$;#U#U#Ur    INTEGERFLOATDATE	DATE_TIMELOCAL_DATE_TIMEminzMin: z, Max: maxLISTmin_sizez
Min Size: z, Max Size: max_sizez  - `property`: r   	rel_propsc                 ,    g | ]}t          |          S rI   rJ   rK   s     r   r(   z"_format_schema.<locals>.<listcomp>   rM   r    z, Max:  : z` , c                 4    g | ]}|d           d|d          S rY   r]   rB   rI   r&   props     r   r(   z"_format_schema.<locals>.<listcomp>  /    III4D$66V66IIIr    z {}c                 4    g | ]}|d           d|d          S r`   rI   ra   s     r   r(   z"_format_schema.<locals>.<listcomp>&  rc   r    c           	      J    g | ] }d |d          d|d          d|d          d!S )z(:startz)-[:rB   z]->(:end)rI   rK   s     r   r(   z"_format_schema.<locals>.<listcomp>+  sO        	<R[;;bj;;r%y;;;  r    relationshipsr   zNode properties:zRelationship properties:zThe relationships:)r+   appendgetDISTINCT_VALUE_LIMITr   r.   join)r>   r?   formatted_node_propsformatted_rel_props	node_type
propertiesrb   examplerel_typelabelprops	props_strrB   formatted_relss                 r   _format_schemary      s     jB%+L%9%?%?%A%A -	 -	!Iz ''(<y(<(<(<===" + +<8++0B0B+xx 0"558LLL  $H~$R)<T(^A=N)O)ORRRR!#    $H~	$!X#U#Ud8n#U#U#U!X !X !X "$   &\ &   xx2"K$u+"K"Kd5k"K"K  $xx11$=h):====!#  
 &\V++88J// !4
3Cj3P3P UT*%5UU4
CSUU  %++ID,IIfIIII   S+\ %+;$7$=$=$?$? *	 *	 Hj&&':h':':':;;;" ( (<8++xx 0"558LLL  $H~$R)<T(^A=N)O)ORRRR!#    $H~	$!X#U#Ud8n#U#U#U!X !X !X "$   &\ &   xx "L$u+"L"LtE{"L"L BFhW=h):====UW   &\V++88J// !4
3Cj3P3P UT*%5UU4
CSUU  $**ID,IIVIIII   M(*	Z #<06688 	D 	DLE5		II5III I !''5(B(BY(B(B(BCCCC "+.4466 	B 	BKD%		II5III I  &&$'@'@9'@'@'@AAAA )  N
 99II*++&II)** IIn%%	
	 	 	r    z4langchain_neo4j.graphs.neo4j_graph._remove_backticksc                 .    |                      dd          S )N`r6   r   r   s    r   _remove_backticksr|   <  s     <<R   r    zlangchain_neo4j.Neo4jGraphc                      e Zd ZdZ	 	 	 	 	 	 	 d ddddee         dee         dee         d	ee         d
ee         dededee         deddfdZ	e
defd            Ze
deeef         fd            Zi fdededeeeef                  fdZd!dZ	 	 d"dee         dededdfdZ	 d#dedeeeef                  dededef
dZdS )$
Neo4jGrapha  Neo4j database wrapper for various graph operations.

    Parameters:
    url (Optional[str]): The URL of the Neo4j database server.
    username (Optional[str]): The username for database authentication.
    password (Optional[str]): The password for database authentication.
    database (str): The name of the database to connect to. Default is 'neo4j'.
    timeout (Optional[float]): The timeout for transactions in seconds.
            Useful for terminating long-running queries.
            By default, there is no timeout set.
    sanitize (bool): A flag to indicate whether to remove lists with
            more than 128 elements from results. Useful for removing
            embedding-like properties from database responses. Default is False.
    refresh_schema (bool): A flag whether to refresh schema information
            at initialization. Default is True.
    enhanced_schema (bool): A flag whether to scan the database for
            example values and use them in the graph schema. Default is False.
    driver_config (Dict): Configuration passed to Neo4j Driver.

    *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.
    NFT)driver_configenhanced_schemaurlusernamepassworddatabasetimeoutsanitizerefresh_schemar   r   r   c                   	 ddl }
n# t          $ r t          d          w xY wt          d|idd          }|dk    r	|dk    rd}n*t          d|idd          }t          d	|id	d
          }||f}t          d|iddd          } |
j        j        |fd|i|pi | _        || _        || _        || _        |	| _	        d| _
        i | _        	 | j                                         n?# |
j        j        $ r t          d          |
j        j        $ r t          d          w xY w|rJ	 |                                  dS # |
j        j        $ r!}|j        dk    rt          d          |d}~ww xY wdS )z*Create a new Neo4j graph wrapper instance.r   NzRCould not import neo4j python package. Please install it with `pip install neo4j`.r   	NEO4J_URIr6   r   NEO4J_USERNAMEr   NEO4J_PASSWORDr   NEO4J_DATABASEneo4jauthzJCould not connect to Neo4j database. Please ensure that the url is correctz]Could not connect to Neo4j database. Please ensure that the username and password are correctz+Neo.ClientError.Procedure.ProcedureNotFoundzCould not use APOC procedures. Please ensure the APOC plugin is installed in Neo4j and that 'apoc.meta.data()' is allowed in Neo4j configuration )r   ImportErrorr	   GraphDatabasedriver_driver	_databaser   r   _enhanced_schemar>   structured_schemaverify_connectivity
exceptionsServiceUnavailable
ValueError	AuthErrorr   ClientErrorcode)selfr   r   r   r   r   r   r   r   r   r   r   es                r   __init__zNeo4jGraph.__init__j  sH   	LLLL 	 	 	>  	 #E3<DDr>>h"nnDD+X&  H
 ,X&  H
 h'D'"J0@'
 
 2u*1
 

,2
 
 "  /13	L,,....2 	 	 	8   ) 	 	 	K  	  
		##%%%%%#/   6JJJ$P  
 
	 
	s,    !C% %<D!'D= =E-E((E-c                     | j         S )zReturns the schema of the Graph)r>   r   s    r   
get_schemazNeo4jGraph.get_schema  s     {r    c                     | j         S )z*Returns the structured schema of the Graph)r   r   s    r   get_structured_schemaz Neo4jGraph.get_structured_schema  s     %%r    queryparamsc                 j   ddl m} ddlm} 	 | j                             ||| j                  | j        |          \  }}}d |D             }| j        rd |D             }|S # |$ rG}|j	        dk    s|j	        d	k    r	d
|j
        v s|j	        dk    rd|j
        v s
d|j
        v s Y d}~nd}~ww xY w| j                            | j                  5 }	|	                     ||| j                  |          }d |D             }| j        rd |D             }|cddd           S # 1 swxY w Y   dS )a  Query Neo4j database.

        Args:
            query (str): The Cypher query to execute.
            params (dict): The parameters to pass to the query.

        Returns:
            List[Dict[str, Any]]: The list of dictionaries containing the query results.
        r   )Query)
Neo4jError)r   r   )	database_parameters_c                 6    g | ]}|                                 S rI   datar&   rs     r   r(   z$Neo4jGraph.query.<locals>.<listcomp>       000a000r    c                 ,    g | ]}t          |          S rI   r$   rK   s     r   r(   z$Neo4jGraph.query.<locals>.<listcomp>       DDDB^B//DDDr    z+Neo.DatabaseError.Statement.ExecutionFailedz4Neo.DatabaseError.Transaction.TransactionStartFailedzin an implicit transactionz'Neo.ClientError.Statement.SemanticErrorz&in an open transaction is not possiblez+tried to execute in an explicit transactionN)r   c                 6    g | ]}|                                 S rI   r   r   s     r   r(   z$Neo4jGraph.query.<locals>.<listcomp>  r   r    c                 ,    g | ]}t          |          S rI   r$   rK   s     r   r(   z$Neo4jGraph.query.<locals>.<listcomp>  r   r    )r   r   neo4j.exceptionsr   r   execute_queryr   r   r   r   messagesessionrun)
r   r   r   r   r   r   _	json_datar   r   s
             r   r   zNeo4jGraph.query  s     	 //////	335$,777." 4  JD!Q
 104000I} EDD)DDD	 	 	 	 "OOO6QR R 5	AA FGGG@AIMMHAIUU %	( \!!4>!:: 	g;;uu%FFFOOD004000I} EDD)DDD		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s+   AA% %B1*=B,,B1AD((D,/D,c                    ddl m}m} d |                     t          dt
          t          gz   i          D             }d |                     t          dt          i          D             }d |                     t          dt
          t          gz   i          D             }	 |                     d          }|                     d	          }n# |$ r g }g }Y nw xY wd
 |D             d |D             |||dd| _
        | j        r|                     d          }|d         d         D ]}	|	d         t
          v r| j
        d                             |	d                   }
|
s;|                     |	d         |
|	d         t          k               }	 |                     |          d         d         }|
D ]-}|d         |v r!|                    ||d                             .# |$ r Y w xY w|d         d         D ]}|d         t          v r| j
        d                             |d                   }|s;|                     |d         ||d         t          k     d          }	 |                     |          d         d         }|D ]-}|d         |v r!|                    ||d                             .# |$ r Y w xY wt!          | j
        | j                  }|| _        dS )z?
        Refreshes the Neo4j graph schema information.
        r   )r   CypherTypeErrorc                     g | ]
}|d          S outputrI   rK   s     r   r(   z-Neo4jGraph.refresh_schema.<locals>.<listcomp>  s,     
 
 
 xL
 
 
r    EXCLUDED_LABELS)r   c                     g | ]
}|d          S r   rI   rK   s     r   r(   z-Neo4jGraph.refresh_schema.<locals>.<listcomp>  s,     
 
 
 xL
 
 
r    c                     g | ]
}|d          S r   rI   rK   s     r   r(   z-Neo4jGraph.refresh_schema.<locals>.<listcomp>
  s,     
 
 
 xL
 
 
r    zSHOW CONSTRAINTSzCALL apoc.schema.nodes() YIELD label, properties, type, size, valuesSelectivity WHERE type = 'RANGE' RETURN *, size * valuesSelectivity as distinctValuesc                 ,    i | ]}|d          |d         S )labelsrr   rI   rK   s     r   
<dictcomp>z-Neo4jGraph.refresh_schema.<locals>.<dictcomp>!  s#    TTTb2h<L)9TTTr    c                 ,    i | ]}|d          |d         S )rB   rr   rI   rK   s     r   r   z-Neo4jGraph.refresh_schema.<locals>.<dictcomp>"  s#    PPP2"V*b&6PPPr    )
constraintindex)rA   r[   rj   metadatazCALL apoc.meta.graphSample() YIELD nodes, relationships RETURN nodes, [rel in relationships | {name:apoc.any.property(rel, 'type'), count: apoc.any.property(rel, 'count')}] AS relationshipsnodesnamerA   countr   rY   rj   r[   T)is_relationshipN)r   r   r   r   node_properties_queryr   r9   rel_properties_queryEXCLUDED_RELS	rel_queryr   r   rl   _enhanced_schema_cypherEXHAUSTIVE_SEARCH_LIMITupdatery   r>   )r   r   r   node_propertiesrel_propertiesrj   r   r   schema_countsnoderA   enhanced_cypherenhanced_inforb   relr[   r>   s                    r   r   zNeo4jGraph.refresh_schema  s    	BAAAAAAA
 
jj%)?>O=P+PQ !  
 
 

 
jj$.?-O !  
 
 

 
jj)?>O=P+PQ !  
 
 
	$677JJJ= EE 	 	 	 JEEE		 UTOTTTPPPPP*'1EBB	"
 "
   /	 JJ$ M &a(1  <?22!3LAEEd6lSS
! "&">">L*d7m>U.U# #$(JJ$?$?$B8$LM * I I
+}<< KKd:6F(GHHHI '   H %Q'8  v;-// 2;?CCCKPP	  "&">">KL#::$(	 #? # #$(JJ$?$?$B8$LM ) I I
+}<< KKd:6F(GHHHI '   H   68MNNs8   #*C 	CCAG%%G-,G-(AJ::KKgraph_documentsr4   r3   c                    |rzt          d | j                            di                               dg           D                       }|s2|                     dt           d           |                                  t          ||          }t          |          }|D ]}|j        j	                            d          sKt          |j        j                            d                                                    |j        j	        d<   |j        D ]}t          |j                  |_        |                     |d |j        D             |j        j        d	           |                     |d
d |j        D             i           dS )aR  
        This method constructs nodes and relationships in the graph based on the
        provided GraphDocument objects.

        Parameters:
        - graph_documents (List[GraphDocument]): A list of GraphDocument objects
        that contain the nodes and relationships to be added to the graph. Each
        GraphDocument should encapsulate the structure of part of the graph,
        including nodes, relationships, and the source document information.
        - include_source (bool, optional): If True, stores the source document
        and links it to nodes in the graph using the MENTIONS relationship.
        This is useful for tracing back the origin of data. Merges source
        documents based on the `id` property from the source document metadata
        if available; otherwise it calculates the MD5 hash of `page_content`
        for merging process. Defaults to False.
        - baseEntityLabel (bool, optional): If True, each newly created node
        gets a secondary __Entity__ label, which is indexed and improves import
        speed and performance. Defaults to False.
        c                 L    g | ]!}|d          t           gk    o|d         dgk    "S )labelsOrTypesrr   idr<   rK   s     r   r(   z2Neo4jGraph.add_graph_documents.<locals>.<listcomp>v  sL         ',=+>> 3<(TF2  r    r   r   z'CREATE CONSTRAINT IF NOT EXISTS FOR (b:z) REQUIRE b.id IS UNIQUE;r   zutf-8c                     g | ]	}|j         
S rI   )__dict__rK   s     r   r(   z2Neo4jGraph.add_graph_documents.<locals>.<listcomp>  s    BBBRR[BBBr    )r   documentr   c                    g | ]}|j         j        t          |j         j                  |j        j        t          |j        j                  t          |j                            d d                                                    |j        dS )r   r   )sourcesource_labeltargettarget_labelrB   rr   )r   r   r|   rB   r   r   upperrr   rK   s     r   r(   z2Neo4jGraph.add_graph_documents.<locals>.<listcomp>  s         ')il,=bin,M,M&(il,=bin,M,M$5 "S 9 9 ? ? A A% % +--	 	  r    N)anyr   rl   r   r9   r   r:   r=   r   r   r   page_contentencode	hexdigestr   r|   rB   r   rj   )	r   r   r4   r3   constraint_existsnode_import_queryrel_import_queryr   r   s	            r   add_graph_documentszNeo4jGraph.add_graph_documents[  s   2  	& #  #488RHHLL$b   ! ! % &

.>O . . .   ##%%%2?NSS0AA' #	 #	H?+//55 14O077@@2 2)++ (.
 ! 9 9-di88		JJ!BB8>BBB ( 8    JJ    #+"8     %#	 #	r    label_or_typerr   
exhaustiver   c                    |rd d}nd d}g }g }i }|r@|D ]:}	|	d         |	d         }
|
dk    rA|                     d d	 d
           |                     d dt           d d           n|
dv rt|                     d d d           |                     d d d           |                     d d d           |                     d d d d           nK|
dk    r?|                     d d d d d	           |                     d d  d           n|
d!v rd"|                                z   d#z   |<   <n'|d$z  }|D ]}	|	d         |	d         }
fd%| j        d&         d'         D             }|
dk    r|r|d(                             d)          d(k    rv|d(                             d*          t          k    rR|                     d+ d, d-          d(         d.         }|                     d/| d0t          |                      n1|                     d d	 d
           |                     d1 d
           n|
dv r|s6|                     d2 d d
           |                     d1 d
           n|                     d d d           |                     d d d           |                     d d d           |                     d d d d           nK|
dk    r?|                     d d d d d	           |                     d d  d           n|
d!v rd"|                                z   d#z   |<    d3d4                    |          z   }d5d6                    d7 |                                D                       z   d8z   }d9                    |||g          }|S ):NzMATCH ()-[n:`z`]->()z
MATCH (n:`z`)rY   rB   rC   z'collect(distinct substring(toString(n.`z`), 0, 50)) AS `z_values`zvalues:`z_values`[..z], distinct_count: size(`z	_values`)rN   zmin(n.`z`) AS `z_min`zmax(n.`z_max`zcount(distinct n.`z
_distinct`zmin: toString(`z_min`), max: toString(`z_max`), distinct_count: `rV   zmin(size(n.`z`)) AS `z_size_min`, max(size(n.`z
_size_max`zmin_size: `z_size_min`, max_size: `)BOOLEANPOINTDURATION{rd   z WITH n LIMIT 5c                 ^    g | ])}|d          k    r|d         gk    r|d         dk    '|*S )ru   rr   rB   RANGErI   )r&   rL   r   	prop_names     r   r(   z6Neo4jGraph._enhanced_schema_cypher.<locals>.<listcomp>  sU       '{m33<(YK776
g--	  .--r    r   r   r   sizedistinctValuesz&CALL apoc.schema.properties.distinct('z', 'z') YIELD valuer1   zvalues: z, distinct_count: z	values: `zcollect(distinct toString(n.`zWITH z,
     zRETURN {r^   c              3   ,   K   | ]\  }}d | d| V  dS )r{   rZ   NrI   )r&   kvs      r   	<genexpr>z5Neo4jGraph._enhanced_schema_cypher.<locals>.<genexpr>J  s2      FF$!QA!FFFFFFr    z} AS outputr   )	rk   rm   popr   rl   r   r-   rn   r+   )r   r   rr   r   r   match_clausewith_clausesreturn_clausesoutput_dictrb   	prop_type
prop_indexdistinct_valueswith_clausereturn_clausecypher_queryr   s    `              @r   r   z"Neo4jGraph._enhanced_schema_cypher  sd     	:@=@@@LL9999L H	J" 0J 0J ,	 L	(( ''Ai A A-6A A A   #))Ky K K=Q K K6?K K K     #   !''(T)(T(TI(T(T(TUUU ''(T)(T(TI(T(T(TUUU ''TYTTyTTT   #))Fi F F.7F F09F F F    &(( ''T9 T Ti T T+4T T>GT T T   #))<i < <&/< < <    "BBB),~/A/A/C/C)Cc)II&&a0Jf --L" SJ SJ ,	 L	    "4Z@I  
 (("O&qM--f5599&qM--.>??CWWW*.**M -M M3<M M M+ + + %+& '--!K? !K !K474H4H!K !K    %++!E) !E !E1:!E !E !E   '--.M).M.M.MNNNN #   & $++7I 7 7#,7 7 7   '--.M).M.M.MNNNN$++HiHH	HHH   %++HiHH	HHH   %++XXX9XXX   '--!J) !J !J2;!J !J4=!J !J !J    &(( ''T9 T Ti T T+4T T>GT T T   #))@) @ @*3@ @ @    "BBB),~/A/A/C/C)Cc)II&&
 = ==iiFF+2C2C2E2EFFFFFG 	 yy,]!KLLr    )NNNNNFT)r   N)FF)F)__name__
__module____qualname____doc__r   strfloatboolr   r   rY   r   r   r   r*   r   r   r   r
   r   r   rI   r    r   r~   r~   E  sa        B ""&"&"&#'#K )- %K K Kc]K 3-K 3-	K
 3-K %K K K  ~K K 
K K K KZ C    X &tCH~ & & & X& 4 44 4 
d38n		4 4 4 4lb b b bN  % %	Q Qm,Q Q 	Q
 
Q Q Q Qp !&b bb c3h(b 	b
 b 
b b b b b br    r~   N)"hashlibr   typingr   r   r   r   langchain_core._api.deprecationr   langchain_core.utilsr	   )langchain_community.graphs.graph_documentr
   &langchain_community.graphs.graph_storer   r9   r   r   r   r.   rm   r   r   r   r8   r  r   r%   r  r:   r=   ry   r|   r~   rI   r    r   <module>r     s         , , , , , , , , , , , , 6 6 6 6 6 6 5 5 5 5 5 5 C C C C C C = = = = = =  (/:$% 
   	  
O  
6c 6c 6 6 6 
6 
J  
+c +c + + + 
+\ 
R  

D 
$ 
3 
 
 
 

. 
Q  

4 
C 
 
 
 

0 
J  
~4 ~d ~s ~ ~ ~ 
~B 
M  
!C !C ! ! ! 
! 
3  
F F F F F F F 
F F Fr    