Class GISDataModel

java.lang.Object
org.opensextant.output.GISDataModel

public class GISDataModel extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected List<String>
     
     
    protected boolean
     
    protected boolean
     
    protected final org.slf4j.Logger
     
    protected org.opensextant.giscore.events.Schema
     
    protected boolean
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    GISDataModel(String jobName, boolean includeOffsets, boolean includeCoordinate)
    Instantiates a new GIS data model.
    GISDataModel(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, Map<String,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, 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
    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, String recordFile, 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, 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.
    List<org.opensextant.giscore.events.Feature>
    buildRows(int id, Geocoding g, TextMatch m, Map<String,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
    Create a schema instance with the fields properly typed and ordered.
    protected boolean
    canAdd(org.opensextant.giscore.events.SimpleField f)
    Can add.
    protected final void
    Default fields.
    protected String
    formatConfidence(double conf)
    Convenience method for managing how confidence number is reported in output.
    protected org.opensextant.giscore.events.SimpleField
    Gets the field.
    org.opensextant.giscore.events.Schema
    Gets the schema.
    void
    Removes the field.

    Methods inherited from class java.lang.Object

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

    • log

      protected final org.slf4j.Logger log
    • includeOffsets

      protected boolean includeOffsets
    • includeCoordinate

      protected boolean includeCoordinate
    • schema

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

      protected List<String> field_order
    • field_set

      public Set<String> field_set
  • Constructor Details

    • GISDataModel

      public GISDataModel(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(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 Details

    • 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, Map<String,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, String recordFile, 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, 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 List<org.opensextant.giscore.events.Feature> buildRows(int id, Geocoding g, TextMatch m, Map<String,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 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(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(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, 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(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(String fld) throws ConfigException
      Removes the field.
      Parameters:
      fld - field name
      Throws:
      ConfigException - the config exception
    • defaultFields

      protected final void defaultFields()
      Default fields.