-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathSamuelHamExampleTest.java
More file actions
143 lines (119 loc) · 7.11 KB
/
SamuelHamExampleTest.java
File metadata and controls
143 lines (119 loc) · 7.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
package org.gedcomx.examples;
import org.gedcomx.Gedcomx;
import org.gedcomx.agent.Address;
import org.gedcomx.agent.Agent;
import org.gedcomx.common.Attribution;
import org.gedcomx.common.URI;
import org.gedcomx.conclusion.*;
import org.gedcomx.rt.SerializationUtil;
import org.gedcomx.source.SourceCitation;
import org.gedcomx.source.SourceDescription;
import org.gedcomx.source.SourceReference;
import org.gedcomx.types.*;
import org.junit.jupiter.api.Test;
import java.text.ParseException;
import java.text.SimpleDateFormat;
/**
* @author Ryan Heaton
*/
class SamuelHamExampleTest {
@Test
void example() throws Exception {
//Jane Doe, the researcher.
Agent janeDoe = new Agent().id("A-1").name("Jane Doe").email("example@example.org");
//Lin Yee Chung Cemetery
Agent fhl = new Agent().id("A-2").name("Family History Library").address(new Address().city("Salt Lake City").stateOrProvince("Utah"));
//The attribution for this research.
Attribution researchAttribution = new Attribution().contributor(janeDoe).modified(parse("2014-04-25"));
//The parish register.
SourceDescription recordDescription = new SourceDescription().id("S-1")
.title("Marriage entry for Samuel Ham and Elizabeth Spiller, Parish Register, Wilton, Somerset, England")
.description("Marriage entry for Samuel Ham and Elizabeth in a copy of the registers of the baptisms, marriages, and burials at the church of St. George in the parish of Wilton : adjoining Taunton, in the county of Somerset from A.D. 1558 to A.D. 1837.")
.citation(new SourceCitation().value("Joseph Houghton Spencer, transcriber, Church of England, Parish Church of Wilton (Somerset). <cite>A copy of the registers of the baptisms, marriages, and burials at the church of St. George in the parish of Wilton : adjoining Taunton, in the county of Somerset from A.D. 1558 to A.D. 1837</cite>; Marriage entry for Samuel Ham and Elizabeth Spiller (3 November 1828), (Taunton: Barnicott, 1890), p. 224, No. 86."))
.resourceType(ResourceType.PhysicalArtifact)
.repository(fhl);
//The transcription of the grave stone.
Document transcription = new Document().id("D-1")
.lang("en")
.type(DocumentType.Transcription)
.text("Samuel Ham of the parish of Honiton and Elizabeth Spiller\n" +
"were married this 3rd day of November 1828 by David Smith\n" +
"Stone, Pl Curate,\n" +
"In the Presence of\n" +
"Jno Pain.\n" +
"R.G. Halls. Peggy Hammet.\n" +
"No. 86.")
.source(recordDescription);
//The transcription described as a source.
SourceDescription transcriptionDescription = new SourceDescription().id("S-2")
.about(URI.create("#" + transcription.getId()))
.title("Transcription of marriage entry for Samuel Ham and Elizabeth Spiller, Parish Register, Wilton, Somerset, England")
.description("Transcription of marriage entry for Samuel Ham and Elizabeth in a copy of the registers of the baptisms, marriages, and burials at the church of St. George in the parish of Wilton : adjoining Taunton, in the county of Somerset from A.D. 1558 to A.D. 1837.")
.citation(new SourceCitation().value("Joseph Houghton Spencer, transcriber, Church of England, Parish Church of Wilton (Somerset). <cite>A copy of the registers of the baptisms, marriages, and burials at the church of St. George in the parish of Wilton : adjoining Taunton, in the county of Somerset from A.D. 1558 to A.D. 1837</cite>; Marriage entry for Samuel Ham and Elizabeth Spiller (3 November 1828), (Taunton: Barnicott, 1890), p. 224, No. 86."))
.resourceType(ResourceType.DigitalArtifact)
.source(new SourceReference().description(recordDescription));
//the marriage fact.
Fact marriage = new Fact()
.type(FactType.Marriage)
.date(new Date().original("3 November 1828").formal("+1828-11-03"))
.place(new PlaceReference().original("Wilton St George, Wilton, Somerset, England"));
//the spouse1's residence.
Fact samsResidence = new Fact()
.type(FactType.Residence)
.date(new Date().original("3 November 1828").formal("+1828-11-03"))
.place(new PlaceReference().original("parish of Honiton, Devon, England"));
//the spouse1's residence.
Fact lizsResidence = new Fact()
.type(FactType.Residence)
.date(new Date().original("3 November 1828").formal("+1828-11-03"))
.place(new PlaceReference().original("parish of Wilton, Somerset, England"));
//the spouse1
Person sam = new Person().id("P-1").extracted(true).source(transcriptionDescription).name("Samuel Ham").gender(GenderType.Male).fact(samsResidence);
//the spouse2.
Person liz = new Person().id("P-2").extracted(true).source(transcriptionDescription).name("Elizabeth Spiller").gender(GenderType.Female).fact(lizsResidence);
//witnesses
Person witness1 = new Person().id("P-3").extracted(true).source(transcriptionDescription).name("Jno. Pain");
Person witness2 = new Person().id("P-4").extracted(true).source(transcriptionDescription).name("R.G. Halls");
Person witness3 = new Person().id("P-5").extracted(true).source(transcriptionDescription).name("Peggy Hammet");
//officiator
Person officiator = new Person().id("P-6").extracted(true).source(transcriptionDescription).name("David Smith Stone");
//the relationship.
Relationship marriageRelationship = new Relationship().extracted(true).type(RelationshipType.Couple).person1(sam).person2(liz).fact(marriage);
//the marriage event
Event marriageEvent = new Event(EventType.Marriage).id("E-1").extracted(true)
.date(new Date().original("3 November 1828").formal("+1828-11-03"))
.place(new PlaceReference().original("Wilton St George, Wilton, Somerset, England"))
.role(new EventRole().person(sam).type(EventRoleType.Principal))
.role(new EventRole().person(liz).type(EventRoleType.Principal))
.role(new EventRole().person(witness1).type(EventRoleType.Witness))
.role(new EventRole().person(witness2).type(EventRoleType.Witness))
.role(new EventRole().person(witness3).type(EventRoleType.Witness))
.role(new EventRole().person(officiator).type(EventRoleType.Official));
//Jane Doe's analysis.
Document analysis = new Document().id("D-2").text("...Jane Doe's analysis document...");
//Jane Doe's conclusions about a person.
Person samConclusion = new Person().id("C-1").evidence(sam).analysis(analysis);
Gedcomx gx = new Gedcomx()
.agent(janeDoe)
.agent(fhl)
.attribution(researchAttribution)
.sourceDescription(recordDescription)
.document(transcription)
.sourceDescription(transcriptionDescription)
.person(sam)
.person(liz)
.person(witness1)
.person(witness2)
.person(witness3)
.person(officiator)
.relationship(marriageRelationship)
.event(marriageEvent)
.document(analysis)
.person(samConclusion);
SerializationUtil.processThroughXml(gx);
SerializationUtil.processThroughJson(gx);
}
private java.util.Date parse(String date) throws ParseException {
return new SimpleDateFormat("yyyy-MM-dd").parse(date);
}
}