def createGeorge(self, birthPlace, deathPlace):
        """

        :param PlaceDescription birthPlace: birth place
        :param PlaceDescription deathPlace: death place
        :return:
        """
        person = Person()
        person.gender.type = GenderType.Male
        #person.setGender(GenderType.Male)


        fact = Fact()
        fact.id = u"123"
        fact.type = FactType.Birth

        fact.date.original = u"February 22, 1732"
        fact.date.formal = u"+1732-02-22"

        fact.place.original = birthPlace.names.get().value.lower()
        fact.place.description = u"#" + birthPlace.id

        person.addFact(fact)

        fact = Fact()
        fact.id = u"456"
        fact.type = FactType.Death
        fact.date.original = u"December 14, 1799"
        fact.date.formal = u"+1799-12-14T22:00:00"
        fact.place.original = deathPlace.names.get().value.lower()
        fact.place.description = u"#" + deathPlace.id
        person.addFact(fact)

        name = Name()
        nameForm = NameForm()
        nameForm.fullText = u"George Washington"
        part = NamePart()
        part.type = NamePartType.Given
        part.value = u"George"
        nameForm.parts.append(part)
        part = NamePart()
        part.type = NamePartType.Surname
        part.value = u"Washington"
        nameForm.parts.append(part)

        name.nameForms.append(nameForm)
        name.id = u"789"

        person.names.append(name)
        person.id = u"BBB-BBBB"

        return person
    def createMartha(self, birthPlace, deathPlace):
        """

        :param PlaceDescription birthPlace: birth place
        :param PlaceDescription deathPlace: death place
        :return:
        """
        person = Person()
        person.gender.type = GenderType.Male
        #person.setGender(GenderType.Male)


        fact = Fact()
        fact.id = u"321"
        fact.type = FactType.Birth

        fact.date.original = u"June 2, 1731"
        fact.date.formal = u"+1731-06-02"
        fact.place.original = birthPlace.names.get().value.lower()
        fact.place.description = u"#" + birthPlace.id

        person.addFact(fact)

        fact = Fact()
        fact.id = u"654"
        fact.type = FactType.Death
        fact.date.original = u"May 22, 1802"
        fact.date.formal = u"+1802-05-22"
        fact.place.original = deathPlace.names.get().value.lower()
        fact.place.description = u"#" + deathPlace.id
        person.addFact(fact)

        name = Name()
        nameForm = NameForm()
        nameForm.fullText = u"Martha Dandridge Custis"
        part = NamePart()
        part.type = NamePartType.Given
        part.value = u"Martha Dandridge"
        nameForm.parts.append(part)
        part = NamePart()
        part.type = NamePartType.Surname
        part.value = u"Custis"
        nameForm.parts.append(part)

        name.nameForms.append(nameForm)
        name.id = u"987"

        person.names.append(name)
        person.id = u"CCC-CCCC"

        return person
Ejemplo n.º 3
0
    def createGeorge(self, birthPlace, deathPlace):
        """

        :param PlaceDescription birthPlace: birth place
        :param PlaceDescription deathPlace: death place
        :return:
        """
        person = Person()
        person.gender.type = GenderType.Male
        #person.setGender(GenderType.Male)

        fact = Fact()
        fact.id = u"123"
        fact.type = FactType.Birth

        fact.date.original = u"February 22, 1732"
        fact.date.formal = u"+1732-02-22"

        fact.place.original = birthPlace.names.get().value.lower()
        fact.place.description = u"#" + birthPlace.id

        person.addFact(fact)

        fact = Fact()
        fact.id = u"456"
        fact.type = FactType.Death
        fact.date.original = u"December 14, 1799"
        fact.date.formal = u"+1799-12-14T22:00:00"
        fact.place.original = deathPlace.names.get().value.lower()
        fact.place.description = u"#" + deathPlace.id
        person.addFact(fact)

        name = Name()
        nameForm = NameForm()
        nameForm.fullText = u"George Washington"
        part = NamePart()
        part.type = NamePartType.Given
        part.value = u"George"
        nameForm.parts.append(part)
        part = NamePart()
        part.type = NamePartType.Surname
        part.value = u"Washington"
        nameForm.parts.append(part)

        name.nameForms.append(nameForm)
        name.id = u"789"

        person.names.append(name)
        person.id = u"BBB-BBBB"

        return person
