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

Graph grammar rule parser. More...

#include <Rule_GML_grammar.hh>

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

Data Structures

struct  definition
 The definition of the GML grammar. More...
 
class  keys_map
 
struct  keyvalue_closure
 
struct  lt_edge
 
struct  lt_node
 

Public Member Functions

 Rule_GML_grammar (Rule::CoreGraph &toFill, std::string &ruleID, std::vector< sgm::Pattern_Interface::Match_Constraint * > &ruleConstraints, Rule::CopyAndPasteOperations &copyAndPaste, std::string &wildcard)
 

Static Public Member Functions

static std::pair< Rule, int > parseRule (const std::string &GML_string) throw (Rule_GML_error)
 

Protected Types

typedef boost::tuple< int, int,
std::string, std::string > 
edge_t
 
typedef std::map< std::string,
kv_values_t
keys_map_t
 
enum  kv_values {
  Y_CONTXT = -3, N_CONTXT = -2, UNKNOWN = -1, INT_VAL = 0,
  STR_VAL = 1, DBL_VAL = 2, LST_VAL = 3, STRLST_VAL = 4
}
 enummeration of value types in gml key-value pairs More...
 
typedef enum kv_values kv_values_t
 
typedef boost::tuple< int,
std::string, std::string > 
node_t
 

Static Protected Member Functions

static std::string trimQuotes (const std::string &s)
 

Protected Attributes

Rule::CopyAndPasteOperationscopyAndPaste
 The copy-and-Paste operation container to be filled. More...
 
boost::property_map
< Rule::CoreGraph,
Rule::EdgeContextProperty >
::type 
edgeContext
 Access to the edge Rule context property_map of g2fill. More...
 
boost::property_map
< Rule::CoreGraph,
Rule::EdgeLabelProperty >
::type 
edgeLabel
 Access to the edge label property_map of g2fill to set edge labels. More...
 
Rule::CoreGraphg2fill
 
boost::property_map
< Rule::CoreGraph,
Rule::NodeContextProperty >
::type 
nodeContext
 Access to the node Rule context property_map of g2fill. More...
 
boost::property_map
< Rule::CoreGraph,
Rule::NodeLabelProperty >
::type 
nodeLabel
 Access to the node label property_map of g2fill to set node labels. More...
 
boost::property_map
< Rule::CoreGraph,
Rule::NodeRightLabelProperty >
::type 
nodeLabelRight
 
std::vector
< sgm::Pattern_Interface::Match_Constraint * > & 
ruleConstraints
 The additional constraints to be fulfilled by the rule to be filled. More...
 
std::string & ruleID
 The rule id that is filled. More...
 
std::string & wildcard
 The wildcard label that is filled if present. More...
 

Detailed Description

  Parses a GML string representation of a ggl::Rule object.

  Example :
      ====== RULE TO ENCODE =======================

        3(D) -1- 1(B)               3(E) -1- 1(B)
         |      /                    |        |
         2    3           ==>        4        3
         |  /                        |        |
        2(C) -0- 0(A)               2(C)     4(D)

      ======= RULE IN GML =========================

      rule [
              ruleID "Example rule"
              context [
                      node [ id 1 label "B" ]
                      node [ id 2 label "C" ]
                      edge [ source 1 target 3 label "-1-" ]
              ]
              left [
                      node [ id 0 label "A" ]
                      node [ id 3 label "D" ]
                      edge [ source 0 target 2 label "-0-" ]
                      edge [ source 1 target 2 label "-3-" ]
                      edge [ source 2 target 3 label "-2-" ]
              ]
              right [
                      node [ id 3 label "E" ]
                      node [ id 4 label "D" ]
                      edge [ source 2 target 3 label "-4-" ]
                      edge [ source 1 target 4 label "-3-" ]
              ]
      ]

      =============================================
    * 

