Generated on Wed Apr 29 2015 11:51:41 for GGL-4.1.2 by doxygen 1.8.3.1
Data Structures | Public Types | Public Member Functions | Static Public Attributes | Static Protected Member Functions | Protected Attributes
ggl::Rule Class Reference

#include <Rule.hh>

Inheritance diagram for ggl::Rule:
Inheritance graph
[legend]

Data Structures

struct  EdgeContextProperty
 
struct  NodeContextProperty
 
struct  NodeRightLabelProperty
 
class  RuleCnP
 
class  RuleSide
 

Public Types

typedef std::map< size_t,
std::set< RuleCnP > > 
CopyAndPasteOperations
 
typedef boost::adjacency_list
< boost::vecS, boost::vecS,
boost::undirectedS,
CoreGraph_NodeProperties,
CoreGraph_EdgeProperties
CoreGraph
 
typedef boost::property
< EdgeLabelProperty,
std::string, boost::property
< EdgeContextProperty,
RuleContext > > 
CoreGraph_EdgeProperties
 
typedef boost::property
< NodeIndexProperty, size_t,
boost::property
< NodeLabelProperty,
std::string, boost::property
< NodeRightLabelProperty,
std::string, boost::property
< NodeContextProperty,
RuleContext > > > > 
CoreGraph_NodeProperties
 The properties available for the nodes of a CoreGraph. More...
 
typedef boost::edge_name_t EdgeLabelProperty
 
typedef std::vector
< sgm::Pattern_Interface::Match_Constraint * > 
MatchConstraintVec
 vector of constraints to be matched More...
 
typedef boost::vertex_index_t NodeIndexProperty
 
typedef boost::vertex_name_t NodeLabelProperty
 
typedef std::map< size_t, size_t > NodeMap
 
typedef std::vector< size_t > NodeVec
 Vector of node indices. More...
 
typedef std::map< size_t, NodeVecOutEdgeMap
 
enum  RuleContext { RULE_LEFT_SIDE = 2, RULE_RIGHT_SIDE = 3, RULE_LABEL_CHANGE = (RULE_LEFT_SIDE * RULE_RIGHT_SIDE), RULE_CONTEXT = 5 * RULE_LABEL_CHANGE }
 

Public Member Functions

virtual bool decodeConsistencyStatus (const size_t consistencyCode, std::ostream &errorStream, const bool completeCheck=true)
 
const RuleSidegetContext (void) const
 
const CopyAndPasteOperationsgetCopyAndPasteOperations (void) const
 
const CoreGraphgetCore (void) const
 
const std::string & getID (void) const
 
const RuleSidegetLeftSide (void) const
 
const MatchConstraintVecgetMatchConstraints (void) const
 
const RuleSidegetRightSide (void) const
 
virtual const std::string * getUsedWildcard (void) const
 
virtual size_t isConsistent (void) const
 
Ruleoperator= (const Rule &toCopy)
 
 Rule (const CoreGraph &core, const std::string &id, const std::string *wildcardToUse=NULL)
 
 Rule (const CoreGraph &core, const std::string &id, const MatchConstraintVec &matchConstraints, const std::string *wildcardToUse=NULL)
 
 Rule (const CoreGraph &core, const std::string &id, const MatchConstraintVec &matchConstraints, const CopyAndPasteOperations &copyAndPaste, const std::string *wildcardToUse=NULL)
 
 Rule (const Rule &toCopy)
 
void setID (const std::string &newID)
 
virtual void setUsedWildcard (const std::string *const wildcardToUse)
 
virtual ~Rule ()
 Destruction. More...
 

Static Public Attributes

static const size_t C_Consistent
 consistency code : everything fine More...
 
static const size_t C_NoID
 consistency code : no rule ID is present More...
 
static const size_t C_WrongEdgeContext
 consistency code : at least one edge shows wrong context usage More...
 

Static Protected Member Functions

static bool checkEdgeContext (const CoreGraph &coreGraph)
 
static NodeVec getRuleSideNodes (const CoreGraph &graph, const RuleContext &level)
 

Protected Attributes

RuleSide Context
 the information describing the invariant context of the Rule More...
 
CopyAndPasteOperations copyAndPaste
 the copy-and-Paste operations to perform More...
 
CoreGraph core
 the boost graph that is encoding the graph grammar rule More...
 
std::string id
 the id or description of this rules More...
 
RuleSide LeftSide
 the information describing the left side pattern of the Rule More...
 
RuleSide RightSide
 the information describing the right side (result) of the Rule More...
 
std::string * wildcard
 the wildcard string to use for left side pattern matching More...
 

Detailed Description

Graph grammar rule data

    A description of a graph grammar rule with left and righ rule side and
    context description.
Author
Martin Mann (c) 2008 http://www.bioinf.uni-freiburg.de/~mmann/

Definition at line 57 of file Rule.hh.

Member Typedef Documentation

