/// <summary>
 /// Visits the relationship.
 /// </summary>
 /// <param name="relationship">The relationship to visit.</param>
 public override void VisitRelationship(Gx.Conclusion.Relationship relationship)
 {
     if (relationship.Id != null)
     {
         this.dictionary.Add(relationship.Id, relationship);
     }
     base.VisitRelationship(relationship);
 }
 public void TestExample()
 {
     Agent contributor = (Agent)new Agent().SetName("Jane Doe").SetEmail("*****@*****.**").SetId("A-1");
     Agent repository = (Agent)new Agent().SetName("General Registry Office, Southport").SetId("A-2");
     Attribution attribution = new Attribution().SetContributor(contributor).SetModified(DateTime.Parse("2014-03-07"));
     SourceDescription sourceDescription = (SourceDescription)new SourceDescription()
     .SetTitle("Birth Certificate of Emma Bocock, 23 July 1843, General Registry Office")
     .SetCitation(new SourceCitation().SetValue("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."))
     .SetResourceType(ResourceType.PhysicalArtifact)
     .SetCreated(DateTime.Parse("1843-07-27"))
     .SetRepository(repository)
     .SetId("S-1");
     Fact birth = new Fact()
     .SetType(FactType.Birth)
     .SetDate(new DateInfo().SetOriginal("23 June 1843"))
     .SetPlace(new PlaceReference().SetOriginal("Broadfield Bar, Abbeydale Road, Ecclesall-Bierlow, York, England, United Kingdom"));
     Person emma = (Person)new Person().SetName("Emma Bocock").SetGender(GenderType.Female).SetFact(birth).SetExtracted(true).SetSource(sourceDescription).SetId("P-1");
     Person father = (Person)new Person().SetName("William Bocock").SetFact(new Fact().SetType(FactType.Occupation).SetValue("Toll Collector")).SetExtracted(true).SetSource(sourceDescription).SetId("P-2");
     Person mother = (Person)new Person().SetName("Sarah Bocock formerly Brough").SetExtracted(true).SetSource(sourceDescription).SetId("P-3");
     Relationship fatherRelationship = new Relationship().SetType(RelationshipType.ParentChild).SetPerson1(father).SetPerson2(emma);
     Relationship motherRelationship = new Relationship().SetType(RelationshipType.ParentChild).SetPerson1(mother).SetPerson2(emma);
     Document analysis = (Document)new Document().SetText("...Jane Doe's analysis document...").SetId("D-1");
     Person emmaConclusion = (Person)new Person().SetEvidence(emma).SetAnalysis(analysis).SetId("C-1");
     Gx.Gedcomx gx = new Gx.Gedcomx()
     .SetAgent(contributor)
     .SetAgent(repository)
     .SetAttribution(attribution)
     .SetSourceDescription(sourceDescription)
     .SetPerson(emma)
     .SetPerson(father)
     .SetPerson(mother)
     .SetRelationship(fatherRelationship)
     .SetRelationship(motherRelationship)
     .SetDocument(analysis)
     .SetPerson(emmaConclusion);
     xmlSerializer.Deserialize<Gx.Gedcomx>(xmlSerializer.Serialize(gx));
     jsonSerializer.Deserialize<Gx.Gedcomx>(jsonSerializer.Serialize(gx));
 }
        public virtual void VisitRelationship(Relationship relationship)
        {
            this.contextStack.Push(relationship);
            VisitSubject(relationship);

            List<Fact> facts = relationship.Facts;
            if (facts != null)
            {
                foreach (Fact fact in facts)
                {
                    fact.Accept(this);
                }
            }

            List<Field> fields = relationship.Fields;
            if (fields != null)
            {
                foreach (Field field in fields)
                {
                    field.Accept(this);
                }
            }

            this.contextStack.Pop();
        }
Exemple #4
0
 /**
  * Build this out with a relationship.
  * @param relationship The relationship.
  * @return this.
  */
 public Gedcomx SetRelationship(Relationship relationship)
 {
     AddRelationship(relationship);
     return this;
 }
