コード例 #1
0
ファイル: SheetMusic.cs プロジェクト: khellang/Solvberget
 protected override void FillPropertiesLight(string xml)
 {
     base.FillPropertiesLight(xml);
     var xmlDoc = XDocument.Parse(xml);
     if (xmlDoc.Root != null)
     {
         var nodes = xmlDoc.Root.Descendants();
        
         //Composer
         var nationality = GetVarfield(nodes, "100", "j");
         string nationalityLookupValue = null;
         if (nationality != null)
             NationalityDictionary.TryGetValue(nationality, out nationalityLookupValue);
         Composer =  new Person
         {
             
             Name = GetVarfield(nodes, "100", "a"),
             LivingYears = GetVarfield(nodes, "100", "d"),
             Nationality = nationalityLookupValue ?? nationality,
             Role = "Composer"
         };
         
         if (Composer.Name != null)
             Composer.InvertName(Composer.Name);
         MainResponsible = Composer;
     }
     
 }
コード例 #2
0
ファイル: LanguageCourse.cs プロジェクト: khellang/Solvberget
        protected override void FillPropertiesLight(string xml)
        {
            base.FillPropertiesLight(xml);
            var xmlDoc = XDocument.Parse(xml);
            if (xmlDoc.Root != null)
            {
                var nodes = xmlDoc.Root.Descendants("oai_marc");
                var nationality = GetVarfield(nodes, "100", "j");
                string nationalityLookupValue = null;
                if (nationality != null)
                    NationalityDictionary.TryGetValue(nationality, out nationalityLookupValue);
                Author = new Person
                {
                    Name = GetVarfield(nodes, "100", "a"),
                    LivingYears = GetVarfield(nodes, "100", "d"),
                    Nationality = nationalityLookupValue ?? nationality,
                    Role = "Author"

                };
                string tempName = GetVarfield(nodes, "100", "a");
                if (tempName != null)
                    Author.InvertName(tempName);
                //If N/A, check BSMARC field 110 for author
                if (Author.Name == null)
                { 
                   Author.Name = GetVarfield(nodes, "110", "a");
                   

                }
            }
        
        }
コード例 #3
0
ファイル: Book.cs プロジェクト: khellang/Solvberget
        protected override void FillPropertiesLight(string xml)
        {
            base.FillPropertiesLight(xml);
            var xmlDoc = XDocument.Parse(xml);
            if (xmlDoc.Root != null)
            {
                var nodes = xmlDoc.Root.Descendants("oai_marc");

                Isbn = GetVarfield(nodes, "020", "a");

                //Author, check BSMARC field 100 for author
                var nationality = GetVarfield(nodes, "100", "j");
                string nationalityLookupValue = null;
                if (nationality != null)
                    NationalityDictionary.TryGetValue(nationality, out nationalityLookupValue);
                Author = new Person
                {
                    Name = GetVarfield(nodes, "100", "a"),
                    LivingYears = GetVarfield(nodes, "100", "d"),
                    Nationality = nationalityLookupValue ?? nationality,
                    Role = "Author"
                };
               

                //If N/A, check BSMARC field 110 for author
                if (Author.Name == null)
                {

                    Author.Name = GetVarfield(nodes, "110", "a");
                    
                    //Organization (110abq)
                    Organization = GenerateOrganizationsFromXml(nodes, "110").FirstOrDefault();

                }

                //If still N/A, check BSMARC field 130 for title when title is main scheme word
                if (Author.Name == null)
                    StandarizedTitle = GetVarfield(nodes, "130", "a");

                if (Author.Name != null)
                    Author.InvertName(Author.Name);
                MainResponsible = Author;

                PartTitle = GetVarfield(nodes, "245", "p");

                if (Title != null && PartTitle != null)
                {
                    Title = Title + " : " + PartTitle;
                }

            }
        }