typedef std::map< size_t, std::set<RuleCnP> > ggl::Rule::CopyAndPasteOperations

container definition to store copy-and-Paste operations to do the key value defines the source node of the copy-and-Paste

Definition at line 313 of file Rule.hh.

typedef boost::adjacency_list< boost::vecS, boost::vecS, boost::undirectedS, CoreGraph_NodeProperties, CoreGraph_EdgeProperties > ggl::Rule::CoreGraph

The definition of a the internal graph representation of a graph grammar rule of undirected graphs.

Definition at line 153 of file Rule.hh.

typedef boost::property< EdgeLabelProperty, std::string , boost::property< EdgeContextProperty, RuleContext > > ggl::Rule::CoreGraph_EdgeProperties

The properties available for the edges of a CoreGraph

        NOTE: EdgeContextProperty is NOT TO BE allowed to be RULE_LABEL_CHANGE.
        Label changes of edges are to be encoded by insertion and deletion of
        the edge, ie. present two times with according RULE_LEFT_SIDE and
        RULE_RIGHT_SIDE EdgeContextProperty value.

Definition at line 142 of file Rule.hh.

typedef boost::property< NodeIndexProperty, size_t , boost::property< NodeLabelProperty, std::string , boost::property< NodeRightLabelProperty, std::string , boost::property< NodeContextProperty, RuleContext > > > > ggl::Rule::CoreGraph_NodeProperties

Definition at line 118 of file Rule.hh.

typedef boost::edge_name_t ggl::Rule::EdgeLabelProperty

This boost graph property is used to determine the label of a given edge. If the specified edge changes the label in the left and right side of the graph grammar rule, this property specifies the label of the LEFT side of the edge.

Definition at line 124 of file Rule.hh.

Definition at line 157 of file Rule.hh.

typedef boost::vertex_index_t ggl::Rule::NodeIndexProperty

This boost graph property is used to determine the index of a given node along the iterator order.

Definition at line 91 of file Rule.hh.

typedef boost::vertex_name_t ggl::Rule::NodeLabelProperty

This boost graph property is used to determine the label of a given node. If the specified node changes the label in the left and right side of the graph grammar rule, this property specifies the label of the LEFT side of the node.

Definition at line 97 of file Rule.hh.

typedef std::map< size_t, size_t > ggl::Rule::NodeMap

Definition at line 78 of file Rule.hh.

typedef std::vector< size_t > ggl::Rule::NodeVec

Definition at line 63 of file Rule.hh.

typedef std::map< size_t, NodeVec > ggl::Rule::OutEdgeMap

If a node has outgoing edges, this class contains the indices of the ends of these edges.

Definition at line 77 of file Rule.hh.

Member Enumeration Documentation

A type definition to encode the different use cases of a node or edge of a graph grammar rule.

Enumerator
RULE_LEFT_SIDE 

graph element is ONLY part of the left rule side

RULE_RIGHT_SIDE 

graph element is ONLY part of the right rule side

RULE_LABEL_CHANGE 

node is part of the both rule sides but the LABEL is CHANGING. NOTE: only valid for nodes!!!

RULE_CONTEXT 

graph element is part of the both rule sides = context of the rule

Definition at line 83 of file Rule.hh.

Constructor & Destructor Documentation

ggl::Rule::Rule ( const CoreGraph core,
const std::string &  id,
const std::string *  wildcardToUse = NULL 
)

Construction of a rule based on the given boost graph based core description.

Parameters
corethe boost graph that describes the graph grammar rule
idthe identifier or description of the graph grammar rule
wildcardToUsethe wildcard string to be used for the left side pattern matching, or NULL if no wildcard to be applied
ggl::Rule::Rule ( const CoreGraph core,
const std::string &  id,
const MatchConstraintVec matchConstraints,
const std::string *  wildcardToUse = NULL 
)

Construction of a rule based on the given boost graph based core description and the additional constraints of the left side matching.

Parameters
corethe boost graph that describes the graph grammar rule
idthe identifier or description of the graph grammar rule
matchConstraintsthe additional constraints for the matching of the left side of the rule
wildcardToUsethe wildcard string to be used for the left side pattern matching, or NULL if no wildcard to be applied
ggl::Rule::Rule ( const CoreGraph core,
const std::string &  id,
const MatchConstraintVec matchConstraints,
const CopyAndPasteOperations copyAndPaste,
const std::string *  wildcardToUse = NULL 
)

Construction of a rule based on the given boost graph based core description and the additional constraints of the left side matching.

Parameters
corethe boost graph that describes the graph grammar rule
idthe identifier or description of the graph grammar rule
matchConstraintsthe additional constraints for the matching of the left side of the rule
copyAndPastethe copy-and-Paste operations to perform
wildcardToUsethe wildcard string to be used for the left side pattern matching, or NULL if no wildcard to be applied
ggl::Rule::Rule ( const Rule toCopy)

Copy construction.

Parameters
toCopythe Rule to make this a copy of
virtual ggl::Rule::~Rule ( )
virtual

