Span¶
bcql_py.models.span
¶
XML span models
SpanQuery
¶
Bases: BCQLNode
A span (XML tag) query.
Three forms exist per Bcql.g4's tag rule:
- Whole span: <s/> or <ne type="PERS"/>
- Start tag: <s>
- End tag: </s>
The tag name can be a plain identifier (s, ne) or a quoted string
for regex patterns (<"person|location"/>).
Attributes:
| Name | Type | Description |
|---|---|---|
tag_name |
str | StringValue
|
The tag name as a plain string or |
position |
Literal['whole', 'start', 'end']
|
|
attributes |
dict[str, StringValue]
|
XML attributes as |
PositionFilterNode
¶
Bases: BCQLNode
A position-filter operator: within, containing, or overlap.
Example: "baker" within <person/> means find "baker" inside a <person/> span.
These operators are right-associative, so A within B within C is parsed as A within (B within C).
Attributes:
| Name | Type | Description |
|---|---|---|
operator |
Literal['within', 'containing', 'overlap']
|
One of |
left |
BCQLNodeUnion
|
The query whose hits are filtered. |
right |
BCQLNodeUnion
|
The span/query that defines the positional constraint. |