Exemple #5
0
 /// <summary>
 /// Add a relationship to the data set.
 /// </summary>
 /// <param name="relationship">The relationship to be added.</param>
 public void AddRelationship(Relationship relationship)
 {
     if (relationship != null)
     {
         if (Relationships == null)
             Relationships = new List<Relationship>();
         Relationships.Add(relationship);
     }
 }
        public void TestExample()
        {
            //Jane Doe, the researcher.
            Agent janeDoe = (Agent)new Agent().SetName("Jane Doe").SetEmail("*****@*****.**").SetId("A-1");

            //Lin Yee Chung Cemetery
            Agent cemetery = (Agent)new Agent().SetName("Lin Yee Chung Cemetery").SetAddress(new Address().SetCity("Honolulu").SetStateOrProvince("Hawaii")).SetId("A-2");

            //Hanyu Pinyin, the translator.
            Agent hanyuPinyin = (Agent)new Agent().SetName("HANYU Pinyin 王大年").SetEmail("*****@*****.**").SetId("A-3");

            //The attribution for this research.
            Attribution researchAttribution = new Attribution().SetContributor(janeDoe).SetModified(DateTime.Parse("2014-03-27"));

            //The attribution for the translation.
            Attribution translationAttribution = new Attribution().SetContributor(hanyuPinyin).SetModified(DateTime.Parse("2014-03-27"));

            //The grave stone.
            SourceDescription gravestoneDescription = (SourceDescription)new SourceDescription()
              .SetTitle("Grave Marker of WONG Aloiau, Lin Yee Chung Cemetery, Honolulu, Oahu, Hawaii")
              .SetCitation(new SourceCitation().SetValue("WONG Aloiau gravestone, Lin Yee Chung Cemetery, Honolulu, Oahu, Hawaii; visited May 1975 by Jane Doe."))
              .SetResourceType(ResourceType.PhysicalArtifact)
              .SetRepository(cemetery)
              .SetId("S-1");

            //The image of the grave stone.
            SourceDescription gravestoneImageDescription = (SourceDescription)new SourceDescription()
              .SetTitle("Grave Marker of WONG Aloiau, Lin Yee Chung Cemetery, Honolulu, Oahu, Hawaii")
              .SetCitation(new SourceCitation().SetValue("WONG Aloiau gravestone (digital photograph), Lin Yee Chung Cemetery, Honolulu, Oahu, Hawaii; visited May 1975 by Jane Doe."))
              .SetResourceType(ResourceType.DigitalArtifact)
              .SetSource(new SourceReference().SetDescription(gravestoneDescription))
              .SetId("S-2");

            //The transcription of the grave stone.
            Document transcription = (Document)new Document()
              .SetText("WONG ALOIAU\n" +
                      "NOV. 22, 1848 – AUG. 3, 1920\n" +
                      "中山  大字都  泮沙鄉\n" +
                      "生  於  前  清 戊申 年 十一 月 廿二(日)子   時\n" +
                      "終  於  民國  庚申 年     七月    十二 (日)    午    時\n" +
                      "先考  諱 羅有  字 容康 王 府 君 之 墓")
              .SetSource(gravestoneImageDescription)
              .SetLang("zh")
              .SetId("D-1");

            //The transcription described as a source.
            SourceDescription transcriptionDescription = (SourceDescription)new SourceDescription()
              .SetAbout("#" + transcription.Id)
              .SetTitle("Transcription of Grave Marker of WONG Aloiau, Lin Yee Chung Cemetery, Honolulu, Oahu, Hawaii")
              .SetCitation(new SourceCitation().SetValue("WONG Aloiau gravestone (transcription), Lin Yee Chung Cemetery, Honolulu, Oahu, Hawaii; visited May 1975 by Jane Doe."))
              .SetResourceType(ResourceType.DigitalArtifact)
              .SetSource(new SourceReference().SetDescription(gravestoneImageDescription))
              .SetId("S-3");

            //The translation of the grave stone.
            Document translation = (Document)new Document()
              .SetText("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.")
              .SetSource(transcriptionDescription)
              .SetId("D-2");

            //The translation described as a source.
            SourceDescription translationDescription = (SourceDescription)new SourceDescription()
              .SetAbout("#" + translation.Id)
              .SetTitle("Translation of Grave Marker of WONG Aloiau, Lin Yee Chung Cemetery, Honolulu, Oahu, Hawaii")
              .SetCitation(new SourceCitation().SetValue("WONG Aloiau gravestone, Lin Yee Chung Cemetery, Honolulu, Oahu, Hawaii; visited May 1975 by Jane Doe. Translation by HANYU Pinyin 王大年."))
              .SetAttribution(translationAttribution)
              .SetResourceType(ResourceType.DigitalArtifact)
              .SetSource(new SourceReference().SetDescription(transcriptionDescription))
              .SetId("S-4");

            //the birth.
            Fact birth = new Fact()
              .SetType(FactType.Birth)
              .SetDate(new DateInfo().SetOriginal("former Qing 1848 year 11th month 22nd day 23-1 hour").SetFormal("+1848-11-22"))
              .SetPlace(new PlaceReference().SetOriginal("Pun Sha Village, See Dai Doo, Chung Shan, Guangdong, China"));

            //the death.
            Fact death = new Fact()
              .SetType(FactType.Death)
              .SetDate(new DateInfo().SetOriginal("Republic of China year 1920 year 7th mo. 12th day 11-13 hour").SetFormal("+1920-08-03"));

            //the burial.
            Fact burial = new Fact()
              .SetType(FactType.Burial)
              .SetPlace(new PlaceReference().SetOriginal("Lin Yee Chung Cemetery, Honolulu, Oahu, Hawaii"));

            //the principal person
            Person aloiau = (Person)new Person().SetName("WONG Aloiau").SetGender(GenderType.Male).SetFact(birth).SetFact(death).SetFact(burial).SetExtracted(true).SetSource(translationDescription).SetId("P-1");

            //the father of the principal (with an aka name).
            Person father = (Person)new Person().SetName("Lo Yau").SetName(new Name().SetType(NameType.AlsoKnownAs).SetNameForm(new NameForm().SetFullText("Young Hong Wong"))).SetExtracted(true).SetSource(translationDescription).SetId("P-2");

            //the relationship.
            Relationship fatherRelationship = new Relationship().SetType(RelationshipType.ParentChild).SetPerson1(father).SetPerson2(aloiau);

            //Jane Doe's analysis.
            Document analysis = (Document)new Document().SetText("...Jane Doe's analysis document...").SetId("D-3");

            //Jane Doe's conclusions about a person.
            Person aloiauConclusion = (Person)new Person().SetEvidence(aloiau).SetAnalysis(analysis).SetId("C-1");

            Gx.Gedcomx gx = new Gx.Gedcomx()
              .SetAgent(janeDoe)
              .SetAgent(cemetery)
              .SetAgent(hanyuPinyin)
              .SetAttribution(researchAttribution)
              .SetSourceDescription(gravestoneDescription)
              .SetSourceDescription(gravestoneImageDescription)
              .SetDocument(transcription)
              .SetSourceDescription(transcriptionDescription)
              .SetDocument(translation)
              .SetSourceDescription(translationDescription)
              .SetPerson(aloiau)
              .SetPerson(father)
              .SetRelationship(fatherRelationship)
              .SetDocument(analysis)
              .SetPerson(aloiauConclusion);

            xmlSerializer.Deserialize<Gx.Gedcomx>(xmlSerializer.Serialize(gx));
            jsonSerializer.Deserialize<Gx.Gedcomx>(jsonSerializer.Serialize(gx));
        }
        public void TestRelationshipFacts()
        {
            Relationship couple = new Relationship()
              .SetType(RelationshipType.Couple)
              .SetFact(new Fact(FactType.CivilUnion, "...", "..."))
              .SetFact(new Fact(FactType.DomesticPartnership, "...", "..."))
              .SetFact(new Fact(FactType.Divorce, "...", "..."))
              .SetFact(new Fact(FactType.Marriage, "...", "..."))
              .SetFact(new Fact(FactType.MarriageBanns, "...", "..."))
              .SetFact(new Fact(FactType.MarriageContract, "...", "..."))
              .SetFact(new Fact(FactType.MarriageLicense, "...", "..."));

            Relationship parentChild = new Relationship()
              .SetType(RelationshipType.ParentChild)
              .SetFact(new Fact(FactType.AdoptiveParent, "...", "..."))
              .SetFact(new Fact(FactType.BiologicalParent, "...", "..."))
              .SetFact(new Fact(FactType.FosterParent, "...", "..."))
              .SetFact(new Fact(FactType.GuardianParent, "...", "..."))
              .SetFact(new Fact(FactType.StepParent, "...", "..."));

            Gx.Gedcomx gx = new Gx.Gedcomx().SetRelationship(couple).SetRelationship(parentChild);
            xmlSerializer.Deserialize<Gx.Gedcomx>(xmlSerializer.Serialize(gx));
            jsonSerializer.Deserialize<Gx.Gedcomx>(jsonSerializer.Serialize(gx));
        }
 /// <summary>
 /// Adds relationship to the collection.
 /// </summary>
 /// <param name="relationship">The relationship to add.</param>
 /// <param name="options">The options to apply before executing the REST API call.</param>
 /// <returns>
 /// A <see cref="RelationshipState" /> instance containing the REST API response.
 /// </returns>
 /// <exception cref="Gx.Rs.Api.GedcomxApplicationException">Thrown if this collection does not have a link to the resource.</exception>
 public override RelationshipState AddRelationship(Relationship relationship, params IStateTransitionOption[] options)
 {
     if (relationship.KnownType == RelationshipType.ParentChild)
     {
         throw new GedcomxApplicationException("FamilySearch Family Tree doesn't support adding parent-child relationships. You must instead add a child-and-parents relationship.");
     }
     return base.AddRelationship(relationship);
 }
        /// <summary>
        /// Visits the relationship.
        /// </summary>
        /// <param name="relationship">The relationship to visit.</param>
        public virtual void VisitRelationship(Relationship relationship)
        {
            this.contextStack.Push(relationship);
            VisitSubject(relationship);

            if (relationship.Facts != null)
            {
                foreach (Fact fact in relationship.Facts)
                {
                    VisitFact(fact);
                }
            }

            if (relationship.Fields != null)
            {
                foreach (Field field in relationship.Fields)
                {
                    VisitField(field);
                }
            }

            this.contextStack.Pop();
        }
 public override void VisitRelationship(Relationship relationship)
 {
     BindIfNeeded(relationship);
     base.VisitRelationship(relationship);
 }
        private List<SourceDescription> CiteGeorgeMarthaAndMarriage(Person george, Person martha, Relationship relationship)
        {
            SourceDescription georgeSource = new SourceDescription();
            georgeSource.SetId("EEE-EEEE");
            georgeSource.SetAbout("http://en.wikipedia.org/wiki/George_washington");
            SourceCitation georgeCitation = new SourceCitation();
            georgeCitation.SetValue("\"George Washington.\" Wikipedia, The Free Encyclopedia. Wikimedia Foundation, Inc. 24 October 2012.");
            georgeSource.SetCitation(georgeCitation);

            SourceDescription marthaSource = new SourceDescription();
            marthaSource.SetId("FFF-FFFF");
            marthaSource.SetAbout("http://en.wikipedia.org/wiki/Martha_washington");
            SourceCitation marthaCitation = new SourceCitation();
            marthaCitation.SetValue("\"Martha Washington.\" Wikipedia, The Free Encyclopedia. Wikimedia Foundation, Inc. 24 October 2012.");
            marthaSource.SetCitation(marthaCitation);

            SourceReference reference = new SourceReference();
            reference.SetDescriptionRef("#" + georgeSource.Id);
            george.SetSource(reference);

            reference = new SourceReference();
            reference.SetDescriptionRef("#" + marthaSource.Id);
            martha.SetSource(reference);

            relationship.SetSource(reference);

            return new List<SourceDescription>() { georgeSource, marthaSource };
        }
 private Relationship CreateMarriage(Person george, Person martha)
 {
     Relationship relationship = new Relationship();
     relationship.SetId("DDD-DDDD");
     relationship.SetPerson1(new ResourceReference("#" + george.Id));
     relationship.SetPerson2(new ResourceReference("#" + martha.Id));
     Fact marriage = new Fact();
     marriage.SetDate(new DateInfo());
     marriage.Date.SetOriginal("January 6, 1759");
     marriage.Date.SetFormal("+01-06-1759");
     marriage.SetPlace(new PlaceReference());
     marriage.Place.SetOriginal("White House Plantation");
     relationship.SetFact(marriage);
     return relationship;
 }