Package org.gedcomx
Class Gedcomx
- java.lang.Object
-
- org.gedcomx.common.ExtensibleData
-
- org.gedcomx.links.HypermediaEnabledData
-
- org.gedcomx.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:
- The GEDCOM X Conceptual Model, Version 1.0
- The GEDCOM X JSON Format, Version 1.0
- The GEDCOM X XML Format, Version 1.0
This documentation is provided as a non-normative reference guide.
- Author:
- Ryan Heaton
-
-
Field Summary
-
Fields inherited from class org.gedcomx.common.ExtensibleData
extensionElements, transientProperties
-
-
Constructor Summary
Constructors Constructor Description Gedcomx()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(GedcomxModelVisitor visitor)Accept a visitor.voidaddAgent(Agent agent)Add a agent to the data set.voidaddCollection(Collection collection)Add a collection to the data set.voidaddDocument(Document document)Add a document to the data set.voidaddEvent(Event event)Add a event to the data set.voidaddField(Field field)Add a field to the data set.GedcomxaddMainPersonDescription()Add a description for the main person in this document.voidaddPerson(Person person)Add a person to the data set.GedcomxaddPersonDescription(Person person, Date lastModified, DateFormat dateFormat, String version, URI collectionUri)Add a description for the person in this document.voidaddPlace(PlaceDescription place)Add a place to the data set.voidaddRecordDescriptor(RecordDescriptor recordDescriptor)Add a recordDescriptor to the data set.voidaddRelationship(Relationship relationship)Add a relationship to the data set.voidaddSourceDescription(SourceDescription sourceDescription)Add a source description to the data set.Gedcomxagent(Agent agent)Build this out with a agent.Stream<Agent>agents()Create a stream of the agents in this data set.Gedcomxattribution(Attribution attribution)Build this out with an attribution.Gedcomxcollection(Collection collection)Build this out with a collection.Stream<Collection>collections()Create a stream of the collections in this data set.GedcomxdescriptionRef(URI descriptionRef)Build out this with a description ref.Gedcomxdocument(Document document)Build this out with a document.Stream<Document>documents()Create a stream of the documents in this data set.voidembed(Gedcomx gedcomx)Gedcomxevent(Event event)Build this out with a event.Stream<Event>events()Create a stream of the events in this data set.GedcomxextensionElement(Object element)Gedcomxfield(Field field)Build this out with a field.Stream<Field>fields()Create a stream of the fields in this data set.AgentfindAgent(URI uri)Find a agent in the document by URI.RelationshipfindCoupleRelationship(ResourceReference person1, ResourceReference person2)Find the couple relationship (if any) that corresponds to the relationship between the people with the given IDs.RelationshipfindCoupleRelationship(FamilyView family)Find the couple relationship (if any) that corresponds to the relationship between the parents in the given family.SourceDescriptionfindDescription()Find the description of this record.SourceDescriptionfindDescription(URI uri)Find a description in the document by URI.static <E extends HypermediaEnabledData>
EfindElement(List<E> items, URI ref)RelationshipfindParentChildRelationship(ResourceReference parent, ResourceReference child)Find the parent-child relationship between the given two persons.PersonfindPerson(URI uri)Find a person in the document by URI.PlaceDescriptionfindPlace(URI uri)Find a place in the document by URI.RelationshipfindRelationship(URI uri)Find a relationship in the document by URI.static <S extends Subject>
SfindSubject(List<S> items, URI ref)protected static voidfixId(ResourceReference ref, String localId)GedcomxfixLocalReferences()Fixes all references to entities that are in the document to be local references.protected static voidfixupSourceReferences(List<SourceDescription> sds, Subject local)List<Agent>getAgents()The agents included in this genealogical data set.AttributiongetAttribution()The attribution of this genealogical data.List<Collection>getCollections()The collections included in this genealogical data set.List<Relationship>getCoupleRelationships()Get the list of couple relationships in the document.URIgetDescriptionRef()A reference to a description of this data set.List<Document>getDocuments()The documents included in this genealogical data set.List<Event>getEvents()The events included in this genealogical data set.List<Field>getFields()The extracted fields included in this genealogical data set.StringgetLang()The language of this genealogical data set.List<Relationship>getParentChildRelationships()Get the list of parent-child relationships in the document.PersongetPerson()Get the first person in the document.List<Person>getPersons()The persons included in this genealogical data set.List<PlaceDescription>getPlaces()The places included in this genealogical data set.List<RecordDescriptor>getRecordDescriptors()The record descriptors included in this genealogical data set.List<Relationship>getRelationships()The relationships included in this genealogical data set.SourceDescriptiongetSourceDescription()Get the first source description in the document.SourceDescriptiongetSourceDescription(URI resourceType)Get the first source description in the document with the type that is specified.List<SourceDescription>getSourceDescriptions()The descriptions of sources included in this genealogical data set.Gedcomxid(String id)Build up this object with an id.Gedcomxlang(String lang)Build out this envelope with a lang.Gedcomxlink(String rel, URI href)Build up this data with a link.Gedcomxlink(Link link)Build up this data with a link.Gedcomxperson(Person person)Build this out with a person.Stream<Person>persons()Create a stream for the persons in this data set.Gedcomxplace(PlaceDescription place)Build this out with a place.Stream<PlaceDescription>places()Create a stream of the places in this data set.GedcomxrecordDescriptor(RecordDescriptor recordDescriptor)Build this out with a record descriptor.Stream<RecordDescriptor>recordDescriptors()Create a stream of the record descriptors in this data set.Gedcomxrelationship(Relationship relationship)Build this out with a relationship.Stream<Relationship>relationships()Create a stream for the relationships in this data set.protected static booleansamePerson(ResourceReference ref1, ResourceReference ref2)Tell whether the given resource reference is referencing the current personvoidsetAgents(List<Agent> agents)The agents included in this genealogical data set.voidsetAttribution(Attribution attribution)The attribution of this genealogical data.voidsetCollections(List<Collection> collections)The collections included in this genealogical data set.voidsetDescriptionRef(URI descriptionRef)A reference to a description of this data set.voidsetDocuments(List<Document> documents)The documents included in this genealogical data set.voidsetEvents(List<Event> events)The events included in this genealogical data set.voidsetFields(List<Field> fields)The extracted fields included in this genealogical data set.voidsetLang(String lang)The language of this genealogical data set.voidsetPersons(List<Person> persons)The persons included in this genealogical data set.voidsetPlaces(List<PlaceDescription> places)The places included in this genealogical data set.voidsetRecordDescriptors(List<RecordDescriptor> recordDescriptors)The record descriptors included in this genealogical data set.voidsetRelationships(List<Relationship> relationships)The relationships included in this genealogical data set.voidsetSourceDescriptions(List<SourceDescription> sourceDescriptions)The descriptions of sources included in this genealogical data set.GedcomxsourceDescription(SourceDescription sourceDescription)Build this out with a source description.Stream<SourceDescription>sourceDescriptions()Create a stream of the source descriptions in this document.Stream<Subject>subjects()Create a stream of all the subjects of this record.-
Methods inherited from class org.gedcomx.links.HypermediaEnabledData
addLink, addLink, addTemplatedLink, embed, getLink, getLinks, getLinks, setLinks
-
Methods inherited from class org.gedcomx.common.ExtensibleData
addExtensionElement, embed, findExtensionOfType, findExtensionOfType, findExtensionsOfType, findExtensionsOfType, getExtensionElements, getId, getTransientProperties, getTransientProperty, removeExtensionElements, setExtensionElement, setExtensionElements, setId, setTransientProperty, toString
-
-
-
-
Method Detail
-
id
public Gedcomx id(String id)
Description copied from class:ExtensibleDataBuild up this object with an id.- Overrides:
idin classExtensibleData- Parameters:
id- The id.- Returns:
- this.
-
extensionElement
public Gedcomx extensionElement(Object element)
- Overrides:
extensionElementin classExtensibleData
-
link
public Gedcomx link(Link link)
Description copied from class:HypermediaEnabledDataBuild up this data with a link.- Overrides:
linkin classHypermediaEnabledData- Parameters:
link- The link.- Returns:
- this.
-
link
public Gedcomx link(String rel, URI href)
Description copied from class:HypermediaEnabledDataBuild up this data with a link.- Overrides:
linkin classHypermediaEnabledData- 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.
-
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.
-
setFields
public void setFields(List<Field> 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 personlastModified- 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.
-
findElement
public static <E extends HypermediaEnabledData> E findElement(List<E> items, URI ref)
-
-