コード例 #4
0
ファイル: Film.cs プロジェクト: khellang/Solvberget
        protected override void FillProperties(string xml)
        {
            base.FillProperties(xml);
            var xmlDoc = XDocument.Parse(xml);
            if (xmlDoc.Root != null)
            {

                var nodes = xmlDoc.Root.Descendants();

                Ean = GetVarfield(nodes, "025", "a");
                //Each subtitlelanguage is given as a 3-char long code, all put together to one string
                var subtitles = GetVarfield(nodes, "041", "b").SplitByLength(3).ToList();

                for (var i = 0; i < subtitles.Count(); i++)
                {
                    string subtitleLookupValue = null;
                    LanguageDictionary.TryGetValue(subtitles[i], out subtitleLookupValue);
                    subtitles[i] = subtitleLookupValue ?? subtitles[i];
                }

                SubtitleLanguage = subtitles;
                OriginalTitle = GetVarfield(nodes, "240", "a");
                Numbering = GetVarfield(nodes, "245", "n");
                PartTitle = GetVarfield(nodes, "245", "p");
                Edition = GetVarfield(nodes, "250", "a");
                ProductionYear = GetVarfield(nodes, "260", "g");
                TypeAndNumberOfDiscs = GetVarfield(nodes, "300", "a");
                Contents = GetVarfield(nodes, "505", "a");

                var actorsString = GetVarfield(nodes, "511", "a");
                var persons = new List<Person>();

                if (actorsString != null)
                {
                    var actorsList = actorsString.Split(':');
                    if (actorsList.Length > 1)
                    {
                        actorsList = actorsList[1].Split(',');
                    }


                    foreach (string personName in actorsList)
                    {
                        var p = new Person();
                        p.Name = personName.Trim();
                        p.InvertName(p.Name);
                        persons.Add(p);
                    }
                }

                Actors = persons;

                AgeLimit = GetVarfield(nodes, "521", "a");
                NorwegianTitle = GetVarfield(nodes, "572", "a");
                ReferredPersons = GeneratePersonsFromXml(nodes, "600");
                ReferredOrganizations = GenerateOrganizationsFromXml(nodes, "610");
                Subject = GetVarfield(nodes, "650", "a");
                ReferencedPlaces = GetVarfieldAsList(nodes, "651", "a");
                CompositionType = GetVarfield(nodes, "652", "a");
                Genre = GetVarfieldAsList(nodes, "655", "a");
                InvolvedOrganizations = GenerateOrganizationsFromXml(nodes, "710");
            }
        }
コード例 #5
0
ファイル: Document.cs プロジェクト: khellang/Solvberget
        protected static IEnumerable<Person> GeneratePersonsFromXml(IEnumerable<XElement> nodes, string id)
        {

            var persons = new List<Person>();

            var varfields = nodes.Elements("varfield").Where(x => ((string)x.Attribute("id")).Equals(id)).ToList();

            foreach (var varfield in varfields)
            {
                var nationality = GetSubFieldValue(varfield, "j");
                string nationalityLookupValue = null;
                if (nationality != null)
                    NationalityDictionary.TryGetValue(nationality, out nationalityLookupValue);

                var role = GetSubFieldValue(varfield, "e");
                string roleLookupValue = null;
                if (role != null)
                    RoleDictionary.TryGetValue(role, out roleLookupValue);

                var person = new Person()
                                 {
                                     Name = GetSubFieldValue(varfield, "a"),
                                     LivingYears = GetSubFieldValue(varfield, "d"),
                                     Nationality = nationalityLookupValue ?? nationality,
                                     Role = roleLookupValue ?? role,
                                     ReferredWork = GetSubFieldValue(varfield, "t")
                                 };

                string tempName = GetSubFieldValue(varfield, "a");
                if (tempName != null)
                    person.InvertName(tempName);

                if (!string.IsNullOrEmpty(person.Name) && !persons.Any(x => x.Name.Equals(person.Name)))
                {
                    persons.Add(person);
                }

            }

            return persons;

        }
コード例 #6
0
ファイル: Cd.cs プロジェクト: khellang/Solvberget
        protected override void FillPropertiesLight(string xml)
        {
            base.FillPropertiesLight(xml);
            var xmlDoc = XDocument.Parse(xml);
            if (xmlDoc.Root != null)
            {
                var nodes = xmlDoc.Root.Descendants("oai_marc");

                //ArtistOrComposer, check BSMARC field 100
                var nationality = GetVarfield(nodes, "100", "j");
                string nationalityLookupValue = null;
                if (nationality != null)
                    NationalityDictionary.TryGetValue(nationality, out nationalityLookupValue);
                ArtistOrComposer = new Person
                {
                    Name = GetVarfield(nodes, "100", "a"),
                    LivingYears = GetVarfield(nodes, "100", "d"),
                    Nationality = nationalityLookupValue ?? nationality,
                    Role = "ArtistOrComposer"
                };


                MainResponsible = ArtistOrComposer;


                //If no ArtistOrCompose, check BSMARC field 110 for MusicGroup
                if (ArtistOrComposer.Name == null)
                {
                    MusicGroup = GetVarfield(nodes, "110", "a");
                    ExplanatoryAddition = GetVarfield(nodes, "110", "q");
                    MainResponsible = MusicGroup;
                }
               
                if (ArtistOrComposer.Name != null)
                    ArtistOrComposer.InvertName(ArtistOrComposer.Name);
            }
        }