← Back to team overview

wintermute-devel team mailing list archive

[Merge] lp:~gentoolx/wintermute/database-archives into lp:~wintermute-devel/wintermute/database

 

Adrian Borucki has proposed merging lp:~gentoolx/wintermute/database-archives into lp:~wintermute-devel/wintermute/database.

Requested reviews:
  Wintermute Developers (wintermute-devel): feature-change

For more details, see:
https://code.launchpad.net/~gentoolx/wintermute/database-archives/+merge/60846

This branch contains changes in the read/write logic that allowed to use Boost text archives as a serialization backend for the LocalNodeWriter and the LocalNodeReader classes. There are also added documentation strings to classes and methods.

The logic change is that NodeWriter::write and NodeReader::read (formerly ::get) are now taking a Lexical object, not string which gives more flexibility to derived classes. The Lexical class, on the other hand, is now equipped with toString() method that returns its string representation.
-- 
https://code.launchpad.net/~gentoolx/wintermute/database-archives/+merge/60846
Your team Wintermute Developers is requested to review the proposed merge of lp:~gentoolx/wintermute/database-archives into lp:~wintermute-devel/wintermute/database.
=== modified file '.bzrignore'
--- .bzrignore	2011-05-10 06:26:25 +0000
+++ .bzrignore	2011-05-12 22:21:33 +0000
@@ -1,17 +1,15 @@
 *~
 api-doc/
-<<<<<<< TREE
 nbproject
 wintermute-database-cli/nbproject
 wintermute-database/nbproject
 dist
 build
 autotools
-=======
 debian/
 json/
 nbproject/
 dist/
 build/
->>>>>>> MERGE-SOURCE
 CMakeFiles
+*.kdev4

=== modified file 'TODO'
--- TODO	2011-04-22 13:58:22 +0000
+++ TODO	2011-05-12 22:21:33 +0000
@@ -1,6 +1,6 @@
 ** Add more data serialization handlers
 	- Perhaps to MySQL, JSON, XML
 
-** Move installing stuff to CMakeLists.txt
+** Move installing stuff to CMakeLists.txt -- Complete 
 
 ** Correct errors over files.

=== added file 'cmake/WntrDataConfigVersion.cmake.in'
=== renamed file 'cmake/WntrDataConfigVersion.cmake.in' => 'cmake/WntrDataConfigVersion.cmake.in.moved'
=== modified file 'include/wntr/data/linguistics.hpp'
--- include/wntr/data/linguistics.hpp	2011-05-06 09:18:59 +0000
+++ include/wntr/data/linguistics.hpp	2011-05-12 22:21:33 +0000
@@ -1,6 +1,7 @@
-/*
- *  @author: Jacky Alcine <jackyalcine@xxxxxxxxx>
- *  Copyright 2011 Jacky Alcine
+/**
+ * @file
+ * @author: Jacky Alcine <jackyalcine@xxxxxxxxx>
+ * Copyright 2011 Jacky Alcine
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -16,10 +17,8 @@
  * License along with this library; if not, write to the
  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  * Boston, MA 02111-1307, USA.
-
- * @file linguistics.hpp
- * @author jacky
- * @created March 29, 2011, 3:08 PM
+ *
+ * @date March 29, 2011, 3:08 PM
  */
 
 #ifndef LINGUISTICS_HPP
