
    mBNjo                     $    d Z dZdZ G d d      Zy)z	DB.LABELSzDB.PROPERTYKEYSzDB.RELATIONSHIPTYPESc                   t    e Zd ZdZd Zd ZddZddZddZd	e	ddfd
Z
de	defdZde	defdZde	defdZy)GraphSchemaz`
    The graph schema.
    Maintains the labels, properties and relationships of the graph.
    c                 2    || _         | j                          y)z
        Initialize the graph schema.

        Args:
            graph (Graph): The graph.

        Returns:
           GraphSchema: The graph schema.
        N)graphclear)selfr   s     f/Users/ahmed/devFolder/Ultron/claude-voice/.venv/lib/python3.12/site-packages/falkordb/graph_schema.py__init__zGraphSchema.__init__   s     


    c                 <    d| _         g | _        g | _        g | _        y)zM
        Clear the graph schema.

        Returns:
            None

            N)versionlabels
propertiesrelationships)r   s    r   r   zGraphSchema.clear   s!     r
   returnNc                     | j                   j                  t              j                  }|D cg c]  }|d   	 c}| _        yc c}w )zE
        Refresh labels.

        Returns:
            None

        r   N)r   call_procedure	DB_LABELS
result_setr   )r   r   labels      r   refresh_labelszGraphSchema.refresh_labels)   s;     ZZ..y9DD
-78ZEuQxZ88   Ac                     | j                   j                  t              j                  }|D cg c]  }|d   	 c}| _        yc c}w )zQ
        Refresh relationship types.

        Returns:
            None

        r   N)r   r   DB_RELATIONSHIPTYPESr   r   )r   r   rs      r   refresh_relationszGraphSchema.refresh_relations5   s=     ZZ../CDOO
,67JqadJ77r   c                     | j                   j                  t              j                  }|D cg c]  }|d   	 c}| _        yc c}w )zL
        Refresh property keys.

        Returns:
            None

        r   N)r   r   DB_PROPERTYKEYSr   r   )r   r   ps      r   refresh_propertieszGraphSchema.refresh_propertiesA   s;     ZZ..?JJ
)34A1Q444r   r   c                     | j                          || _        | j                          | j                          | j	                          y)z
        Refresh the graph schema.

        Args:
            version (int): The version of the graph schema.

        Returns:
            None

        N)r   r   r   r   r    )r   r   s     r   refreshzGraphSchema.refreshM   s8     	

 !r
   idxc                     	 | j                   |   }|S # t        $ r# | j                          | j                   |   }Y |S w xY w)z
        Returns a label by its index.

        Args:
            idx (int): The index of the label.

        Returns:
            str: The label.

        )r   
IndexErrorr   )r   r#   r   s      r   	get_labelzGraphSchema.get_label_   sL    	%KK$E
 	  	%!KK$E		%    (??c                     	 | j                   |   }|S # t        $ r# | j                          | j                   |   }Y |S w xY w)z
        Returns a relationship type by its index.

        Args:
            idx (int): The index of the relation.

        Returns:
            str: The relationship type.

        )r   r%   r   )r   r#   r   s      r   get_relationzGraphSchema.get_relations   sP    	(""3'A
 	  	(""$""3'A		(r'   c                     	 | j                   |   }|S # t        $ r# | j                          | j                   |   }Y |S w xY w)z
        Returns a property by its index.

        Args:
            idx (int): The index of the property.

        Returns:
            str: The property.

        )r   r%   r    )r   r#   r   s      r   get_propertyzGraphSchema.get_property   sL    	%$A
 	  	%##%$A		%r'   )r   N)__name__
__module____qualname____doc__r	   r   r   r   r    intr"   strr&   r)   r+    r
   r   r   r      sl    
 
9
8
5"s "t "$S S (  (  r
   r   N)r   r   r   r   r2   r
   r   <module>r3      s!   	#- R Rr
   