Package org.gedcomx

Class Gedcomx

All Implemented Interfaces:
HasTransientProperties, SupportsLinks, HasFields, SupportsExtensionElements

public class Gedcomx extends HypermediaEnabledData implements HasFields

The GEDCOM X data formats define the serialization formats of the GEDCOM X conceptual model. The canonical documentation is provided by the formal specification documents:

This documentation is provided as a non-normative reference guide.

Author:
Ryan Heaton
  • Constructor Details

    • Gedcomx

      public Gedcomx()
    • Gedcomx

      public Gedcomx(Gedcomx copy)
  • Method Details

    • id

      public Gedcomx id(String id)
      Description copied from class: ExtensibleData
      Build up this object with an id.
      Overrides:
      id in class ExtensibleData
      Parameters:
      id - The id.
      Returns:
      this.
    • extensionElement

      public Gedcomx extensionElement(Object element)
      Overrides:
      extensionElement in class ExtensibleData
    • link

      public Gedcomx link(Link link)
      Description copied from class: HypermediaEnabledData
      Build up this data with a link.
      Overrides:
      link in class HypermediaEnabledData
      Parameters:
      link - The link.
      Returns:
      this.
    • link

      public Gedcomx link(String rel, URI href)
      Description copied from class: HypermediaEnabledData
      Build up this data with a link.
      Overrides:
      link in class HypermediaEnabledData
      Parameters:
      rel - The rel.
      href - The href.
      Returns:
      this.
    • getLang

      public String getLang()
      The language of this genealogical data set. See http://www.w3.org/International/articles/language-tags/. Note that some language-enabled elements MAY override the language.
      Returns:
      The language of the genealogical data.
    • setLang

      public void setLang(String lang)
      The language of this genealogical data set. See http://www.w3.org/International/articles/language-tags/. Note that some language-enabled elements MAY override the language.
      Parameters:
      lang - The language of this genealogical data.
    • lang

      public Gedcomx lang(String lang)
      Build out this envelope with a lang.
      Parameters:
      lang - The lang.
      Returns:
      this.
    • getDescriptionRef

      public URI getDescriptionRef()
      A reference to a description of this data set.
      Returns:
      A reference to a description of this data set.
    • setDescriptionRef

      public void setDescriptionRef(URI descriptionRef)
      A reference to a description of this data set.
      Parameters:
      descriptionRef - A reference to a description of this data set.
    • descriptionRef

      public Gedcomx descriptionRef(URI descriptionRef)
      Build out this with a description ref.
      Parameters:
      descriptionRef - The description ref.
      Returns:
      this.
    • getAttribution

      public Attribution getAttribution()
      The attribution of this genealogical data.
      Returns:
      The attribution of this genealogical data.
    • setAttribution

      public void setAttribution(Attribution attribution)
      The attribution of this genealogical data.
      Parameters:
      attribution - The attribution of this genealogical data.
    • attribution

      public Gedcomx attribution(Attribution attribution)
      Build this out with an attribution.
      Parameters:
      attribution - The attribution.
      Returns:
      this.
    • getPerson

      public Person getPerson()
      Get the first person in the document.
      Returns:
      The first person in the document.
    • findPerson

      public Person findPerson(URI uri)
      Find a person in the document by URI.
      Parameters:
      uri - the uri
      Returns:
      The person, or null.
    • persons

      public Stream<Person> persons()
      Create a stream for the persons in this data set.
      Returns:
      The stream of persons.
    • getPersons

      public List<Person> getPersons()
      The persons included in this genealogical data set.
      Returns:
      The persons included in this genealogical data set.
    • setPersons

      public void setPersons(List<Person> persons)
      The persons included in this genealogical data set.
      Parameters:
      persons - The persons included in this genealogical data set.
    • person

      public Gedcomx person(Person person)
      Build this out with a person.
      Parameters:
      person - The person.
      Returns:
      this.
    • addPerson

      public void addPerson(Person person)
      Add a person to the data set.
      Parameters:
      person - The person to be added.
    • getCoupleRelationships

      public List<Relationship> getCoupleRelationships()
      Get the list of couple relationships in the document.
      Returns:
      The list of couple relationships in the document.
    • getParentChildRelationships

      public List<Relationship> getParentChildRelationships()
      Get the list of parent-child relationships in the document.
      Returns:
      The list of parent-child relationships in the document.
    • findCoupleRelationship

      public Relationship findCoupleRelationship(FamilyView family)
      Find the couple relationship (if any) that corresponds to the relationship between the parents in the given family.
      Parameters:
      family - - Family to find the couple relationship for.
      Returns:
      the couple relationship for the parents in the family, if any, or null if there isn't one (or if there are not two parents).
    • findCoupleRelationship

      public Relationship findCoupleRelationship(ResourceReference person1, ResourceReference person2)
      Find the couple relationship (if any) that corresponds to the relationship between the people with the given IDs.
      Parameters:
      person1 - - person1 to find (i.e., spouse1)
      person2 - - person2 to find (i.e., spouse2)
      Returns:
      the couple relationship for the parents in the family, if any, or null if there isn't one (or if there are not two parents).
    • findParentChildRelationship

      public Relationship findParentChildRelationship(ResourceReference parent, ResourceReference child)
      Find the parent-child relationship between the given two persons.
      Parameters:
      parent - - Reference to the parent to find.
      child - - Reference to the child to find.
      Returns:
      parent-child relationship for the given parent and child, or null if not found in the document.
    • samePerson

      protected static boolean samePerson(ResourceReference ref1, ResourceReference ref2)
      Tell whether the given resource reference is referencing the current person
      Parameters:
      ref1 - - Local reference to a person URI.
      ref2 - - Local reference to a person URI.
      Returns:
      true if the personReference is referencing this person (or both are null). False otherwise.
    • findRelationship

      public Relationship findRelationship(URI uri)
      Find a relationship in the document by URI.
      Parameters:
      uri - the uri
      Returns:
      The relationship, or null.
    • relationships

      public Stream<Relationship> relationships()
      Create a stream for the relationships in this data set.
      Returns:
      a stream for the relationships in this data set.
    • getRelationships

      public List<Relationship> getRelationships()
      The relationships included in this genealogical data set.
      Returns:
      The relationships included in this genealogical data set.
    • setRelationships

      public void setRelationships(List<Relationship> relationships)
      The relationships included in this genealogical data set.
      Parameters:
      relationships - The relationships included in this genealogical data set.
    • relationship

      public Gedcomx relationship(Relationship relationship)
      Build this out with a relationship.
      Parameters:
      relationship - The relationship.
      Returns:
      this.
    • addRelationship

      public void addRelationship(Relationship relationship)
      Add a relationship to the data set.
      Parameters:
      relationship - The relationship to be added.
    • getSourceDescription

      public SourceDescription getSourceDescription()
      Get the first source description in the document.
      Returns:
      The first source description in the document.
    • getSourceDescription

      public SourceDescription getSourceDescription(URI resourceType)
      Get the first source description in the document with the type that is specified.
      Parameters:
      resourceType - The URI resource type of the SourceDescription you are trying to find.
      Returns:
      The first source description in the document with the type that is specified..
    • findDescription

      public SourceDescription findDescription()
      Find the description of this record.
      Returns:
      The description, or null.
    • findDescription

      public SourceDescription findDescription(URI uri)
      Find a description in the document by URI.
      Parameters:
      uri - the uri
      Returns:
      The description, or null.
    • sourceDescriptions

      public Stream<SourceDescription> sourceDescriptions()
      Create a stream of the source descriptions in this document.
      Returns:
      a stream of the source descriptions in this document.
    • getSourceDescriptions

      public List<SourceDescription> getSourceDescriptions()
      The descriptions of sources included in this genealogical data set.
      Returns:
      The descriptions of sources included in this genealogical data set.
    • setSourceDescriptions

      public void setSourceDescriptions(List<SourceDescription> sourceDescriptions)
      The descriptions of sources included in this genealogical data set.
      Parameters:
      sourceDescriptions - The descriptions of sources included in this genealogical data set.
    • sourceDescription

      public Gedcomx sourceDescription(SourceDescription sourceDescription)
      Build this out with a source description.
      Parameters:
      sourceDescription - The source description.
      Returns:
      this.
    • addSourceDescription

      public void addSourceDescription(SourceDescription sourceDescription)
      Add a source description to the data set.
      Parameters:
      sourceDescription - The source description to be added.
    • findAgent

      public Agent findAgent(URI uri)
      Find a agent in the document by URI.
      Parameters:
      uri - the uri
      Returns:
      The agent, or null.
    • agents

      public Stream<Agent> agents()
      Create a stream of the agents in this data set.
      Returns:
      a stream of the agents in this data set.
    • getAgents

      public List<Agent> getAgents()
      The agents included in this genealogical data set.
      Returns:
      The agents included in this genealogical data set.
    • setAgents

      public void setAgents(List<Agent> agents)
      The agents included in this genealogical data set.
      Parameters:
      agents - The agents included in this genealogical data set.
    • agent

      public Gedcomx agent(Agent agent)
      Build this out with a agent.
      Parameters:
      agent - The agent.
      Returns:
      this.
    • addAgent

      public void addAgent(Agent agent)
      Add a agent to the data set.
      Parameters:
      agent - The agent to be added.
    • events

      public Stream<Event> events()
      Create a stream of the events in this data set.
      Returns:
      a stream of the events in this data set.
    • getEvents

      public List<Event> getEvents()
      The events included in this genealogical data set.
      Returns:
      The events included in this genealogical data set.
    • setEvents

      public void setEvents(List<Event> events)
      The events included in this genealogical data set.
      Parameters:
      events - The events included in this genealogical data set.
    • event

      public Gedcomx event(Event event)
      Build this out with a event.
      Parameters:
      event - The event.
      Returns:
      this.
    • addEvent

      public void addEvent(Event event)
      Add a event to the data set.
      Parameters:
      event - The event to be added.
    • findPlace

      public PlaceDescription findPlace(URI uri)
      Find a place in the document by URI.
      Parameters:
      uri - the uri
      Returns:
      The place, or null.
    • places

      public Stream<PlaceDescription> places()
      Create a stream of the places in this data set.
      Returns:
      a stream of the places in this data set.
    • getPlaces

      public List<PlaceDescription> getPlaces()
      The places included in this genealogical data set.
      Returns:
      The places included in this genealogical data set.
    • setPlaces

      public void setPlaces(List<PlaceDescription> places)
      The places included in this genealogical data set.
      Parameters:
      places - The places included in this genealogical data set.
    • place

      public Gedcomx place(PlaceDescription place)
      Build this out with a place.
      Parameters:
      place - The place.
      Returns:
      this.
    • addPlace

      public void addPlace(PlaceDescription place)
      Add a place to the data set.
      Parameters:
      place - The place to be added.
    • documents

      public Stream<Document> documents()
      Create a stream of the documents in this data set.
      Returns:
      a stream of the documents in this data set.
    • getDocuments

      public List<Document> getDocuments()
      The documents included in this genealogical data set.
      Returns:
      The documents included in this genealogical data set.
    • setDocuments

      public void setDocuments(List<Document> documents)
      The documents included in this genealogical data set.
      Parameters:
      documents - The documents included in this genealogical data set.
    • document

      public Gedcomx document(Document document)
      Build this out with a document.
      Parameters:
      document - The document.
      Returns:
      this.
    • addDocument

      public void addDocument(Document document)
      Add a document to the data set.
      Parameters:
      document - The document to be added.
    • collections

      public Stream<Collection> collections()
      Create a stream of the collections in this data set.
      Returns:
      a stream of the collections in this data set.
    • getCollections

      public List<Collection> getCollections()
      The collections included in this genealogical data set.
      Returns:
      The collections included in this genealogical data set.
    • setCollections

      public void setCollections(List<Collection> collections)
      The collections included in this genealogical data set.
      Parameters:
      collections - The collections included in this genealogical data set.
    • collection

      public Gedcomx collection(Collection collection)
      Build this out with a collection.
      Parameters:
      collection - The collection.
      Returns:
      this.
    • addCollection

      public void addCollection(Collection collection)
      Add a collection to the data set.
      Parameters:
      collection - The collection to be added.
    • fields

      public Stream<Field> fields()
      Create a stream of the fields in this data set.
      Specified by:
      fields in interface HasFields
      Returns:
      a stream of the fields in this data set.
    • getFields

      public List<Field> getFields()
      The extracted fields included in this genealogical data set. Fields that apply to a particular person, relationship or value should be included within that person or value, respectively. Remaining fields that did not have a place within the person or relationship structure can be included here. Also, fields that were extracted but not yet fit into a structure can also be included here.
      Specified by:
      getFields in interface HasFields
      Returns:
      The extracted fields included in this genealogical data set.
    • setFields

      public void setFields(List<Field> fields)
      The extracted fields included in this genealogical data set.
      Specified by:
      setFields in interface HasFields
      Parameters:
      fields - The extracted fields included in this genealogical data set.
    • field

      public Gedcomx field(Field field)
      Build this out with a field.
      Parameters:
      field - The field.
      Returns:
      this.
    • addField

      public void addField(Field field)
      Add a field to the data set.
      Parameters:
      field - The field to be added.
    • recordDescriptors

      public Stream<RecordDescriptor> recordDescriptors()
      Create a stream of the record descriptors in this data set.
      Returns:
      a stream of the record descriptors in this data set.
    • getRecordDescriptors

      public List<RecordDescriptor> getRecordDescriptors()
      The record descriptors included in this genealogical data set.
      Returns:
      The record descriptors included in this genealogical data set.
    • setRecordDescriptors

      public void setRecordDescriptors(List<RecordDescriptor> recordDescriptors)
      The record descriptors included in this genealogical data set.
      Parameters:
      recordDescriptors - The record descriptors included in this genealogical data set.
    • recordDescriptor

      public Gedcomx recordDescriptor(RecordDescriptor recordDescriptor)
      Build this out with a record descriptor.
      Parameters:
      recordDescriptor - The record descriptor.
      Returns:
      this.
    • addRecordDescriptor

      public void addRecordDescriptor(RecordDescriptor recordDescriptor)
      Add a recordDescriptor to the data set.
      Parameters:
      recordDescriptor - The recordDescriptor to be added.
    • accept

      public void accept(GedcomxModelVisitor visitor)
      Accept a visitor.
      Parameters:
      visitor - The visitor.
    • embed

      public void embed(Gedcomx gedcomx)
    • addMainPersonDescription

      public Gedcomx addMainPersonDescription()
      Add a description for the main person in this document.
      Returns:
      this.
    • addPersonDescription

      public Gedcomx addPersonDescription(Person person, Date lastModified, DateFormat dateFormat, String version, URI collectionUri)
      Add a description for the person in this document.
      Parameters:
      person - The person
      lastModified - When the person was last modified.
      dateFormat - The format for the date.
      version - The version of the person.
      collectionUri - The URI to the collection in which the person is found.
      Returns:
      this.
    • fixLocalReferences

      public Gedcomx fixLocalReferences()
      Fixes all references to entities that are in the document to be local references.
      Returns:
      this
    • fixupSourceReferences

      protected static void fixupSourceReferences(List<SourceDescription> sds, Subject local)
    • fixId

      protected static void fixId(ResourceReference ref, String localId)
    • subjects

      public Stream<Subject> subjects()
      Create a stream of all the subjects of this record.
      Returns:
      a stream of all the subjects of this record.
    • findSubject

      public static <S extends Subject> S findSubject(List<S> items, URI ref)
    • findElement

      public static <E extends HypermediaEnabledData> E findElement(List<E> items, URI ref)