Index: /other-projects/maori-lang-detection/MoreReading/mongodb.txt
===================================================================
--- /other-projects/maori-lang-detection/MoreReading/mongodb.txt	(revision 33652)
+++ /other-projects/maori-lang-detection/MoreReading/mongodb.txt	(revision 33653)
@@ -316,6 +316,6 @@
 db.getCollection('webpages').find({"isMRI": true, "singleSentences.langCode": "mri"})
 db.getCollection('webpages').find({"singleSentences": { $elemMatch: {"langCode":"mri"} } }, {"singleSentences.$": "mri"})
-
-
+db.getCollection('Webpages').find({"isMRI": true, "singleSentences": { $elemMatch: {"langCode":"eng"} } }, {"singleSentences.$": "eng"}) [single English lang sentence]
+db.getCollection('Webpages').find({"containsMRI": true, "singleSentences": { $elemMatch: {"langCode":"mri"} } }, {"singleSentences.$": "mri"}) [gets 1st sentence of docs which have sentences containing MRI]
 
 
Index: /other-projects/maori-lang-detection/src/org/greenstone/atea/MongoDBAccess.java
===================================================================
--- /other-projects/maori-lang-detection/src/org/greenstone/atea/MongoDBAccess.java	(revision 33652)
+++ /other-projects/maori-lang-detection/src/org/greenstone/atea/MongoDBAccess.java	(revision 33653)
@@ -165,5 +165,5 @@
     }
     
-    
+    /*
     public void insertWebsiteInfo(WebsiteInfo website)
     {
@@ -188,13 +188,12 @@
 			   + " inserted successfully into " + WEBSITES_COLLECTION);  
     }
-
-    /* TODO:
-    https://stackoverflow.com/questions/39433775/mongodb-java-inserting-throws-org-bson-codecs-configuration-codecconfigurationex
     */
+
     /**
      * Inserts a web page into the mongodb. Besides page related metadata and full body text
      * the language information per sentence and per 2 adjacent sentences also get stored
      * into the mongodb.
-     */    
+     */
+    /*
     public void insertWebpageInfo(WebpageInfo webpage)
     {
@@ -255,4 +254,5 @@
 	logger.debug("\nwebpage info for " + webpage.webpageID + " inserted successfully into " + WEBPAGES_COLLECTION);  
     }
+    */
 
     /** https://stackoverflow.com/questions/19938153/do-i-need-to-explicitly-close-connection */