BNF grammar of GML (http://www.infosun.fim.uni-passau.de/Graphlet/GML/)

       gml            ::= keyvalues
       keyvalues      ::= keyvalue (keyvalue)
       keyvalue       ::= key value
       key            ::= ['a'-'z''A'-'Z']['a'-'z''A'-'Z''0'-'9']
       value          ::= real | integer | string | operator | list
       real           ::= sign? digit  '.' digit+ mantissa
       integer        ::= sign? digit+
       string         ::= '"' instring '"'
       operator       ::= '>' | '<' | '=' | '!'
       list           ::= '[' keyvalues ']'
       sign           ::= '+' | '-'
       digit          ::= ['0'-'9']
       mantissa       ::= ('E' | 'e') sign? digit+
       instring       ::= ASCII-{'&', '"'} | '&' ['a'-'z''A'-'Z']  ';'
    * 
Author
Christoph Flamm (c) 2008 http://www.tbi.univie.ac.at/~xtof/
Martin Mann (c) 2008 http://www.bioinf.uni-freiburg.de/~mmann/

Definition at line 117 of file Rule_GML_grammar.hh.

Member Typedef Documentation

typedef boost::tuple<int,int,std::string,std::string> ggl::Rule_GML_grammar::edge_t
protected

Definition at line 136 of file Rule_GML_grammar.hh.

typedef std::map<std::string, kv_values_t> ggl::Rule_GML_grammar::keys_map_t
protected

Definition at line 145 of file Rule_GML_grammar.hh.

Definition at line 135 of file Rule_GML_grammar.hh.

typedef boost::tuple<int,std::string,std::string> ggl::Rule_GML_grammar::node_t
protected

Definition at line 137 of file Rule_GML_grammar.hh.

Member Enumeration Documentation

Enumerator
Y_CONTXT 
N_CONTXT 
UNKNOWN 
INT_VAL 
STR_VAL 
DBL_VAL 
LST_VAL 
STRLST_VAL 

Definition at line 123 of file Rule_GML_grammar.hh.

Constructor & Destructor Documentation

ggl::Rule_GML_grammar::Rule_GML_grammar ( Rule::CoreGraph toFill,
std::string &  ruleID,
std::vector< sgm::Pattern_Interface::Match_Constraint * > &  ruleConstraints,
Rule::CopyAndPasteOperations copyAndPaste,
std::string &  wildcard 
)
explicit

Constructs the definitions of a GML graph grammar to parse a GML graph string representation and to fill the encoded graph into a given boost graph object.

Parameters
toFillthe Rule core graph object to add nodes and edges to
ruleIDthe Rule ID to set
ruleConstraintsthe additional constraints that have to be met by the rule
copyAndPastethe copy-and-Paste operation container to fill
wildcardthe wildcard string to be filled. NOTE: if no wildcard was parsed this string is not changed, so check for a change to know if a wildcard was parsed or not!

Member Function Documentation

static std::pair< Rule, int > ggl::Rule_GML_grammar::parseRule ( const std::string &  GML_string) throw (Rule_GML_error)
static

Parses a GML string and generates a Rule object

Parameters
GML_stringthe string to parse
Returns
pair.first = the graph encoding of the molecule pair.second = -1 if parsing was successfull, in error case it returns the string position that caused the parsing error
Exceptions
ggl::Rule_GML_errorif parsing errors occur
static std::string ggl::Rule_GML_grammar::trimQuotes ( const std::string &  s)
staticprotected

Trims leading and tailing quotes from a string

Parameters
sthe string to trim
Returns
the trimmed string

Field Documentation

Rule::CopyAndPasteOperations& ggl::Rule_GML_grammar::copyAndPaste
protected

Definition at line 248 of file Rule_GML_grammar.hh.

boost::property_map<Rule::CoreGraph , Rule::EdgeContextProperty>::type ggl::Rule_GML_grammar::edgeContext
mutableprotected

Definition at line 282 of file Rule_GML_grammar.hh.

boost::property_map<Rule::CoreGraph , Rule::EdgeLabelProperty>::type ggl::Rule_GML_grammar::edgeLabel
mutableprotected

Definition at line 276 of file Rule_GML_grammar.hh.

Rule::CoreGraph& ggl::Rule_GML_grammar::g2fill
protected

The boost core graph object that is filled to represent the next parsed Rule.

Definition at line 239 of file Rule_GML_grammar.hh.

boost::property_map<Rule::CoreGraph , Rule::NodeContextProperty>::type ggl::Rule_GML_grammar::nodeContext
mutableprotected

Definition at line 270 of file Rule_GML_grammar.hh.

boost::property_map<Rule::CoreGraph , Rule::NodeLabelProperty>::type ggl::Rule_GML_grammar::nodeLabel
mutableprotected

Definition at line 257 of file Rule_GML_grammar.hh.

boost::property_map<Rule::CoreGraph , Rule::NodeRightLabelProperty>::type ggl::Rule_GML_grammar::nodeLabelRight
mutableprotected

Access to the right node label property_map of g2fill to set changing node labels

Definition at line 264 of file Rule_GML_grammar.hh.

std::vector< sgm::Pattern_Interface::Match_Constraint* >& ggl::Rule_GML_grammar::ruleConstraints
protected

Definition at line 245 of file Rule_GML_grammar.hh.

std::string& ggl::Rule_GML_grammar::ruleID
protected

Definition at line 242 of file Rule_GML_grammar.hh.

std::string& ggl::Rule_GML_grammar::wildcard
protected

Definition at line 251 of file Rule_GML_grammar.hh.


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