@@ -57,7 +56,7 @@
     namespace Data {
         namespace Linguistics {
             class Configuration;
-            class NodeIo;
+            class NodeIO;
             class LocalNode;
             class JsonNode;
             class XmlNode;
@@ -74,29 +73,48 @@
             class JsonNodeWriter;
 
             /**
-             */
-            typedef boost::signal2<bool, const string&, const string&> NodeIoExistsSignal;
-            /**
-             */
-            typedef boost::signal2<NodeIo*, const string&, const string&> NodeIoHandleSignal;
-            /**
-             */
-            typedef NodeIoExistsSignal::slot_type NodeIoExistsSlot;
-            /**
-             */
-            typedef NodeIoHandleSignal::slot_type NodeIoHandleSlot;
-            /**
-             */
-            typedef pair<NodeIoExistsSignal*, NodeIoHandleSignal*> NodeInteroperingSignalPair;
-            /**
+             * Signal type intended for checking data existence.
+             */
+            typedef boost::signal<bool (const string&, const string&)> NodeIOExistsSignal;
+            /**
+             * Signal type intended for handling data.
+             */
+            typedef boost::signal<NodeIO* (const string&, const string&)> NodeIOHandleSignal;
+            /**
+             * Slot of the NodeIOExistsSignal.
+             * @see NodeIOExistsSignal
+             */
+            typedef NodeIOExistsSignal::slot_type NodeIOExistsSlot;
+            /**
+			 * Slot of the NodeIOHandleSignal.
+			 * @see NodeIOHandleSignal
+             */
+            typedef NodeIOHandleSignal::slot_type NodeIOHandleSlot;
+            /**
+			 * Pair of pointers to signals used to operating on Nodes.
+			 * @see Node
+			 * @see NodeIOExistsSignal
+			 * @see NodeIOHandleSignal
+             */
+            typedef pair<NodeIOExistsSignal*, NodeIOHandleSignal*> NodeInteroperingSignalPair;
+            /**
+			 * Vector of NodeInteroperingSignalPair.
+			 * @see NodeInteroperingSignalPair
              */
             typedef vector<NodeInteroperingSignalPair> NodeInteroperingSignalVector;
+			
             /**
+			 * Synonym for the LocalNode.
+			 * @see LocalNode
              */
             typedef LocalNode LocalData;
+			
             /**
+			 * Synonym for the JsonData.
+			 * @see JsonNode
              */
             typedef JsonNode JsonData;
+			
             /**
              */
             typedef XmlNode XmlData;
@@ -104,10 +122,16 @@
             /**
              * An abstract static class representing the current configuration of the linguistics data.
              */
-            class Configuration {
+            class Configuration 
+            {
             private:
+                /* Configuration directory and locale variables */
                 static string _root;
                 static string _locale;
+
+                /* Serialization backend variables */
+                static string _serial_backend;
+
                 Configuration();
                 ~Configuration();
 
@@ -118,40 +142,60 @@
                  * @param string locale The locale that should be initially loaded.
                  */
                 static void Initialize(string const = _root, string const = _locale);
+				
                 /**
-                 * @description Sets the default locale to use.
+                 * Sets the default locale to use.
                  * @param locale The locale to set.
                  */
                 static void setLocale(string const = "");
+				
                 /**
-                 * @description Sets the root directory to load information from.
+                 * Sets the root directory to load information from.
                  * @param root The root directory.
                  */
                 static void setRootDirectory(string const = "");
+				
                 /**
-                 * @description Gets current locale used.
+                 * Gets current locale used.
                  * @return String with the current locale.
                  */
-                inline static const string getLocale();
+                inline static string getLocale()
+                { return _locale; }
+                
                 /**
-                 * @description Gets the root directory for the specified locale.
+                 * Gets the root directory for the specified locale.
                  * @param locale String with the locale name.
                  * @return String with the path to the locale root, relative to the main root.
                  */
-                static const string getRootDirectory(string const = "");
+                static string getRootDirectory(string const = "") ;
+
+                /**
+                 * Returns information about currently used serialization backend (actually only info about Boost backends).
+                 * @return String containing the name of the current serialization backend.
+                 */
+                inline static string getSerializationBackend() 
+                { return _serial_backend; }
+                
+                /**
+                 * Initializes new Boost oarchive according to default archive used.
+                 * @param ofstream Output file stream to use.
+                 * @return Reference to the new Boost oarchive.
+                 */
+                template<class Archive>
+                Archive* setOArchive( ofstream ofs);
             };
 
             /**
              * Represents the foundational class of all node input and output.
              */
-            class NodeIo {
+            class NodeIO {
             protected:
                 /**
-                 * Creates a new NodeIo.
+                 * Creates a new NodeIO.
                  * @param string nodeID The ID of the node.
                  * @param string nodeLocale The locale of the node.
                  */
-                NodeIo(const string&, const string&);
+                NodeIO(const string&, const string&);
                 const string strID;
                 const string strLocale;
             public:
@@ -159,46 +203,55 @@
                  * Obtains the representing ID of this I/O object.
                  * @return string The ID.
                  */
-                inline const string getID() const;
+                inline string getID() const
+                { return this->strID; }
+                
                 /**
                  * Obtains the underlying locale of this I/O object.
                  * @return string The locale in a two to five-character string.
                  */
-                inline const string getLocale() const;
+                inline string getLocale() const
+                { return this->strLocale; }
+                
                 /**
-                 *
-                 * @return
+                 * Checks whether the NodeIO is NULL.
+                 * @return bool True if the current object is NULL, False otherwise.
                  */
-                inline bool const isNull() const;
+                inline bool isNull() 
+                { return (this == NULL); }
             };
 
             /**
-             * Dependant on NodeIo; this class represents all NodeIo objects that
+             * Dependant on NodeIO; this class represents all NodeIO objects that
              * read data.
-             * @see NodeIo
              */
-            class NodeReader : public NodeIo {
+            class NodeReader : public NodeIO {
                 friend class Lexical;
+                
             private:
                 static NodeInteroperingSignalVector handles;
+                
             protected:
                 /**
-                 * Creates an input object based on NodeIo.
+                 * Creates an input object based on NodeIO.
                  * @param string nodeID The ID of the node.
                  * @param string nodeLocale The locale of the node.
                  */
-                NodeReader(const string&, const string&);
+                NodeReader(const string, const string);
+                
                 /**
-                 * 
-                 * @param
+                 * Creates an input object based on an existing NodeIO.
+                 * @param NodeReader The reference to the existing node reader.
                  */
-                NodeReader(const NodeReader&);
-                NodeReader(const NodeIo&);
+                NodeReader(NodeReader const &);
+				
+                NodeReader(NodeIO const &);
+				
                 /**
                  * Returns the data to be parsed as a Node.
-                 * @return string
+                 * @return String representation of the Node.
                  */
-                virtual const string get() const;
+                virtual void read(Lexical& out);
 
             public:
                 /**
@@ -207,175 +260,260 @@
                  * @see NodeInteroperingSignalPair
                  * @see NodeReader::obtain
                  */
-                static void addHandle(const NodeInteroperingSignalPair&);
+                static void addHandle(NodeInteroperingSignalPair const &);
+				
                 /**
-                 *
-                 * @param
-                 * @param
-                 * @return
+                 * Create new NodeReader and return pointer to it.
+                 * @param string ID of the new node.
+                 * @param string Locale of the new node.
+                 * @return Pointer to the new NodeReader instance.
+				 * @see NodeReader::NodeReader(string const, string const)
                  */
                 static NodeReader* obtain(const string&, const string&);
                 /**
-                 *
-                 * @param
-                 * @param
-                 * @return
+                 * Check whether given NodeReader exists.
+                 * @param string Node ID.
+                 * @param string Node locale.
+                 * @return True if the given NodeReader exists, false otherwise.
                  */
                 static bool exists(const string&, const string&);
-                static void getData(const NodeReader&, Lexical&);
+                static void getData(NodeReader& reader, Lexical& out);
             };
 
             /**
+             * Class representing objects used to perform writing operations.
              */
-            class NodeWriter : public NodeIo {
-                friend class Lexical;
+            class NodeWriter : public NodeIO {
+//                 friend class Lexical;
+                
             private:
                 static NodeInteroperingSignalVector handles;
 
             protected:
                 /**
-                 *
-                 * @param
-                 * @param
+                 * NodeWriter constructor.
+                 * @param string Node ID.
+                 * @param string Node locale.
                  */
                 NodeWriter(const string&, const string&);
+                
                 /**
-                 * 
-                 * @param
+                 * NodeWriter constructor.
+                 * @param NodeIO NodeIO instance to use as a base.
                  */
-                NodeWriter(const NodeIo&);
+                NodeWriter(const NodeIO&);
+                
                 /**
-                 * 
-                 * @param
+                 * NodeWriter copy constructor.
+                 * @param NodeWriter Reference to NodeWriter to use.
                  */
                 NodeWriter(const NodeWriter&);
+                
                 /**
-                 *
-                 * @param
+                 * Write data from the Lexical object.
+                 * @param Lexical Reference to the Lexical object -- source of the data.
                  */
-                virtual void write(const string&);
+                virtual void write(Lexical& data);
 
             public:
                 /**
-                 *
-                 * @param
+                 * 
+                 * @param NodeInteroperingSignalPair Pair of signals to insert.
                  */
-                static void addHandle(const NodeInteroperingSignalPair&);
+                static void addHandle(const NodeInteroperingSignalPair &);
+                
                 /**
-                 *
-                 * @param
-                 * @param
-                 * @return
+                 * Create new NodeWriter returning pointer to it.
+                 * @param string Node ID.
+                 * @param string Node locale.
+                 * @return Poiter to the new NodeWriter instance.
+                 * @see NodeWriter::NodeWriter(const string&, const string&)
                  */
                 static NodeWriter* obtain(const string&, const string&);
-                /**
-                 *
-                 * @param
-                 * @param
-                 * @return
-                 */
-                static bool exists(const string&, const string&);
+                
+                /**
+                 * Check whether NodeWriter exists.
+                 * @param string Node ID.
+                 * @param string Node locale.
+                 * @return True if NodeWriter found, false otherwise.
+                 */
+                static bool exists(const string, const string);
+                
+                /**
+                 * Wrapper for the NodeWriter::write function.
+                 * @param NodeWriter Reference to the NodeWriter that performs writing.
+                 * @param[out] Lexical Reference to the Lexical object that serves as a data source. 
+                 */
                 static void setData(NodeWriter&, Lexical&);
             };
-
+            
             /**
+             * Class responsible for handling lexical data.
              */
-            class Lexical {
-            protected:
-                Lexical();
+            class Lexical
+            {
+                friend ostream& operator <<(ostream& ost, Lexical const & lex);
+                friend class boost::serialization::access;
+                
             public:
-                /**
-                 */
                 typedef map<string, string> LexicalMap;
-                static Lexical* obtain();
-                void save(NodeWriter&);
-                void load(const NodeReader&);
-                string& symbol();
-                LexicalMap& flags();
+                
+                /**
+                * Return pointer to the new Lexical instance.
+                * @return Pointer to the newly created Lexical object.
+                * @see Lexical::Lexical()
+                */
+                inline static Lexical* obtain()
+                { return new Lexical(); }
+
+                inline static Lexical* obtain(string symbol, LexicalMap flags)
+                { return new Lexical(symbol, flags); }
+				
+				/**
+                 * Load data to this Lexical object using NodeReader.
+                 * @param NodeReader Reference to the NodeReader object to use.
+                 * @see Lexical::save(NodeWriter &)
+                 */
+                void load(NodeReader& nodeReader);
+                
+                /**
+                 * Save data from this Lexical object using NodeWriter.
+                 * @param NodeWriter Reference to the NodeWriter object to use.
+                 * @see Lexical::load(NodeReader &)
+                 */
+                void save(NodeWriter &);
+
+                inline string& symbol()
+                { return this->_symbol;}
+			
+                inline LexicalMap& flags()
+                { return this->_flags; }
+                
+                /**
+                 * Return string representation of the Lexical object.
+                 * @return String containing representation of the data in the Lexical object.
+                 */
+                string toString();
+                
+                Lexical() {}
+                virtual ~Lexical() {}
+                
+            protected:
+                Lexical(string symbol, LexicalMap flags) : _symbol(symbol), _flags(flags)
+                {}
+
             private:
-                string _strSymbol;
-                LexicalMap _data;
+                string _symbol;
+                LexicalMap _flags;
+                
+                /**
+                 * Function needed to add serialization capability by Boost Serialization library.
+                 */
+                template<class Archive>
+                void serialize(Archive& ar, unsigned int const version);
             };
+            
+            /**
+             * Operator for printing the Lexical object content to the stdout.
+             * @param[out] ostream Output stream to use.
+             * @param[in] Lexical Lexical object to print out.
+             */
+            ostream& operator <<(ostream& ost, Lexical const& lex);
 
             /**
+             * Class being an interface for all classes working with the local data.
              */
             class LocalNode {
             protected:
                 /**
-                 *
+                 * Create new LocalNode.
                  */
                 LocalNode();
+                
                 virtual ~LocalNode() = 0;
+                
                 /**
-                 *
-                 * @param
-                 * @param
-                 * @return
+                 * Get path to the file representing LocalNode.
+                 * @param string Node ID.
+                 * @param string Node locale.
+                 * @return String describing path to the file.
                  */
-                static const string getPath(const string&, const string&);
+                static string getPath(const string&, const string&);
 
             public:
                 /**
-                 *
-                 * @param
-                 * @param
-                 * @return
+                 * Check whether an instance of LocalNode exists.
+                 * @param string Node ID.
+                 * @param string Node locale.
+                 * @return True if an object was found, false otherwise.
                  */
                 static bool exists(const string&, const string&);
             };
 
             /**
-             *
+             * Class intended for reading nodes from local files.
              */
-            class LocalNodeReader : public NodeReader, protected LocalNode {
+            class LocalNodeReader : public NodeReader, protected LocalNode
+            {
             protected:
                 /**
-                 *
-                 * @param
-                 * @param
+                 * Create new LocalNodeReader.
+                 * @param string Node ID.
+                 * @param string Node locale.
                  */
                 LocalNodeReader(const string&, const string&);
+
+                /**
+                 * Create new LocalNodeReader from an existing NodeReader.
+                 * @param NodeReader An instance of NodeReader class.
+                 */
                 LocalNodeReader(const NodeReader&);
+                
             public:
                 /**
-                 *
-                 * @param
-                 * @param
-                 * @return
+                 * Create new LocalNodeReader returning pointer to it.
+                 * @param string Node ID.
+                 * @param string Node locale.
+                 * @return Pointer to the new LocalNodeReader instance.
+                 * @see LocalNodeReader::LocalNodeReader(const string&, const string&)
                  */
                 static LocalNodeReader* obtain(const string&, const string&);
+                
                 /**
-                 *
-                 * @return
+                 * Load data from file to the Lexical object.
+                 * @param[out] Lexical Reference to the Lexical object where data is to be loaded in.
                  */
-                const string get() const;
+                 virtual void read(Lexical& out);
             };
 
             /**
+             * Class intended for writing to local files.
              */
             class LocalNodeWriter : public NodeWriter, protected LocalNode {
             protected:
                 /**
-                 *
-                 * @param
-                 * @param
+                 * LocalNodeWriter constructor.
+                 * @param string Node ID.
+                 * @param string Node locale.
                  */
                 LocalNodeWriter(const string&, const string&);
                 LocalNodeWriter(const NodeWriter&);
 
             public:
                 /**
-                 *
-                 * @param
-                 * @param
-                 * @return
+                 * Create new LocalNodeWriter instance returning pointer to it.
+                 * @param string Node ID.
+                 * @param string Node locale.
+                 * @return Pointer to the new LocalNodeWriter object.
+                 * @see LocalNodeWriter::LocalNodeWriter(const string&, const string&)
                  */
                 static LocalNodeWriter* obtain(const string&, const string&);
+                
                 /**
-                 *
-                 * @param
+                 * Write data to the file.
+                 * @param Lexical The Lexical instance serving as a data source.
                  */
-                void write(const string&);
+                virtual void write(Lexical& data);
             };
 
             /**
@@ -389,6 +527,7 @@
                 XmlNode();
                 virtual ~XmlNode() = 0;
                 static XmlDataSources _docs;
+                
                 /**
                  *
                  * @param
@@ -396,12 +535,14 @@
                  * @return
                  */
                 static Element* obtainNode(const string&, const string&);
+                
                 /**
                  *
                  * @param
                  * @return
                  */
                 static Element* getXmlLocale(const string& = "");
+                
             public:
                 /**
                  *
@@ -409,6 +550,7 @@
                  * @return
                  */
                 static bool loadLocale(const string& = "");
+                
                 /**
                  *
                  * @param
@@ -441,7 +583,7 @@
                  *
                  * @return
                  */
-                virtual const string get() const;
+                virtual void read(Lexical& out);
             };
 
             /**
@@ -466,26 +608,31 @@
                  *
                  * @param
                  */
-                virtual void write(const string&);
+                virtual void write(Lexical& data);
             };
 
             /**
              */
             class JsonNode {
                 typedef map<const string, Json::Value> JsonDataSources;
+                
             protected:
                 /**
                  *
                  */
                 JsonNode();
+                
                 virtual ~JsonNode() = 0;
+                
                 static JsonDataSources _data;
+                
                 /**
                  *
                  * @param
                  * @return
                  */
                 static Json::Value getJsonLocale(const string& = "");
+                
             public:
                 /**
                  *
@@ -493,6 +640,7 @@
                  * @return
                  */
                 static bool loadLocale(const string& = "");
+                
                 /**
                  *
                  * @param
@@ -525,7 +673,7 @@
                  *
                  * @return
                  */
-                virtual const string get() const;
+                virtual void read(Lexical& out);
             };
 
             /**
@@ -539,6 +687,7 @@
                  * @param
                  */
                 JsonNodeWriter(const string&, const string&);
+                
             public:
                 /**
                  *
@@ -547,11 +696,12 @@
                  * @return
                  */
                 static JsonNodeWriter* obtain(const string&, const string&);
+                
                 /**
-                 *
-                 * @param
+                 * Create JSON data from string and write it.
+                 * @param string String representation of a Lexical object.
                  */
-                virtual void write(const string&);
+                virtual void write(Lexical& data);
             };
         }
     }

=== modified file 'src/linguistics.cpp'
--- src/linguistics.cpp	2011-05-06 09:50:35 +0000
+++ src/linguistics.cpp	2011-05-12 22:21:33 +0000
@@ -1,6 +1,7 @@
 /**
- *  @author Jacky Alcine <jackyalcine@xxxxxxxxx>
- *  @copyright 2011 SII
+ * @file
+ * @author Jacky Alcine <jackyalcine@xxxxxxxxx>
+ * @copyright 2011 SII
  *
  * <license>
  * This library is free software; you can redistribute it and/or
@@ -21,8 +22,12 @@
  *
  */
 
+#include <boost/serialization/string.hpp>
+#include <boost/serialization/map.hpp>
+
 #include <boost/signals.hpp>
 #include <boost/filesystem.hpp>
+
 #include <jsoncpp/json.hpp>
 #include <libxml++/libxml++.h>
 
@@ -60,47 +65,51 @@
             XmlNode::XmlDataSources XmlNode::_docs;
             JsonNode::JsonDataSources JsonNode::_data;
 
+            /* Configuration internals */
             string Configuration::_root = __WDATA_DATA_DIR__; 
             string Configuration::_locale = "en";
 
+            /* Backend variables */
+            string Configuration::_serial_backend = __WDATA_SERIAL_BACKEND__;
+
             /// @todo Fix the XmlNode and JsonNode readers; they're not working!
             void Configuration::Initialize(string const root, string const locale) {
 #ifdef DEBUG
                 cout << "(database) Initializing Linguistics data.." << endl;
 #endif
                 NodeInteroperingSignalPair localNodeReader;
-                localNodeReader.first = new NodeIoExistsSignal;
-                localNodeReader.second = new NodeIoHandleSignal;
+                localNodeReader.first = new NodeIOExistsSignal;
+                localNodeReader.second = new NodeIOHandleSignal;
                 localNodeReader.first->connect(&LocalNode::exists);
                 localNodeReader.second->connect(&LocalNodeReader::obtain);
 
                 NodeInteroperingSignalPair jsonNodeReader;
-                jsonNodeReader.first = new NodeIoExistsSignal;
-                jsonNodeReader.second = new NodeIoHandleSignal;
+                jsonNodeReader.first = new NodeIOExistsSignal;
+                jsonNodeReader.second = new NodeIOHandleSignal;
                 jsonNodeReader.first->connect(&JsonNode::exists);
                 jsonNodeReader.second->connect(&JsonNodeReader::obtain);
 
                 NodeInteroperingSignalPair xmlNodeReader;
-                xmlNodeReader.first = new NodeIoExistsSignal;
-                xmlNodeReader.second = new NodeIoHandleSignal;
+                xmlNodeReader.first = new NodeIOExistsSignal;
+                xmlNodeReader.second = new NodeIOHandleSignal;
                 xmlNodeReader.first->connect(&XmlNode::exists);
                 xmlNodeReader.second->connect(&XmlNodeReader::obtain);
 
                 NodeInteroperingSignalPair localNodeWriter;
-                localNodeWriter.first = new NodeIoExistsSignal;
-                localNodeWriter.second = new NodeIoHandleSignal;
+                localNodeWriter.first = new NodeIOExistsSignal;
+                localNodeWriter.second = new NodeIOHandleSignal;
                 localNodeWriter.first->connect(&LocalNode::exists);
                 localNodeWriter.second->connect(&LocalNodeWriter::obtain);
 
                 NodeInteroperingSignalPair jsonNodeWriter;
-                jsonNodeWriter.first = new NodeIoExistsSignal;
-                jsonNodeWriter.second = new NodeIoHandleSignal;
+                jsonNodeWriter.first = new NodeIOExistsSignal;
+                jsonNodeWriter.second = new NodeIOHandleSignal;
                 jsonNodeWriter.first->connect(&JsonNode::exists);
                 jsonNodeWriter.second->connect(&JsonNodeWriter::obtain);
 
                 /*NodeInteroperingSignalPair xmlNodeWriter;
-                xmlNodeWriter.first = new NodeIoExistsSignal;
-                xmlNodeWriter.second = new NodeIoHandleSignal;
+                xmlNodeWriter.first = new NodeIOExistsSignal;
+                xmlNodeWriter.second = new NodeIOHandleSignal;
                 xmlNodeWriter.first->connect(&XmlNode::exists);
                 xmlNodeWriter.second->connect(&XmlNodeWriter::obtain);*/
 #ifdef DEBUG
@@ -134,7 +143,8 @@
 #endif
             }
 
-            void Configuration::setRootDirectory(string const root) {
+            void Configuration::setRootDirectory(string const root) 
+            {
                 if (root.size() == 0)
                     return;
 
@@ -145,11 +155,8 @@
 #endif
             }
 
-            inline string const Configuration::getLocale() {
-                return Configuration::_locale;
-            }
-
-            string const Configuration::getRootDirectory(string const locale) {
+            string Configuration::getRootDirectory(const std::string locale) 
+            {
                 string newLocale = locale;
                 if (newLocale.empty())
                     newLocale = Configuration::getLocale();
@@ -158,33 +165,43 @@
                 boost::filesystem::path thePath(path);
                 return thePath.string();
             }
-
-            NodeIo::NodeIo(const string& nodeID, const string& nodeLocale) : strID(nodeID), strLocale(nodeLocale) {
-            }
-
-            inline string const NodeIo::getID() const {
-                return this->strID;
-            }
-
-            inline string const NodeIo::getLocale() const {
-                return this->strLocale;
-            }
-
-            inline bool const NodeIo::isNull() const {
-                return (this == NULL);
-            }
-
-            NodeReader::NodeReader(const string& nodeID, const string& nodeLocale) : NodeIo(nodeID, nodeLocale) {
+            
+            template<class Archive>
+            Archive* Configuration::setOArchive(ofstream ofs)
+            {
+//                 if (Configuration::_serial_backend == "text")
+//                     return new boost::archive::text_oarchive(ofs);
+//                 else 
+//                 if (Configuration::_serial_backend == "xml")
+//                     return new boost::archive::xml_oarchive(ofs);
+//                 else
+//                 if (Configuration::_serial_backend == "binary")
+//                     return new boost::archive::binary_oarchive(ofs);
+//                 else
+//                     cout << "*** Unknown archive type!!! Done nothing. \n";
+//                  throw ConfigException
+
+                /* Temporary solution */
+                return new boost::archive::text_oarchive(ofs);
+                
+            }
+
+            NodeIO::NodeIO(const string& nodeID, const string& nodeLocale) : strID(nodeID), strLocale(nodeLocale) 
+            {}
+
+            NodeReader::NodeReader(const string nodeID, const string nodeLocale) : NodeIO(nodeID, nodeLocale) 
+            {
 #ifdef DEBUG
-                cout << "(database) Abstract linguistcal data input source initialized for (" << nodeLocale << ")# " << nodeID << "." << endl;
+                cout << "(database) Abstract linguistcal data input source initialized for (" << nodeLocale << ") #" << nodeID << "." << endl;
 #endif
             }
 
-            NodeReader::NodeReader(const NodeReader& node) : NodeIo(node.getID(), node.getLocale()) {
-
-            }
-
-            void NodeReader::addHandle(const NodeInteroperingSignalPair& dataPair) {
+            NodeReader::NodeReader(const NodeReader & node)
+			: NodeIO(node.getID(), node.getLocale())
+			{}
+
+            void NodeReader::addHandle(const NodeInteroperingSignalPair& dataPair) 
+            {
                 if (!(&dataPair == NULL)) {
                     NodeReader::handles.push_back(dataPair);
 #ifdef DEBUG
@@ -197,10 +214,12 @@
 #ifdef DEBUG
                 cout << "(database) Searching for linguistics data input sources..." << endl;
 #endif
-                for (NodeInteroperingSignalVector::const_iterator itr = NodeReader::handles.begin(); itr != NodeReader::handles.end(); itr++) {
-                    const NodeInteroperingSignalPair aPair = *itr;
-                    if ((*aPair.first)(nodeID, nodeLocale))
-                        return static_cast<NodeReader*> ((*aPair.second)(nodeID, nodeLocale));
+                for ( NodeInteroperingSignalVector::const_iterator itr = NodeReader::handles.begin();
+                     itr != NodeReader::handles.end(); itr++)
+                {
+                    const NodeInteroperingSignalPair sigPair = *itr;
+                    if ((*sigPair.first)(nodeID, nodeLocale))
+                        return static_cast<NodeReader*> ((*sigPair.second)(nodeID, nodeLocale));
                 }
 #ifdef DEBUG
                 cout << "(database) No linguistics data input sources found!" << endl;
@@ -220,7 +239,7 @@
                 return false;
             }
 
-            const string NodeReader::get() const {
+            void NodeReader::read(Lexical& out) {
 #ifdef DEBUG
                 cout << "(database) [NodeReader] Reading from stdin..." << endl;
 #endif
@@ -234,49 +253,71 @@
                     outData << flags << " " << semid << " " << endl;
                 }
 
-                return outData.str();
-            }
-
-            void NodeReader::getData(const NodeReader& data, Lexical& out) {
-#ifdef DEBUG
-                cout << "(database) [NodeReader] *** Read node #" << data.getID() << ".." << endl;
-#endif
-                const string theData = data.get();
+                string theData = outData.str();
+                
                 if (!theData.empty()) {
                     out.flags().clear();
                     string symbol, flags, semid;
                     istringstream inData(theData);
-
+                    
                     inData >> out.symbol();
-
+                    
                     while (inData >> flags >> semid)
                         out.flags().insert(Lexical::LexicalMap::value_type(flags, semid));
-
+                    
                     inData.clear();
                 }
-            }
-
-            NodeWriter::NodeWriter(const string& nodeID, const string& nodeLocale) : NodeIo(nodeID, nodeLocale) {
+
+//                 return outData.str();
+            }
+
+            void NodeReader::getData(NodeReader& reader, Lexical& out) 
+            {
+#ifdef DEBUG
+                cout << "(database) [NodeReader] *** Read node #" << reader.getID() << "..." << endl;
+#endif
+                
+                reader.read(out);
+                
+//                 if (!theData.empty()) {
+//                     out.flags().clear();
+//                     string symbol, flags, semid;
+//                     istringstream inData(theData);
+// 
+//                     inData >> out.symbol();
+// 
+//                     while (inData >> flags >> semid)
+//                         out.flags().insert(Lexical::LexicalMap::value_type(flags, semid));
+// 
+//                     inData.clear();
+//                 }
+            }
+
+            NodeWriter::NodeWriter(const string& nodeID, const string& nodeLocale) : NodeIO(nodeID, nodeLocale)
+            {
 #ifdef DEBUG
                 cout << "(database) Abstract linguistcal data output source initialized for (" << nodeLocale << ")# " << nodeID << "." << endl;
 #endif
             }
 
-            NodeWriter::NodeWriter(const NodeWriter& node) : NodeIo(node.getID(), node.getLocale()) {
+            NodeWriter::NodeWriter(const NodeWriter& node) : NodeIO(node.getID(), node.getLocale())
+            {
 #ifdef DEBUG
                 cout << "(database) [NodeWriter] Abstract linguistcal data output source initialized for (" << getLocale() << ")# " << getID() << "." << endl;
 #endif
             }
 
-            NodeWriter::NodeWriter(const NodeIo& io) : NodeIo(io) {
+            NodeWriter::NodeWriter(const NodeIO& io) : NodeIO(io)
+            {
 #ifdef DEBUG
-                cout << "(database) [NodeIo] Abstract linguistcal data output source initialized for (" << getLocale() << ")# " << getID() << "." << endl;
+                cout << "(database) [NodeIO] Abstract linguistcal data output source initialized for (" << getLocale() << ")# " << getID() << "." << endl;
 #endif
             }
 
-            void NodeWriter::addHandle(const NodeInteroperingSignalPair& dataPair) {
-                if (!(&dataPair == NULL)) {
-                    NodeWriter::handles.push_back(dataPair);
+            void NodeWriter::addHandle(const NodeInteroperingSignalPair& sigPair)
+            {
+                if (!(&sigPair == NULL)) {
+                    NodeWriter::handles.push_back(sigPair);
 #ifdef DEBUG
                     cout << "(database) Linguistics data output source added (#" << NodeWriter::handles.size() << ")" << endl;
 #endif
@@ -293,98 +334,116 @@
                         return new NodeWriter(*(*aPair.second)(nodeID, nodeLocale));
                     }
                 }
+                
 #ifdef DEBUG
                 cout << "(database) No linguistics data output sources found!" << endl;
 #endif
                 return NULL;
             }
 
-            bool NodeWriter::exists(const string &nodeID, const string &nodeLocale) {
-                for (NodeInteroperingSignalVector::const_iterator itr = NodeWriter::handles.begin(); itr != NodeWriter::handles.end(); itr++) {
-                    const NodeInteroperingSignalPair aPair = *itr;
-                    if ((*aPair.first)(nodeID, nodeLocale))
+            bool NodeWriter::exists(const std::string nodeID, const std::string nodeLocale)
+            {
+                for ( NodeInteroperingSignalVector::const_iterator itr = NodeWriter::handles.begin();
+                     itr != NodeWriter::handles.end(); itr++)
+                {
+                    NodeInteroperingSignalPair const sigPair = *itr;
+                    if ((*sigPair.first)(nodeID, nodeLocale))
                         return true;
                 }
                 return false;
             }
 
-            void NodeWriter::write(const string& data) {
+            void NodeWriter::write( Wintermute::Data::Linguistics::Lexical& data)
+            {
 #ifdef DEBUG
                 cout << "(database) [NodeWriter] Writing to stdout..." << endl;
                 cout << data << endl;
 #endif
             }
 
-            void NodeWriter::setData(NodeWriter& writer, Lexical& in) {
-                ostringstream outData;
-                outData << in.symbol() << endl;
-
-                for (Lexical::LexicalMap::const_iterator itr = in.flags().begin(); itr != in.flags().end(); itr++)
-                    outData << itr->first << " " << itr->second << endl;
-
-                writer.write(outData.str());
-                outData.clear();
+            void NodeWriter::setData(NodeWriter& writer, Lexical& in) 
+            {
+                writer.write(in);
             }
 
-            LocalNode::LocalNode() {
+            LocalNode::LocalNode()
+            {
 #ifdef DEBUG
                 cout << "(database) [LocalNode] Linguisics data source base initialized." << endl;
 #endif
             }
 
-            LocalNode::~LocalNode() {
+            LocalNode::~LocalNode()
+            {
 #ifdef DEBUG
                 cout << "(database) [LocalNode] Linguisics data source base destroyed." << endl;
 #endif
             }
 
-            const string LocalNode::getPath(const string& nodeID, const string& nodeLocale) {
+            string LocalNode::getPath(const string& nodeID, const string& nodeLocale) 
+            {
                 string myLocale = nodeLocale;
-                if (nodeLocale.empty())
+                if (myLocale.empty())
                     myLocale = Configuration::getLocale();
 
                 string path = Configuration::getRootDirectory(nodeLocale) + string("/nods/") + nodeID;
-                boost::filesystem::path thePath(path);
-
-                //cout << "Formed path: " << thePath.relative_path().string() << endl;
-                return thePath.string();
+                boost::filesystem::path nodePath(path);
+#ifdef DEBUG
+                cout << "Formed path: " << nodePath.string() << endl;
+#endif
+                return nodePath.string();
             }
 
-            bool LocalNode::exists(const string& nodeID, const string& nodeLocale) {
-               //cout << "(database) [LocalNode] Determing existence of (" << nodeLocale << ")'" << nodeID << "'..." << endl;
+            bool LocalNode::exists(const string& nodeID, const string& nodeLocale)
+            {
+#ifdef DEBUG
+                cout << "(database) [LocalNode] Determing existence of (" << nodeLocale << ")'" << nodeID << "'..." << endl;
+#endif
                 return boost::filesystem::exists(LocalNode::getPath(nodeID, nodeLocale));
             }
 
-            LocalNodeReader::LocalNodeReader(const string& nodeID, const string& nodeLocale) : NodeReader(nodeID, nodeLocale), LocalNode() {
-               //cout << "(database) [LocalNodeReader] Linguistics data input source initialized. " << endl;
-            }
-
-            LocalNodeReader::LocalNodeReader(const NodeReader& node) : NodeReader(node), LocalNode() {
-
-            }
-
-            const string LocalNodeReader::get() const {
+            LocalNodeReader::LocalNodeReader(const string& nodeID, const string& nodeLocale) : NodeReader(nodeID, nodeLocale), LocalNode()
+            {
+#ifdef DEBUG
+                cout << "(database) [LocalNodeReader] Linguistics data input source initialized. " << endl;
+#endif
+            }
+
+            LocalNodeReader::LocalNodeReader(const NodeReader& node) : NodeReader(node), LocalNode()
+            {}
+
+            void LocalNodeReader::read(Lexical& out)
+            {
                 // TODO: Allow configuration of location globally and internally.
-                string path, data, flags, semid;
+//                 string path, 
+//                 data, flags, semid;
 
                 // get the path to the node on disk.
-                path = LocalNode::getPath(this->getID(), this->getLocale());
-
-                ifstream inNode(path.c_str(), ios::in);
-                ostringstream outData("");
-                inNode >> data;
-                outData << data << endl;
-
-                while (inNode >> flags >> semid)
-                    outData << flags << " " << semid << " " << endl;
-
-                inNode.close();
-               //cout << outData.str() << std::endl;
-                return outData.str();
+                string path = LocalNode::getPath(this->getID(), this->getLocale());
+                ifstream ifNode(path.c_str(), ios::in);
+                
+                {
+                    boost::archive::text_iarchive ifNodeArchive(ifNode);
+                    ifNodeArchive >> out;
+                }
+                
+//                 ostringstream outData("");
+//                 ifNode >> data;
+//                 outData << data << endl;
+// 
+//                 while (ifNode >> flags >> semid)
+//                     outData << flags << " " << semid << " " << endl;
+// 
+//                 ifNode.close();
+//                //cout << outData.str() << std::endl;
+//                 return outData.str();
             }
 
-            LocalNodeReader* LocalNodeReader::obtain(const string& nodeID, const string& nodeLocale) {
-               //cout << "(database) [LocalNodeReader] Linguistics data input source formed. " << endl;
+            LocalNodeReader* LocalNodeReader::obtain(const string& nodeID, const string& nodeLocale)
+            {
+#ifdef DEBUG
+                cout << "(database) [LocalNodeReader] Linguistics data input source formed. " << endl;
+#endif
                 if (LocalNode::exists(nodeID,nodeLocale))
                     return new LocalNodeReader(nodeID, nodeLocale);
                 else
@@ -392,44 +451,76 @@
             }
 
             LocalNodeWriter::LocalNodeWriter(const string& nodeID, const string& nodeLocale) : NodeWriter(nodeID, nodeLocale), LocalNode() {
-               //cout << "(database) [LocalNodeWriter] Linguistics data output source initialized. " << endl;
+#ifdef DEBUG
+                cout << "(database) [LocalNodeWriter] Linguistics data output source initialized. " << endl;
+#endif
                 if (LocalNode::exists(nodeID, nodeLocale)){
-                   //cout << "(database) [LocalNodeWriter] Overwriting pre-existing data... " << endl;
-                }
-            }
-
-            LocalNodeWriter::LocalNodeWriter(const NodeWriter& node) : NodeWriter(node), LocalNode() {
-               //cout << "(database) [LocalNodeWriter] Linguistics data output source initialized. " << endl;
-                if (LocalNode::exists(getID(), getLocale())){
-                   //cout << "(database) [LocalNodeWriter] Overwriting pre-existing data... " << endl;
-                }
-            }
-
-            void LocalNodeWriter::write(const string& data) {
-               //cout << "(database) [LocalNodeWriter] Saving... " << endl;
-                string path;
-
-                path = LocalNode::getPath(this->getID(), this->getLocale());
-                ofstream outNode(path.c_str(), ios::out | ios::trunc);
-                outNode << data;
-                outNode.close();
-               //cout << "(database) [LocalNodeWriter] Wrote " << data.length() * sizeof (char) << " bytes to '" << path << "'." << endl;
-            }
-
-            LocalNodeWriter* LocalNodeWriter::obtain(const string& nodeID, const string& nodeLocale) {
+#ifdef DEBUG
+                    cout << "(database) [LocalNodeWriter] Overwriting pre-existing data... " << endl;
+#endif
+                }
+            }
+
+            LocalNodeWriter::LocalNodeWriter(const NodeWriter& node) : NodeWriter(node), LocalNode() 
+            {
+#ifdef DEBUG
+                cout << "(database) [LocalNodeWriter] Linguistics data output source initialized. " << endl;
+#endif
+                if (LocalNode::exists(getID(), getLocale()))
+                {
+#ifdef DEBUG
+                    cout << "(database) [LocalNodeWriter] Overwriting pre-existing data... " << endl;
+#endif
+                }
+            }
+
+            void LocalNodeWriter::write( Wintermute::Data::Linguistics::Lexical& data)
+            {
+#ifdef DEBUG
+                cout << "(database) [LocalNodeWriter] Saving... " << endl;
+#endif
+                
+                string path = LocalNode::getPath(this->getID(), this->getLocale());
+                ofstream ofNode(path.c_str(), ios::trunc);
+//                 ofstream ofNode("/home/gentoolx/wntr/data/locale/en/nods/a98a7se7yf9aas9df8u0w0as", ios::trunc);
+                
+                // ofNodeArchive = Configuration::setOArchive(ofNode);
+                {
+                    boost::archive::text_oarchive ofNodeArchive(ofNode);
+//                    ofNode << data;
+                    ofNodeArchive << data;
+//                    ofNode.close();
+                }
+                
+#ifdef DEBUG 
+                cout << "(database) [LocalNodeWriter] Wrote " << data.toString().length() * sizeof (char) << " bytes " << "to '" << path << "'." << endl;
+#endif
+            }
+
+            LocalNodeWriter* LocalNodeWriter::obtain(const string& nodeID, const string& nodeLocale) 
+            {
                 return new LocalNodeWriter(nodeID, nodeLocale);
             }
 
-            JsonNode::JsonNode() {
-               //cout << "(database) [JsonNode] Linguisics data source base initialized." << endl;
-            }
-
-            JsonNode::~JsonNode() {
-               //cout << "(database) [JsonNode] Linguisics data source base destroyed." << endl;
-            }
-
-            bool JsonNode::loadLocale(const string& nodeLocale) {
-               //cout << "(database) [JsonNode] < " << nodeLocale << " > Loading locale information ..." << endl;
+            JsonNode::JsonNode() 
+            {
+#ifdef DEBUG
+                cout << "(database) [JsonNode] Linguisics data source base initialized." << endl;
+#endif
+            }
+
+            JsonNode::~JsonNode() 
+            {
+#ifdef DEBUG
+                cout << "(database) [JsonNode] Linguisics data source base destroyed." << endl;
+#endif
+            }
+
+            bool JsonNode::loadLocale(const string& nodeLocale) 
+            {
+#ifdef DEBUG
+                cout << "(database) [JsonNode] < " << nodeLocale << " > Loading locale information ..." << endl;
+#endif
                 string path = Configuration::getRootDirectory(nodeLocale) + "/db.json";
                 boost::filesystem::path thePath(path);
                 path = thePath.string();
@@ -438,12 +529,17 @@
                 aReader.parse(path, theValue);
 
                 if (theValue.isNull()) {
-                   //cout << "(database) [JsonNode] < " << nodeLocale << " > Malformed information recieved." << endl << "\t" << aReader.getFormatedErrorMessages() << endl;
+#ifdef DEBUG
+                    cout << "(database) [JsonNode] < " << nodeLocale << " > Malformed information recieved." << endl 
+                         << "\t" << aReader.getFormatedErrorMessages() << endl;
+#endif
                     return false;
                 }
 
                 JsonDataSources::value_type dataPair(nodeLocale, theValue);
-               //cout << theValue.toStyledString() << endl;
+#ifdef DEBUG
+                cout << theValue.toStyledString() << endl;
+#endif
                 JsonNode::_data.insert(dataPair);
                 return true;
             }
@@ -457,7 +553,9 @@
             }
 
             bool JsonNode::exists(const string& nodeID, const string& nodeLocale) {
-               //cout << "(database) [JsonNode] Determing existence of (" << nodeLocale << ")'" << nodeID << "'..." << endl;
+#ifdef DEBUG
+                cout << "(database) [JsonNode] Determing existence of (" << nodeLocale << ")'" << nodeID << "'..." << endl;
+#endif
                 JsonDataSources::iterator theItr = _data.find(nodeLocale);
                 if (theItr == _data.end())
                     return false;
@@ -466,21 +564,31 @@
                 return theLocale.isMember(nodeID);
             }
 
-            JsonNodeReader::JsonNodeReader(const string& nodeID, const string& nodeLocale) : NodeReader(nodeID, nodeLocale) {
-               //cout << "(database) [JsonNodeWriter] Linguistics data input source initialized. " << endl;
+            JsonNodeReader::JsonNodeReader(const string& nodeID, const string& nodeLocale) : NodeReader(nodeID, nodeLocale) 
+            {
+#ifdef DEBUG
+                cout << "(database) [JsonNodeWriter] Linguistics data input source initialized. " << endl;
+#endif
             }
 
-            JsonNodeReader* JsonNodeReader::obtain(const string& nodeID, const string& nodeLocale) {
-               //cout << "(database) [JsonNodeReader] Linguistics data input source formed. " << endl;
+            JsonNodeReader* JsonNodeReader::obtain(const string& nodeID, const string& nodeLocale) 
+            {
+#ifdef DEBUG
+                cout << "(database) [JsonNodeReader] Linguistics data input source formed. " << endl;
+#endif
                 return new JsonNodeReader(nodeID, nodeLocale);
             }
 
-            const string JsonNodeReader::get() const {
+            void JsonNodeReader::read(Lexical& out) 
+            {
                 Json::Value theLocale = _data.find(this->getLocale())->second;
                 Json::Value node = theLocale[this->getID()];
 
-               //cout << "Dump: " << endl << theLocale.toStyledString() << endl;
-               //cout << "Focused dump: " << endl << node.toStyledString() << endl;
+#ifdef DEBUG
+                cout << "Dump: " << endl << theLocale.toStyledString() << endl;
+                cout << "Focused dump: " << endl << node.toStyledString() << endl;
+#endif
+                
                 ostringstream outData;
                 outData << node["symbol"] << endl;
 
@@ -490,20 +598,36 @@
                     outData << aValue["flags"] << " " << aValue["semantic"] << endl;
                 }
 
-                return outData.str();
+                string theData = outData.str();
+                
+                if (!theData.empty()) {
+                    out.flags().clear();
+                    string symbol, flags, semid;
+                    istringstream inData(theData);
+                    
+                    inData >> out.symbol();
+                    
+                    while (inData >> flags >> semid)
+                        out.flags().insert(Lexical::LexicalMap::value_type(flags, semid));
+                    
+                    inData.clear();
+                }
+
+//                 return outData.str();
             }
 
             JsonNodeWriter::JsonNodeWriter(const string& nodeID, const string& nodeLocale) : NodeWriter(nodeID, nodeLocale) {
 
             }
 
-            void JsonNodeWriter::write(const string& data) {
-                istringstream inData(data);
+            void JsonNodeWriter::write(Lexical& data) {
+                string strData = data.toString();
+                istringstream inData(strData);
                 Json::Value theLocale = JsonNode::getJsonLocale(this->getLocale());
                 Json::Value theNode;
                 if (!theLocale.isMember(this->getID())) {
                     Json::Reader aReader;
-                    aReader.parse(string("{'") + this->getID() + string("' : {}}"), theNode);
+                    aReader.parse(string("{\"") + this->getID() + string("\" : {}}"), theNode);
                     theLocale.append(theNode);
                 }
                 theNode = theLocale[this->getID()];
@@ -515,7 +639,7 @@
                     Json::Reader aLinkReader;
                     Json::Value theLink;
                     ostringstream outLink;
-                    outLink << "{ flags : '" << flags << "', semantic: '" << semid << "' }";
+                    outLink << "{ \"flags\" : \"" << flags << "\", \"semantic\": \"" << semid << "\" }";
                     aLinkReader.parse(outLink.str(), theLink);
                     flagCollection.append(theLink);
                 }
@@ -525,15 +649,21 @@
                 return new JsonNodeWriter(nodeID, nodeLocale);
             }
 
-            XmlNode::XmlNode() {
-               //cout << "(database) [XmlNode] Linguisics data source base initialized." << endl;
+            XmlNode::XmlNode() 
+            {
+#ifdef DEBUG
+                cout << "(database) [XmlNode] Linguisics data source base initialized." << endl;
+#endif
             }
 
             XmlNode::~XmlNode() {
-               //cout << "(database) [XmlNode] Linguisics data source base destroyed." << endl;
+#ifdef DEBUG
+                cout << "(database) [XmlNode] Linguisics data source base destroyed." << endl;
+#endif
             }
 
-            Element* XmlNode::getXmlLocale(const string& locale) {
+            Element* XmlNode::getXmlLocale(const string& locale) 
+            {
                 XmlDataSources::iterator theItr = XmlNode::_docs.find(locale);
                 if (theItr == XmlNode::_docs.end())
                     return NULL;
@@ -541,24 +671,32 @@
                     return theItr->second->get_root_node();
             }
 
-            bool XmlNode::loadLocale(const string& nodeLocale) {
-               //cout << "(database) [XmlNode] < " << nodeLocale << " > Loading locale information ..." << endl;
+            bool XmlNode::loadLocale(const string& nodeLocale) 
+            {
+#ifdef DEBUG
+                cout << "(database) [XmlNode] < " << nodeLocale << " > Loading locale information ..." << endl;
+#endif
                 string path = Configuration::getRootDirectory(nodeLocale) + "/db.xml";
                 boost::filesystem::path thePath(path);
                 path = thePath.string();
-                
+
                 DomParser aParser;
                 aParser.set_validate(false);
                 aParser.set_substitute_entities(false);
                 try {
                     aParser.parse_file(path);
                 } catch (xmlpp::exception &e) {
-                   //cout << "(database) [XmlNode] <" << nodeLocale << "> Error parsing linguistics data; '" << e.what() << "'" << endl;
+#ifdef DEBUG
+                    cout << "(database) [XmlNode] <" << nodeLocale << "> Error parsing linguistics data; '" << e.what() << "'" << endl;
+#endif
                     return false;
                 }
 
-                if (!aParser) {
-                   //cout << "(database) [XmlNode] <" << nodeLocale << "> Malformed linguistics data." << endl;
+                if (!aParser) 
+                {
+#ifdef DEBUG
+                    cout << "(database) [XmlNode] <" << nodeLocale << "> Malformed linguistics data." << endl;
+#endif
                     return false;
                 }
 
@@ -572,18 +710,22 @@
 
                     if (theElem) {
                         _docs.insert(XmlDataSources::value_type(nodeLocale, theDoc));
-                       //cout << "(database) [XmlNode] Memory dump:" << endl << theElem->get_children().size() << endl;
+#ifdef DEBUG
+                        cout << "(database) [XmlNode] Memory dump:" << endl << theElem->get_children().size() << endl;
+#endif
                         return true;
                     } else
                         return false;
-                } else {
+					} else {
                     return false;
-                }
+					}
                 return false;
             }
 
             bool XmlNode::exists(const string& nodeID, const string& nodeLocale) {
-               //cout << "(database) [XmlNode] Determing existence of (" << nodeLocale << ")'" << nodeID << "'..." << endl;
+#ifdef DEBUG
+                cout << "(database) [XmlNode] Determing existence of (" << nodeLocale << ")'" << nodeID << "'..." << endl;
+#endif
                 if (XmlNode::_docs.find(nodeLocale) == XmlNode::_docs.end())
                     return false;
 
@@ -611,11 +753,23 @@
                 return NULL;
             }
 
-            XmlNodeReader::XmlNodeReader(const string& nodeID, const string& nodeLocale) : NodeReader(nodeID, nodeLocale) {
-               //cout << "(database) [XmlNodeReader] Linguistics data input source initialized. " << endl;
+            XmlNodeReader::XmlNodeReader(const string& nodeID, const string& nodeLocale) : NodeReader(nodeID, nodeLocale)
+			{
+#ifdef DEBUG
+                cout << "(database) [XmlNodeReader] Linguistics data input source initialized. " << endl;
+#endif
             }
 
-            const string XmlNodeReader::get() const {
+			XmlNodeReader* XmlNodeReader::obtain(const string& nodeID, const string& nodeLocale)
+			{
+#ifdef DEBUG
+			  cout << "(database) [XmlNodeReader] Linguistics data input source formed. " << endl;
+#endif
+			  return new XmlNodeReader(nodeID, nodeLocale);
+			}
+
+            void XmlNodeReader::read(Lexical& out)
+            {
                 ostringstream outData;
                 Element* theNode = XmlNode::obtainNode(this->getID(), this->getLocale());
                 NodeSet theLinks = theNode->find("Link");
@@ -627,41 +781,60 @@
                         outData << theLink->get_attribute_value("flag") << " " << theLink->get_attribute_value("semanticID") << endl;
                     }
                 }
-
-                return outData.str();
-            }
-
-            XmlNodeReader* XmlNodeReader::obtain(const string& nodeID, const string& nodeLocale) {
-               //cout << "(database) [XmlNodeReader] Linguistics data input source formed. " << endl;
-                return new XmlNodeReader(nodeID, nodeLocale);
+                
+                string theData = outData.str();
+                
+                if (!theData.empty()) {
+                    out.flags().clear();
+                    string symbol, flags, semid;
+                    istringstream inData(theData);
+                    
+                    inData >> out.symbol();
+                    
+                    while (inData >> flags >> semid)
+                        out.flags().insert(Lexical::LexicalMap::value_type(flags, semid));
+                    
+                    inData.clear();
+                }
+
+//                 return outData.str();
             }
 
 			/*XmlNodeWriter* XmlNodeWriter::obtain (const string&, const string&){
 			}*/
 
-            Lexical::Lexical() {
-
-            }
-
-            Lexical* Lexical::obtain() {
-                return new Lexical();
-            }
-
-            void Lexical::load(const NodeReader& node) {
-                NodeReader::getData(node, *this);
-            }
-
-            void Lexical::save(NodeWriter& node) {
-                NodeWriter::setData(node, *this);
-            }
-
-            string& Lexical::symbol() {
-                return _strSymbol;
-            }
-
-            Lexical::LexicalMap& Lexical::flags() {
-                return _data;
-
+            void Lexical::load(NodeReader& nodeReader)
+            {
+                NodeReader::getData(nodeReader, *this);
+            }
+
+            void Lexical::save(NodeWriter& nodeWriter)
+            {
+                NodeWriter::setData(nodeWriter, *this);
+            }
+
+            template<class Archive>
+            void Lexical::serialize(Archive& ar, unsigned int const version)
+            {
+                ar & this->_symbol;
+                ar & this->_flags;
+            }
+            
+            string Lexical::toString()
+            {
+                ostringstream outData;
+                outData << this->symbol() << endl;
+                
+                for (Lexical::LexicalMap::const_iterator itr = this->flags().begin(); itr != this->flags().end(); itr++)
+                    outData << itr->first << " " << itr->second << endl;
+                
+                string ret = outData.str();
+                return ret;
+            }
+            
+            ostream& operator <<(ostream& ost, Lexical const& lex)
+            {
+                return ost << lex._symbol;
             }
         }
     }

=== added file 'wntrdata.pc.in'
--- wntrdata.pc.in	1970-01-01 00:00:00 +0000
+++ wntrdata.pc.in	2011-05-12 22:21:33 +0000
@@ -0,0 +1,14 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=${prefix}
+libdir=${prefix}/lib
+includedir=${prefix}/include
+
+Name: Wintermute Database (library)
+Description: Library and development files for Wintermute's database.
+Version: @GENERIC_LIB_VERSION@
+URL: https://www.launchpad.net/wintermute
+Requires: jsoncpp >= 0.6.0, libxml++-2.6
+Conflicts: wntrdata > @GENERIC_LIB_VERSION@
+Libs: -L${libdir} -lwntrdata
+Libs.private: -lm
+Cflags: -I${includedir}/wntr/data

=== renamed file 'wntrdata.pc.in' => 'wntrdata.pc.in.moved'

Follow ups