Пример #1
0
        public override void Export()
        {
            VufindXMLWriter vfWriter = new VufindXMLWriter("CERF");//Jewish Book House

            vfWriter.StartVufindXML(@"D:\VGBIL\" + Fund.ToLower() + ".xml");


            //string[] JHB = File.ReadAllLines(@"D:\HOME\ВГБИЛ\jbh_source_pasted.txt");

            HtmlDocument BooksDocument = new HtmlDocument();

            BooksDocument.Load(@"d:\VGBIL\WATERBEAR\waterbear.htm");
            //HtmlDocument ExemplarsDocument = new HtmlDocument();
            //ExemplarsDocument.Load(@"d:\VGBIL\WATERBEAR\waterbear (exemplaires).htm");
            //Linq

            var books = BooksDocument.DocumentNode.Descendants("tr");

            idbook = 0;
            foreach (HtmlNode book in books)
            {
                if (idbook > 0)
                {
                    VufindDoc doc = this.CreateVufindDocument(book);
                    vfWriter.AppendVufindDoc(doc);

                    //OnRecordExported
                    VuFindConverterEventArgs args = new VuFindConverterEventArgs();
                    args.RecordId = doc.id;
                    OnRecordExported(args);
                }
                idbook++;
            }
            vfWriter.FinishWriting();
        }
Пример #2
0
        public override void Export()
        {
            ///////////////////////////////////////////////////////////////////////////////////////////////
            //////////////////////////////////// JBH  /////////////////////////////////////////////////////
            ///////////////////////////////////////////////////////////////////////////////////////////////


            VufindXMLWriter vfWriter = new VufindXMLWriter("JBH");//Jewish Book House

            vfWriter.StartVufindXML(@"D:\HOME\ВГБИЛ\" + Fund.ToLower() + ".xml");

            string[] JHB = File.ReadAllLines(@"D:\HOME\ВГБИЛ\jbh_source_pasted.txt");

            List <VufindDoc> docs = new List <VufindDoc>();

            foreach (string line in JHB)
            {
                VufindDoc doc = new VufindDoc();
                if (doc.id != line)//если встретили новый ID
                {
                    docs.Add(doc);
                    doc = new VufindDoc();
                }
                doc.id = "JHB_000001";
                doc.id = "JHB_" + line;

                string FieldCode  = line.Substring(0, line.IndexOf(":") - 1);
                string FieldValue = line.Substring(line.IndexOf(":"));

                StringBuilder sb     = new StringBuilder();
                StringWriter  sw     = new StringWriter(sb);
                JsonWriter    writer = new JsonTextWriter(sw);

                switch (FieldCode)
                {
                case "700":
                    doc.author.Add(FieldValue);
                    break;

                case "200":
                    doc.title.Add(FieldValue);
                    break;

                case "901":
                    break;
                }
                vfWriter.AppendVufindDoc(doc);
                //OnRecordExported
                VuFindConverterEventArgs args = new VuFindConverterEventArgs();
                args.RecordId = "JBH_" + doc.id;
                OnRecordExported(args);

                docs.Add(doc);
            }
            vfWriter.FinishWriting();

            //добавили новый комментарий.
        }
Пример #3
0
 public override void Export()
 {
     writer = new VufindXMLWriter(this.Fund);
     writer.StartVufindXML(@"E:\import\" + Fund.ToLower() + ".xml");
     /////////////////////////////////////////////////////////////////////////////////////////////
     //////////////////////////////////BJVVV/////////////////////////////////////////////////////
     /////////////////////////////////////////////////////////////////////////////////////////////
     _lastID = 1;
     this.StartExportFrom(_lastID);
 }
Пример #4
0
        public override void ExportSingleRecord(int idmain)
        {
            VufindXMLWriter writer = new VufindXMLWriter(this.Fund);
            VufindDoc       vfDoc  = new VufindDoc();

            //DataTable record = BJLoader.GetBJRecord(idmain);
            vfDoc = CreateVufindDocument(idmain);
            if (vfDoc == null)
            {
                MessageBox.Show("Запись не имеет экземпляров.");
                return;
            }
            writer.WriteSingleRecord(vfDoc);
            MessageBox.Show("Завершено");
        }
Пример #5
0
        public override void Export()
        {
            /////////////////////////////////////////////////////////////////////////////////////////////
            //////////////////////////////////Pearson////////////////////////////////////////////////////
            /////////////////////////////////////////////////////////////////////////////////////////////
            VufindXMLWriter vfWriter = new VufindXMLWriter("pearson");

            vfWriter.StartVufindXML(@"F:\import\" + Fund.ToLower() + ".xml");
            string Pearson = File.ReadAllText(@"f:/pearson_source.json");

            JArray desPearson = (JArray)JsonConvert.DeserializeObject(Pearson);

            string tmp = desPearson.First["licensePackage"].ToString();

            tmp = desPearson.First["catalog"]["options"]["Supported platforms"].ToString();
            int           cnt       = 1;
            VufindDoc     vfDoc     = new VufindDoc();
            StringBuilder AllFields = new StringBuilder();

            foreach (JToken token in desPearson)
            {
                vfDoc = new VufindDoc();
                vfDoc.title.Add(token["catalog"]["title"]["default"].ToString());
                AllFields.AppendFormat(" {0}", vfDoc.title);
                vfDoc.title_short.Add(token["catalog"]["title"]["default"].ToString());
                vfDoc.title_sort.Add(token["catalog"]["title"]["default"].ToString());

                if (token["catalog"]["options"] != null)
                {
                    if (token["catalog"]["options"]["Authors"] != null)
                    {
                        vfDoc.author.Add(token["catalog"]["options"]["Authors"].ToString());
                        AllFields.AppendFormat(" {0}", vfDoc.author);
                        vfDoc.author_sort.Add(token["catalog"]["options"]["Authors"].ToString());
                    }
                }

                if (token["catalog"]["options"] != null)
                {
                    if (token["catalog"]["options"]["Country of publication"] != null)
                    {
                        vfDoc.Country.Add(token["catalog"]["options"]["Country of publication"].ToString());
                        AllFields.AppendFormat(" {0}", vfDoc.Country);
                    }
                }

                if (token["catalog"]["options"] != null)
                {
                    if (token["catalog"]["options"]["Publisher"] != null)
                    {
                        vfDoc.publisher.Add(token["catalog"]["options"]["Publisher"].ToString());
                        AllFields.AppendFormat(" {0}", vfDoc.publisher);
                    }
                }

                if (token["catalog"]["options"] != null)
                {
                    if (token["catalog"]["options"]["Publishing date"] != null)
                    {
                        vfDoc.publishDate.Add(token["catalog"]["options"]["Publishing date"].ToString().Split('.')[2]);
                        AllFields.AppendFormat(" {0}", vfDoc.publishDate);
                    }
                }

                if (token["catalog"]["options"] != null)
                {
                    if (token["catalog"]["options"]["ISBN"] != null)
                    {
                        vfDoc.isbn.Add(token["catalog"]["options"]["ISBN"].ToString());
                        AllFields.AppendFormat(" {0}", vfDoc.isbn);
                    }
                }

                if (token["catalog"]["options"] != null)
                {
                    if (token["catalog"]["options"]["Number of pages"] != null)
                    {
                        vfDoc.Volume.Add(token["catalog"]["options"]["Number of pages"].ToString());
                        AllFields.AppendFormat(" {0}", vfDoc.Volume);
                    }
                }

                if (token["catalog"]["options"] != null)
                {
                    if (token["catalog"]["options"]["Desk"] != null)
                    {
                        vfDoc.Annotation.Add(token["catalog"]["options"]["Desk"].ToString() + " ; " +
                                             token["catalog"]["description"]["default"].ToString());
                        AllFields.AppendFormat(" {0}", vfDoc.Annotation);
                    }
                }

                if (token["catalog"]["options"] != null)
                {
                    if (token["catalog"]["options"]["Subject"] != null)
                    {
                        vfDoc.genre.Add(token["catalog"]["options"]["Subject"].ToString());
                        AllFields.AppendFormat(" {0}", vfDoc.genre);
                        vfDoc.genre_facet.Add(token["catalog"]["options"]["Subject"].ToString());
                    }
                }

                if (token["catalog"]["options"] != null)
                {
                    if (token["catalog"]["options"]["Catalogue section"] != null)
                    {
                        vfDoc.topic.Add(token["catalog"]["options"]["Catalogue section"].ToString());
                        AllFields.AppendFormat(" {0}", vfDoc.topic);
                        vfDoc.topic_facet.Add(token["catalog"]["options"]["Catalogue section"].ToString());
                    }
                }

                if (token["catalog"]["options"] != null)
                {
                    if (token["catalog"]["options"]["Collection"] != null)
                    {
                        vfDoc.collection.Add(token["catalog"]["options"]["Collection"].ToString());
                        AllFields.AppendFormat(" {0}", vfDoc.collection);
                    }
                }

                if (token["catalog"]["options"] != null)
                {
                    if (token["catalog"]["options"]["Language"] != null)
                    {
                        vfDoc.language.Add(token["catalog"]["options"]["Language"].ToString());
                        AllFields.AppendFormat(" {0}", vfDoc.language);
                    }
                }



                vfDoc.allfields = AllFields.ToString();

                //описание экземпляра Пирсон
                StringBuilder sb        = new StringBuilder();
                StringWriter  strwriter = new StringWriter(sb);
                JsonWriter    writer    = new JsonTextWriter(strwriter);

                writer.WriteStartObject();
                writer.WritePropertyName("1");
                writer.WriteStartObject();

                writer.WritePropertyName("exemplar_carrier");
                //writer.WriteValue("Электронная книга");
                writer.WriteValue("3012");
                writer.WritePropertyName("exemplar_access");
                writer.WriteValue("1008");
                writer.WritePropertyName("exemplar_access_group");
                writer.WriteValue(KeyValueMapping.AccessCodeToGroup[1008]);

                //writer.WriteValue("Для прочтения онлайн необходимо перейти по ссылке");
                writer.WritePropertyName("exemplar_hyperlink");
                writer.WriteValue("https://ebooks.libfl.ru/catalog/knigi/" + token["id"].ToString() + @"/");
                writer.WritePropertyName("exemplar_copyright");
                writer.WriteValue("Да");
                writer.WritePropertyName("exemplar_id");
                writer.WriteValue("ebook");
                writer.WritePropertyName("exemplar_location");
                writer.WriteValue("2042");

                writer.WriteEndObject();
                writer.WriteEndObject();


                vfDoc.MethodOfAccess.Add("4002");
                vfDoc.Location.Add("2042");
                vfDoc.ExemplarsJSON = sb.ToString();
                vfDoc.id            = "Pearson_" + token["id"].ToString();
                vfDoc.HyperLink.Add("https://ebooks.libfl.ru/catalog/knigi/" + token["id"].ToString() + @"/");
                vfDoc.fund  = "5008";
                vfDoc.Level = "Монография";
                vfDoc.format.Add("3012");

                vfWriter.AppendVufindDoc(vfDoc);


                //OnRecordExported
                cnt++;
                VuFindConverterEventArgs args = new VuFindConverterEventArgs();
                args.RecordId = "Pearson_" + token["id"].ToString();
                OnRecordExported(args);
            }
            vfWriter.FinishWriting();
        }