Package org.opensextant.output
Class GISDataModel
java.lang.Object
org.opensextant.output.GISDataModel
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
protected boolean
protected final org.slf4j.Logger
protected org.opensextant.giscore.events.Schema
protected boolean
-
Constructor Summary
ConstructorDescriptionGISDataModel
(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 TypeMethodDescriptionprotected 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
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>
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
(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 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
removeField
(String fld) Removes the field.
-
Field Details
-
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
-
field_set
-
-
Constructor Details
-
GISDataModel
Instantiates a new GIS data model.- Parameters:
jobName
- the job nameincludeOffsets
- the include offsetsincludeCoordinate
- the include coordinate
-
GISDataModel
public GISDataModel(String jobName, boolean includeOffsets, boolean includeCoordinate, boolean buildSchema) Instantiates a new GIS data model.- Parameters:
jobName
- the job nameincludeOffsets
- the include offsetsincludeCoordinate
- the include coordinatebuildSchema
- the build schema
-
-
Method Details
-
addPlaceData
Adds the place data.- Parameters:
row
- row of datag
- geocoding
-
addPrecision
Adds the precision.- Parameters:
row
- row of datag
- geocoding
-
addConfidence
protected void addConfidence(org.opensextant.giscore.events.Feature row, int conf) Adds the confidence.- Parameters:
row
- row of dataconf
- confidence
-
addOffsets
Adds the offsets.- Parameters:
row
- datam
- match metadata
-
addLatLon
Adds the lat lon. to the given data row.- Parameters:
row
- datag
- geocoding
-
addAdditionalAttributes
protected void addAdditionalAttributes(org.opensextant.giscore.events.Feature row, Map<String, Object> rowAttributes) throws ConfigExceptionIf 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 rowrowAttributes
- 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
- datarecordFile
- original filerecordTextFile
- text version of original
-
addContext
Adds the context.- Parameters:
row
- the rowg
- the g
-
addMatchText
Adds the match text.- Parameters:
row
- the rowg
- the g
-
addMatchMethod
Allows caller to add a method or pattern id of sorts to denote how match was derived.- Parameters:
row
- the rowmethod
- the method
-
addMatchMethod
Adds the match method.- Parameters:
row
- the rowmatch
- the match
-
buildRows
public List<org.opensextant.giscore.events.Feature> buildRows(int id, Geocoding g, TextMatch m, Map<String, Object> rowAttributes, ExtractionResult res) throws ConfigExceptionBuilds 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 idg
- the gm
- the mrowAttributes
- the row attributesres
- the res- Returns:
- the list
- Throws:
ConfigException
- schema configuration error
-
formatConfidence
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
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
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 rowf
- the fd
- 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 rowf
- the fd
- 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 rowf
- the field named
- value
-
addField
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
Removes the field.- Parameters:
fld
- field name- Throws:
ConfigException
- the config exception
-
defaultFields
protected final void defaultFields()Default fields.
-