vibesketcher.document.queries¶
Read-only, snapshot-scoped queries over drawn atoms (#167).
Matching delegates to RDKit’s VF2 implementation: Cordella et al., “A (sub)graph isomorphism algorithm for matching large graphs”, IEEE TPAMI 26, 1367-1372 (2004), doi:10.1109/TPAMI.2004.75. Native parsing and matching run in a separate, deadline-limited process; no query is executable code.
Functions
|
Match actual drawn atoms without editing the document or creating H atoms. |
Classes
|
Conjunction of simple atom predicates, with OR within elements. |
|
Exactly one SMARTS pattern or structured filter. |
Exceptions
Both matching workers are occupied; retry later. |
|
The caller cancelled a read; no partial match set is returned. |
|
A query cannot be completed safely or expressed by this service. |
- exception vibesketcher.document.queries.QueryRefused[source]¶
Bases:
ValueErrorA query cannot be completed safely or expressed by this service.
- exception vibesketcher.document.queries.QueryCancelled[source]¶
Bases:
QueryRefusedThe caller cancelled a read; no partial match set is returned.
- exception vibesketcher.document.queries.QueryBusy[source]¶
Bases:
QueryRefusedBoth matching workers are occupied; retry later.
- class vibesketcher.document.queries.AtomFilter(*, elements=None, charge=None, aromatic=None, in_ring=None)[source]¶
Bases:
BaseModelConjunction of simple atom predicates, with OR within elements.
- Parameters:
- model_config = {'extra': 'forbid', 'strict': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class vibesketcher.document.queries.AtomQuery(*, smarts=None, filter=None, species=None, use_chirality=False)[source]¶
Bases:
BaseModelExactly one SMARTS pattern or structured filter.
- Parameters:
- model_config = {'extra': 'forbid', 'strict': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- filter: AtomFilter | None¶
- use_chirality: StrictBool¶
- vibesketcher.document.queries.query_atoms(document, query, *, species=None, use_chirality=False, timeout=10.0, cancelled=None)[source]¶
Match actual drawn atoms without editing the document or creating H atoms.
Returned
{node, atom}references require the exact source snapshot.speciesgroups can contain several IDs if the stored model has more than one species with the same graph. Distinct drawn occurrences remain distinct. Cancellation/deadline/overflow refuse the whole result.