Member Function Documentation

static bool ggl::Rule::checkEdgeContext ( const CoreGraph coreGraph)
staticprotected

Checks the context assumptions of all edges, ie.

  • context edges have to connect context nodes,
  • left side edges have to connect left or context nodes, and
  • right side edges have to connect right or context nodes.
Parameters
coreGraphthe rule core graph to check
Returns
true if all edges show correct context use; false otherwise
virtual bool ggl::Rule::decodeConsistencyStatus ( const size_t  consistencyCode,
std::ostream &  errorStream,
const bool  completeCheck = true 
)
virtual

Writes a description of the consistency status or errors, encoded in a consistency code produced by isConsistent*(...), to a given outstream. The function returns whether or not an error occured.

Parameters
consistencyCodethe error code to parse, produced by a call to isConsistent(...)
errorStreamthe output stream to write the error decription to
completeCheckif true: tries to decode the whole consistencyCode and reports an error message if this is not possible. if false: decodes and reports only the known error codes from consistencyCode
Returns
true if no error is encoded; false otherwise

Reimplemented in ggl::chem::ChemRule.

const RuleSide& ggl::Rule::getContext ( void  ) const

Access to the context of the Rule that is fixed during the Rule application and that is present in the left and right side of the Rule.

Returns
the context
const CopyAndPasteOperations& ggl::Rule::getCopyAndPasteOperations ( void  ) const

Access to the copy-and-Paste operations to perform

Returns
the CnP operation container
const CoreGraph& ggl::Rule::getCore ( void  ) const

Access to the core graph that encodes the whole Rule.

Returns
the Rule's core graph
const std::string& ggl::Rule::getID ( void  ) const

Access to the string identifier or description of the Rule.

Returns
the identifier
const RuleSide& ggl::Rule::getLeftSide ( void  ) const

Access to the left side pattern of the rule that has to be matched when the Rule is applied.

Returns
the left side pattern
const MatchConstraintVec& ggl::Rule::getMatchConstraints ( void  ) const

Access to the match constraints to fulfill for each left side match

Returns
the match constraint container
const RuleSide& ggl::Rule::getRightSide ( void  ) const

Access to the right side pattern that is produced after the Rule was applied.

Returns
the right side pattern
static NodeVec ggl::Rule::getRuleSideNodes ( const CoreGraph graph,
const RuleContext level 
)
staticprotected

Utility member function to derive the node information that describes a certain part of the Rule.

Parameters
graphthe core graph that contains the whole information
levelidentifies what RuleSide is of interest
Returns
the vector of node indices of the requested RuleSide
virtual const std::string* ggl::Rule::getUsedWildcard ( void  ) const
virtual

Access to the wildcard string to use for left side pattern matching

Returns
the wildcard or NULL if no wildcard is to be applied

Reimplemented in ggl::chem::ChemRule.

virtual size_t ggl::Rule::isConsistent ( void  ) const
virtual

Checks whether or not this rule is a consistent one. If not, a combination of according error codes is given.

Returns
the value is either C_Consistent, or a product of all other consistency error codes encountered

Reimplemented in ggl::chem::ChemRule.

Rule& ggl::Rule::operator= ( const Rule toCopy)

Assignment operator

Parameters
toCopythe Rule to make this a copy of
Returns
*this
void ggl::Rule::setID ( const std::string &  newID)

Sets the string identifier or description of the Rule.

Parameters
newIDthe new identifier to set
virtual void ggl::Rule::setUsedWildcard ( const std::string *const  wildcardToUse)
virtual

Sets the wildcard string to use for left side pattern matching. To disable wildcard matching set the wildcard to NULL.

Parameters
wildcardToUsethe wildcard to be applied or NULL if no wildcard matching should be done.

Reimplemented in ggl::chem::ChemRule.

Field Documentation

const size_t ggl::Rule_ConCodes::C_Consistent
staticinherited

Definition at line 37 of file Rule.hh.

const size_t ggl::Rule_ConCodes::C_NoID
staticinherited

Definition at line 39 of file Rule.hh.

const size_t ggl::Rule_ConCodes::C_WrongEdgeContext
staticinherited

Definition at line 41 of file Rule.hh.

RuleSide ggl::Rule::Context
protected

Definition at line 386 of file Rule.hh.

CopyAndPasteOperations ggl::Rule::copyAndPaste
protected

Definition at line 389 of file Rule.hh.

CoreGraph ggl::Rule::core
protected

Definition at line 163 of file Rule.hh.

std::string ggl::Rule::id
protected

Definition at line 166 of file Rule.hh.

RuleSide ggl::Rule::LeftSide
protected

Definition at line 382 of file Rule.hh.

RuleSide ggl::Rule::RightSide
protected

Definition at line 384 of file Rule.hh.

std::string* ggl::Rule::wildcard
protected

Definition at line 169 of file Rule.hh.


The documentation for this class was generated from the following file: