citoid

Citoid node.js 서비스는 URL, DOI, ISBN, PMID, PMCID 또는 QID를 제공하는 인용 데이터를 생성합니다. 그것은 Extension:VisualEditor에 citoid 서비스를 제공하는 것을 목표로 하는, 동반되는 확장, Citoid를 가집니다.
그것은 현재 VisualEditor가 활성화된 모든 WMF-위키에 배포됩니다,[1] 그렇지만, 확장은 그들의 일부에서만 구성되어 있습니다. 2018년 초이래로, 그것은 위키미디어와 자매 프로젝터에서 하루에 7,000회 정도 사용됩니다. 그들 요청의 약 99%가 (책과 같은 비-URL 식별자를 통해 찾아질 수 있는 출처에 대한 URL을 포함하여) URL을 사용합니다.
Public API
URL, DOI, ISBN, PMCID, PMID 또는 QID에 대한 메타데이터를 요청하기 위해, https://en.wikipedia.org/api/rest_v1/#!/Citation/getCitation 에서 영어 API 끝점을 사용할 수 있습니다. 또는 언어로 지역화된 요청에 대해, 원하는 언어 위키피디아를 사용할 수 있습니다. 마찬가지로 이 서버는 http://dawoum.duckdns.org/api/rest_v1/#!/Citation/getCitation 에서 보실 수 있지만, 테스트는 불가능합니다.
Issue tracker and project management
버그, 이슈, 그리고 개선에 대해 제안은 Citoid phabricator 프로젝트에 추가될 수 있습니다.
Installation
Citoid는 Zotero translators 라이브러리, 그리고 xulrunner를 사용하는, Zotero의 번역 서버를 설치해야 작동하는 nodejs 프로그램입니다.
Install nodejs and npm (Prerequistic)
우분투를 사용하고, OS 버전에 따라 다르지만, 가장 최근 버전의 nodej를 저장소에서 제공하지는 않을 것입니다. nodej 설치를 관리하기 위해서 nvm[1]을 사용하는 것을 추천합니다. 어쨌든, 우분투 18.10에서는 버전 8을 제공하기 때문에 저장소의 것을 이용해도 상관없습니다.
- sudo apt-get install nodejs npm
nodejs -v로 확인하십시요.다른 시스템에서는, 다음을 참조하십시오:
- http://nodejs.org/download/
- https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager
- (Debian Squeeze, Wheezy) https://gist.github.com/x-Code-x/2562576
Install and configure Zotero's translation server
Citoid 버전 0.5.3 또는 이전 버전에 대해서, 참조하십시오: Translation-server installation instructions
Citoid 버전 1.0.0 또는 그 이후 버전에 대해서:
- cd ~
- mkdir git
- cd git
- git clone --recursive --depth 1 https://gitlab.wikimedia.org/repos/mediawiki/services/zotero
- cd zotero
- npm install
- npm start
(3)(+0000000): Translators initialized with 528 loaded (3)(+0000003): Listening on 0.0.0.0:1969
설치가 제대로 되었는지 확인하기 위해서 터미널에서 다음을 입력해 봅니다.
- curl -d 'https://www.nytimes.com/2018/06/11/technology/net-neutrality-repeal.html' -H 'Content-Type: text/plain' http://localhost:1969/web
[{"key":"LYY9PFLM","version":0,"itemType":"newspaperArticle","creators":[{"firstName":"Keith","lastName":"Collins","creatorType":"author"}],"tags":[{"tag":"Net Neutrality","type":1},{"tag":"Pai, Ajit","type":1},{"tag":"Federal Communications Commission","type":1},{"tag":"Regulation and Deregulation of Industry","type":1},{"tag":"Computers and the Internet","type":1}],"title":"Net Neutrality Has Officially Been Repealed. Here’s How That Could Affect You.","section":"Technology","url":"https://www.nytimes.com/2018/06/11/technology/net-neutrality-repeal.html","abstractNote":"Net Neutrality rules that required internet service providers to offer equal access to all web content are no longer in effect as of Monday.","language":"en-US","libraryCatalog":"NYTimes.com","accessDate":"2019-01-03T05:13:14Z","date":"2018-06-11","publicationTitle":"The New York Times","ISSN":"0362-4331"}]
정상적인 동작이 확인이 되면, 시스템이 시작할 때 서비스가 자동으로 기동되도록 하는 것이 좋습니다.
- sudo chown -R root:root zotero
- sudo mv zotero /usr/local/lib
- sudo vi /etc/systemd/system/zotero.service
[Unit] Description=Zotero's Translation Server [Service] ExecStart=/usr/bin/node /usr/local/lib/zotero/src/server.js WorkingDirectory=/usr/local/lib/zotero Restart=always RestartSec=10 StandardOutput=syslog StandardError=syslog SyslogIdentifier=zotero [Install] WantedBy=multi-user.target
- sudo systemctl daemon-reload
- sudo systemctl enable zotero.service
- sudo systemctl start zotero.service
- sudo systemctl status zotero.service
Install and configure citoid service
시각 편집기(VisualEditor)에서 처럼, 개발자 가지는 미디어위키의 알파 빌드를 요구합니다. 만약 다른 미디어위키 버전에서 설치하려면, 예를 들어 최신 안정 버전 1.31 버전의 미디어위키에서는 git clone -b REL1_31 https://gerrit.wikimedia.org/r/p/mediawiki/services/citoid와 같이, 해당하는 가지를 사용해야 합니다.
미디어위키 알파 버전, 현재 1.33.0-wmf.9 등을 이용하고 있다면, 다음과 같이 설치할 수 있습니다.
- cd ~
- cd git
- git clone https://gerrit.wikimedia.org/r/mediawiki/services/citoid
- cd citoid
- npm install
- gvim config.yaml (optional)
- node server.js
{"name":"citoid","hostname":"dawoum","pid":26859,"level":30,"levelPath":"info","msg":"Worker 26859 listening on 0.0.0.0:1970","time":"2019-01-03T05:53:22.393Z","v":0}
위의 메시지에서와 같이, 서비스는 포트 1970에서 시작됩니다. 테스트를 위해서 브라우저를 열어서 http://localhost:1970/?doc로 접근합니다. 창에서 Citation아래의 /api를 누릅니다.
입력하고 Try it out!를 누릅니다.
Response Code: 200이 출력되어야 정상적으로 동작하는 것입니다.
정상적인 동작이 확인이 되면, 시스템이 시작할 때 서비스가 자동으로 기동되도록 하는 것이 좋습니다.
- sudo chown -R root:root citoid
- sudo mv citoid /usr/local/lib
- sudo vi /etc/systemd/system/citoid.service
[Unit] Description=Citoid Server [Service] ExecStart=/usr/bin/node /usr/local/lib/citoid/server.js WorkingDirectory=/usr/local/lib/citoid Restart=always RestartSec=10 StandardOutput=syslog StandardError=syslog SyslogIdentifier=citoid [Install] WantedBy=multi-user.target
- sudo systemctl daemon-reload
- sudo systemctl enable citoid.service
- sudo systemctl start citoid.service
- sudo systemctl status citoid.service
Configure RESTBase
RESTBase와 통합을 위해서는 config.yaml 파일에 다음을 추가합니다.
citoid:
host: http://localhost:1970
마찬가지로, projects/dev.yaml도 다음과 같이 수정합니다.
/data:
x-modules:
- path: v1/citoid.js
options: '{{options.citoid}}'
RESTBase 서비스를 재시작합니다.
브라우저를 열어서 http://dawoum.duckdns.org/apt/rest_v1/로 접근합니다. 만약 RESTBase 서비스를 재시작해도 Citation 카테고리가 보이지 않으면, 우분투 시스템을 재시작해야 합니다.
Citation 카테고리에서 Expand Operations를 누릅니다.
를 입력하고, Try it out!를 누릅니다.
Request URL에 다음과 같이 출력됩니다.
- http://dawoum.duckdns.org/localhost/v1/data/citation/mediawiki/http%3A%2F%2Fbrajo.duckdns.org%2Fwiki%2FGNOME
이 부분은 RESTBase 이전 설정과 다르기 때문에, 올라르게 동작하지 않습니다. 왜냐하면, http://dawoum.duckdns.org/apt/rest_v1/로 접근하도록 Nginx에 설정이 되어 있기 때문입니다.
대신에 터미널을 열어서 다음을 입력합니다.
- curl -X GET --header 'Accept: text/html' 'http://dawoum.duckdns.org/api/rest_v1/data/citation/mediawiki/http%3A%2F%2Fbrajo.duckdns.org%2Fwiki%2FGNOME'
[{"url":"http://brajo.duckdns.org/wiki/GNOME","itemType":"webpage","title":"GNOME - Dawoum Wiki","language":"en","accessDate":"2019-01-03","websiteTitle":"brajo.duckdns.org","source":["citoid"]}]
오류없이 정상적으로 작동하는 것으로 보입니다.
Install Citoid extension
여러분 위키에서 citoid 기능과 VisualEditor를 결합하기 위해서는, 다음의 것이 필요합니다: Extension:VisualEditor 및 Parsoid, VisualEditor's Citation Tool, 그리고 Citoid 확장.
또한, 다음 확장들이 같이 설치/운영되어 있는 것을 추천합니다: Extension:VisualEditor, Extension:Scribunto, Extension:Cite, Extension:TemplateData, Extension:ParserFunctions, 그리고 Extension:Citoid.
다음과 같이 확장을 설치합니다:
- cd /var/www/html/w/extensions
- sudo git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/Citoid
미디어위키 알파(개발자) 버전을 사용하지 않는 분들은 미디어위키 Citoid 확장 배포 지면에서 해당 버전을 받으실 수 있습니다.
미디어위키 설정 LocalSettings.php 파일에 다음을 추가합니다:
wfLoadExtension( 'Citoid' );
#$wgCitoidServiceUrl = 'http://localhost:1970/api'; #RESTBase가 없을 때,
$wgCitoidFullRestbaseURL = 'http://dawoum.duckdns.org/api/rest_'; #RESTBase가 있을 때, 생략해도 무방하다고 합니다.
| Option | Default value | Useful for… | Documentation |
|---|---|---|---|
$wgCitoidServiceUrl
|
false
|
Sysadmins | Full url to use the native citoid api, i.e. http://localhost:1970/api. Only used if VisualEditorFullRestbaseURL is null. |
$wgCitoidFullRestbaseURL
|
false
|
Sysadmins | Full url to use a citoid service running behind restbase, i.e. https://en.wikipedia.org/api/rest_. Overwrites default, which is to use VisualEditorFullRestbaseURL. Does not need to be set if you are running citoid behind the same restbase instance as parsoid/VisualEditor; mostly useful for point to a cross domain restbase citoid installation. |
VisualEditor and Citation Tool
다음의 템플릿을 영문 위키피디아에서 가져옵니다.
- w:Template:Cite web
- w:Template:Cite news
- w:Template:Cite journal
- w:Template:Cite book
- w:MediaWiki:Visualeditor-cite-tool-definition.json
- w:MediaWiki:Visualeditor-cite-tool-name-web
- w:MediaWiki:Visualeditor-cite-tool-name-book
- w:MediaWiki:Visualeditor-cite-tool-name-news
- w:MediaWiki:Visualeditor-cite-tool-name-journal
w:Special:Export에서 아래의 세 가지 옵션을 전부 선택하고 파일로 저장한 후에, Special:Import에서 해당 파일을 읽어 드립니다.
Extension:TemplateData 확장을 설치합니다.
Configure Citoid on a Citoid-enabled wiki
Citoid 확장은 특수 TemplateData 맵과 특수 citoid-specific 메시지를 사용하여 구성되어야 합니다. 그것은 현재 VisualEditor가 활성화된 모든 WMF-위키에 배포되지만, 사용하기 전에 반드시 먼저 구성되어야 합니다.
Ensure each template to be used in MediaWiki:Citoid-template-type-map.json has an 'citoid' maps value
Citoid는 각 문서 유형에 대해 필드의 고유한 집합을 가지고 있으므로 (예를 들어, 저널 이름은 citoid에서 'publicationTitle'이라고 불리지만, Template:Cite_journal에서는 'journal'이라고 불립니다), 각 템플릿은 반드시 citoid의 필드와 템플릿의 필드 사이에 맵(map)을 만드는 정의된 TemplateData를 가지고 있어야 합니다. 맵 'citoid'를 호출하는 것은 citoid 확장이 어떤 맵을 찾을지 알도록 만듭니다. 만약 맵 'citoid'가 사용자 스크립트와 같이 사용 목적에 맞지 않으면, 어떤 다른 것으로 불리는 citoid 서비스 관련 맵을 새롭게 만들 수 있습니다; 고유한 키를 가진 무제한의 맵이 맵 오브젝트에서 허용됩니다. 주목할 것은 TemplateData 맵은 편집 모드에서만 볼 수 있다는 것입니다; 그들은 TemplateData 테이블에서 표시되지는 않습니다.
필드 issn 및 isbn은 citoid 맵에서 배열 []을 가질 수 있습니다; 그것을 사용하는 것은 필드에서 오직 하나의 ISBN만 있어야 합니다. 만약 매개변수를 배열 (예를 들어, isbn: "[ISBN]") 내부에 배치하지 않으면, 여러 ISBN 또는 ISSN은 필드에서 문자로 연결될 것입니다 (예를 들어, "issn: 1234-5678, 7777-7777"). 모든 'person' 필드, 예를 들어 author, editor, translator, contributor 등은 citoid 맵에서 2D 배열 [[]]을 요구합니다. 예제에 대해 아래의 표본templateData를 참조하십시오.
- https://en.wikipedia.org/wiki/Template:Citation/doc
- https://en.wikipedia.org/wiki/Template:Cite_journal/doc
- https://en.wikipedia.org/wiki/Template:Cite_web/doc
- https://en.wikipedia.org/wiki/Template:Cite_news/doc
- https://en.wikipedia.org/wiki/Template:Cite_book/TemplateData
Configure special MediaWiki namespace Citoid message
이전 문단에서 언급한 것처럼, 특별한 MediaWiki: namespace message를 구성해야 합니다. 이 메시지는 고유한 citoid 유형 (website, book, journalArticle)을 적절한 템플릿 (Cite web, Cite book, Cite journal)으로 매핑합니다. 반드시 모든 각 단일 citoid 유형마다 템플릿을 짝지워야 합니다; 만약 템플릿이 특정 유형에 대해 짝지워지지 않으면 기본 동작은 없습니다. 나쁜 짝지워짐이 짝지워지지 않는 것보다는 좋습니다 (예를 들어, 비디어 라이너 노트와 책, 또는 비디어 라이너 노트와 비디오 사이의 공통으로 어떤 필드를 둘 수 있습니다).
처음에는 영문 위키피디아의 이름공간 메시지를 가져오는 것(Import)이 좋겠습니다.
Troubleshooting VisualEditor Extension
Inspector does not appear in the toolbar
An icon for the inspector should appear in the toolbar menu. If the icon does not appear in the toolbar, it most likely means there's a problem with MediaWiki:Citoid-template-type-map.json. If there is no message at that location, or if the JSON is invalid, the inspector will not load. Alternatively, you may need to refresh your JavaScript cache.
Get "could not make a citation for you" every time
You may consistently get this error if the citation template being inserted contains no maps data, or if the maps data is there but not making it to the MediaWiki API. First, determine the template that the inspector is attempted to insert, for example, Template:Cite web/doc. View source of the template or documentation page to verify that
"maps": {
"citoid": {
is present and contains fields. Then verify that these data are making it to the MediaWiki API by visiting the API page, i.e. http://localhost/w/api.php?action=templatedata&titles=Template:Cite%20web&format=jsonfm on your local installation, or https://en.wikipedia.org/w/api.php?action=templatedata&titles=Template:Cite%20web&format=jsonfm on en wiki.
If the maps object is present in TemplateData, but not in the API response, try editing the template where the TemplateData is transcluded i.e. Template:Cite_web (but making no changes) and saving it, a.k.a. a "null edit". There is a known bug with transcluded TemplateData where it can take a long for the API to update (phab:T52372); null edits force the change.
If the response from the API looks okay, there may be an issue with installation of the citoid service. Open up your browser's debugger to confirm that the responses from the citoid server are OK.
The inspector is still "pending" after a really long time following insertion
This typically means there is a bug. If you open your JavaScript console, you will likely find error messages that will help you debug.
Access date is formatted differently on my wiki
The dates are in ISO format, which is an international standard. On the back-end, we're sticking to ISO and in the future all dates will all be in ISO, not just access date. This is because it is an unambiguous way to present the date in any language. If the community doesn't like the way this looks to the user, it is possible to edit the citation template to format the ISO dates to something that is standard in your language. For instance, you can add logic to the template such that if the date is detected to be in ISO yyyy/mm/dd format, the date is reformatted *to appear* to be dd/mm/yyyy on the page. However, if you do this, the underlying data (i.e. when you edit the wikitext, or the form in VisualEditor) will still remain the same.
Troubleshooting the citoid service
My favourite site isn't recognised by citoid and only gets basic information
The Citoid service relies on the brilliant Zotero community for much of the "magic", as Zotero translators need to be written for each site. You can see a list of all Zotero translators at https://github.com/zotero/translators. Right now, Zotero best supports English-language sources. We need your help to improve coverage of other sites. You can write your own Zotero translator. Start by looking at mw:Citoid/Creating Zotero translators.
Testing for the translators using the "server" option or 'v' flag
To test with translation-server, download and install https://github.com/zotero/translation-server-old Your translator will need to have the 'v' flag enabled for 'browserSupport'. More here on that: https://www.zotero.org/support/dev/translators As an example, see https://github.com/zotero/translators/blob/master/3news.co.nz.js ; you will see there are a bunch of letters, one of which is v, which corresponds to translation-server. If server support is not enabled by testing it/then adding the 'v' flag, we won't be able to use the translator.
See also
- Old Zotero translation server -- xpcshell-based Zotero translation server, and translation-server, a pre-alpha nodejs equivalent.
- Valid field names for each item type
- Zotero field mappings, including vs. some cite templates
- mw:Citoid/Maps TemplateData
- w:Category:Citation_templates
- w:Help:Citation tools
- mw:VisualEditor/Citation tool
- m:Research:Citoid support for Wikimedia references
- Translators testing
- Citoid/Enabling Citoid on your wiki
- mw:Citoid/itemTypes
- mw:Citoid/Zotero's Tech Talk
- James Forrester talks Citoid and Zotero at m:WikiCite 2017
References
- ^ CommonSettings.php on phabricator.wikimedia.org (no feature flag set)