Chemical Data Processing Library Python API - Version 1.1.1
Public Member Functions | Properties | List of all members
CDPL.Chem.BondMatchExpression Class Reference

A generic boolean expression interface for the implementation of query/target object equivalence tests in molecular graph matching algorithms. More...

+ Inheritance diagram for CDPL.Chem.BondMatchExpression:

Public Member Functions

None __init__ ()
 Initializes the BondMatchExpression instance.
 
int getObjectID ()
 Returns the numeric identifier (ID) of the wrapped C++ class instance. More...
 
bool requiresAtomBondMapping ()
 Tells whether the expression must be reevaluated after a query to target atom/bond mapping candidate has been found. More...
 
bool __call__ (Bond query_bond, MolecularGraph query_molgraph, Bond target_bond, MolecularGraph target_molgraph, Base.Any aux_data)
 Performs an evaluation of the expression for the given query and target objects. More...
 
bool __call__ (Bond query_bond, MolecularGraph query_molgraph, Bond target_bond, MolecularGraph target_molgraph, AtomBondMapping mapping, Base.Any aux_data)
 Performs an evaluation of the expression for the given query and target objects under consideration of the provided candidate atom/bond mapping. More...
 

Properties

 objectID = property(getObjectID)
 

Detailed Description

A generic boolean expression interface for the implementation of query/target object equivalence tests in molecular graph matching algorithms.

The BondMatchExpression interface abstracts the task of checking a set of constraints on the attributes of target objects when performing query object equivalence tests in molecular graph matching procedures. Subclasses of BondMatchExpression must override one (or all, if required) of the provided function call operators to implement the logic of the constraint checks. The first form of the two operators gets called in the pre-mapping stage of the graph matching algorithm where all feasible query/target object pairings are determined. In this pre-mapping stage all sorts of query constraints can be checked that are invariant with respect to the final mapping between any of the other query and target objects. The second type of operator is invoked immediately after a complete graph mapping solution has been found and can be used to re-evaluate the validity of a given query/target object pairing in the context of the provided matching result. As soon as a pairing is found to be invalid, the current mapping solution is rejected and the algorithm proceeds to find the next possible query to target graph mapping (if any). For efficiency reasons, subclasses of BondMatchExpression which implement the post-mapping function call operator must explicitly enable its invocation by additionally overriding the BondMatchExpression.requiresAtomBondMapping() method. Its implementation simply has to return True (the default implementation returns False) to request the invocation of the operator.

Member Function Documentation

◆ getObjectID()

int CDPL.Chem.BondMatchExpression.getObjectID ( )

Returns the numeric identifier (ID) of the wrapped C++ class instance.

Different Python BondMatchExpression instances may reference the same underlying C++ class instance. The commonly used Python expression a is not b thus cannot tell reliably whether the two BondMatchExpression instances a and b reference different C++ objects. The numeric identifier returned by this method allows to correctly implement such an identity test via the simple expression a.getObjectID() != b.getObjectID().

Returns
The numeric ID of the internally referenced C++ class instance.

Reimplemented in CDPL.Chem.BondMatchExpressionList.

◆ requiresAtomBondMapping()

bool CDPL.Chem.BondMatchExpression.requiresAtomBondMapping ( )

Tells whether the expression must be reevaluated after a query to target atom/bond mapping candidate has been found.

Returns
True if the expression needs to be evaluated again after a query to target atom/bond mapping candidate has been found, and False otherwise.
Note
The default implementation returns False.

◆ __call__() [1/2]

bool CDPL.Chem.BondMatchExpression.__call__ ( Bond  query_bond,
MolecularGraph  query_molgraph,
Bond  target_bond,
MolecularGraph  target_molgraph,
Base.Any  aux_data 
)

Performs an evaluation of the expression for the given query and target objects.

Parameters
query_bondThe query bond.
query_molgraphThe query molecular graph.
target_bondThe target bond.
target_molgraphThe target molecular graph.
aux_dataProvides auxiliary information for the evaluation of the expression.
Returns
The result of the expression evaluation for the specified query and target objects.
Note
The default implementation returns True.

◆ __call__() [2/2]

bool CDPL.Chem.BondMatchExpression.__call__ ( Bond  query_bond,
MolecularGraph  query_molgraph,
Bond  target_bond,
MolecularGraph  target_molgraph,
AtomBondMapping  mapping,
Base.Any  aux_data 
)

Performs an evaluation of the expression for the given query and target objects under consideration of the provided candidate atom/bond mapping.

Parameters
query_bondThe query bond.
query_molgraphThe query molecular graph.
target_bondThe target bond.
target_molgraphThe target molecular graph.
mappingThe current query to target atom/bond mapping candidate to evaluate.
aux_dataProvides auxiliary information for the evaluation of the expression.
Returns
The result of the expression evaluation for the specified query and target objects.
Note
The default implementation returns the result of call(query_bond, query_molgraph, target_bond, target_molgraph, aux_data).