From a0b01df0d310f1bfa413c195f1adeadd7e834f6d Mon Sep 17 00:00:00 2001 From: aldente-hu Date: Thu, 19 Sep 2019 15:11:50 +0900 Subject: [PATCH 1/5] Fix a test case. ('firstName' is actually a last name and vice versa.) --- J-Stage.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/J-Stage.js b/J-Stage.js index c8dfa00f3a2..e8be82baf8b 100644 --- a/J-Stage.js +++ b/J-Stage.js @@ -1,7 +1,7 @@ { "translatorID": "e40a27bc-0eef-4c50-b78b-37274808d7d2", "label": "J-Stage", - "creator": "Sebastian Karcher", + "creator": "Sebastian Karcher, Satoshi Ando", "target": "^https?://www\\.jstage\\.jst\\.go\\.jp/", "minVersion": "3.0", "maxVersion": "", @@ -9,13 +9,13 @@ "inRepository": true, "translatorType": 4, "browserSupport": "gcsibv", - "lastUpdated": "2019-06-15 19:04:11" + "lastUpdated": "2019-09-19 05:58:40" } /* ***** BEGIN LICENSE BLOCK ***** - J-Stage translator - Copyright © 2012 Sebastian Karcher + J-Stage translator - Copyright © 2012 Sebastian Karcher, Satoshi Ando This file is part of Zotero. Zotero is free software: you can redistribute it and/or modify @@ -221,13 +221,13 @@ var testCases = [ "title": "フラックスタワーデータを用いた各種植生指標の季節変化の検討", "creators": [ { - "firstName": "田中", - "lastName": "博春", + "firstName": "博春", + "lastName": "田中", "creatorType": "author" }, { - "firstName": "小熊", - "lastName": "宏之", + "firstName": "宏之", + "lastName": "小熊", "creatorType": "author" } ], From ab03f167abc72392bb9ac476af105301526b7dab Mon Sep 17 00:00:00 2001 From: aldente-hu Date: Thu, 7 Oct 2021 11:33:00 +0900 Subject: [PATCH 2/5] Use RIS instead of BibTeX. --- J-Stage.js | 54 +++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 41 insertions(+), 13 deletions(-) diff --git a/J-Stage.js b/J-Stage.js index e8be82baf8b..ab9ec8ad918 100644 --- a/J-Stage.js +++ b/J-Stage.js @@ -9,13 +9,14 @@ "inRepository": true, "translatorType": 4, "browserSupport": "gcsibv", - "lastUpdated": "2019-09-19 05:58:40" + "lastUpdated": "2020-11-09 04:55:16" } /* ***** BEGIN LICENSE BLOCK ***** - J-Stage translator - Copyright © 2012 Sebastian Karcher, Satoshi Ando + J-Stage translator - Copyright © 2012 Sebastian Karcher, + Copyright © 2019 Satoshi Ando This file is part of Zotero. Zotero is free software: you can redistribute it and/or modify @@ -83,29 +84,35 @@ function scrape(doc, url) { for (let tagNode of tagNodes) { tags.push(tagNode.content); } - + // get BibTex Link var bibtexurl = ZU.xpathText(doc, '//a[contains(text(), "BIB TEX")]/@href'); - ZU.doGet(bibtexurl, function (text) { + var risurl = ZU.xpathText(doc, '//a[contains(text(), "RIS")]/@href'); + //ZU.doGet(bibtexurl, function (text) { + ZU.doGet(risurl, function (text) { var bibtex = text; // Zotero.debug(bibtex) var translator = Zotero.loadTranslator("import"); - translator.setTranslator("9cb70025-a888-4a29-a210-93ec52da40d4"); + //translator.setTranslator("9cb70025-a888-4a29-a210-93ec52da40d4"); + translator.setTranslator("32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7"); translator.setString(bibtex); translator.setHandler("itemDone", function (obj, item) { if (abs) item.abstractNote = abs.replace(/^\s*(?:Abstract|抄録)\s*/, ''); if (tags) item.tags = tags; - for (var i = 0; i < item.creators.length; i++) { - if (item.creators[i].lastName && item.creators[i].lastName == item.creators[i].lastName.toUpperCase()) { - item.creators[i].lastName = ZU.capitalizeTitle(item.creators[i].lastName.toLowerCase(), true); - } - if (item.creators[i].firstName && item.creators[i].firstName == item.creators[i].firstName.toUpperCase()) { - item.creators[i].firstName = ZU.capitalizeTitle(item.creators[i].firstName.toLowerCase(), true); - } - } + delete item.creators; +// for (var i = 0; i < item.creators.length; i++) { +// if (item.creators[i].lastName && item.creators[i].lastName == item.creators[i].lastName.toUpperCase()) { +// item.creators[i].lastName = ZU.capitalizeTitle(item.creators[i].lastName.toLowerCase(), true); +// } +// if (item.creators[i].firstName && item.creators[i].firstName == item.creators[i].firstName.toUpperCase()) { +// item.creators[i].firstName = ZU.capitalizeTitle(item.creators[i].firstName.toLowerCase(), true); +// } +// } if (item.title == item.title.toUpperCase()) { item.title = ZU.capitalizeTitle(item.title.toLowerCase(), true); } + delete item.title; + if (item.publicationTitle == item.publicationTitle.toUpperCase()) { item.publicationTitle = ZU.capitalizeTitle(item.publicationTitle.toLowerCase(), true); } @@ -123,6 +130,27 @@ function scrape(doc, url) { mimeType: "application/pdf" }); } + //item.complete(); + }); + translator.translate(); + }); + + // get RIS Link + var risurl = ZU.xpathText(doc, '//a[contains(text(), "RIS")]/@href'); + ZU.doGet(risurl, function (text) { + var ris = text; + var translator = Zotero.loadTranslator("import"); + translator.setTranslator("32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7"); + translator.setString(ris); + translator.setHandler("itemDone", function (obj, item) { + for (var i = 0; i < item.creators.length; i++) { + if (item.creators[i].lastName && item.creators[i].lastName == item.creators[i].lastName.toUpperCase()) { + item.creators[i].lastName = ZU.capitalizeTitle(item.creators[i].lastName.toLowerCase(), true); + } + if (item.creators[i].firstName && item.creators[i].firstName == item.creators[i].firstName.toUpperCase()) { + item.creators[i].firstName = ZU.capitalizeTitle(item.creators[i].firstName.toLowerCase(), true); + } + } item.complete(); }); translator.translate(); From 61000feb85e924aeb21825aa12de50c9d69f6227 Mon Sep 17 00:00:00 2001 From: aldente-hu Date: Fri, 6 Oct 2023 16:25:54 +0900 Subject: [PATCH 3/5] Update scrape function to satisfy test cases except itemID. --- J-Stage.js | 58 +++++++++++++++--------------------------------------- 1 file changed, 16 insertions(+), 42 deletions(-) diff --git a/J-Stage.js b/J-Stage.js index 565935df243..596c1eec96e 100644 --- a/J-Stage.js +++ b/J-Stage.js @@ -9,14 +9,14 @@ "inRepository": true, "translatorType": 4, "browserSupport": "gcsibv", - "lastUpdated": "2023-04-27 13:09:03" + "lastUpdated": "2023-10-06 07:23:03" } /* ***** BEGIN LICENSE BLOCK ***** J-Stage translator - Copyright © 2012 Sebastian Karcher, - Copyright © 2019 Satoshi Ando + Copyright © 2023 Satoshi Ando This file is part of Zotero. Zotero is free software: you can redistribute it and/or modify @@ -78,7 +78,7 @@ function doWeb(doc, url) { // help function function scrape(doc, url) { - // get abstract and tags from article plage + // get abstract and tags from article page var abs = text("#article-overiew-abstract-wrap"); var tagNodes = doc.querySelectorAll("meta[name='citation_keywords']"); var tags = []; @@ -86,33 +86,28 @@ function scrape(doc, url) { tags.push(tagNode.content); } - // get BibTex Link - var bibtexurl = ZU.xpathText(doc, '//a[contains(text(), "BIB TEX")]/@href'); + // get RIS Link var risurl = ZU.xpathText(doc, '//a[contains(text(), "RIS")]/@href'); - //ZU.doGet(bibtexurl, function (text) { ZU.doGet(risurl, function (text) { - var bibtex = text; - // Zotero.debug(bibtex) + var ris = text; var translator = Zotero.loadTranslator("import"); - //translator.setTranslator("9cb70025-a888-4a29-a210-93ec52da40d4"); - translator.setTranslator("32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7"); - translator.setString(bibtex); + translator.setTranslator("32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7"); // RIS + translator.setString(ris); translator.setHandler("itemDone", function (obj, item) { if (abs) item.abstractNote = abs.replace(/^\s*(?:Abstract|抄録)\s*/, ''); if (tags) item.tags = tags; - delete item.creators; -// for (var i = 0; i < item.creators.length; i++) { -// if (item.creators[i].lastName && item.creators[i].lastName == item.creators[i].lastName.toUpperCase()) { -// item.creators[i].lastName = ZU.capitalizeTitle(item.creators[i].lastName.toLowerCase(), true); -// } -// if (item.creators[i].firstName && item.creators[i].firstName == item.creators[i].firstName.toUpperCase()) { -// item.creators[i].firstName = ZU.capitalizeTitle(item.creators[i].firstName.toLowerCase(), true); -// } -// } + for (var i = 0; i < item.creators.length; i++) { + if (item.creators[i].lastName && item.creators[i].lastName == item.creators[i].lastName.toUpperCase()) { + item.creators[i].lastName = ZU.capitalizeTitle(item.creators[i].lastName.toLowerCase(), true); + } + if (item.creators[i].firstName && item.creators[i].firstName == item.creators[i].firstName.toUpperCase()) { + item.creators[i].firstName = ZU.capitalizeTitle(item.creators[i].firstName.toLowerCase(), true); + } + } if (item.title == item.title.toUpperCase()) { item.title = ZU.capitalizeTitle(item.title.toLowerCase(), true); } - delete item.title; + delete item.journalAbbreviation; // J-Stage doesn't output journal abbreviations. if (item.publicationTitle == item.publicationTitle.toUpperCase()) { item.publicationTitle = ZU.capitalizeTitle(item.publicationTitle.toLowerCase(), true); @@ -131,27 +126,6 @@ function scrape(doc, url) { mimeType: "application/pdf" }); } - //item.complete(); - }); - translator.translate(); - }); - - // get RIS Link - var risurl = ZU.xpathText(doc, '//a[contains(text(), "RIS")]/@href'); - ZU.doGet(risurl, function (text) { - var ris = text; - var translator = Zotero.loadTranslator("import"); - translator.setTranslator("32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7"); - translator.setString(ris); - translator.setHandler("itemDone", function (obj, item) { - for (var i = 0; i < item.creators.length; i++) { - if (item.creators[i].lastName && item.creators[i].lastName == item.creators[i].lastName.toUpperCase()) { - item.creators[i].lastName = ZU.capitalizeTitle(item.creators[i].lastName.toLowerCase(), true); - } - if (item.creators[i].firstName && item.creators[i].firstName == item.creators[i].firstName.toUpperCase()) { - item.creators[i].firstName = ZU.capitalizeTitle(item.creators[i].firstName.toLowerCase(), true); - } - } item.complete(); }); translator.translate(); From 0aebbeceed42a9f0c4bc7425e10d94d90cbd74c4 Mon Sep 17 00:00:00 2001 From: aldente-hu Date: Tue, 10 Oct 2023 11:48:40 +0900 Subject: [PATCH 4/5] Remove itemIDs from testCases, which are not essential for journal articles. --- J-Stage.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/J-Stage.js b/J-Stage.js index 596c1eec96e..4db8dfbc34c 100644 --- a/J-Stage.js +++ b/J-Stage.js @@ -169,7 +169,6 @@ var testCases = [ "date": "2001", "DOI": "10.2208/prohe.45.811", "abstractNote": "Soil erosion is one of the most serious environmental problems commonly in over the world, which is caused by both natural and human factors. It is possible to investigate the global issue on soil erosion with the development of global data sets. This research estimated global soil erosion by the RUSLE model with use of a comprehensive global data set. The accuracy of the estimate mostly depends on the available information related to the study area. Present available finest data was used in this study. As the desired objective of estimating soil erosion by water at global scale, the application of RUSLE has shown its positive applicability on large-scale estimates. The study has shown a global view of water soil erosion potential with 0.5-degree grid resolution. Regional validations and examinations have been carried out by different ways. The global mean of annual soil erosion by water was estimated as 1100 ton/ km2, which agrees with several results obtained in different regions.", - "itemID": "2001811", "libraryCatalog": "J-Stage", "pages": "811-816", "publicationTitle": "Proceedings of Hydraulic Engineering", @@ -237,7 +236,6 @@ var testCases = [ "date": "2003", "DOI": "10.11519/jfs.114.0.280.0", "abstractNote": "I. はじめに 分光日射計データから得られる各種植生指標の季節変化を、CO2吸収量ならびに葉面積指数の季節変化と比較した。データは、国立環境研究所苫小牧フラックスリサーチサイト(カラマツ人工林)のタワーデータを用いた。・各種植生指標:全天分光日射計 英弘精機MS-131WP使用。地上高40mに設置した上向き・下向きの日積算日射量より各種植生指標値を算出。波長帯は、可視(Ch3:590-695nm≒ 赤)と近赤外(Ch5:850-1200nm)の組み合わせ[図1-a]、ならびに可視(Ch2:395-590nm≒青・緑)と 近赤外(Ch4:695-850nm)の組み合わせ[図1-b]の2通りを用いた。・CO2フラックス日中積算値:クローズドパス法非分散型赤外線分析計Li-Cor LI-6262使用。地上高27m 9:00から16:30までの30分値を加算、日中の積算値とした[図1-c]。・葉面積指数(LAI):光合成有効放射計Li-Cor LI-190SB 地上高1.5mと40mの下向き光合成有効放射量(PAR)の日積算値の比から、Lambert-Beerの式を用いPAI(Plant Area Index)を算出。落葉期の測定値を減じLAIとした [図1-d]。II. 日中CO2フラックスと植生指標GEMIの整合性[図1-c] Ch2とCh4から求めた植生指標GEMI(Global Environmental Monitoring Index)の季節変化と、日中積算CO2フラックスの極小値を結んだ包絡線の季節変化の間によい一致がみられた[図1-c]。特にカラマツの萌芽後のGEMI値の急増時期や、展葉に伴うGEMI値の増加傾向が、CO2フラックスの変化傾向とよく一致している。ただし紅葉期は両者は一致しない。これは、光合成活動が低下した葉が落葉せずに残るためと思われる。III. 各種植生指標の季節変化 [図1-a,b] これに対し、植生指標としてよく用いられる正規化植生指標NDVI(Normalized Vegetation Index)は、CO2フラックスの季節変化傾向と一致しなかった。NDVIは春先の融雪に伴う値のジャンプがあり、また6__から__10月の活葉期に値がだいたい一定となる。この特徴は、Ch3とCh5から求めた図1-aの4つの植生指標も同様であった。しかし、Ch2とCh4を用いた図1-bのGEMIと、近赤外と可視の差であるDVI(Difference Vegetation Index)にはこれらの特徴がみられず、CO2フラックスの季節変化傾向と同様に萌芽後に値が急増し、6月にピークを迎えた後なだらかに減少した。IV. 葉面積指数LAIと植生指標GEMIの整合性 [図1-d] 葉面積指数(LAI)が正常値を示す、積雪期以外のLAIの季節変化を、Ch2とCh4によるGEMI(≒CO2フラックスの季節変化)と比較すると、カラマツ萌芽後の展葉期にはGEMIより1__から__2週間ほど遅れてLAIの値が増加した。タワー設置のモニタリングカメラの日々の画像の変化を見ても、カラマツの葉の色の変化が先に現れ、その後に葉が茂ってゆく様子がわかる。 萌芽後、LAIは直線的に増加するが、GEMIの増加は立ち上がりは急なものの徐々に増加量が減ってくる。これは、萌芽後LAIの増加とともに葉の相互遮蔽が生じ、下層まで届く光量が減少するため、群落全体としての光合成活動が低下することが原因と思われる。 他にも、今回の測定方法ではLAIとしてカウントされていない林床植物のCO2フラックスの影響等が想定される。<CO2フラックス・LAIデータ提供: 産業総合技術研究所 三枝 信子・王 輝民>", - "itemID": "田中博春2003", "libraryCatalog": "J-Stage", "pages": "280-280", "publicationTitle": "日本林学会大会発表データベース", From 4cdccec724fa01bc134dfa265979ef98c881b180 Mon Sep 17 00:00:00 2001 From: aldente-hu Date: Mon, 23 Oct 2023 15:52:30 +0900 Subject: [PATCH 5/5] Update J-Stage.js to specify the link to RIS. Co-authored-by: zoe-translates --- J-Stage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/J-Stage.js b/J-Stage.js index 4db8dfbc34c..26c52d93296 100644 --- a/J-Stage.js +++ b/J-Stage.js @@ -87,7 +87,7 @@ function scrape(doc, url) { } // get RIS Link - var risurl = ZU.xpathText(doc, '//a[contains(text(), "RIS")]/@href'); + var risurl = ZU.xpathText(doc, '//div[contains(@class, "third-level-sublinks")]//a[contains(text(), "RIS")]/@href'); ZU.doGet(risurl, function (text) { var ris = text; var translator = Zotero.loadTranslator("import");