|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.gedcomx.util.FieldMap
public class FieldMap
Class for helping to deal with connecting field values with record descriptors for historical records and image browse data. Historical records have both structured data (persons with names, gender, facts; and relationships with facts) and 'fields'. A field often represents what was actually stated within some area of text on a historical document (or what was strongly implied by that document, such as the male gender of a father in a birth record). Each field has a list of field values, which can be of FieldValueType.Original, meaning what the document originally said (or structurally implied); or FieldValueType.Interpreted, meaning that a user or system interpreted. For example, a 'gender' field might have an original field value of "M", which, because it is in a Mexican census, means "Mujer", which means "Female". So the "Interpreted" field value might say "Mujer", or might say "Female"; or it is possible that both are included, since it is a list. These field values will be found within a Field of type "http://gedcomx.org/Gender", and that field will be found inside of the gender inside of the person it applies to. That gender will have a conclusional 'type' (e.g., "http://gedcomx.org/Female") that software will typically use. The 'structured data' of the record is typically used when dealing with what the record 'meant' or in displaying genealogical data to be used in copying over to a conclusion tree. The 'fields' of a record are typically used when display what the record originally 'said', in order to help communicate to a user some of the genealogical nuances that each record can have, including some that don't translate directly into the standardized conclusional structure that GedcomX supports. Having structured data with embedded fields (plus a list of fields at the person, relationship and record level) allows general-purpose genealogical use of 'what the record is telling us' (via the structure) as well as preservation of the special-purpose nuances of a particular record type (via the fields). A GedcomX document that represents a historical record will often have a SourceDescription that has a record 'descriptor' reference, which is the URL of a GedcomX document that represents the Collection that the record is found in, along with a "#" and local id of the record descriptor withing that collection's document, that describes the display labels to be used for displaying a field-value pair view of the record's field data. This class takes two GedcomX documents: a record and its collection (or, equivalently, the DocMap for both) and walks the structure of the record to find all of the field values, and builds the maps necessary to find all the field labelIds, the localized display labels for each labelId, and the values for each labelId found in the record. (Note that because a Field can have multiple FieldValues of the same type (original or interpreted), then each labelId can map to a list of values). Also, Census records are different from other records in that each person in a census household can have the same list of fields, so when displaying field values from census data, it must be done one person at a time. Therefore, each record will either support getValues(labelId) [i.e., for non-census] or getValues(person, labelId) [census], but not both. User: Randy Wilson Date: 7/31/2014 Time: 11:07 AM
| Constructor Summary | |
|---|---|
FieldMap(DocMap recordDocMap,
DocMap collectionDocMap)
Constructor using a DocMap for a collection and record. |
|
FieldMap(Gedcomx record,
Gedcomx collection)
Constructor for a collection and record GedcomX document. |
|
| Method Summary | |
|---|---|
static List<Field> |
getAllFields(Gedcomx record)
Create a list of all of the fields occurring in the given GedcomX record, including those found within the various values. |
Gedcomx |
getCollection()
Get the GedcomX document for the collection that the record is found in. |
DocMap |
getCollectionDocMap()
Get the DocMap for the collection that the record is found in. |
String |
getDisplayLabel(String labelId,
String language)
Get the display label for the given labelId in the closest language available to the one given. |
FieldValueDescriptor |
getFieldValueDescriptor(String labelId)
Get the FieldValueDescriptor for the given field value label ID. |
Map<String,FieldValueDescriptor> |
getLabelFieldValueDescriptorMap()
Get the map of labelId to FieldValueDescriptor used by this FieldMap. |
static Map<String,FieldValueDescriptor> |
getLabelFieldValueDescriptorMap(RecordDescriptor recordDescriptor)
Get a map of labelId to FieldValueDescriptor for that label id. |
Map<String,List<String>> |
getLabelValueMap()
Get a map of labelId to list of values for that labelId. |
static Map<String,List<String>> |
getLabelValuesMap(List<Field> fields)
Get a map of labelId to values from all of the FieldValues that appear in the given list of Fields. |
static Map<Person,List<Field>> |
getPersonFieldMap(Gedcomx record)
Get a map of Person to the list of Fields for that person. |
Map<String,List<String>> |
getPersonLabelValueMap(Person person)
Get a map of labelId to list of values for that labelId for the given person. |
Gedcomx |
getRecord()
Get the GedcomX document for the record. |
RecordDescriptor |
getRecordDescriptor()
Get the RecordDescriptor that goes with this record. |
static RecordDescriptor |
getRecordDescriptor(DocMap collectionDocMap,
DocMap recordDocMap)
Find the RecordDescriptor from the collection document that is referenced by the main source description from the record document, i.e., find the record's record descriptor in the collection. |
DocMap |
getRecordDocMap()
Get the DocMap for the record. |
List<String> |
getValues(Person person,
String labelId)
Get a list of values that had the given labelId in the record for the given person. |
List<String> |
getValues(String labelId)
Get a list of values that had the given labelId in the record. |
static boolean |
isCensus(DocMap recordDocMap)
Tell whether the record with the given DocMap is a Census record, i.e., if it has a SourceDescription with a Coverage with a RecordType of Census. |
static boolean |
isCensus(Gedcomx record)
Tell whether the given record is a Census record, i.e., if it has a SourceDescription with a Coverage with a RecordType of Census. |
static boolean |
isCensus(SourceDescription sourceDescription)
Tell whether the given SourceDescription has 'coverage' with a RecordType of census. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FieldMap(Gedcomx record,
Gedcomx collection)
record - - GedcomX document for a record (which is in the given collection).collection - - GedcomX document for a collection (which contains the RecordDescriptor for the record).
public FieldMap(DocMap recordDocMap,
DocMap collectionDocMap)
recordDocMap - - DocMap for a GedcomX document for a record (which is in the given collection)collectionDocMap - - DocMap for a GedcomX document for a collection (which contains the RecordDescriptor for the record).| Method Detail |
|---|
public DocMap getCollectionDocMap()
public DocMap getRecordDocMap()
public Gedcomx getCollection()
public Gedcomx getRecord()
public String getDisplayLabel(String labelId,
String language)
labelId - - labelId to get the display value for (e.g., "PR_NAME")language - - Preferred language to get the display label in. null => use en-US.
public List<String> getValues(String labelId)
labelId - - LabelId to get the values for
public List<String> getValues(Person person,
String labelId)
person - - person to get values for (null => get record-level values for the given labelId, if any)labelId - - LabelId to get the values for
public FieldValueDescriptor getFieldValueDescriptor(String labelId)
labelId - - Label ID to find the FieldValueDescriptor for.
public Map<String,List<String>> getPersonLabelValueMap(Person person)
person - - Person to get the map for
public Map<String,List<String>> getLabelValueMap()
public Map<String,FieldValueDescriptor> getLabelFieldValueDescriptorMap()
public RecordDescriptor getRecordDescriptor()
public static RecordDescriptor getRecordDescriptor(DocMap collectionDocMap,
DocMap recordDocMap)
collectionDocMap - - DocMap for the collection GedcomX document.recordDocMap - - DocMap for the record GedcomX document.
public static Map<String,FieldValueDescriptor> getLabelFieldValueDescriptorMap(RecordDescriptor recordDescriptor)
recordDescriptor - - RecordDescriptor to build the map from.
public static Map<Person,List<Field>> getPersonFieldMap(Gedcomx record)
record - - record to get field map from
public static List<Field> getAllFields(Gedcomx record)
record - - GedcomX to get fields for.
public static Map<String,List<String>> getLabelValuesMap(List<Field> fields)
fields - - list of Fields to look in for FieldValues.
public static boolean isCensus(Gedcomx record)
record - - GedcomX record to examine
public static boolean isCensus(DocMap recordDocMap)
recordDocMap - - DocMap of the GedcomX record to examine
public static boolean isCensus(SourceDescription sourceDescription)
sourceDescription - - SourceDescription to examine for coverage.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||