Class GISDataModel


  • public class GISDataModel
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      GISDataModel​(java.lang.String jobName, boolean includeOffsets, boolean includeCoordinate)
      Instantiates a new GIS data model.
      GISDataModel​(java.lang.String jobName, boolean includeOffsets, boolean includeCoordinate, boolean buildSchema)
      Instantiates a new GIS data model.
    • Method Summary

      Modifier and Type Method Description
      protected void addAdditionalAttributes​(org.opensextant.giscore.events.Feature row, java.util.Map<java.lang.String,​java.lang.Object> rowAttributes)
      If the caller has additional data to attach to records, allow them to add fields to schema at runtime and map their data to keys on GeocodingResult Similarly, you could have Geocoding row-level attributes unique to the geocoding whereas attrs on GeocodingResult are global for all geocodings in that result set.
      protected void addColumn​(org.opensextant.giscore.events.Feature row, org.opensextant.giscore.events.SimpleField f, double d)
      Add a column of data to output; Field is validated.
      protected void addColumn​(org.opensextant.giscore.events.Feature row, org.opensextant.giscore.events.SimpleField f, int d)
      Add a column of data to output; Field is validated.
      protected void addColumn​(org.opensextant.giscore.events.Feature row, org.opensextant.giscore.events.SimpleField f, java.lang.Object d)
      Add a column of data to output; Field is validated ; value is not added if null.
      protected void addConfidence​(org.opensextant.giscore.events.Feature row, int conf)
      Adds the confidence.
      protected void addContext​(org.opensextant.giscore.events.Feature row, TextMatch g)
      Adds the context.
      void addField​(java.lang.String fld)
      Add a field key to the field order; Caller must also be responsible for ensuring field is valid and exists in Schema.
      protected void addFilePaths​(org.opensextant.giscore.events.Feature row, java.lang.String recordFile, java.lang.String recordTextFile)
      Adds the file paths.
      protected void addLatLon​(org.opensextant.giscore.events.Feature row, Geocoding g)
      Adds the lat lon.
      protected void addMatchMethod​(org.opensextant.giscore.events.Feature row, java.lang.String method)
      Allows caller to add a method or pattern id of sorts to denote how match was derived.
      protected void addMatchMethod​(org.opensextant.giscore.events.Feature row, TextMatch match)
      Adds the match method.
      protected void addMatchText​(org.opensextant.giscore.events.Feature row, TextMatch g)
      Adds the match text.
      protected void addOffsets​(org.opensextant.giscore.events.Feature row, TextMatch m)
      Adds the offsets.
      protected void addPlaceData​(org.opensextant.giscore.events.Feature row, Geocoding g)
      Adds the place data.
      protected void addPrecision​(org.opensextant.giscore.events.Feature row, Geocoding g)
      Adds the precision.
      java.util.List<org.opensextant.giscore.events.Feature> buildRows​(int id, Geocoding g, TextMatch m, java.util.Map<java.lang.String,​java.lang.Object> rowAttributes, ExtractionResult res)
      Builds a GISCore feature array (rows) from a given array of TextMatches; Enrich the features with record-level attributes (columns).
      protected org.opensextant.giscore.events.Schema buildSchema​(java.lang.String jobName)
      Create a schema instance with the fields properly typed and ordered.
      protected boolean canAdd​(org.opensextant.giscore.events.SimpleField f)
      Can add.
      protected void defaultFields()
      Default fields.
      protected java.lang.String formatConfidence​(double conf)
      Convenience method for managing how confidence number is reported in output.
      protected org.opensextant.giscore.events.SimpleField getField​(java.lang.String field)
      Gets the field.
      org.opensextant.giscore.events.Schema getSchema()
      Gets the schema.
      void removeField​(java.lang.String fld)
      Removes the field.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • log

        protected final org.slf4j.Logger log
      • includeOffsets

        protected boolean includeOffsets
      • includeCoordinate

        protected boolean includeCoordinate
      • useFileHyperlink

        protected boolean useFileHyperlink
      • schema

        protected org.opensextant.giscore.events.Schema schema
      • field_order

        protected java.util.List<java.lang.String> field_order
      • field_set

        public java.util.Set<java.lang.String> field_set
    • Constructor Detail

      • GISDataModel

        public GISDataModel​(java.lang.String jobName,
                            boolean includeOffsets,
                            boolean includeCoordinate)
        Instantiates a new GIS data model.
        Parameters:
        jobName - the job name
        includeOffsets - the include offsets
        includeCoordinate - the include coordinate
      • GISDataModel

        public GISDataModel​(java.lang.String jobName,
                            boolean includeOffsets,
                            boolean includeCoordinate,
                            boolean buildSchema)
        Instantiates a new GIS data model.
        Parameters:
        jobName - the job name
        includeOffsets - the include offsets
        includeCoordinate - the include coordinate
        buildSchema - the build schema
    • Method Detail

      • addPlaceData

        protected void addPlaceData​(org.opensextant.giscore.events.Feature row,
                                    Geocoding g)
        Adds the place data.
        Parameters:
        row - row of data
        g - geocoding
      • addPrecision

        protected void addPrecision​(org.opensextant.giscore.events.Feature row,
                                    Geocoding g)
        Adds the precision.
        Parameters:
        row - row of data
        g - geocoding
      • addConfidence

        protected void addConfidence​(org.opensextant.giscore.events.Feature row,
                                     int conf)
        Adds the confidence.
        Parameters:
        row - row of data
        conf - confidence
      • addOffsets

        protected void addOffsets​(org.opensextant.giscore.events.Feature row,
                                  TextMatch m)
        Adds the offsets.
        Parameters:
        row - data
        m - match metadata
      • addLatLon

        protected void addLatLon​(org.opensextant.giscore.events.Feature row,
                                 Geocoding g)
        Adds the lat lon. to the given data row.
        Parameters:
        row - data
        g - geocoding
      • addAdditionalAttributes

        protected void addAdditionalAttributes​(org.opensextant.giscore.events.Feature row,
                                               java.util.Map<java.lang.String,​java.lang.Object> rowAttributes)
                                        throws ConfigException
        If the caller has additional data to attach to records, allow them to add fields to schema at runtime and map their data to keys on GeocodingResult Similarly, you could have Geocoding row-level attributes unique to the geocoding whereas attrs on GeocodingResult are global for all geocodings in that result set.
        Parameters:
        row - the row
        rowAttributes - the row attributes
        Throws:
        ConfigException - the config exception
      • addFilePaths

        protected void addFilePaths​(org.opensextant.giscore.events.Feature row,
                                    java.lang.String recordFile,
                                    java.lang.String recordTextFile)
        Adds the file paths.
        Parameters:
        row - data
        recordFile - original file
        recordTextFile - text version of original
      • addContext

        protected void addContext​(org.opensextant.giscore.events.Feature row,
                                  TextMatch g)
        Adds the context.
        Parameters:
        row - the row
        g - the g
      • addMatchText

        protected void addMatchText​(org.opensextant.giscore.events.Feature row,
                                    TextMatch g)
        Adds the match text.
        Parameters:
        row - the row
        g - the g
      • addMatchMethod

        protected void addMatchMethod​(org.opensextant.giscore.events.Feature row,
                                      java.lang.String method)
        Allows caller to add a method or pattern id of sorts to denote how match was derived.
        Parameters:
        row - the row
        method - the method
      • addMatchMethod

        protected void addMatchMethod​(org.opensextant.giscore.events.Feature row,
                                      TextMatch match)
        Adds the match method.
        Parameters:
        row - the row
        match - the match
      • buildRows

        public java.util.List<org.opensextant.giscore.events.Feature> buildRows​(int id,
                                                                                Geocoding g,
                                                                                TextMatch m,
                                                                                java.util.Map<java.lang.String,​java.lang.Object> rowAttributes,
                                                                                ExtractionResult res)
                                                                         throws ConfigException
        Builds a GISCore feature array (rows) from a given array of TextMatches; Enrich the features with record-level attributes (columns). If provided result has .input set, then conext and other metadata for this match will be pulled from it. Context is not pulled at match time, as it is not used by most processing -- it tends to be more of an output/formatting issue. And only matches that pass any filters are enriched with context and other metadaa.
        Parameters:
        id - the id
        g - the g
        m - the m
        rowAttributes - the row attributes
        res - the res
        Returns:
        the list
        Throws:
        ConfigException - schema configuration error
      • formatConfidence

        protected java.lang.String formatConfidence​(double conf)
        Convenience method for managing how confidence number is reported in output.
        Parameters:
        conf - the conf
        Returns:
        the string
      • getSchema

        public org.opensextant.giscore.events.Schema getSchema()
        Gets the schema.
        Returns:
        the schema
      • buildSchema

        protected org.opensextant.giscore.events.Schema buildSchema​(java.lang.String jobName)
                                                             throws ConfigException
        Create a schema instance with the fields properly typed and ordered.
        Parameters:
        jobName - the job name
        Returns:
        the schema
        Throws:
        ConfigException - schema configuration error
      • getField

        protected org.opensextant.giscore.events.SimpleField getField​(java.lang.String field)
                                                               throws ConfigException
        Gets the field.
        Parameters:
        field - the field
        Returns:
        the field
        Throws:
        ConfigException - the config exception
      • canAdd

        protected boolean canAdd​(org.opensextant.giscore.events.SimpleField f)
        Can add.
        Parameters:
        f - the f
        Returns:
        true, if successful
      • addColumn

        protected void addColumn​(org.opensextant.giscore.events.Feature row,
                                 org.opensextant.giscore.events.SimpleField f,
                                 java.lang.Object d)
        Add a column of data to output; Field is validated ; value is not added if null.
        Parameters:
        row - the row
        f - the f
        d - the d
      • addColumn

        protected void addColumn​(org.opensextant.giscore.events.Feature row,
                                 org.opensextant.giscore.events.SimpleField f,
                                 int d)
        Add a column of data to output; Field is validated.
        Parameters:
        row - the row
        f - the f
        d - the d
      • addColumn

        protected void addColumn​(org.opensextant.giscore.events.Feature row,
                                 org.opensextant.giscore.events.SimpleField f,
                                 double d)
        Add a column of data to output; Field is validated.
        Parameters:
        row - the row
        f - the field name
        d - value
      • addField

        public void addField​(java.lang.String fld)
                      throws ConfigException
        Add a field key to the field order; Caller must also be responsible for ensuring field is valid and exists in Schema.
        Parameters:
        fld - field name
        Throws:
        ConfigException - the config exception
      • removeField

        public void removeField​(java.lang.String fld)
                         throws ConfigException
        Removes the field.
        Parameters:
        fld - field name
        Throws:
        ConfigException - the config exception
      • defaultFields

        protected final void defaultFields()
        Default fields.