Ignore:
Timestamp:
2019-11-12T20:51:48+13:00 (4 years ago)
Author:
ak19
Message:
  1. As suggested by Dr Bainbridge, made the code changes to use Morphia as ODM for MongoDB (Object Document Mapper, ODM for MongoDB is equivalent to what ORM is to RDBMS). 2. Adding jar files to get this to work. 3. Further changes to store site folder names of form ##### as primary key of Websites collection. However, may in a future commit decide to store a reference to a WebsiteInfo object (representing a JSON document in a Websites MongoDB collection) inside a WebpageInfo object. 4. The MongoDB collections are now called Websites and Webpages, not websites and webpages. 5. geolocation of site now stored as field in Websites mongodb collection. And containsMRI now stored as field in Webpages collection of mongoDB. 6. Tried out some mongodb query commands based on what Dr Bainbridge did yesterday.
File:
1 moved

Legend:

Unmodified
Added
Removed
  • other-projects/maori-lang-detection/src/org/greenstone/atea/morphia/WebpageInfo.java

    r33652 r33653  
    1 package org.greenstone.atea;
     1package org.greenstone.atea.morphia;
    22
     3import dev.morphia.annotations.*;
    34import java.util.ArrayList;
     5import java.util.List;
    46
     7/**
     8 * Morphia provides the Object Document Mapper for MongoDB
     9 * https://www.baeldung.com/mongodb-morphia
     10 *
     11 */
     12@Entity("Webpages")
    513public class WebpageInfo {
    614
    7     private int mriSentenceCount;
    8    
    915    /** db table ids */
     16    @Id
    1017    public final long webpageID;
    11     public final int websiteID;
     18    // TODO: should this be a "Reference" to the WebsiteInfo object instead?
     19    // See section 5.2 of https://www.baeldung.com/mongodb-morphia
     20    public final String websiteID; //int websiteID;
    1221
    1322    public final int totalSentences;
     
    2029    public final String modifiedTime;
    2130    public final String fetchTime;
    22     public final ArrayList<SentenceInfo> singleSentences;
    23     public final ArrayList<SentenceInfo> overlappingSentences;
    24    
    25     public WebpageInfo (long webpageID, int websiteID,
     31
     32    @Embedded
     33    public final List<SentenceInfo> singleSentences;
     34    @Embedded
     35    public final List<SentenceInfo> overlappingSentences;
     36
     37    private int mriSentenceCount;   
     38    private boolean containsMRI;
     39   
     40    public WebpageInfo (long webpageID, String siteID/*int websiteID,*/,
    2641            String pageText, String pageURL, boolean isMRI, int totalSentences,
    2742            String charEncoding, String modifiedTime, String fetchTime,
    28             ArrayList<SentenceInfo> singleSentences,
    29             ArrayList<SentenceInfo> overlappingSentences)
     43            List<SentenceInfo> singleSentences,
     44            List<SentenceInfo> overlappingSentences)
    3045    {
    3146
    3247    this.webpageID = webpageID;
    33     this.websiteID = websiteID;
     48    //this.websiteID = websiteID;
     49    this.websiteID = siteID;
    3450
    3551    this.totalSentences = totalSentences;
     
    5167    this.mriSentenceCount = count;
    5268    }
     69    public void setContainsMRI(boolean containsMRI) {
     70    this.containsMRI = containsMRI;
     71    }
    5372
    5473    public int getMRISentenceCount() { return this.mriSentenceCount; }
Note: See TracChangeset for help on using the changeset viewer.