diff --git a/swig/document.i b/swig/document.i
index 5d62a33c6215b4e47a69de36a8f2132994aac214..3abe1e06be8eb1eea7d2b0a987e981df05f2bc00 100644
--- a/swig/document.i
+++ b/swig/document.i
@@ -10,10 +10,11 @@
 %include "chunk.i"
 %include "relation.i"
 
-%template(DocumentPtr) boost::shared_ptr<Corpus2::Document>;
-%template(ConstDocumentPtr) boost::shared_ptr<const Corpus2::Document>;
+%template(DocumentPtr) boost::shared_ptr<Corpus2::whole::Document>;
+%template(ConstDocumentPtr) boost::shared_ptr<const Corpus2::whole::Document>;
 
 namespace Corpus2 {
+namespace whole {
   class Document {
   public:
     Document();
@@ -25,9 +26,11 @@ namespace Corpus2 {
     const std::vector< boost::shared_ptr<Chunk> >& paragraphs() const;
     const std::vector< boost::shared_ptr<Relation> >& relations() const;
   };
-}
+} // whole ns
+} // Corpus2 ns
 
 using namespace std;
 using namespace Corpus2;
+using namespace Corpus2::whole;
 
 #endif /* SWIG_LIBCORPUS2_DOCUMENT_I */
diff --git a/swig/documentreader.i b/swig/documentreader.i
index efdbf0cf73c694a5be51e1ae87b6bb845e5a7bfd..2d1258b736a0b6df031e78b0e3941f071ca1b7ab 100644
--- a/swig/documentreader.i
+++ b/swig/documentreader.i
@@ -3,7 +3,7 @@
 
 %module libcorpusdocumentreader
 %{
-  #include <libcorpus2_whole/io/docreader.h>
+  #include <libcorpus2_whole/io/documentreader.h>
 %}
 
 %include "exception.i"
@@ -11,6 +11,7 @@
 %include "boost_shared_ptr.i"
 
 namespace Corpus2 {
+namespace whole {
   class DocumentReader {
   public:
     %exception {
@@ -39,9 +40,11 @@ namespace Corpus2 {
     /* --------------------------------------------------------------------- */
     ~DocumentReader();
   };
-}
+} // whole ns
+} // Corpus2 ns
 
 using namespace std;
 using namespace Corpus2;
+using namespace Corpus2::whole;
 
 #endif /* SWIG_LIBCORPUS2_DOCUMENTREADER_I */
diff --git a/swig/relation.i b/swig/relation.i
index 7ebe41a656c379135760dddc69826355be47f06a..507e77ed8a30a984fd3ff8509bc9900940c5e145 100644
--- a/swig/relation.i
+++ b/swig/relation.i
@@ -10,14 +10,15 @@
 %include "std_string.i"
 %include "boost_shared_ptr.i"
 
-%template(DirectionPointPtr) boost::shared_ptr<Corpus2::DirectionPoint>;
-%template(ConstDirectionPointPtr) boost::shared_ptr<const Corpus2::DirectionPoint>;
+%template(DirectionPointPtr) boost::shared_ptr<Corpus2::whole::DirectionPoint>;
+%template(ConstDirectionPointPtr) boost::shared_ptr<const Corpus2::whole::DirectionPoint>;
 
-%template(RelationPtr) boost::shared_ptr<Corpus2::Relation>;
-%template(ConstRelationPtr) boost::shared_ptr<const Corpus2::Relation>;
-%template(RelationPtrVector) std::vector< boost::shared_ptr<Corpus2::Relation> >;
+%template(RelationPtr) boost::shared_ptr<Corpus2::whole::Relation>;
+%template(ConstRelationPtr) boost::shared_ptr<const Corpus2::whole::Relation>;
+%template(RelationPtrVector) std::vector< boost::shared_ptr<Corpus2::whole::Relation> >;
 
 namespace Corpus2 {
+namespace whole {
   class DirectionPoint {
   public:
     DirectionPoint(const std::string, const std::string, const int);
@@ -50,9 +51,11 @@ namespace Corpus2 {
     %rename(rel_name) name() const;
     const std::string name() const;
   };
-}
+} // whole ns
+} // Corpus2 ns
 
 using namespace std;
 using namespace Corpus2;
+using namespace Corpus2::whole;
 
 #endif /* SWIG_LIBCORPUS2_RELATION_I */
diff --git a/swig/relationreader.i b/swig/relationreader.i
index bcf567aed3cdb936bd3e87f3f71ff6c8bc874cf6..b763980a4e2c3e91013f5b9046572e600111bd5a 100644
--- a/swig/relationreader.i
+++ b/swig/relationreader.i
@@ -7,14 +7,17 @@
 %}
 
 namespace Corpus2 {
+namespace whole {
   class RelationReader {
   public:
     RelationReader(const std::string &rela_path);
     const std::vector< boost::shared_ptr<Relation> >& relations();
   };
-}
+} // whole ns
+} // Corpus2 ns
 
 using namespace std;
 using namespace Corpus2;
+using namespace Corpus2::whole;
 
 #endif /* SWIG_LIBCORPUS2_RELATIONREADER_I */