Commit 6c41472c880d248ba3de1b419b3b3c18d9e5f9ce

Authored by Paulo Graça
1 parent d73422afc0

Test bulk integration

@@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
  1 +The MIT License (MIT)
  2 +Copyright (c) 2017 PTCRIS - FCT|FCCN (http://ptcris.pt)
  3 +
  4 +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
  5 +
  6 +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
  7 +
  8 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
0 \ No newline at end of file 9 \ No newline at end of file
src/main/java/org/um/dsi/gavea/orcid/client/BaseOrcidOAuthClient.java
@@ -79,7 +79,7 @@ public class BaseOrcidOAuthClient implements Serializable { @@ -79,7 +79,7 @@ public class BaseOrcidOAuthClient implements Serializable {
79 createConnection(OrcidConstants.ENDPOINT_OAUTH_TOKEN, null, null); 79 createConnection(OrcidConstants.ENDPOINT_OAUTH_TOKEN, null, null);
80 80
81 if (debugMode || _log.isTraceEnabled()) { 81 if (debugMode || _log.isTraceEnabled()) {
82 - _log.trace("[getAccessTokens][post].[Request.form] " + formData.toString()); 82 + _log.debug("[getAccessTokens][post].[Request.form] " + formData.toString());
83 } 83 }
84 Response response = target.request(MediaType.APPLICATION_JSON_TYPE).post(Entity.form(formData)); 84 Response response = target.request(MediaType.APPLICATION_JSON_TYPE).post(Entity.form(formData));
85 _log.debug("[getAccessTokens][post].[Response.Status] " + response.getStatus()); 85 _log.debug("[getAccessTokens][post].[Response.Status] " + response.getStatus());
@@ -97,7 +97,7 @@ public class BaseOrcidOAuthClient implements Serializable { @@ -97,7 +97,7 @@ public class BaseOrcidOAuthClient implements Serializable {
97 createConnection(endpoint, token.getOrcid(), null); 97 createConnection(endpoint, token.getOrcid(), null);
98 98
99 if (debugMode || _log.isTraceEnabled()) { 99 if (debugMode || _log.isTraceEnabled()) {
100 - _log.trace("[post].[Request.entity] " + RecordUtil.convertToString(entity.getEntity())); 100 + _log.debug("[post].[Request.entity] " + RecordUtil.convertToString(entity.getEntity()));
101 } 101 }
102 102
103 response = target.request(OrcidConstants.APPLICATION_ORCID_XML) 103 response = target.request(OrcidConstants.APPLICATION_ORCID_XML)
@@ -121,7 +121,7 @@ public class BaseOrcidOAuthClient implements Serializable { @@ -121,7 +121,7 @@ public class BaseOrcidOAuthClient implements Serializable {
121 createConnection(endpoint, token.getOrcid(), putCode); 121 createConnection(endpoint, token.getOrcid(), putCode);
122 122
123 if (debugMode || _log.isTraceEnabled()) { 123 if (debugMode || _log.isTraceEnabled()) {
124 - _log.trace("[put].[Request.entity] " + RecordUtil.convertToString(entity.getEntity())); 124 + _log.debug("[put].[Request.entity] " + RecordUtil.convertToString(entity.getEntity()));
125 } 125 }
126 126
127 response = target.request(OrcidConstants.APPLICATION_ORCID_XML) 127 response = target.request(OrcidConstants.APPLICATION_ORCID_XML)
@@ -167,7 +167,7 @@ public class BaseOrcidOAuthClient implements Serializable { @@ -167,7 +167,7 @@ public class BaseOrcidOAuthClient implements Serializable {
167 167
168 target = restClient.target(apiUri).path(buildPath(endpoint, orcidId, putCode)); 168 target = restClient.target(apiUri).path(buildPath(endpoint, orcidId, putCode));
169 if (debugMode || _log.isTraceEnabled()) { 169 if (debugMode || _log.isTraceEnabled()) {
170 - _log.trace("[connection].[Request.path] " + target.getUri().toString()); 170 + _log.debug("[connection].[Request.path] " + target.getUri().toString());
171 } 171 }
172 } 172 }
173 173
src/main/java/org/um/dsi/gavea/orcid/client/OrcidOAuthClient.java
@@ -181,6 +181,19 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient { @@ -181,6 +181,19 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
181 } 181 }
182 } 182 }
183 183
  184 + /* Activities - Works */
  185 + public org.um.dsi.gavea.orcid.model.activities.Works readWorksSummary(final OrcidAccessToken token) throws OrcidClientException {
  186 + Response response = null;
  187 + try {
  188 + response = get(OrcidConstants.ENDPOINT_WORKS, token, null);
  189 +
  190 + return response.readEntity(org.um.dsi.gavea.orcid.model.activities.Works.class);
  191 + } finally {
  192 + if (response != null)
  193 + response.close();
  194 + }
  195 + }
  196 +
184 197
185 /* Address */ 198 /* Address */
186 public Addresses readAddresses(final OrcidAccessToken token) throws OrcidClientException { 199 public Addresses readAddresses(final OrcidAccessToken token) throws OrcidClientException {
@@ -792,6 +805,18 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient { @@ -792,6 +805,18 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
792 response.close(); 805 response.close();
793 } 806 }
794 } 807 }
  808 +
  809 + /* Bulks */
  810 + public org.orcid.ns.bulk.Bulk addWorks(final OrcidAccessToken token, final org.orcid.ns.bulk.Bulk bulk) throws OrcidClientException {
  811 + Response response = null;
  812 + try {
  813 + response = post(OrcidConstants.ENDPOINT_WORKS, token, Entity.entity(bulk, MediaType.APPLICATION_XML_TYPE));
  814 + return response.readEntity(org.orcid.ns.bulk.Bulk.class);
  815 + } finally {
  816 + if (response != null)
  817 + response.close();
  818 + }
  819 + }
795 820
796 public void updateWork(final OrcidAccessToken token, final String putCode, final Work work) throws OrcidClientException { 821 public void updateWork(final OrcidAccessToken token, final String putCode, final Work work) throws OrcidClientException {
797 Response response = null; 822 Response response = null;
src/main/java/org/um/dsi/gavea/orcid/client/constants/OrcidConstants.java
@@ -10,6 +10,7 @@ public final class OrcidConstants { @@ -10,6 +10,7 @@ public final class OrcidConstants {
10 public final static String ENDPOINT_OAUTH_TOKEN = "/oauth/token"; 10 public final static String ENDPOINT_OAUTH_TOKEN = "/oauth/token";
11 11
12 public final static String ENDPOINT_ACTIVITIES = "/activities"; 12 public final static String ENDPOINT_ACTIVITIES = "/activities";
  13 + public final static String ENDPOINT_WORKS = "/works";
13 public final static String ENDPOINT_ADDRESS = "/address"; 14 public final static String ENDPOINT_ADDRESS = "/address";
14 public final static String ENDPOINT_BIOGRAPHY = "/biography"; 15 public final static String ENDPOINT_BIOGRAPHY = "/biography";
15 public final static String ENDPOINT_EDUCATION = "/education"; 16 public final static String ENDPOINT_EDUCATION = "/education";
@@ -28,7 +29,7 @@ public final class OrcidConstants { @@ -28,7 +29,7 @@ public final class OrcidConstants {
28 public final static String ENDPOINT_PERSONAL_DETAILS = "/personal-details"; 29 public final static String ENDPOINT_PERSONAL_DETAILS = "/personal-details";
29 public final static String ENDPOINT_RESEARCHER_URLS = "/researcher-urls"; 30 public final static String ENDPOINT_RESEARCHER_URLS = "/researcher-urls";
30 public final static String ENDPOINT_WORK = "/work"; 31 public final static String ENDPOINT_WORK = "/work";
31 - public final static String ENDPOINT_WORK_SUMMARY = "/work/summary"; 32 + public final static String ENDPOINT_WORK_SUMMARY = "/work/summary";
32 33
33 public final static String APPLICATION_VND_ORCID_XML = "application/vnd.orcid+xml"; 34 public final static String APPLICATION_VND_ORCID_XML = "application/vnd.orcid+xml";
34 public final static MediaType APPLICATION_VND_ORCID_XML_TYPE = new MediaType("application", "vnd.orcid+xml"); 35 public final static MediaType APPLICATION_VND_ORCID_XML_TYPE = new MediaType("application", "vnd.orcid+xml");
src/main/resources/binding/orcid-2.0.xjb
@@ -93,7 +93,7 @@ @@ -93,7 +93,7 @@
93 <jaxb:package name="org.um.dsi.gavea.orcid.model.funding" /> 93 <jaxb:package name="org.um.dsi.gavea.orcid.model.funding" />
94 </jaxb:schemaBindings> 94 </jaxb:schemaBindings>
95 95
96 - <jaxb:bindings node="//xs:element[@name='summary']"> 96 + <jaxb:bindings node="//xs:element[@name='funding-summary']">
97 <jaxb:property name="funding-summary" /> 97 <jaxb:property name="funding-summary" />
98 <jaxb:class name="FundingSummary" /> 98 <jaxb:class name="FundingSummary" />
99 </jaxb:bindings> 99 </jaxb:bindings>
@@ -126,7 +126,7 @@ @@ -126,7 +126,7 @@
126 <jaxb:package name="org.um.dsi.gavea.orcid.model.peerreview" /> 126 <jaxb:package name="org.um.dsi.gavea.orcid.model.peerreview" />
127 </jaxb:schemaBindings> 127 </jaxb:schemaBindings>
128 128
129 - <jaxb:bindings node="//xs:element[@name='summary']"> 129 + <jaxb:bindings node="//xs:element[@name='peer-review-summary']">
130 <jaxb:property name="peer-review-summary" /> 130 <jaxb:property name="peer-review-summary" />
131 <jaxb:class name="PeerReviewSummary" /> 131 <jaxb:class name="PeerReviewSummary" />
132 </jaxb:bindings> 132 </jaxb:bindings>
src/main/resources/xsd/record_2.0/activities-2.0.xsd
@@ -140,7 +140,7 @@ @@ -140,7 +140,7 @@
140 <xs:element ref="common:external-ids"></xs:element> 140 <xs:element ref="common:external-ids"></xs:element>
141 <xs:sequence> 141 <xs:sequence>
142 <xs:element maxOccurs="unbounded" minOccurs="0" 142 <xs:element maxOccurs="unbounded" minOccurs="0"
143 - ref="funding:summary" /> 143 + ref="funding:funding-summary" />
144 </xs:sequence> 144 </xs:sequence>
145 </xs:sequence> 145 </xs:sequence>
146 </xs:complexType> 146 </xs:complexType>
@@ -168,7 +168,7 @@ @@ -168,7 +168,7 @@
168 <xs:element ref="common:external-ids"></xs:element> 168 <xs:element ref="common:external-ids"></xs:element>
169 <xs:sequence> 169 <xs:sequence>
170 <xs:element maxOccurs="unbounded" minOccurs="0" 170 <xs:element maxOccurs="unbounded" minOccurs="0"
171 - ref="peer-review:summary" /> 171 + ref="peer-review:peer-review-summary" />
172 </xs:sequence> 172 </xs:sequence>
173 </xs:sequence> 173 </xs:sequence>
174 </xs:complexType> 174 </xs:complexType>
src/main/resources/xsd/record_2.0/bulk-2.0.xsd
@@ -0,0 +1,57 @@ @@ -0,0 +1,57 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
  3 + xmlns:sch="http://purl.oclc.org/dsdl/schematron" elementFormDefault="qualified"
  4 + targetNamespace="http://www.orcid.org/ns/bulk"
  5 + xmlns:bulk="http://www.orcid.org/ns/bulk"
  6 + xmlns:work="http://www.orcid.org/ns/work"
  7 + xmlns:error="http://www.orcid.org/ns/error">
  8 + <xs:annotation>
  9 + <xs:documentation>
  10 + =============================================================================
  11 +
  12 + ORCID (R) Open Source
  13 + http://orcid.org
  14 +
  15 + Copyright (c) 2012-2014 ORCID,
  16 + Inc.
  17 + Licensed under an MIT-Style License (MIT)
  18 + http://orcid.org/open-source-license
  19 +
  20 + This copyright and license
  21 + information (including a link to the full
  22 + license)
  23 + shall be included in
  24 + its entirety in all copies or substantial portion of
  25 + the software.
  26 +
  27 + =============================================================================
  28 + The schema describes the message format used for ORCID API requests
  29 + and responses.
  30 + The top level element is orcid-message.
  31 + </xs:documentation>
  32 + <xs:appinfo>
  33 + <sch:title>Schematron validation</sch:title>
  34 + <sch:ns prefix="bulk" uri="http://www.orcid.org/ns/bulk" />
  35 + </xs:appinfo>
  36 + </xs:annotation>
  37 +
  38 + <xs:import namespace="http://www.orcid.org/ns/error"
  39 + schemaLocation="error-2.0.xsd" />
  40 +
  41 + <xs:import namespace="http://www.orcid.org/ns/work"
  42 + schemaLocation="work-2.0.xsd" />
  43 +
  44 + <xs:element name="bulk">
  45 + <xs:complexType>
  46 + <xs:annotation>
  47 + <xs:documentation>Utilitary schema that allow the creation of multiple works in a single request</xs:documentation>
  48 + </xs:annotation>
  49 + <xs:sequence maxOccurs="unbounded">
  50 + <xs:choice>
  51 + <xs:element minOccurs="0" ref="work:work" />
  52 + <xs:element minOccurs="0" ref="error:error" />
  53 + </xs:choice>
  54 + </xs:sequence>
  55 + </xs:complexType>
  56 + </xs:element>
  57 +</xs:schema>
src/main/resources/xsd/record_2.0/funding-2.0.xsd
@@ -93,7 +93,7 @@ @@ -93,7 +93,7 @@
93 </xs:complexType> 93 </xs:complexType>
94 </xs:element> 94 </xs:element>
95 95
96 - <xs:element name="summary"> 96 + <xs:element name="funding-summary">
97 <xs:complexType> 97 <xs:complexType>
98 <xs:complexContent> 98 <xs:complexContent>
99 <xs:extension base="common:element-summary"> 99 <xs:extension base="common:element-summary">
src/main/resources/xsd/record_2.0/history-2.0.xsd
@@ -0,0 +1,203 @@ @@ -0,0 +1,203 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
  3 + xmlns:sch="http://purl.oclc.org/dsdl/schematron" elementFormDefault="qualified"
  4 + targetNamespace="http://www.orcid.org/ns/history" xmlns:history="http://www.orcid.org/ns/history"
  5 + xmlns:common="http://www.orcid.org/ns/common">
  6 + <xs:annotation>
  7 + <xs:documentation>
  8 + =============================================================================
  9 +
  10 + ORCID (R) Open Source
  11 + http://orcid.org
  12 +
  13 + Copyright (c) 2012-2014 ORCID,
  14 + Inc.
  15 + Licensed under an MIT-Style License (MIT)
  16 + http://orcid.org/open-source-license
  17 +
  18 + This copyright and license
  19 + information (including a link to the full
  20 + license)
  21 + shall be included in
  22 + its entirety in all copies or substantial portion of
  23 + the software.
  24 +
  25 + =============================================================================
  26 + The schema describes the message format used for ORCID API requests
  27 + and responses.
  28 + The top level element is orcid-message.
  29 + </xs:documentation>
  30 + <xs:appinfo>
  31 + <sch:title>Schematron validation</sch:title>
  32 + <sch:ns prefix="orcid" uri="http://www.orcid.org/ns/orcid" />
  33 + </xs:appinfo>
  34 + </xs:annotation>
  35 +
  36 + <xs:import namespace="http://www.orcid.org/ns/common"
  37 + schemaLocation="../common_2.0/common-2.0.xsd" />
  38 +
  39 + <xs:element name="history">
  40 + <xs:complexType>
  41 + <xs:annotation>
  42 + <xs:documentation>A simple history of the researcher or
  43 + contributor's
  44 + ORCID Record. The visibility attribute (private, limited or public)
  45 + can be set at record creation, and indicates who can see this
  46 + section of information.
  47 + </xs:documentation>
  48 + </xs:annotation>
  49 + <xs:sequence>
  50 + <xs:element name="creation-method" type="history:creation-method"
  51 + minOccurs="0" maxOccurs="1">
  52 + <xs:annotation>
  53 + <xs:documentation>The method used to create the ORCID Record
  54 + * API
  55 + method - Institution created the record on behalf of the
  56 + individual
  57 + * Direct method - Individual registered directly at
  58 + orcid.org
  59 + * Member-referrred method - Individual registered as
  60 + part
  61 + of a workflow such as submitting a manuscript or applying
  62 + for a
  63 + grant
  64 + </xs:documentation>
  65 + </xs:annotation>
  66 + </xs:element>
  67 + <xs:element name="completion-date" type="history:completion-date"
  68 + minOccurs="0" maxOccurs="1" />
  69 + <xs:element name="submission-date" type="history:submission-date"
  70 + minOccurs="0" maxOccurs="1" />
  71 + <xs:element ref="common:last-modified-date"
  72 + minOccurs="0" maxOccurs="1" />
  73 + <xs:element name="claimed" type="history:claimed" minOccurs="0"
  74 + maxOccurs="1" />
  75 + <xs:element ref="common:source" minOccurs="0" maxOccurs="1" />
  76 + <xs:element name="deactivation-date" type="history:deactivation-date"
  77 + minOccurs="0" maxOccurs="1" />
  78 + <xs:element name="verified-email" type="xs:boolean"
  79 + minOccurs="1" maxOccurs="1">
  80 + <xs:annotation>
  81 + <xs:documentation>True if the user has a verified email
  82 + </xs:documentation>
  83 + </xs:annotation>
  84 + </xs:element>
  85 + <xs:element name="verified-primary-email" type="xs:boolean"
  86 + minOccurs="1" maxOccurs="1">
  87 + <xs:annotation>
  88 + <xs:documentation>True if the user's current primary email is
  89 + verified
  90 + </xs:documentation>
  91 + </xs:annotation>
  92 + </xs:element>
  93 + </xs:sequence>
  94 + <xs:attribute name="visibility" type="common:visibility" />
  95 + </xs:complexType>
  96 + </xs:element>
  97 +
  98 + <xs:complexType name="completion-date">
  99 + <xs:annotation>
  100 + <xs:documentation>The date and time when the ORCID Record set up was
  101 + completed.
  102 + </xs:documentation>
  103 + </xs:annotation>
  104 + <xs:simpleContent>
  105 + <xs:extension base="xs:dateTime" />
  106 + </xs:simpleContent>
  107 + </xs:complexType>
  108 +
  109 + <xs:complexType name="submission-date">
  110 + <xs:annotation>
  111 + <xs:documentation>The date time when the ORCID Record and iD was
  112 + first created.
  113 + </xs:documentation>
  114 + </xs:annotation>
  115 + <xs:simpleContent>
  116 + <xs:extension base="xs:dateTime" />
  117 + </xs:simpleContent>
  118 + </xs:complexType>
  119 +
  120 + <xs:complexType name="claimed">
  121 + <xs:annotation>
  122 + <xs:documentation>True if the researcher or contributor has added a
  123 + password
  124 + to assume ownership of their ORCID Record after bulk
  125 + creation
  126 + by their institution.
  127 + </xs:documentation>
  128 + </xs:annotation>
  129 + <xs:simpleContent>
  130 + <xs:extension base="xs:boolean" />
  131 + </xs:simpleContent>
  132 + </xs:complexType>
  133 +
  134 + <xs:complexType name="deactivation-date">
  135 + <xs:annotation>
  136 + <xs:documentation>The date and time when the ORCID Record was
  137 + deactivated. (If the account is active, this field will be NULL.)
  138 + </xs:documentation>
  139 + </xs:annotation>
  140 + <xs:simpleContent>
  141 + <xs:extension base="xs:dateTime" />
  142 + </xs:simpleContent>
  143 + </xs:complexType>
  144 +
  145 + <xs:complexType mixed="true" name="source-reference">
  146 + <xs:annotation>
  147 + <xs:documentation>(UNUSED) The identifier or other reference
  148 + information for the researcher or contributor in the source client
  149 + application (Member Organization's) system.
  150 + </xs:documentation>
  151 + </xs:annotation>
  152 + </xs:complexType>
  153 +
  154 + <xs:complexType name="source-date">
  155 + <xs:annotation>
  156 + <xs:documentation>The date time that the source client application
  157 + (Member organization system) or individual user created/attempted to
  158 + create the item.
  159 + </xs:documentation>
  160 + </xs:annotation>
  161 + <xs:simpleContent>
  162 + <xs:extension base="xs:dateTime" />
  163 + </xs:simpleContent>
  164 + </xs:complexType>
  165 +
  166 + <xs:simpleType name="creation-method">
  167 + <xs:annotation>
  168 + <xs:documentation>Indicates how the ORCID record and iD were created.
  169 + </xs:documentation>
  170 + </xs:annotation>
  171 + <xs:restriction base="common:non-empty-string">
  172 + <xs:enumeration value="API">
  173 + <xs:annotation>
  174 + <xs:documentation>The ORCID Record was created using the ORCID
  175 + Member API.
  176 + </xs:documentation>
  177 + </xs:annotation>
  178 + </xs:enumeration>
  179 + <xs:enumeration value="Direct">
  180 + <xs:annotation>
  181 + <xs:documentation>The user registered on the /register page.
  182 + </xs:documentation>
  183 + </xs:annotation>
  184 + </xs:enumeration>
  185 + <xs:enumeration value="Member-referred">
  186 + <xs:annotation>
  187 + <xs:documentation>The registered on the /oauth/signin.
  188 + </xs:documentation>
  189 + </xs:annotation>
  190 + </xs:enumeration>
  191 + <xs:enumeration value="website">
  192 + <xs:annotation>
  193 + <xs:documentation>DEPRECATED use Direct or Member-referred
  194 + instead.
  195 + The method used to create the ORCID Record (Website or
  196 + API).
  197 + </xs:documentation>
  198 + </xs:annotation>
  199 + </xs:enumeration>
  200 + </xs:restriction>
  201 + </xs:simpleType>
  202 +
  203 +</xs:schema>
src/main/resources/xsd/record_2.0/peer-review-2.0.xsd
@@ -135,7 +135,7 @@ @@ -135,7 +135,7 @@
135 </xs:complexType> 135 </xs:complexType>
136 </xs:element> 136 </xs:element>
137 137
138 - <xs:element name="summary"> 138 + <xs:element name="peer-review-summary">
139 <xs:complexType> 139 <xs:complexType>
140 <xs:complexContent> 140 <xs:complexContent>
141 <xs:extension base="common:element-summary"> 141 <xs:extension base="common:element-summary">
src/main/resources/xsd/record_2.0/peer-review-guide-v2.0.md
@@ -0,0 +1,131 @@ @@ -0,0 +1,131 @@
  1 +
  2 +#ORCID API v2.0 Peer Review Guide
  3 +Starting in v2.0, the ORCID API now supports a new activity type: ```peer-review```.
  4 +
  5 +The ```peer-review``` activity type is intended to allow for recognition of and exchange of data about peer review service contributed by researchers.
  6 +
  7 +The ```peer-review``` activity type follows the [CASRAI Peer Review Services data profile](http://dictionary.casrai.org/Peer_Review_Services), which was developed by the [Peer Review Services Working Group (PRS-WG)](http://casrai.org/standards/subject-groups/peer-review-services), led by [ORCID](http://orcid.org) and [F1000](http://f1000.com/). More details about ORCID's implementation of this recommendation, and the Early Adopter program for Peer Review can be found on the [Peer Review Early Adopter page](http://orcid.org/content/peer-review-early-adopter-program).
  8 +
  9 +##Peer Review XML
  10 +XML for the ```peer-review``` activity follows the [peer-review-2.0.xsd](https://github.com/ORCID/ORCID-Source/blob/master/orcid-model/src/main/resources/record_2.0/peer-review-2.0.xsd) and consists of the following sections:
  11 +
  12 +###The fields
  13 +
  14 +**DESCRIBING THE REVIEWER**
  15 +
  16 +- **reviewer-role** _(required)_ The role played by a person in their contribution to a review. This field is selected from a list containing the following values: _chair, editor, member, organizer, reviewer_
  17 +
  18 +**DESCRIBING THE REVIEW**
  19 +
  20 +- **review-identifiers** _(required)_ Unique identifier(s) of the review. *This identifier refers to the review itself, NOT to the item that was reviewed.* At least one identifier is required. In the case where there is no persistent unique identifier for the review, the source providing the data should generate a locally-sourced unique identifier for the review (e.g., type "organization-defined-type"). This field will be checked when adding new reviews to prevent double counting of review activity.
  21 +
  22 +- **review-url** _(optional)_ A link to a representation of the review on the web. *This URL refers to the review itself, NOT to the item that was reviewed.*
  23 +
  24 +- **review-type** _(required)_ The kind of review applied to the subject type reviewed. This field is selected from a list containing the following values: _evaluation, review_
  25 +
  26 +
  27 +- **review-completion-date** _(required)_ The date on which the review was completed (formatted to ISO 8601). Allowable values: yyyy; yyyy-mm; yyyy-mm-dd, formatted using the ORCID fuzzy date format.
  28 +
  29 +- **review-group-id** _(required)_ Identifier for the group that this review should be a part of for aggregation purposes. The Group ID must be pre-registered before use. (see [Group ID Registration]() below for more information.)
  30 +
  31 +**DESCRIBING THE SUBJECT OF THE REVIEW**
  32 +
  33 +- **subject-external-identifier** _(optional)_ The unique ID of the object that was reviewed. *This identifier refers to the SUBJECT of the review, not of the review itself.*
  34 +
  35 +- **subject-container-name** _(optional)_ The name of the journal, conference, grant review panel, or other applicable object of which the review subject was a part.
  36 +
  37 +- **subject-type** _(optional)_ The type of object that the review subject is (for example, a journal article, grant, etc)
  38 +
  39 +- **subject-name** _(optional)_ The name/title of the subject object that was reviewed.
  40 +
  41 +- **subject-url** _(optional)_ The URL of the subject object that was reviewed. *This URL points to the SUBJECT of the review, not to the review itself.*
  42 +
  43 +**DESCRIBING THE ORGANIZATION THAT THE REVIEW WAS DONE FOR**
  44 +
  45 +- **convening-organization** _(required)_ Information about the organization convening the review (journal publisher, conference organizer, funding agency, etc.). Whenever possible, this organization is identified by a unique identifier like the Ringgold ID or FundRef ID.
  46 +
  47 +###Example file
  48 +
  49 +For an example XML file, see [peer-review-2.0.xml](https://github.com/ORCID/ORCID-Source/blob/master/orcid-model/src/main/resources/record_2.0/samples/peer-review-2.0.xml )
  50 +
  51 +***Note:*** *Sample files contain system-generated elements/attributes that are returned when reading items from ORCID. The following items should not be included when posting items to ORCID:*
  52 +
  53 +- *put-code (exception: include put-code when updating items using the PUT method)*
  54 +- *source*
  55 +- *created-date*
  56 +- *last-modified-date*
  57 +
  58 +
  59 +##Peer Review API Reference
  60 +```peer-review``` is available only in ORCID API v2.0_rcX, which uses a slightly different data structure from previous API versions.
  61 +
  62 +In v2.0_rcX, activities are read, added, and modified on an individual basis (rather than as a list), using a ```put-code```, which is a system-generated identifier used within the ORCID database.
  63 +
  64 +The ```put-code``` for a specific item can be obtained by reading a summary of a user's ORCID record.
  65 +
  66 +Other notable differences between v2.0_rcX previous versions include:
  67 +
  68 +- Only 2 scopes are used: ```/read-limited``` and ```/activities/update```
  69 +- An explicit ```DELETE``` method is used to remove record items
  70 +
  71 +###Read Activities Summary
  72 +| Action | HTTP method | Scope | URL |
  73 +|-------------------------|-------------|--------------------------|----------------------------------------------------------|
  74 +| Read activities summary | GET | /read-limited | https://api.sandbox.orcid.org/v2.0/[ORCID-iD]/activities |
  75 +
  76 +###Read/Modifiy Peer Review Activities
  77 +| Action | HTTP method | Scope | URL |
  78 +|--------------------|-------------|--------------------------|--------------------------------------------------------------------------|
  79 +| Add peer-review item | POST | /activities/update | https://api.sandbox.orcid.org/v2.0/[ORCID-iD]/peer-review |
  80 +| Read peer-review item | GET | /read-limited | https://api.sandbox.orcid.org/v2.0/[ORCID-iD]/peer-review/[PUT-CODE] |
  81 +| Update peer-review item | PUT | /activities/update | https://api.sandbox.orcid.org/v2.0/[ORCID-iD]/peer-review/[PUT-CODE] |
  82 +| Delete peer-review item | DELETE | /activities/update | https://api.sandbox.orcid.org/v2.0/[ORCID-iD]/peer-review/[PUT-CODE] |
  83 +
  84 +
  85 +- **[ORCID-iD]** is the ORCID iD for the record, formatted as XXXX-XXXX-XXXX-XXXX
  86 +- **[PUT-CODE]** is the ```put-code``` attribute for the specific ```peer-review``` activity that you wish to read or modify.
  87 +
  88 +###Example cURL Statements
  89 +####Read Activities Summary
  90 +
  91 +```shell
  92 +curl -i -H "Accept: application/orcid+xml" \
  93 + -H 'Authorization: Bearer dd91868d-d29a-475e-9acb-bd3fdf2f43f4' \
  94 + 'https://api.sandbox.orcid.org/v2.0/0000-0002-1306-4180/activities'
  95 +```
  96 +
  97 +####Add Peer-Review Activity
  98 +
  99 +```shell
  100 +curl -i -H 'Content-type: application/orcid+xml’ \
  101 + -H 'Authorization: Bearer dd91868d-d29a-475e-9acb-bd3fdf2f43f4' \
  102 + -d '@[FILE-PATH]/peer-review-item.xml' \
  103 + -X POST 'https://api.sandbox.orcid.org/v2.0/[ORCID]/peer-review'
  104 +```
  105 +
  106 +####Read Peer-Review Activity
  107 +
  108 +```
  109 +curl -i -H "Accept: application/orcid+xml" \
  110 + -H 'Authorization: Bearer dd91868d-d29a-475e-9acb-bd3fdf2f43f4' \
  111 + 'https://api.sandbox.orcid.org/v2.0/[ORCID]/peer-review/[PUT-CODE]'
  112 +```
  113 +
  114 +####Update Peer-Review Activity
  115 +
  116 +```shell
  117 +curl -i -H 'Content-type: application/orcid+xml’ \
  118 + -H 'Authorization: Bearer dd91868d-d29a-475e-9acb-bd3fdf2f43f4' \
  119 + -d '@[FILE-PATH]/peer-review-item-updated.xml' \
  120 + -X PUT 'https://api.sandbox.orcid.org/v2.0/[ORCID]/peer-review/[PUT-CODE]'
  121 +```
  122 +
  123 +####Delete Peer-Review Activity
  124 +
  125 +```shell
  126 +curl -i -H 'Content-type: application/orcid+xml’ \
  127 + -H 'Authorization: Bearer dd91868d-d29a-475e-9acb-bd3fdf2f43f4' \
  128 + -X DELETE 'https://api.sandbox.orcid.org/v2.0/[ORCID]/peer-review/[PUT-CODE]'
  129 +```
  130 +
  131 +
src/main/resources/xsd/record_2.0/preferences-2.0.xsd
@@ -0,0 +1,50 @@ @@ -0,0 +1,50 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
  3 + xmlns:sch="http://purl.oclc.org/dsdl/schematron" elementFormDefault="qualified"
  4 + targetNamespace="http://www.orcid.org/ns/preferences" xmlns:preferences="http://www.orcid.org/ns/preferences"
  5 + xmlns:common="http://www.orcid.org/ns/common">
  6 + <xs:annotation>
  7 + <xs:documentation>
  8 + =============================================================================
  9 +
  10 + ORCID (R) Open Source
  11 + http://orcid.org
  12 +
  13 + Copyright (c) 2012-2014 ORCID,
  14 + Inc.
  15 + Licensed under an MIT-Style License (MIT)
  16 + http://orcid.org/open-source-license
  17 +
  18 + This copyright and license
  19 + information (including a link to the full
  20 + license)
  21 + shall be included in
  22 + its entirety in all copies or substantial portion of
  23 + the software.
  24 +
  25 + =============================================================================
  26 + The schema describes the message format used for ORCID API requests
  27 + and responses.
  28 + The top level element is orcid-message.
  29 + </xs:documentation>
  30 + <xs:appinfo>
  31 + <sch:title>Schematron validation</sch:title>
  32 + <sch:ns prefix="orcid" uri="http://www.orcid.org/ns/orcid" />
  33 + </xs:appinfo>
  34 + </xs:annotation>
  35 + <xs:import namespace="http://www.orcid.org/ns/common"
  36 + schemaLocation="../common_2.0/common-2.0.xsd" />
  37 + <xs:element name="preferences">
  38 + <xs:complexType>
  39 + <xs:annotation>
  40 + <xs:documentation>Preferences set by the researcher or contributor.
  41 + (currently language preference)
  42 + </xs:documentation>
  43 + </xs:annotation>
  44 + <xs:sequence>
  45 + <xs:element name="locale" type="common:locale" />
  46 + </xs:sequence>
  47 + </xs:complexType>
  48 + </xs:element>
  49 +
  50 +</xs:schema>
src/main/resources/xsd/record_2.0/record-2.0.xsd
@@ -0,0 +1,98 @@ @@ -0,0 +1,98 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
  3 + xmlns:sch="http://purl.oclc.org/dsdl/schematron" elementFormDefault="qualified"
  4 + targetNamespace="http://www.orcid.org/ns/record" xmlns:internal="http://www.orcid.org/ns/internal"
  5 + xmlns:person="http://www.orcid.org/ns/person" xmlns:common="http://www.orcid.org/ns/common"
  6 + xmlns:work="http://www.orcid.org/ns/work" xmlns:funding="http://www.orcid.org/ns/funding"
  7 + xmlns:education="http://www.orcid.org/ns/education" xmlns:employment="http://www.orcid.org/ns/employment"
  8 + xmlns:activities="http://www.orcid.org/ns/activities" xmlns:history="http://www.orcid.org/ns/history"
  9 + xmlns:record="http://www.orcid.org/ns/record" xmlns:preferences="http://www.orcid.org/ns/preferences"
  10 + xmlns:peer-review="http://www.orcid.org/ns/peer-review">
  11 + <xs:annotation>
  12 + <xs:documentation>
  13 + =============================================================================
  14 +
  15 + ORCID (R) Open Source
  16 + http://orcid.org
  17 +
  18 + Copyright (c) 2012-2014 ORCID,
  19 + Inc.
  20 + Licensed under an MIT-Style License (MIT)
  21 + http://orcid.org/open-source-license
  22 +
  23 + This copyright and license
  24 + information (including a link to the full
  25 + license)
  26 + shall be included in
  27 + its entirety in all copies or substantial portion of
  28 + the software.
  29 +
  30 + =============================================================================
  31 + The schema describes the message format used for ORCID API requests
  32 + and responses.
  33 + The top level element is orcid-message.
  34 + </xs:documentation>
  35 + <xs:appinfo>
  36 + <sch:title>Schematron validation</sch:title>
  37 + <sch:ns prefix="orcid" uri="http://www.orcid.org/ns/orcid" />
  38 + </xs:appinfo>
  39 + </xs:annotation>
  40 +
  41 + <xs:import namespace="http://www.orcid.org/ns/activities"
  42 + schemaLocation="activities-2.0.xsd" />
  43 + <xs:import namespace="http://www.orcid.org/ns/person"
  44 + schemaLocation="person-2.0.xsd" />
  45 + <xs:import namespace="http://www.orcid.org/ns/common"
  46 + schemaLocation="../common_2.0/common-2.0.xsd" />
  47 + <xs:import namespace="http://www.orcid.org/ns/history"
  48 + schemaLocation="history-2.0.xsd" />
  49 + <xs:import namespace="http://www.orcid.org/ns/preferences"
  50 + schemaLocation="preferences-2.0.xsd" />
  51 + <xs:import namespace="http://www.orcid.org/ns/work"
  52 + schemaLocation="work-2.0.xsd" />
  53 + <xs:import namespace="http://www.orcid.org/ns/funding"
  54 + schemaLocation="funding-2.0.xsd" />
  55 + <xs:import namespace="http://www.orcid.org/ns/education"
  56 + schemaLocation="education-2.0.xsd" />
  57 + <xs:import namespace="http://www.orcid.org/ns/employment"
  58 + schemaLocation="employment-2.0.xsd" />
  59 + <xs:import namespace="http://www.orcid.org/ns/peer-review"
  60 + schemaLocation="peer-review-2.0.xsd" />
  61 +
  62 + <xs:element name="record">
  63 + <xs:complexType>
  64 + <xs:annotation>
  65 + <xs:documentation>The container element for a researcher or
  66 + contributor ORCID Record.
  67 + * The type attribute can only be set by
  68 + ORCID, and indicates the type of ORCID Record the information
  69 + refers
  70 + to. In most cases the value will be "user" to indicate an
  71 + ORCID iD
  72 + holder.
  73 + * The client type attribute is set by ORCID, and is
  74 + present
  75 + when the type attribute is "group" or "client". This
  76 + attribute
  77 + indicates the API privileges held by the group as
  78 + indicated by
  79 + their
  80 + ORCID Membership Agreement.
  81 + </xs:documentation>
  82 + </xs:annotation>
  83 + <xs:sequence>
  84 + <xs:element ref="common:orcid-identifier" minOccurs="0"
  85 + maxOccurs="1" />
  86 + <xs:element ref="preferences:preferences" minOccurs="0"
  87 + maxOccurs="1" />
  88 + <xs:element ref="history:history" minOccurs="0"
  89 + maxOccurs="1" />
  90 + <xs:element ref="person:person" minOccurs="0" maxOccurs="1" />
  91 + <xs:element ref="activities:activities-summary"
  92 + minOccurs="0" maxOccurs="1" />
  93 + </xs:sequence>
  94 + <xs:attribute name="path" type="common:element-path" use="optional" />
  95 + </xs:complexType>
  96 + </xs:element>
  97 +
  98 +</xs:schema>
src/main/resources/xsd/record_2.0/search-2.0.xsd
@@ -0,0 +1,62 @@ @@ -0,0 +1,62 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
  3 + elementFormDefault="qualified"
  4 + targetNamespace="http://www.orcid.org/ns/search"
  5 + xmlns:search="http://www.orcid.org/ns/search"
  6 + xmlns:common="http://www.orcid.org/ns/common">
  7 + <xs:annotation>
  8 + <xs:documentation>
  9 + =============================================================================
  10 +
  11 + ORCID (R) Open Source
  12 + http://orcid.org
  13 +
  14 + Copyright (c) 2012-2014 ORCID,
  15 + Inc.
  16 + Licensed under an MIT-Style License (MIT)
  17 + http://orcid.org/open-source-license
  18 +
  19 + This copyright and license
  20 + information (including a link to the full
  21 + license)
  22 + shall be included in
  23 + its entirety in all copies or substantial portion of
  24 + the software.
  25 +
  26 + =============================================================================
  27 + The schema describes the message format used for ORCID API requests
  28 + and responses.
  29 + The top level element is orcid-message.
  30 + </xs:documentation>
  31 + </xs:annotation>
  32 + <xs:import namespace="http://www.orcid.org/ns/common"
  33 + schemaLocation="../common_2.0/common-2.0.xsd" />
  34 +
  35 + <xs:element name="search">
  36 + <xs:complexType>
  37 + <xs:annotation>
  38 + <xs:documentation>The container element for the results when
  39 + performing a search on the ORCID Registry. the num-found attribute
  40 + indicates the number of successful matches.
  41 + </xs:documentation>
  42 + </xs:annotation>
  43 + <xs:sequence>
  44 + <xs:element name="result" type="search:result" minOccurs="0"
  45 + maxOccurs="unbounded" />
  46 + </xs:sequence>
  47 + <xs:attribute name="num-found" type="xs:integer" default="0" />
  48 + </xs:complexType>
  49 + </xs:element>
  50 +
  51 + <xs:complexType name="result">
  52 + <xs:annotation>
  53 + <xs:documentation>A single result when performing a search on the
  54 + ORCID Registry.
  55 + </xs:documentation>
  56 + </xs:annotation>
  57 + <xs:sequence>
  58 + <xs:element ref="common:orcid-identifier" maxOccurs="1" />
  59 + </xs:sequence>
  60 + </xs:complexType>
  61 +
  62 +</xs:schema>