Commit 2459f259 authored by Matija Obreza's avatar Matija Obreza

New GLIS XML integration protocol

parent f3646962
...@@ -24,6 +24,10 @@ import java.util.Date; ...@@ -24,6 +24,10 @@ import java.util.Date;
import java.util.List; import java.util.List;
import org.genesys.glis.v1.invoker.ApiException; import org.genesys.glis.v1.invoker.ApiException;
import org.genesys.glis.v1.model.Acquisition;
import org.genesys.glis.v1.model.Actor;
import org.genesys.glis.v1.model.Collection;
import org.genesys.glis.v1.model.Collector;
import org.genesys.glis.v1.model.Location; import org.genesys.glis.v1.model.Location;
import org.genesys.glis.v1.model.Registration; import org.genesys.glis.v1.model.Registration;
import org.genesys.glis.v1.model.RegistrationResponse; import org.genesys.glis.v1.model.RegistrationResponse;
...@@ -62,7 +66,7 @@ public class RegistrationApiTest extends BaseApiTest { ...@@ -62,7 +66,7 @@ public class RegistrationApiTest extends BaseApiTest {
SimpleDateFormat df = new SimpleDateFormat("YYYY-MM-dd"); SimpleDateFormat df = new SimpleDateFormat("YYYY-MM-dd");
pgrfa.setDate(df.format(new Date())); pgrfa.setDate(df.format(new Date()));
pgrfa.setCropname(cropName); pgrfa.addCropnamesItem(cropName);
pgrfa.setSampleid(prefix + System.currentTimeMillis()); pgrfa.setSampleid(prefix + System.currentTimeMillis());
pgrfa.setMethod("obna"); pgrfa.setMethod("obna");
Location location = new Location(); Location location = new Location();
...@@ -77,12 +81,35 @@ public class RegistrationApiTest extends BaseApiTest { ...@@ -77,12 +81,35 @@ public class RegistrationApiTest extends BaseApiTest {
RegistrationResponse response1 = api.registerPGRFA(pgrfa1); RegistrationResponse response1 = api.registerPGRFA(pgrfa1);
assertThat(response1.getDoi(), not(nullValue())); assertThat(response1.getDoi(), not(nullValue()));
Registration pgrfa2 = makePGRFA("Matija", "Matija ").method("acqu"); Registration pgrfa2 = makePGRFA("Matija", "Matija ").method("nodi");
pgrfa2.addProgdoiItem(response1.getDoi()).addProgdoiItem(response1.getDoi()); pgrfa2.addProgdoiItem(response1.getDoi()).addProgdoiItem(response1.getDoi());
RegistrationResponse response2 = api.registerPGRFA(pgrfa2); RegistrationResponse response2 = api.registerPGRFA(pgrfa2);
assertThat(response2.getDoi(), not(nullValue())); assertThat(response2.getDoi(), not(nullValue()));
List<Relationship> rels = queryApi.listRelationships(response1.getDoi(), null, null); List<Relationship> rels = queryApi.listRelationships(response1.getDoi(), null, null);
assertThat(rels.size(), greaterThan(0)); assertThat(rels.size(), greaterThan(0));
} }
@Test
public void testAcquisition() throws ApiException {
Registration pgrfa = makePGRFA("Matija", "Matija ").method("acqu").acquisition(new Acquisition().provenance("SVN").provider(new Actor().name("Genesys GLIS Tool").country("DEU")))
.date("2017-07-23");
RegistrationResponse response = api.registerPGRFA(pgrfa);
assertThat(response.getDoi(), not(nullValue()));
}
@Test
public void testCollection() throws ApiException {
Registration pgrfa = makePGRFA("Matija", "Matija ").method("acqu").collection(new Collection().date("2017-07-23").elevation(100).missid("Genesys GLIS"));
RegistrationResponse response = api.registerPGRFA(pgrfa);
assertThat(response.getDoi(), not(nullValue()));
}
@Test
public void testCollectionCollector() throws ApiException {
Registration pgrfa = makePGRFA("Matija", "Matija ").method("acqu")
.collection(new Collection().date("2017-07-23").elevation(100).missid("Genesys GLIS").addCollectorsItem(new Collector().name("Matija Obreza")));
RegistrationResponse response = api.registerPGRFA(pgrfa);
assertThat(response.getDoi(), not(nullValue()));
}
} }
...@@ -48,7 +48,7 @@ public class RegistrationApiTest extends BaseApiTest { ...@@ -48,7 +48,7 @@ public class RegistrationApiTest extends BaseApiTest {
SimpleDateFormat df = new SimpleDateFormat("YYYY-MM-dd"); SimpleDateFormat df = new SimpleDateFormat("YYYY-MM-dd");
pgrfa.setDate(df.format(new Date())); pgrfa.setDate(df.format(new Date()));
// pgrfa.setDate("1990"); // pgrfa.setDate("1990");
pgrfa.setCropname("Matija"); pgrfa.addCropnamesItem("Matija");
pgrfa.setSampleid("Matija " + System.currentTimeMillis()); pgrfa.setSampleid("Matija " + System.currentTimeMillis());
pgrfa.setMethod("ihcp"); pgrfa.setMethod("ihcp");
Location location = new Location(); Location location = new Location();
...@@ -90,7 +90,7 @@ public class RegistrationApiTest extends BaseApiTest { ...@@ -90,7 +90,7 @@ public class RegistrationApiTest extends BaseApiTest {
pgrfa.setDate(df.format(new Date())); pgrfa.setDate(df.format(new Date()));
// pgrfa.setDate("1990-03-22"); // pgrfa.setDate("1990-03-22");
pgrfa.setCropname("Matija"); pgrfa.addCropnamesItem("Matija");
pgrfa.setSampleid("Matija " + System.currentTimeMillis()); pgrfa.setSampleid("Matija " + System.currentTimeMillis());
pgrfa.setMethod("ihcp"); pgrfa.setMethod("ihcp");
Location location = new Location(); Location location = new Location();
......
...@@ -529,21 +529,21 @@ paths: ...@@ -529,21 +529,21 @@ paths:
application-xml: >- application-xml: >-
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<pgrfas xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <pgrfas xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<item> <item>
<code>5</code> <code>5</code>
<language>en</language> <language>en</language>
<term>Multimedia</term> <term>Multimedia</term>
</item> </item>
<item> <item>
<code>4</code> <code>4</code>
<language>en</language> <language>en</language>
<term>Environments</term> <term>Environments</term>
</item> </item>
<item> <item>
<code>3.8</code> <code>3.8</code>
<language>en</language> <language>en</language>
<term>Phenomics</term> <term>Phenomics</term>
</item> </item>
</pgrfas> </pgrfas>
/glisapi/v1/holders: /glisapi/v1/holders:
...@@ -581,6 +581,7 @@ paths: ...@@ -581,6 +581,7 @@ paths:
"holdwiews": "PHL001" "holdwiews": "PHL001"
}] }]
securityDefinitions: securityDefinitions:
easySmta: easySmta:
type: basic type: basic
...@@ -818,7 +819,6 @@ definitions: ...@@ -818,7 +819,6 @@ definitions:
# Moreover, an info element is also added containing the following elements: # Moreover, an info element is also added containing the following elements:
info: info:
type: object
$ref: '#/definitions/UpdateInformation' $ref: '#/definitions/UpdateInformation'
# PGRFA Actor model # PGRFA Actor model
...@@ -963,8 +963,9 @@ definitions: ...@@ -963,8 +963,9 @@ definitions:
# Model for DOI holder # Model for DOI holder
DOIHolder: DOIHolder:
title: WIEWS code of DOI holder title: DOI and WIEWS code of PGRFA holder
description: -> description: >-
The PGRFA DOI and the WIEWS code of its holder.
type: object type: object
properties: properties:
doi: doi:
...@@ -1009,6 +1010,7 @@ definitions: ...@@ -1009,6 +1010,7 @@ definitions:
basePGRFA: basePGRFA:
type: object type: object
properties: properties:
# Authentication
username: username:
type: string type: string
example: 'cgn' example: 'cgn'
...@@ -1019,43 +1021,32 @@ definitions: ...@@ -1019,43 +1021,32 @@ definitions:
example: 'Passw0rd' example: 'Passw0rd'
xml: xml:
attribute: true attribute: true
# Please follow the order in 'XML request object' section of the 'GLIS XML integration protocol'
location:
$ref: '#/definitions/Location'
sampledoi: sampledoi:
type: string type: string
format: uuid ## TODO DOI regexp
# format: uuid
description: >- description: >-
A Digital Object Identifier (DOI) obtained from a service other than GLIS and that is already assigned to the PGRFA. A Digital Object Identifier (DOI) obtained from a service other than GLIS and that is already assigned to the PGRFA.
sampleid: sampleid:
type: string type: string
example: 'CGN00001' example: 'CGN00001'
location: description: >-
$ref: '#/definitions/Location' A string that identifies the PGRFA that is being registered. This value will be returned by GLIS in the response message and is assumed to be used to associate the DOI to the corresponding material in the local database. You must provide <sampleid> even if <sampledoi> is provided. In case you use the DOI as unique identifier in your local database, you can repeat it in <sampleid>. Mandatory. Please read more details in the “HTTPS reply” chapter.
date: date:
type: string type: string
pattern: '^\d{4}(\-\d{1,2}){0,2}' pattern: '^\d{4}(\-\d{1,2}){0,2}'
description: >- description: >-
Date in which PGRFA became part of the collection. Date fragments (YYYY-MM and YYYY) are also accepted. Date in which PGRFA became part of the collection. Date fragments (YYYY-MM and YYYY) are also accepted.
example: '1987-06-23' example: '1987-06-23'
genus:
type: string
example: 'Hordeum'
cropname:
type: string
example: 'Barley'
species:
type: string
example: 'vulgare'
spauth:
type: string
example: 'L.'
subtaxa:
type: string
example: 'subsp. vulgare'
stauth:
type: string
example: 'L.'
method: method:
type: string type: string
example: 'acqu' example: 'acqu'
description: >-
Method through which the PGRFA has been acquired. Mandatory.
items: items:
type: string type: string
enum: enum:
...@@ -1065,12 +1056,30 @@ definitions: ...@@ -1065,12 +1056,30 @@ definitions:
- nodi - nodi
- obna - obna
- obin - obin
biostatus: genus:
type: integer type: string
example: 300 description: >-
mlsstatus: The taxon of the genus for the PGRFA. At least one between <genus> and <cropname> must be provided.
type: integer example: 'Hordeum'
example: 1 cropnames:
type: array
description: >-
Common name of the crop. At least one between <genus> and one cropname must be provided. Multiple names are allowed.
xml:
wrapped: true
name: cropnames
example:
- 'Barley'
- 'Wheat'
items:
type: string
xml:
name: name
example: 'Barley'
targets:
type: array
items:
$ref: '#/definitions/Target'
progdoi: progdoi:
type: array type: array
description: >- description: >-
...@@ -1092,6 +1101,165 @@ definitions: ...@@ -1092,6 +1101,165 @@ definitions:
name: doi name: doi
description: >- description: >-
Progenitor DOI Progenitor DOI
biostatus:
type: integer
description: >-
Biological status of the PGRFA.
example: 300
species:
type: string
description: >-
Specific epithet of the PGRFA scientific name. If not provided, "sp." is assumed.
example: 'vulgare'
spauth:
type: string
description: >-
Authority for the specific epithet.
example: 'L.'
subtaxa:
type: string
description: >-
Any additional infra-specific taxon such as subspecies, variety, form, Group and so on.
example: 'subsp. vulgare'
stauth:
type: string
description: >-
Authority for the subtaxon at the most detailed level provided.
example: 'L.'
names:
type: array
description: >-
Other name of the PGRFA. Any number of names can be provided.
xml:
wrapped: true
example: ['a', 'b']
items:
type: string
xml:
name: name
ids:
type: array
xml:
wrapped: true
example: ['a', 'b']
items:
type: string
# TODO
xml:
name: id
mlsstatus:
type: integer
description: >-
Code that identifies the status of the PGRFA with regard to the MLS.
example: 1
historical:
type: string
maxLength: 1
description: >-
Indicates whether the PGRFA currently exists. Allowed value is y/n
example: n
acquisition:
$ref: '#/definitions/Acquisition'
collection:
$ref: '#/definitions/Collection'
breeding:
$ref: '#/definitions/Breeding'
# Model for Acquisition
Acquisition:
type: object
title: Acquisition
required:
- provider
properties:
provider:
$ref: '#/definitions/Actor'
sampleid:
type: string
provenance:
type: string
description: >-
ISO-3166 alpha-3 country code (https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3) of the country of provenance.
pattern: '^.{3}$'
example: 'DEU'
# Model for Collection
Collection:
type: object
title: Collection
properties:
collectors:
type: array
xml:
wrapped: true
name: collectors
items:
$ref: '#/definitions/Collector'
xml:
name: collector
sampleid:
type: string
missid:
type: string
site:
type: string
lat:
type: string
lon:
type: string
uncert:
type: string
datum:
type: string
georef:
type: string
elevation:
type: integer
description: >-
Elevation of collecting site in metres above sea level.
date:
type: string
description: >-
Date on which the PGRFA was collected. Date fragments (YYYY-MM and YYYY) are also accepted.
pattern: '^\d{4}(\-\d{1,2}){0,2}'
source:
type: string
description: >-
Code of the nature of the location where the PGRFA was collected.
# Model for Collector
Collector:
type: object
title: Collector
allOf:
- $ref: '#/definitions/Actor'
xml:
name: collector
# Model for Breeding
Breeding:
type: object
title: Breeding
properties:
breeders:
type: array
xml:
wrapped: true
name: breeders
items:
$ref: '#/definitions/Breeder'
ancestry:
type: string
description: >-
Pedigree or other description of the ancestry of the PGRFA and how it was bred.
# Model for Breeder
Breeder:
allOf:
- $ref: '#/definitions/Actor'
xml:
name: breeder
# Model for Registration registration # Model for Registration registration
RegistrationResponse: RegistrationResponse:
...@@ -1151,3 +1319,4 @@ definitions: ...@@ -1151,3 +1319,4 @@ definitions:
externalDocs: externalDocs:
description: GLIS API documentation description: GLIS API documentation
url: 'https://glis.planttreaty.org/assets/' url: 'https://glis.planttreaty.org/assets/'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment