type_bridge.expressions.string¶
string
¶
String-specific expressions for text filtering.
See :mod:type_bridge.expressions.utils for documentation on TypeDB 3.x
variable scoping and why we generate unique attribute variables.
StringExpr
¶
Bases: Expression
Type-safe string expression for text-based filtering.
Represents string operations like contains, like (regex), etc.
Create a string expression.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
attr_type
|
type[T]
|
String attribute type to filter on |
required |
operation
|
Literal['contains', 'like', 'regex']
|
String operation type |
required |
pattern
|
T
|
Pattern to match |
required |
Source code in type_bridge/expressions/string.py
to_ast
¶
Generate AST patterns for this string operation.
Example: "$e has Name $e_name; $e_name contains 'Alice'"
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
var
|
str
|
Entity variable name (e.g., "$e", "$actor") |
required |
Returns:
| Type | Description |
|---|---|
list[Pattern]
|
List of AST patterns |