org.gbif.datatester.tests
Class ItineraryTest

java.lang.Object
  extended by org.gbif.datatester.AbstractDataTest
      extended by org.gbif.datatester.AbstractRecordSetTest
          extended by org.gbif.datatester.tests.ItineraryTest
All Implemented Interfaces:
DataTest

public class ItineraryTest
extends AbstractRecordSetTest

Generic itinerary test implementation. The idea is to select georeferenced records related to a particular person, order them by date and check whether the distance between each neighbor records is consistent with the interval between them considering the maximum accepted distance to be travelled over one day in the corresponding period of history.

It accepts five parameters: personConcept, longitudeConcept, latitudeConcept, dateSource and dateFormat. The first one must contain the identifier of a known Concept with a string DataType, the second and third one must contain the identifier of a known Concept with a double DataType, the fourth must contain either a single Concept identifier or a comma-separated list of three Concepts related to year, month and day, respectively and the last parameter can be used to indicate the date format according to patterns that are accepted by the SimpleDateFormat Java class (default format is yyyy-MM-dd).

A typical configuration entry for this test would look like:

  <test id="09" class="org.gbif.datatester.tests.ItineraryTest">
    <parameter name="personConcept">
      <value v="Collector" />
    </parameter>
    <parameter name="longitudeConcept">
      <value v="Longitude" />
    </parameter>
    <parameter name="latitudeConcept">
      <value v="Latitude" />
    </parameter>
    <parameter name="dateSource">
      <value v="CollectingDate" />
    </parameter>
    <parameter name="dateFormat">
      <value v="yyyy-MM-dd" />
    </parameter>
  </test>
 

Important: when three concepts are involved in the dateSource, the test first concatenates their values using dashes before checking the content. So in this case if a format is specified, it must contain two and only two dashes.

Version:
$Revision: 1.3 $
Author:
Alexandre Marino ( marino at cria . org . br ), Renato De Giovanni ( renato at cria . org . br )

Field Summary
static java.lang.String CALCULATED_DISTANCE_TAG_ID
          Shortcut to the "calculated distance" tag.
static java.lang.String ITINERARY_OUTLIER_TAG_ID
          Shortcut to the "itinerary outlier" tag id.
static java.lang.String MAXIMUM_DISTANCE_TAG_ID
          Shortcut to the "maximum distance" tag id.
static java.lang.String NUMBER_OF_DAYS_TAG_ID
          Shortcut to the "number of days" tag id.
static java.lang.String SINGLE_RECORD_TAG_ID
          Shortcut to the "single record" debug tag id.
 
Fields inherited from class org.gbif.datatester.AbstractDataTest
instanceId, knownConcepts, locale, result
 
Constructor Summary
ItineraryTest()
          Contructs a generic itinerary test.
 
Method Summary
protected  void doInitialize()
          Internal method to initialize the test.
protected  void doTest(GenericRecordSet genericRecordSet)
          Detect inconsistencies between two events related with the same person.
 java.lang.String getVersion()
          Outputs the current version of this test based on the CVS revision.
 int minNumberOfRecords()
          Indicates the minimum number of records that the record set to be tested must have.
 
Methods inherited from class org.gbif.datatester.AbstractRecordSetTest
doTest, test
 
Methods inherited from class org.gbif.datatester.AbstractDataTest
declareMandatoryConcept, declareOptionalConcept, declareParameter, declareTag, getDescription, getInstanceId, getInstanceXml, getMandatoryConcepts, getOptionalConcepts, getParametersMetadata, getParameterValue, getPossibleTags, getResourceBundle, getResult, getString, initialize, initialize, loadResourceBundle, setLocale, setResourceBundleBaseName, test
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ITINERARY_OUTLIER_TAG_ID

public static final java.lang.String ITINERARY_OUTLIER_TAG_ID

Shortcut to the "itinerary outlier" tag id.

See Also:
Constant Field Values

SINGLE_RECORD_TAG_ID

public static final java.lang.String SINGLE_RECORD_TAG_ID

Shortcut to the "single record" debug tag id.

See Also:
Constant Field Values

MAXIMUM_DISTANCE_TAG_ID

public static final java.lang.String MAXIMUM_DISTANCE_TAG_ID

Shortcut to the "maximum distance" tag id.

See Also:
Constant Field Values

CALCULATED_DISTANCE_TAG_ID

public static final java.lang.String CALCULATED_DISTANCE_TAG_ID

Shortcut to the "calculated distance" tag.

See Also:
Constant Field Values

NUMBER_OF_DAYS_TAG_ID

public static final java.lang.String NUMBER_OF_DAYS_TAG_ID

Shortcut to the "number of days" tag id.

See Also:
Constant Field Values
Constructor Detail

ItineraryTest

public ItineraryTest()

Contructs a generic itinerary test.

Method Detail

minNumberOfRecords

public int minNumberOfRecords()

Indicates the minimum number of records that the record set to be tested must have.

Specified by:
minNumberOfRecords in interface DataTest
Specified by:
minNumberOfRecords in class AbstractRecordSetTest
Returns:
minimum number of records to be tested.

doInitialize

protected void doInitialize()
                     throws DataTesterException

Internal method to initialize the test.

Overrides:
doInitialize in class AbstractDataTest
Throws:
DataTesterException

doTest

protected void doTest(GenericRecordSet genericRecordSet)
               throws DataTesterException

Detect inconsistencies between two events related with the same person.

Specified by:
doTest in class AbstractDataTest
Parameters:
genericRecordSet - RecordSet to be tested.
Throws:
DataTesterException

getVersion

public java.lang.String getVersion()

Outputs the current version of this test based on the CVS revision.

Specified by:
getVersion in interface DataTest
Specified by:
getVersion in class AbstractDataTest
Returns:
Test version.