Ejemplo n.º 4
0
    def createMartha(self, birthPlace, deathPlace):
        """

        :param PlaceDescription birthPlace: birth place
        :param PlaceDescription deathPlace: death place
        :return:
        """
        person = Person()
        person.gender.type = GenderType.Male
        #person.setGender(GenderType.Male)

        fact = Fact()
        fact.id = u"321"
        fact.type = FactType.Birth

        fact.date.original = u"June 2, 1731"
        fact.date.formal = u"+1731-06-02"
        fact.place.original = birthPlace.names.get().value.lower()
        fact.place.description = u"#" + birthPlace.id

        person.addFact(fact)

        fact = Fact()
        fact.id = u"654"
        fact.type = FactType.Death
        fact.date.original = u"May 22, 1802"
        fact.date.formal = u"+1802-05-22"
        fact.place.original = deathPlace.names.get().value.lower()
        fact.place.description = u"#" + deathPlace.id
        person.addFact(fact)

        name = Name()
        nameForm = NameForm()
        nameForm.fullText = u"Martha Dandridge Custis"
        part = NamePart()
        part.type = NamePartType.Given
        part.value = u"Martha Dandridge"
        nameForm.parts.append(part)
        part = NamePart()
        part.type = NamePartType.Surname
        part.value = u"Custis"
        nameForm.parts.append(part)

        name.nameForms.append(nameForm)
        name.id = u"987"

        person.names.append(name)
        person.id = u"CCC-CCCC"

        return person
    def testExample(self):
        import os
        contributor = Agent( {'id': u"A-1",})
        contributor.name(u"Jane Doe")
        contributor.email( u"*****@*****.**" )

        repository = Agent({'id': u"A-2"})
        repository.name(u"General Registry Office, Southport")

        attribution = Attribution()
        attribution.contributor.resource = u"#" + contributor.id
        attribution.modified = self.parse("2014-03-07")

        sourceDescription = SourceDescription()
        sourceDescription.id = u"S-1"
        sourceDescription.titles.append( u"Birth Certificate of Emma Bocock, 23 July 1843, General Registry Office" )
        sourceDescription.resourceType = ResourceType.PhysicalArtifact
        citation = SourceCitation({'value': u'England, birth certificate for Emma Bocock, born 23 July 1843; citing 1843 Birth in District and Sub-district of Ecclesall-Bierlow in the County of York, 303; General Registry Office, Southport.'})
        sourceDescription.citations.append(citation)
        sourceDescription.created = self.parse("1843-07-27")
        sourceDescription.repository.resource = "#" + repository.id

        birth = Fact()
        birth.type = FactType.Birth
        birth.date.original = u"23 June 1843"
        birth.place.original = u"Broadfield Bar, Abbeydale Road, Ecclesall-Bierlow, York, England, United Kingdom"

        emma = Person()
        emma.id = u"P-1"
        emma.extracted = True
        emma.sources.append(sourceDescription)
        emma.setName(u"Emma Bocock")
        emma.setGender(GenderType.Female)
        emma.addFact(birth)

        occupation = Fact({'type': FactType.Occupation,
                           'value': u"Toll Collector"})
        father = Person({'id': u'P-2'})
        father.extracted = True
        father.sources.append(sourceDescription)
        father.setName(u"William Bocock")
        father.addFact(occupation)

        mother = Person({'id': u'P-3'})
        mother.extracted = True
        mother.sources.append(sourceDescription)
        mother.setName(u'Sarah Bocock formerly Brough')

        fatherRelationship = Relationship()
        fatherRelationship.type = RelationshipType.ParentChild
        fatherRelationship.setPerson1(father)
        fatherRelationship.setPerson2(emma)

        motherRelationship = Relationship()
        motherRelationship.type = RelationshipType.ParentChild
        motherRelationship.setPerson1(mother)
        motherRelationship.setPerson2(emma)

        analysis = Document({'id' : u'D-1',
                             'text': u"...Jane Doe's analysis document..."})
        emmaConclusion = Person({'id': u'C-1'})
        emmaReference = EvidenceReference()
        emmaReference.setReference(emma)
        emmaConclusion.evidence.append(EvidenceReference(emma))
        emmaConclusion.analysis = ResourceReference(analysis)

        gx = Gedcomx()
        gx.agents.append(contributor)
        gx.agents.append(repository)
        gx.attribution = attribution
        gx.sourceDescriptions.append(sourceDescription)
        gx.persons.extend([emma, father, mother])
        gx.relationships.extend([fatherRelationship, motherRelationship])
        gx.documents.append(analysis)
        gx.persons.append(emmaConclusion)
        gx_dict = gx.to_dict()

        # Read the json output from java program and initialize a gedcomx object.
        dirname = os.path.abspath(os.path.dirname(__file__))
        java_gx = Gedcomx()
        java_gx.load( open(os.path.join(dirname, 'data', 'EmmaBocockExample_java.json') ))
        java_dict = java_gx.to_dict()
        # Compare both objects.
        self.assertDictEqual(gx_dict, java_dict)
        self.assertDictEqual(java_dict, gx_dict)
    def testExample(self):
        import os

        # Jane Doe, the researcher.
        janeDoe = Agent( {'id': u"A-1",})
        janeDoe.name(u"Jane Doe")
        janeDoe.email( u"*****@*****.**" )


        # Lin Yee Chung cemetry
        address = Address()
        address.city = "Salt Lake City"
        address.stateOrProvince = "Utah"
        fh1 = Agent({'id': 'A-2'})
        fh1.addresses.append(address)
        fh1.name("Family History Library")

        researchAttribution = Attribution()
        researchAttribution.contributor.resource = u'#' + janeDoe.id
        researchAttribution.modified = self.parse('2014-04-25')

        recordDescription = SourceDescription({'id': u'S-1'})
        recordDescription.titles.append(u"Marriage entry for Samuel Ham and Elizabeth Spiller, Parish Register, Wilton, Somerset, England")
        recordDescription.descriptions.append(u"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 = 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.'})
        recordDescription.citations.append(citation)
        recordDescription.resourceType = ResourceType.PhysicalArtifact
        recordDescription.repository.resource = u'#' + fh1  .id

        transcription = Document({'id': u'D-1',
                                  'lang': u'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."})
        transcription.source(recordDescription)


        transcriptionDescription = SourceDescription({'id': 'S-2'})
        transcriptionDescription.about = '#' + transcription.id
        transcriptionDescription.titles.append("Transcription of marriage entry for Samuel Ham and Elizabeth Spiller, Parish Register, Wilton, Somerset, England")
        transcriptionDescription.descriptions.append("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.")
        trans_citation = 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."})
        transcriptionDescription.citations.append(trans_citation)
        transcriptionDescription.resourceType = ResourceType.DigitalArtifact
        reference = SourceReference(recordDescription)
        transcriptionDescription.sources.append(reference)

        marriage = Fact()
        marriage.type = FactType.Marriage
        marriage.date.original = "3 November 1828"
        marriage.date.formal = "+1828-11-03"
        marriage.place.original = "Wilton St George, Wilton, Somerset, England"

        samsResidence = Fact()
        samsResidence.type = FactType.Residence
        samsResidence.date.original = "3 November 1828"
        samsResidence.date.formal = "+1828-11-03"
        samsResidence.place.original = "parish of Honiton, Devon, England"

        lizsResidence = Fact()
        lizsResidence.type = FactType.Residence
        lizsResidence.date.original = "3 November 1828"
        lizsResidence.date.formal = "+1828-11-03"
        lizsResidence.place.original = "parish of Wilton, Somerset, England"


        sam = Person({'id': 'P-1',
                      'extracted': True})
        sam.source(transcriptionDescription)
        sam.setName("Samuel Ham")
        sam.setGender(GenderType.Male)
        sam.addFact(samsResidence)

        liz = Person({'id': 'P-2',
                      'extracted': True})
        liz.source(transcriptionDescription)
        liz.setName("Elizabeth Spiller")
        liz.setGender(GenderType.Female)
        liz.addFact(lizsResidence)

        witness1 = Person({'id': 'P-3',
                           'extracted': True})
        witness1.source(transcriptionDescription)
        witness1.setName("Jno. Pain")

        witness2 = Person({'id': 'P-4',
                           'extracted': True})
        witness2.source(transcriptionDescription)
        witness2.setName("R.G. Halls")

        witness3 = Person({'id': 'P-5',
                           'extracted': True})
        witness3.source(transcriptionDescription)
        witness3.setName("Peggy Hammet")

        officiator = Person({'id': 'P-6',
                             'extracted': True})
        officiator.source(transcriptionDescription)
        officiator.setName("David Smith Stone")


        marriageRelationship = Relationship()
        marriageRelationship.extracted = True
        marriageRelationship.type = RelationshipType.Couple
        marriageRelationship.setPerson1(sam)
        marriageRelationship.setPerson2(liz)
        marriageRelationship.facts.append(marriage)

        marriageEvent = Event()
        marriageEvent.id = 'E-1'
        marriageEvent.type = EventType.Marriage
        marriageEvent.extracted = True
        marriageEvent.date.original = "3 November 1828"
        marriageEvent.date.formal = "+1828-11-03"
        marriageEvent.place.original = "Wilton St George, Wilton, Somerset, England"
        marriageEvent.roles.append(EventRole(EventRoleType.Principal, sam))
        marriageEvent.roles.append(EventRole(EventRoleType.Principal, liz))
        marriageEvent.roles.append(EventRole(EventRoleType.Witness, witness1))
        marriageEvent.roles.append(EventRole(EventRoleType.Witness, witness2))
        marriageEvent.roles.append(EventRole(EventRoleType.Witness, witness3))
        marriageEvent.roles.append(EventRole(EventRoleType.Official, officiator))

        analysis = Document({'id': 'D-2',
                             'text': "...Jane Doe's analysis document..."})
        samConclusion = Person({'id': 'C-1'})
        samConclusion.evidence.append(EvidenceReference(sam))
        samConclusion.analysis = ResourceReference(analysis)

        gx = Gedcomx()
        gx.agents.append(janeDoe)
        gx.agents.append(fh1)
        gx.attribution = researchAttribution
        gx.events.append(marriageEvent)
        gx.documents.append(transcription)
        gx.persons.extend([sam, liz, witness1, witness2,witness3, officiator, samConclusion])
        gx.relationships.append(marriageRelationship)
        gx.sourceDescriptions.extend([recordDescription, transcriptionDescription])
        gx.documents.append(analysis)

        gx_dict = gx.to_dict()
        # Read the json output from java program and initialize a gedcomx object.
        dirname = os.path.abspath(os.path.dirname(__file__))
        java_gx = Gedcomx()
        java_gx.load( open(os.path.join(dirname, 'data', 'SamuelHamExampleTest_java.json') ))
        java_dict = java_gx.to_dict()

        # Compare both objects.
        self.assertDictEqual(gx_dict, java_dict)
        self.assertDictEqual(java_dict, gx_dict)
Ejemplo n.º 7
0
    def testExample(self):
        import os
        contributor = Agent({
            'id': u"A-1",
        })
        contributor.name(u"Jane Doe")
        contributor.email(u"*****@*****.**")

        repository = Agent({'id': u"A-2"})
        repository.name(u"General Registry Office, Southport")

        attribution = Attribution()
        attribution.contributor.resource = u"#" + contributor.id
        attribution.modified = self.parse("2014-03-07")

        sourceDescription = SourceDescription()
        sourceDescription.id = u"S-1"
        sourceDescription.titles.append(
            u"Birth Certificate of Emma Bocock, 23 July 1843, General Registry Office"
        )
        sourceDescription.resourceType = ResourceType.PhysicalArtifact
        citation = SourceCitation({
            'value':
            u'England, birth certificate for Emma Bocock, born 23 July 1843; citing 1843 Birth in District and Sub-district of Ecclesall-Bierlow in the County of York, 303; General Registry Office, Southport.'
        })
        sourceDescription.citations.append(citation)
        sourceDescription.created = self.parse("1843-07-27")
        sourceDescription.repository.resource = "#" + repository.id

        birth = Fact()
        birth.type = FactType.Birth
        birth.date.original = u"23 June 1843"
        birth.place.original = u"Broadfield Bar, Abbeydale Road, Ecclesall-Bierlow, York, England, United Kingdom"

        emma = Person()
        emma.id = u"P-1"
        emma.extracted = True
        emma.sources.append(sourceDescription)
        emma.setName(u"Emma Bocock")
        emma.setGender(GenderType.Female)
        emma.addFact(birth)

        occupation = Fact({
            'type': FactType.Occupation,
            'value': u"Toll Collector"
        })
        father = Person({'id': u'P-2'})
        father.extracted = True
        father.sources.append(sourceDescription)
        father.setName(u"William Bocock")
        father.addFact(occupation)

        mother = Person({'id': u'P-3'})
        mother.extracted = True
        mother.sources.append(sourceDescription)
        mother.setName(u'Sarah Bocock formerly Brough')

        fatherRelationship = Relationship()
        fatherRelationship.type = RelationshipType.ParentChild
        fatherRelationship.setPerson1(father)
        fatherRelationship.setPerson2(emma)

        motherRelationship = Relationship()
        motherRelationship.type = RelationshipType.ParentChild
        motherRelationship.setPerson1(mother)
        motherRelationship.setPerson2(emma)

        analysis = Document({
            'id': u'D-1',
            'text': u"...Jane Doe's analysis document..."
        })
        emmaConclusion = Person({'id': u'C-1'})
        emmaReference = EvidenceReference()
        emmaReference.setReference(emma)
        emmaConclusion.evidence.append(EvidenceReference(emma))
        emmaConclusion.analysis = ResourceReference(analysis)

        gx = Gedcomx()
        gx.agents.append(contributor)
        gx.agents.append(repository)
        gx.attribution = attribution
        gx.sourceDescriptions.append(sourceDescription)
        gx.persons.extend([emma, father, mother])
        gx.relationships.extend([fatherRelationship, motherRelationship])
        gx.documents.append(analysis)
        gx.persons.append(emmaConclusion)
        gx_dict = gx.to_dict()

        # Read the json output from java program and initialize a gedcomx object.
        dirname = os.path.abspath(os.path.dirname(__file__))
        java_gx = Gedcomx()
        java_gx.load(
            open(os.path.join(dirname, 'data', 'EmmaBocockExample_java.json')))
        java_dict = java_gx.to_dict()
        # Compare both objects.
        self.assertDictEqual(gx_dict, java_dict)
        self.assertDictEqual(java_dict, gx_dict)