-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathWongAloiauExampleTest.java
More file actions
149 lines (123 loc) · 6.86 KB
/
WongAloiauExampleTest.java
File metadata and controls
149 lines (123 loc) · 6.86 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
144
145
146
147
148
149
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 WongAloiauExampleTest {
@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 cemetery = new Agent().id("A-2").name("Lin Yee Chung Cemetery").address(new Address().city("Honolulu").stateOrProvince("Hawaii"));
//Hanyu Pinyin, the translator.
Agent hanyuPinyin = new Agent().id("A-3").name("HANYU Pinyin 王大年").email("example@example.org");
//The attribution for this research.
Attribution researchAttribution = new Attribution().contributor(janeDoe).modified(parse("2014-03-27"));
//The attribution for the translation.
Attribution translationAttribution = new Attribution().contributor(hanyuPinyin).modified(parse("2014-03-27"));
//The grave stone.
SourceDescription gravestoneDescription = new SourceDescription().id("S-1")
.title("Grave Marker of WONG Aloiau, Lin Yee Chung Cemetery, Honolulu, Oahu, Hawaii")
.citation(new SourceCitation().value("WONG Aloiau gravestone, Lin Yee Chung Cemetery, Honolulu, Oahu, Hawaii; visited May 1975 by Jane Doe."))
.resourceType(ResourceType.PhysicalArtifact)
.repository(cemetery);
//The image of the grave stone.
SourceDescription gravestoneImageDescription = new SourceDescription().id("S-2")
.title("Grave Marker of WONG Aloiau, Lin Yee Chung Cemetery, Honolulu, Oahu, Hawaii")
.citation(new SourceCitation().value("WONG Aloiau gravestone (digital photograph), Lin Yee Chung Cemetery, Honolulu, Oahu, Hawaii; visited May 1975 by Jane Doe."))
.resourceType(ResourceType.DigitalArtifact)
.source(new SourceReference().description(gravestoneDescription));
//The transcription of the grave stone.
Document transcription = new Document().id("D-1")
.lang("zh")
.text("WONG ALOIAU\n" +
"NOV. 22, 1848 – AUG. 3, 1920\n" +
"中山 大字都 泮沙鄉\n" +
"生 於 前 清 戊申 年 十一 月 廿二(日)子 時\n" +
"終 於 民國 庚申 年 七月 十二 (日) 午 時\n" +
"先考 諱 羅有 字 容康 王 府 君 之 墓")
.source(gravestoneImageDescription);
//The transcription described as a source.
SourceDescription transcriptionDescription = new SourceDescription().id("S-3")
.about(URI.create("#" + transcription.getId()))
.title("Transcription of Grave Marker of WONG Aloiau, Lin Yee Chung Cemetery, Honolulu, Oahu, Hawaii")
.citation(new SourceCitation().value("WONG Aloiau gravestone (transcription), Lin Yee Chung Cemetery, Honolulu, Oahu, Hawaii; visited May 1975 by Jane Doe."))
.resourceType(ResourceType.DigitalArtifact)
.source(new SourceReference().description(gravestoneImageDescription));
//The translation of the grave stone.
Document translation = new Document().id("D-2")
.text("WONG ALOIAU\n" +
"NOV. 22, 1848 – AUG. 3, 1920 [lunar dates]\n" +
"[Birthplace] [China, Guandong, ]Chung Shan, See Dai Doo, Pun Sha village\n" +
"[Date of birth] Born at former Qing 1848 year 11th month 22nd day 23-1 hour.\n" +
"[Life] ended at Republic of China year 1920 year 7th mo. 12th day 11-13 hour.\n" +
"Deceased father avoid [mention of] Lo Yau also known as Young Hong Wong [noble]residence ruler’s grave.")
.source(transcriptionDescription);
//The translation described as a source.
SourceDescription translationDescription = new SourceDescription().id("S-4")
.about(URI.create("#" + translation.getId()))
.title("Translation of Grave Marker of WONG Aloiau, Lin Yee Chung Cemetery, Honolulu, Oahu, Hawaii")
.citation(new SourceCitation().value("WONG Aloiau gravestone, Lin Yee Chung Cemetery, Honolulu, Oahu, Hawaii; visited May 1975 by Jane Doe. Translation by HANYU Pinyin 王大年."))
.attribution(translationAttribution)
.resourceType(ResourceType.DigitalArtifact)
.source(new SourceReference().description(transcriptionDescription));
//the birth.
Fact birth = new Fact()
.type(FactType.Birth)
.date(new Date().original("former Qing 1848 year 11th month 22nd day 23-1 hour").formal("+1848-11-22"))
.place(new PlaceReference().original("Pun Sha Village, See Dai Doo, Chung Shan, Guangdong, China"));
//the death.
Fact death = new Fact()
.type(FactType.Death)
.date(new Date().original("Republic of China year 1920 year 7th mo. 12th day 11-13 hour").formal("+1920-08-03"));
//the burial.
Fact burial = new Fact()
.type(FactType.Burial)
.place(new PlaceReference().original("Lin Yee Chung Cemetery, Honolulu, Oahu, Hawaii"));
//the principal person
Person aloiau = new Person().id("P-1").extracted(true).source(translationDescription).name("WONG Aloiau").gender(GenderType.Male).fact(birth).fact(death).fact(burial);
//the father of the principal (with an aka name).
Person father = new Person().id("P-2").extracted(true).source(translationDescription).name("Lo Yau").name(new Name().type(NameType.AlsoKnownAs).nameForm(new NameForm().fullText("Young Hong Wong")));
//the relationship.
Relationship fatherRelationship = new Relationship().type(RelationshipType.ParentChild).person1(father).person2(aloiau);
//Jane Doe's analysis.
Document analysis = new Document().id("D-3").text("...Jane Doe's analysis document...");
//Jane Doe's conclusions about a person.
Person aloiauConclusion = new Person().id("C-1").evidence(aloiau).analysis(analysis);
Gedcomx gx = new Gedcomx()
.agent(janeDoe)
.agent(cemetery)
.agent(hanyuPinyin)
.attribution(researchAttribution)
.sourceDescription(gravestoneDescription)
.sourceDescription(gravestoneImageDescription)
.document(transcription)
.sourceDescription(transcriptionDescription)
.document(translation)
.sourceDescription(translationDescription)
.person(aloiau)
.person(father)
.relationship(fatherRelationship)
.document(analysis)
.person(aloiauConclusion);
SerializationUtil.processThroughXml(gx);
SerializationUtil.processThroughJson(gx);
}
private java.util.Date parse(String date) throws ParseException {
return new SimpleDateFormat("yyyy-MM-dd").parse(date);
}
}