Index: her-projects/maori-lang-detection/src/org/greenstone/atea/SentenceInfo.java
===================================================================
--- /other-projects/maori-lang-detection/src/org/greenstone/atea/SentenceInfo.java	(revision 33652)
+++ 	(revision )
@@ -1,14 +1,0 @@
-package org.greenstone.atea;
-
-public class SentenceInfo {
-    public final double confidenceLevel;
-    /** 3 letter lang code */
-    public final String langCode;
-    public final String sentence;
-    
-    public SentenceInfo(double confidence, String langCode, String sentence) {
-	this.confidenceLevel = confidence;
-	this.langCode = langCode;
-	this.sentence = sentence;
-    }
-}
Index: her-projects/maori-lang-detection/src/org/greenstone/atea/WebpageInfo.java
===================================================================
--- /other-projects/maori-lang-detection/src/org/greenstone/atea/WebpageInfo.java	(revision 33652)
+++ 	(revision )
@@ -1,55 +1,0 @@
-package org.greenstone.atea;
-
-import java.util.ArrayList;
-
-public class WebpageInfo {
-
-    private int mriSentenceCount;
-    
-    /** db table ids */
-    public final long webpageID;
-    public final int websiteID;
-
-    public final int totalSentences;
-    
-    public final String text;
-    public final String URL;
-    public final boolean isMRI;    
-	
-    public final String charEncoding;
-    public final String modifiedTime;
-    public final String fetchTime;
-    public final ArrayList<SentenceInfo> singleSentences;
-    public final ArrayList<SentenceInfo> overlappingSentences;
-	
-    public WebpageInfo (long webpageID, int websiteID,
-			String pageText, String pageURL, boolean isMRI, int totalSentences,
-			String charEncoding, String modifiedTime, String fetchTime,
-			ArrayList<SentenceInfo> singleSentences,
-			ArrayList<SentenceInfo> overlappingSentences)
-    {
-
-	this.webpageID = webpageID;
-	this.websiteID = websiteID;
-
-	this.totalSentences = totalSentences;
-	
-	this.text = pageText;
-	this.URL = pageURL;
-	this.isMRI = isMRI;
-	
-	this.charEncoding = charEncoding;
-	this.modifiedTime = modifiedTime;
-	this.fetchTime = fetchTime;
-
-	this.singleSentences = singleSentences;
-	this.overlappingSentences = overlappingSentences;
-	
-    }
-
-    public void setMRISentenceCount(int count) {
-	this.mriSentenceCount = count;
-    }
-
-    public int getMRISentenceCount() { return this.mriSentenceCount; }
-}
Index: her-projects/maori-lang-detection/src/org/greenstone/atea/WebsiteInfo.java
===================================================================
--- /other-projects/maori-lang-detection/src/org/greenstone/atea/WebsiteInfo.java	(revision 33652)
+++ 	(revision )
@@ -1,40 +1,0 @@
-package org.greenstone.atea;
-
-public class WebsiteInfo {
-
-    public final int id;
-    public final String siteFolderName;
-    public final String domain;
-    
-    public final int totalPages;
-    public final int countOfWebPagesWithBodyText;
-    public final int numPagesInMRI;
-    
-    public final long siteCrawledTimestamp;
-    public final boolean siteCrawlUnfinished;
-    public final boolean redoCrawl;
-    
-    public final String geoLocationCountryCode;
-    public final boolean urlContainsLangCodeInpath;
-	
-    public WebsiteInfo(int siteCount, String siteFolderName, String domainOfSite,
-		       int totalPages, int countOfWebPagesWithBodyText, int numPagesInMRI,
-		       long siteCrawledTimestamp, boolean siteCrawlUnfinished, boolean redoCrawl,
-		       String geoLocationCountryCode, boolean urlContainsLangCodeInpath)
-    {
-	this.id = siteCount;
-	this.siteFolderName = siteFolderName;
-	this.domain = domainOfSite;
-	
-	this.totalPages = totalPages;
-	this.countOfWebPagesWithBodyText = countOfWebPagesWithBodyText;
-	this.numPagesInMRI = numPagesInMRI;
-	
-	this.siteCrawledTimestamp = siteCrawledTimestamp;
-	this.siteCrawlUnfinished = siteCrawlUnfinished;
-	this.redoCrawl = redoCrawl;
-	
-	this.geoLocationCountryCode = geoLocationCountryCode;
-	this.urlContainsLangCodeInpath = urlContainsLangCodeInpath;
-    }
-}
Index: /other-projects/maori-lang-detection/src/org/greenstone/atea/morphia/SentenceInfo.java
===================================================================
--- /other-projects/maori-lang-detection/src/org/greenstone/atea/morphia/SentenceInfo.java	(revision 33653)
+++ /other-projects/maori-lang-detection/src/org/greenstone/atea/morphia/SentenceInfo.java	(revision 33653)
@@ -0,0 +1,17 @@
+package org.greenstone.atea.morphia;
+
+import dev.morphia.annotations.*;
+
+@Entity("Sentences")
+public class SentenceInfo {
+    public final double confidenceLevel;
+    /** 3 letter lang code */
+    public final String langCode;
+    public final String sentence;
+    
+    public SentenceInfo(double confidence, String langCode, String sentence) {
+	this.confidenceLevel = confidence;
+	this.langCode = langCode;
+	this.sentence = sentence;
+    }
+}
Index: /other-projects/maori-lang-detection/src/org/greenstone/atea/morphia/WebpageInfo.java
===================================================================
--- /other-projects/maori-lang-detection/src/org/greenstone/atea/morphia/WebpageInfo.java	(revision 33653)
+++ /other-projects/maori-lang-detection/src/org/greenstone/atea/morphia/WebpageInfo.java	(revision 33653)
@@ -0,0 +1,74 @@
+package org.greenstone.atea.morphia;
+
+import dev.morphia.annotations.*;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Morphia provides the Object Document Mapper for MongoDB
+ * https://www.baeldung.com/mongodb-morphia 
+ * 
+ */
+@Entity("Webpages")
+public class WebpageInfo {
+
+    /** db table ids */
+    @Id
+    public final long webpageID;
+    // TODO: should this be a "Reference" to the WebsiteInfo object instead?
+    // See section 5.2 of https://www.baeldung.com/mongodb-morphia
+    public final String websiteID; //int websiteID;
+
+    public final int totalSentences;
+    
+    public final String text;
+    public final String URL;
+    public final boolean isMRI;    
+	
+    public final String charEncoding;
+    public final String modifiedTime;
+    public final String fetchTime;
+
+    @Embedded
+    public final List<SentenceInfo> singleSentences;
+    @Embedded
+    public final List<SentenceInfo> overlappingSentences;
+
+    private int mriSentenceCount;    
+    private boolean containsMRI;
+    
+    public WebpageInfo (long webpageID, String siteID/*int websiteID,*/,
+			String pageText, String pageURL, boolean isMRI, int totalSentences,
+			String charEncoding, String modifiedTime, String fetchTime,
+			List<SentenceInfo> singleSentences,
+			List<SentenceInfo> overlappingSentences)
+    {
+
+	this.webpageID = webpageID;
+	//this.websiteID = websiteID;
+	this.websiteID = siteID;
+
+	this.totalSentences = totalSentences;
+	
+	this.text = pageText;
+	this.URL = pageURL;
+	this.isMRI = isMRI;
+	
+	this.charEncoding = charEncoding;
+	this.modifiedTime = modifiedTime;
+	this.fetchTime = fetchTime;
+
+	this.singleSentences = singleSentences;
+	this.overlappingSentences = overlappingSentences;
+	
+    }
+
+    public void setMRISentenceCount(int count) {
+	this.mriSentenceCount = count;
+    }
+    public void setContainsMRI(boolean containsMRI) {
+	this.containsMRI = containsMRI;
+    }
+
+    public int getMRISentenceCount() { return this.mriSentenceCount; }
+}
Index: /other-projects/maori-lang-detection/src/org/greenstone/atea/morphia/WebsiteInfo.java
===================================================================
--- /other-projects/maori-lang-detection/src/org/greenstone/atea/morphia/WebsiteInfo.java	(revision 33653)
+++ /other-projects/maori-lang-detection/src/org/greenstone/atea/morphia/WebsiteInfo.java	(revision 33653)
@@ -0,0 +1,43 @@
+package org.greenstone.atea.morphia;
+
+import dev.morphia.annotations.*;
+
+@Entity("Websites")
+public class WebsiteInfo {
+    //public final int id;
+    @Id
+    public final String siteFolderName;
+    public final String domain;
+    
+    public final int totalPages;
+    public final int countOfWebPagesWithBodyText;
+    public final int numPagesInMRI;
+    
+    public final long siteCrawledTimestamp;
+    public final boolean siteCrawlUnfinished;
+    public final boolean redoCrawl;
+    
+    public final String geoLocationCountryCode;
+    public final boolean urlContainsLangCodeInpath;
+	
+    public WebsiteInfo(/*int siteCount,*/ String siteFolderName, String domainOfSite,
+		       int totalPages, int countOfWebPagesWithBodyText, int numPagesInMRI,
+		       long siteCrawledTimestamp, boolean siteCrawlUnfinished, boolean redoCrawl,
+		       String geoLocationCountryCode, boolean urlContainsLangCodeInpath)
+    {
+	//this.id = siteCount;
+	this.siteFolderName = siteFolderName;
+	this.domain = domainOfSite;
+	
+	this.totalPages = totalPages;
+	this.countOfWebPagesWithBodyText = countOfWebPagesWithBodyText;
+	this.numPagesInMRI = numPagesInMRI;
+	
+	this.siteCrawledTimestamp = siteCrawledTimestamp;
+	this.siteCrawlUnfinished = siteCrawlUnfinished;
+	this.redoCrawl = redoCrawl;
+	
+	this.geoLocationCountryCode = geoLocationCountryCode;
+	this.urlContainsLangCodeInpath = urlContainsLangCodeInpath;
+    }
+}
