예제 #1
0
 public static PhotosFirst PhF()
 {
     if (_phf == null)
     {
         _phf = new PhotosFirst();
     }
     return(_phf);
 }
예제 #2
0
        public void BuildPortrait()
        {
            adocauthority = this.XRecord.Elements("inverse")
                            .Where(i => i.Attribute("prop").Value == "http://fogid.net/o/adoc")
                            .Select(i => i.Element("record"))
                            .ToArray();

            reflected_reflections = this.XRecord.Elements("inverse")
                                    .Where(i => i.Attribute("prop").Value == "http://fogid.net/o/reflected")
                                    .Select(i => i.Element("record"))
                                    .Distinct(new IdEqual())
                                    .OrderBy(r => r.Element("direct")?.Element("record"), PhotosFirst.PhF())
                                    .ToArray();

            portraitphotouri = reflected_reflections
                               .Where(re => re.Elements("field").FirstOrDefault(f => f.Attribute("prop").Value == "http://fogid.net/o/ground")?.Value == "portrait")
                               .Select(re => re.Element("direct")?.Element("record"))
                               .Where(r => r?.Attribute("type").Value == "http://fogid.net/o/photo-doc")
                               .FirstOrDefault()
                               ?.Elements("field")
                               .FirstOrDefault(f => f.Attribute("prop").Value == "http://fogid.net/o/uri")?.Value;

            titles = this.XRecord.Elements("inverse")
                     .Where(i => i.Attribute("prop").Value == "http://fogid.net/o/has-title")
                     .Select(i => i.Element("record"))
                     .Select <XElement, Tuple <string, string> >(r => Tuple.Create <string, string>(
                                                                     r.Elements("field").FirstOrDefault(f => f.Attribute("prop")?.Value == "http://fogid.net/o/degree")?.Value,
                                                                     r.Elements("field").FirstOrDefault(f => f.Attribute("prop")?.Value == "http://fogid.net/o/from-date")?.Value
                                                                     ))
                     .OrderBy(t => t.Item2)
                     .ToArray();

            XElement[] participant_participation = this.XRecord.Elements("inverse")
                                                   .Where(i => i.Attribute("prop").Value == "http://fogid.net/o/participant")
                                                   .Select(i => i.Element("record"))
                                                   .ToArray();
            work = participant_participation
                   .Where(r => r.Element("direct")?.Element("record")?.Elements("field")
                          .FirstOrDefault(f => f.Attribute("prop").Value == "http://fogid.net/o/org-classification")?.Value == "organization")
                   .ToArray();
            parties = participant_participation
                      .Where(r => r.Element("direct")?.Element("record")?.Elements("field")
                             .FirstOrDefault(f => f.Attribute("prop").Value == "http://fogid.net/o/org-classification")?.Value != "organization")
                      .ToArray();


            naming = this.XRecord.Elements("inverse")
                     .Where(i => i.Attribute("prop").Value == "http://fogid.net/o/referred-sys")
                     .Select(i => i.Element("record"))
                     .Select <XElement, Tuple <string, string, string> >(r => Tuple.Create <string, string, string>(
                                                                             r.Elements("field").FirstOrDefault(f => f.Attribute("prop")?.Value == "http://fogid.net/o/alias")?.Value,
                                                                             r.Elements("field").FirstOrDefault(f => f.Attribute("prop")?.Value == "http://fogid.net/o/from-date")?.Value,
                                                                             r.Elements("field").FirstOrDefault(f => f.Attribute("prop")?.Value == "http://fogid.net/o/to-date")?.Value
                                                                             ))
                     .OrderBy(t => t.Item2)
                     .ToArray();
            var inorg_participation = this.XRecord.Elements("inverse")
                                      .Where(i => i.Attribute("prop").Value == "http://fogid.net/o/in-org")
                                      .Select(i => i.Element("record"))
                                      .ToArray();

            firstfaces = inorg_participation
                         .Where(r => StaticObjects.GetField(r, "http://fogid.net/o/role-classification") == "director")
                         .ToArray();
            allparticipants = inorg_participation
                              .Where(r => StaticObjects.GetField(r, "http://fogid.net/o/role-classification") != "director")
                              .ToArray();
            //inorg_participation = this.XRecord.Elements("inverse")
            //    .Select(i => i.Element("record"))
            //    .OrderBy(r => StaticObjects.GetField(r.Element("direct").Element("record"), "http://fogid.net/o/from-date"))
            //    .ToArray();
            indocreflected = this.XRecord.Elements("inverse")
                             .Where(i => i.Attribute("prop").Value == "http://fogid.net/o/in-doc")
                             .Select(i => i.Element("record"))
                             .ToArray();
            incollectionmember = this.XRecord.Elements("inverse")
                                 .Where(i => i.Attribute("prop").Value == "http://fogid.net/o/in-collection")
                                 .Select(i => i.Element("record")?.Element("direct")?.Element("record"))
                                 .Where(r => r != null)
                                 .OrderBy(r => StaticObjects.GetField(r, "http://fogid.net/o/name"))
                                 .ToArray();
            orgparentorgrelatives = this.XRecord.Elements("inverse")
                                    .Where(i => i.Attribute("prop").Value == "http://fogid.net/o/org-parent")
                                    .Select(i => i.Element("record")?.Element("direct")?.Element("record"))
                                    .Where(r => r != null)
                                    .ToArray();
        }