AR
Aron Roberts
Tue, Jun 14, 2016 1:03 AM
Sometimes it feels like these processes are just a bit more technical
than they need to be. Perhaps it is necessary but there are a lot of
details which must be just right for success.
D'accord.
Import, in particular, is rather finicky. For sheer speed - since imports
can be quite large and performance is of the essence - the import service
is interacting in a fairly raw way with the Nuxeo enterprise content
management system that underlies CollectionSpace, in a manner that mostly
bypasses the CollectionSpace framework.
-
One thing I observed in the import payload:
<document name="persons">
<ns2:persons_common xmlns:ns2="
http://collectionspace.org/services/person"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
...
</ns2:persons_common>
</document>
(These two elements appear in the payloads that are produced and consumed
when interacting with CollectionSpace via most of its Services REST API ...)
Whereas for the Import service, the corresponding single element at this
same level of the payload might instead be <schema ...> (AIUI due to the
'bypass' mentioned above):
<schema xmlns:persons_common="http://collectionspace.org/services/person"
name="persons_common">
...
</schema>
-
As well, as mentioned in the brief convo between Chris and myself
earlier, it appears the refName element (field) is required, when importing
an authority term via the Import service.
-
If you replace the two elements above with the <schema...> element
here, and add the refName, perhaps the import will succeed?
The following payload just imported successfully for me on
qa.collectionspace.org (after substituting QA's "Local Persons" value in
the inAuthority field for the one you're using with your own server, below).
<?xml version="1.0" encoding="utf-8" ?>
<imports>
<import seq="1" service="Persons" type="Person">
<schema xmlns:persons_common="
http://collectionspace.org/services/person" name="persons_common">
<inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
<shortIdentifier>huangjunbi</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang
Junbi (黃君壁)'</refName>
<personTermGroupList>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(eng)'English'</termLanguage>
<termDisplayName>Huang Junbi</termDisplayName>
<surName>Huang</surName>
<foreName>Junbi</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
<termDisplayName>黃君壁</termDisplayName>
<surName>黃</surName>
<foreName>君壁</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
</personTermGroupList>
<birthDateGroup>
<dateLatestYear></dateLatestYear>
</birthDateGroup>
<deathDateGroup>
<dateLatestYear></dateLatestYear>
</deathDateGroup>
</schema>
</import>
</imports>
The resulting record can be viewed at:
https://qa.collectionspace.org/collectionspace/ui/core/html/person.html?csid=7606204f-67ee-4e1f-8a2e-451683c8ff03&vocab=person
Aron
On Mon, Jun 13, 2016 at 5:25 PM, James Keeline james@keeline.com wrote:
I have seen the messages since my last inquiry and I need to read them
carefully. I understand now how to "get" the unique ID for the
inAuthority value.
According to this (
http://core.collectionspace.org:8180/cspace-services/personauthorities )
there are several person authorities but the local person authority seems
to have an ID of:
<list-item>
<csid>*2937e6b9-8ec6-4e0f-b45a*</csid>
<uri>/personauthorities/2937e6b9-8ec6-4e0f-b45a</uri>
<refName>
urn:cspace:core.collectionspace.org:personauthorities:name(person)'Local
Persons'
</refName>
<updatedAt>2016-04-08T18:52:26.094Z</updatedAt>
<workflowState>project</workflowState>
<shortIdentifier>person</shortIdentifier>
<displayName>Local Persons</displayName>
</list-item>
This is what I sent to core.collectionspace.org as a test with additional
fields. It says it was created but it does not show up on a search.
<?xml version="1.0" encoding="utf-8" ?>
<imports>
<import seq="1" service="Persons" type="Person">
<document name="persons">
<ns2:persons_common xmlns:ns2="
http://collectionspace.org/services/person"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
<shortIdentifier>huangjunbi</shortIdentifier>
<personTermGroupList>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(eng)'English'</termLanguage>
<termDisplayName>Huang Junbi</termDisplayName>
<surName>Huang</surName>
<foreName>Junbi</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
<termDisplayName>黃君壁</termDisplayName>
<surName>黃</surName>
<foreName>君壁</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
</personTermGroupList>
<birthDateGroup>
<dateLatestYear></dateLatestYear>
</birthDateGroup>
<deathDateGroup>
<dateLatestYear></dateLatestYear>
</deathDateGroup>
</ns2:persons_common>
</document>
</import>
</imports>
Perhaps this is related to my inAuthority value being different/wrong. I
tried sending to the "found" csid value but it still does not show up under
search. These are the response codes for the two attempts with the old ID
and the found one:
jameskesmacbook:BPOC keeline$ curl -X POST '
http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items'
-i -u admin@core.collectionspace.org:Administrator -H "Content-Type:
application/xml " -T testperson.xml
HTTP/1.1 100 Continue
HTTP/1.1 201 Created
Server: Apache-Coyote/1.1
Location:
http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/85b329e4-0d14-48f3-9365
Set-Cookie: JSESSIONID=E2A4F02670F864DDE3A5D4517B7A36A2;
Path=/cspace-services/; HttpOnly
Content-Length: 0
Date: Tue, 14 Jun 2016 00:05:43 GMT
jameskesmacbook:BPOC keeline$ curl -X POST '
http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items'
-i -u admin@core.collectionspace.org:Administrator -H "Content-Type:
application/xml " -T testperson.xml
HTTP/1.1 100 Continue
HTTP/1.1 201 Created
Server: Apache-Coyote/1.1
Location:
http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/18394f8b-00c4-40d2-a256
Set-Cookie: JSESSIONID=A5405E5A665EE6375E295A27E4DD53B4;
Path=/cspace-services/; HttpOnly
Content-Length: 0
Date: Tue, 14 Jun 2016 00:17:26 GMT
I'm using a PHP script to generate the XML so if there is a snippet to
extract the correct value into a variable, I will include that. I can
probably parse through it with some regex but I'll bet there's a better way
if anyone knows it.
Sometimes it feels like these processes are just a bit more technical than
they need to be. Perhaps it is necessary but there are a lot of details
which must be just right for success.
James D. Keeline
From: Aron Roberts aron@socrates.berkeley.edu
To: James Keeline james@keeline.com
Cc: Talk talk@lists.collectionspace.org; Chris Hoffman <
chris_h@berkeley.edu>
Sent: Monday, June 13, 2016 5:08 PM
Subject: Re: [Talk] XML payload with multiple people
BTW, there was a typo in the sample payload in a previous note: this
should have read <import service="Persons" type="Person"> (note: first
attribute value is now plural) rather than: <import service="Person"
type="Person">.
The (corrected) example payload:
<?xml version="1.0" encoding="utf-8"?>
<imports>
<import service="Persons" type="Person">
<schema xmlns:persons_common="
http://collectionspace.org/services/person" name="persons_common">
<personTermGroupList>
<personTermGroup>
<termDisplayName>Zelda C. Dobbs</termDisplayName>
</personTermGroup>
</personTermGroupList>
<shortIdentifier>ZedaCDobbs</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(ZeldaCDobbs)'ZeldaC.
Dobbs'</refName>
<inAuthority>4b5cd4b4-9776-48e1-9258</inAuthority>
</schema>
</import>
<import service="Persons" type="Person">
<!-- Another record goes here ... -->
</import>
</imports>
The section "How to find the service and type values" in the Imports
Service Home document,
https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Howtofindtheserviceandtypevalues,
describes how to find and enter the right values for those
two attributes, in the <import service="something_here"
type="something_else_here"> elements.
Aron
On Mon, Jun 13, 2016 at 4:54 PM, Aron Roberts aron@socrates.berkeley.edu
wrote:
Good questions, Chris!
About an hour ago, I test-imported a couple of Person records lacking
a refName and shortidentifier. It looks like an 'ID' form of the refName
was auto-created for
those records; e.g.:
urn:cspace:core.collectionspace.org:
persons:id(dbbf8c78-6c4e-470b-8765-b07ba73ff9a4)
And when listing all Person records, following that import, the following
services error occurred:
ERROR ...
[org.collectionspace.services.common.vocabulary.RefNameServiceUtils:527]
Could not retrieve a list of documents referring to the specified
authority item
java.lang.IllegalArgumentException: Malformed refName for AuthorityTerm
(too few tokens)
This might yet reflect pilot error on my part, but this at least suggests
a need
to supply values for one or both of those fields in the import payload.
On Mon, Jun 13, 2016 at 4:40 PM, Chris Hoffman chris_h@berkeley.edu
wrote:
Thanks, Aron, for this better example!
Do you know if the refname and shortidentifier elements are still needed
by the import service? I don’t see them listed in the schema needed via
the Rest API
https://wiki.collectionspace.org/display/DOC/Person+Service+REST+APIs#PersonServiceRESTAPIs-Personinstanceschema
But maybe they are still needed for the import service.
Thanks
Chris
On Jun 13, 2016, at 4:34 PM, Aron Roberts aron@socrates.berkeley.edu
wrote:
Hi James,
Sounds good. Note that these examples are for authority records,
not for the records for terms within an authority, which may be what
you're planning to add here.
(Note to self and colleagues: we really need to add the latter examples
to this doc.)
One thing you'll need to be aware of, when importing authority term
records
(i.e. the items within a particular authority/vocabulary), the
'inAuthority' field
must be present in each such record and must reference an extant parent
authority. This associates the term with the relevant (parent) authority.
In the example below, when importing one or more persons terms into,
say, the "Local Persons" authority, the inAuthority field here contains the
unique ID ("CSID") of that authority in the relevant CollectionSpace
system,
4b5cd4b4-9776-48e1-9258, in this instance. (You can find that CSID via a
request to http://host:port/cspace-services/personauthorities)
<?xml version="1.0" encoding="utf-8"?>
<imports>
<import service="Person" type="Person">
<schema xmlns:persons_common="
http://collectionspace.org/services/person" name="persons_common">
<personTermGroupList>
<personTermGroup>
<termDisplayName>Zelda C. Dobbs</termDisplayName>
</personTermGroup>
</personTermGroupList>
<shortIdentifier>ZedaCDobbs</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(ZeldaCDobbs)'ZeldaC.
Dobbs'</refName>
<inAuthority>4b5cd4b4-9776-48e1-9258</inAuthority>
</schema>
</import>
<import service="Person" type="Person">
<!-- Another record goes here ... -->
</import>
</imports>
Aron
On Mon, Jun 13, 2016 at 3:54 PM, James Keeline james@keeline.com wrote:
I think I will try to emulate the one on Aron's first link to my inquiry:
<?xml version="1.0" encoding="UTF-8"?>
<imports>
<import seq="1" service="Personauthorities" type="Personauthority">
<schema xmlns:personauthorities_common="
http://collectionspace.org/services/person"
<http://collectionspace.org/services/person> name=
"personauthorities_common">
<personauthorities_common:displayName>American Poets</
personauthorities_common:displayName>
<personauthorities_common:shortIdentifier>americanpoets</
personauthorities_common:shortIdentifier>
<personauthorities_common:vocabType>PersonAuthority</
personauthorities_common:vocabType>
<personauthorities_common:refName
urn:cspace:core.collectionspace.org:Personauthorities:name(americanpoets)'American
Poets'</personauthorities_common:refName>
</schema>
</import>
<import seq="2" service="Personauthorities" type="Personauthority"
CSID="11111111-2222-3333-4444-123456789012">
<schema xmlns:personauthorities_common="
http://collectionspace.org/services/person"
http://collectionspace.org/services/person name=
"personauthorities_common">
<personauthorities_common:displayName>French Poets</
personauthorities_common:displayName>
<personauthorities_common:shortIdentifier>frenchpoets</
personauthorities_common:shortIdentifier>
<personauthorities_common:vocabType>PersonAuthority</
personauthorities_common:vocabType>
<personauthorities_common:refName
urn:cspace:core.collectionspace.org:Personauthorities:name(frenchpoets)'French
Poets'</personauthorities_common:refName>
</schema>
</import>
</imports>
I'm not adding multiple person authorities so I'll have to use some of
your suggestion as well. I will report back on its efficacy.
This is an example of the kind of person record I will be including in the
larger document:
<?xml version="1.0" encoding="utf-8"?>
<document name="persons">
<ns2:persons_common xmlns:ns2="
http://collectionspace.org/services/person" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance">
<inAuthority>*e5c217c5-26ad-4289-b778*</inAuthority>
<personTermGroupList>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(eng)'English'</termLanguage>
<termDisplayName>Chiang Kai-shek</termDisplayName>
<surName>Chiang</surName>
<foreName>Kai-shek</foreName>
</personTermGroup>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
<termDisplayName>蔣介石</termDisplayName>
<surName>蔣</surName>
<foreName>介石</foreName>
</personTermGroup>
</personTermGroupList>
</ns2:persons_common>
</document>
This worked against core.collectionspace.org. There are a couple fields
to add to this payload.
I think though that I might wish to define the short-name so that I can
use a known value for the object records.
I'm always a bit concerned about supplying the right unique IDs for
something like the inAuthority field. Any thoughts? It is also not clear
to me why the second block of data in the Person Authorities example at the
top has a unique ID (admittedly contrived) but the first one does not.
Thank you both for your prompt help to this and my other inquiries.
James D. Keeline
From: Chris Hoffman chris_h@berkeley.edu
To: Aron Roberts aron@socrates.berkeley.edu
Cc: James Keeline james@keeline.com; Talk <
talk@lists.collectionspace.org>
Sent: Monday, June 13, 2016 3:03 PM
Subject: Re: [Talk] XML payload with multiple people
Hi James,
Your typical import document is set up to support submitting multiple
records at once. If I recall correctly, the whole document is wrapped in
<imports></imports>. Within that you can have any number of
<import></import> blocks, each of which represents one person record that
you want to create. In practice, we’ve found that we can really only
submit 5K records per batch. Otherwise we’ve had timeouts and other very
nasty behaviors. Here’s an example with the top level elements for
creating 3 records.
<?xml version="1.0" encoding="UTF-8"?>
<imports>
<import service="Persons" type="Person”>
...
</import>
<import service="Persons" type="Person”>
...
</import>
<import service="Persons" type="Person”>
...
</import>
</imports>
I hope this helps,
Chris
On Jun 13, 2016, at 12:04 PM, Aron Roberts aron@socrates.berkeley.edu
wrote:
And this is also (somewhat) helpful, as you branch out from Person
authority records to other record types:
https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Howtodeterminethecorrectvaluestoputintoan%22/imports/import/schema%22element
:
On Mon, Jun 13, 2016 at 12:02 PM, Aron Roberts <aron@socrates.berkeley.edu
> Sometimes it feels like these processes are just a bit more technical
than they need to be. Perhaps it is necessary but there are a lot of
details which must be just right for success.
D'accord.
Import, in particular, is rather finicky. For sheer speed - since imports
can be quite large and performance is of the essence - the import service
is interacting in a fairly raw way with the Nuxeo enterprise content
management system that underlies CollectionSpace, in a manner that mostly
bypasses the CollectionSpace framework.
1. One thing I observed in the import payload:
<document name="persons">
<ns2:persons_common xmlns:ns2="
http://collectionspace.org/services/person"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
...
</ns2:persons_common>
</document>
(These two elements appear in the payloads that are produced and consumed
when interacting with CollectionSpace via most of its Services REST API ...)
Whereas for the Import service, the corresponding *single* element at this
same level of the payload might instead be <schema ...> (AIUI due to the
'bypass' mentioned above):
<schema xmlns:persons_common="http://collectionspace.org/services/person"
name="persons_common">
...
</schema>
2. As well, as mentioned in the brief convo between Chris and myself
earlier, it appears the refName element (field) is required, when importing
an authority term via the Import service.
3. If you replace the two elements above with the <schema...> element
here, and add the refName, perhaps the import will succeed?
The following payload just imported successfully for me on
qa.collectionspace.org (after substituting QA's "Local Persons" value in
the inAuthority field for the one you're using with your own server, below).
<?xml version="1.0" encoding="utf-8" ?>
<imports>
<import seq="1" service="Persons" type="Person">
<schema xmlns:persons_common="
http://collectionspace.org/services/person" name="persons_common">
<inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
<shortIdentifier>huangjunbi</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang
Junbi (黃君壁)'</refName>
<personTermGroupList>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(eng)'English'</termLanguage>
<termDisplayName>Huang Junbi</termDisplayName>
<surName>Huang</surName>
<foreName>Junbi</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
<termDisplayName>黃君壁</termDisplayName>
<surName>黃</surName>
<foreName>君壁</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
</personTermGroupList>
<birthDateGroup>
<dateLatestYear></dateLatestYear>
</birthDateGroup>
<deathDateGroup>
<dateLatestYear></dateLatestYear>
</deathDateGroup>
</schema>
</import>
</imports>
The resulting record can be viewed at:
https://qa.collectionspace.org/collectionspace/ui/core/html/person.html?csid=7606204f-67ee-4e1f-8a2e-451683c8ff03&vocab=person
Aron
On Mon, Jun 13, 2016 at 5:25 PM, James Keeline <james@keeline.com> wrote:
> I have seen the messages since my last inquiry and I need to read them
> carefully. I understand now how to "get" the unique ID for the
> *inAuthority* value.
>
> According to this (
> http://core.collectionspace.org:8180/cspace-services/personauthorities )
> there are several person authorities but the local person authority seems
> to have an ID of:
>
> <list-item>
> <csid>*2937e6b9-8ec6-4e0f-b45a*</csid>
> <uri>/personauthorities/2937e6b9-8ec6-4e0f-b45a</uri>
> <refName>
> urn:cspace:core.collectionspace.org:personauthorities:name(person)'Local
> Persons'
> </refName>
> <updatedAt>2016-04-08T18:52:26.094Z</updatedAt>
> <workflowState>project</workflowState>
> <shortIdentifier>person</shortIdentifier>
> <displayName>Local Persons</displayName>
> </list-item>
>
> This is what I sent to core.collectionspace.org as a test with additional
> fields. It says it was created but it does not show up on a search.
>
> <?xml version="1.0" encoding="utf-8" ?>
> <imports>
> <import seq="1" service="Persons" type="Person">
> <document name="persons">
> <ns2:persons_common xmlns:ns2="
> http://collectionspace.org/services/person"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
> <shortIdentifier>huangjunbi</shortIdentifier>
> <personTermGroupList>
> <personTermGroup>
> <termType>urn:cspace:core.collectionspace.org:
> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
> <termLanguage>urn:cspace:core.collectionspace.org:
> vocabularies:name(languages):item:name(eng)'English'</termLanguage>
> <termDisplayName>Huang Junbi</termDisplayName>
> <surName>Huang</surName>
> <foreName>Junbi</foreName>
> <termSource></termSource>
> <termSourceID></termSourceID>
> </personTermGroup>
> <personTermGroup>
> <termType>urn:cspace:core.collectionspace.org:
> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
> <termLanguage>urn:cspace:core.collectionspace.org:
> vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
> <termDisplayName>黃君壁</termDisplayName>
> <surName>黃</surName>
> <foreName>君壁</foreName>
> <termSource></termSource>
> <termSourceID></termSourceID>
> </personTermGroup>
> </personTermGroupList>
> <birthDateGroup>
> <dateLatestYear></dateLatestYear>
> </birthDateGroup>
> <deathDateGroup>
> <dateLatestYear></dateLatestYear>
> </deathDateGroup>
> </ns2:persons_common>
> </document>
> </import>
> </imports>
>
> Perhaps this is related to my inAuthority value being different/wrong. I
> tried sending to the "found" csid value but it still does not show up under
> search. These are the response codes for the two attempts with the old ID
> and the found one:
>
> jameskesmacbook:BPOC keeline$ curl -X POST '
> http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items'
> -i -u admin@core.collectionspace.org:Administrator -H "Content-Type:
> application/xml " -T testperson.xml
> HTTP/1.1 100 Continue
>
> HTTP/1.1 201 Created
> Server: Apache-Coyote/1.1
> Location:
> http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/85b329e4-0d14-48f3-9365
> Set-Cookie: JSESSIONID=E2A4F02670F864DDE3A5D4517B7A36A2;
> Path=/cspace-services/; HttpOnly
> Content-Length: 0
> Date: Tue, 14 Jun 2016 00:05:43 GMT
>
> jameskesmacbook:BPOC keeline$ curl -X POST '
> http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items'
> -i -u admin@core.collectionspace.org:Administrator -H "Content-Type:
> application/xml " -T testperson.xml
> HTTP/1.1 100 Continue
>
> HTTP/1.1 201 Created
> Server: Apache-Coyote/1.1
> Location:
> http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/18394f8b-00c4-40d2-a256
> Set-Cookie: JSESSIONID=A5405E5A665EE6375E295A27E4DD53B4;
> Path=/cspace-services/; HttpOnly
> Content-Length: 0
> Date: Tue, 14 Jun 2016 00:17:26 GMT
>
> I'm using a PHP script to generate the XML so if there is a snippet to
> extract the correct value into a variable, I will include that. I can
> probably parse through it with some regex but I'll bet there's a better way
> if anyone knows it.
>
> Sometimes it feels like these processes are just a bit more technical than
> they need to be. Perhaps it is necessary but there are a lot of details
> which must be just right for success.
>
> James D. Keeline
>
> ------------------------------
> *From:* Aron Roberts <aron@socrates.berkeley.edu>
> *To:* James Keeline <james@keeline.com>
> *Cc:* Talk <talk@lists.collectionspace.org>; Chris Hoffman <
> chris_h@berkeley.edu>
> *Sent:* Monday, June 13, 2016 5:08 PM
>
> *Subject:* Re: [Talk] XML payload with multiple people
>
> BTW, there was a typo in the sample payload in a previous note: this
> should have read <import service="Persons" type="Person"> (note: first
> attribute value is now plural) rather than: <import service="Person"
> type="Person">.
>
> The (corrected) example payload:
>
> <?xml version="1.0" encoding="utf-8"?>
> <imports>
> <import service="Persons" type="Person">
> <schema xmlns:persons_common="
> http://collectionspace.org/services/person" name="persons_common">
> <personTermGroupList>
> <personTermGroup>
> <termDisplayName>Zelda C. Dobbs</termDisplayName>
> </personTermGroup>
> </personTermGroupList>
> <shortIdentifier>ZedaCDobbs</shortIdentifier>
> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(ZeldaCDobbs)'ZeldaC.
> Dobbs'</refName>
> <inAuthority>4b5cd4b4-9776-48e1-9258</inAuthority>
> </schema>
> </import>
> <import service="Persons" type="Person">
> <!-- Another record goes here ... -->
> </import>
> </imports>
>
> The section "How to find the service and type values" in the Imports
> Service Home document,
> https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Howtofindtheserviceandtypevalues,
> describes how to find and enter the right values for those
> two attributes, in the <import service="something_here"
> type="something_else_here"> elements.
>
> Aron
>
>
> On Mon, Jun 13, 2016 at 4:54 PM, Aron Roberts <aron@socrates.berkeley.edu>
> wrote:
>
> Good questions, Chris!
>
> About an hour ago, I test-imported a couple of Person records lacking
> a refName and shortidentifier. It looks like an 'ID' form of the refName
> was auto-created for
> those records; e.g.:
> urn:cspace:core.collectionspace.org:
> persons:id(dbbf8c78-6c4e-470b-8765-b07ba73ff9a4)
>
> And when listing all Person records, following that import, the following
> services error occurred:
>
> ERROR ...
> [org.collectionspace.services.common.vocabulary.RefNameServiceUtils:527]
> Could not retrieve a list of documents referring to the specified
> authority item
> java.lang.IllegalArgumentException: Malformed refName for AuthorityTerm
> (too few tokens)
>
> This might yet reflect pilot error on my part, but this at least suggests
> a need
> to supply values for one or both of those fields in the import payload.
>
> On Mon, Jun 13, 2016 at 4:40 PM, Chris Hoffman <chris_h@berkeley.edu>
> wrote:
>
> Thanks, Aron, for this better example!
>
> Do you know if the refname and shortidentifier elements are still needed
> by the import service? I don’t see them listed in the schema needed via
> the Rest API
> <https://wiki.collectionspace.org/display/DOC/Person+Service+REST+APIs#PersonServiceRESTAPIs-Personinstanceschema>
>
> But maybe they are still needed for the import service.
>
> Thanks
> Chris
>
>
> On Jun 13, 2016, at 4:34 PM, Aron Roberts <aron@socrates.berkeley.edu>
> wrote:
>
> Hi James,
>
> Sounds good. Note that these examples are for *authority* records,
> not for the records for terms *within* an authority, which may be what
> you're planning to add here.
>
> (Note to self and colleagues: we *really* need to add the latter examples
> to this doc.)
>
> One thing you'll need to be aware of, when importing authority term
> records
> (i.e. the items within a particular authority/vocabulary), the
> 'inAuthority' field
> must be present in each such record and must reference an extant parent
> authority. This associates the term with the relevant (parent) authority.
>
> In the example below, when importing one or more persons terms into,
> say, the "Local Persons" authority, the inAuthority field here contains the
> unique ID ("CSID") of that authority in the relevant CollectionSpace
> system,
> 4b5cd4b4-9776-48e1-9258, in this instance. (You can find that CSID via a
> request to http://host:port/cspace-services/personauthorities)
>
> <?xml version="1.0" encoding="utf-8"?>
> <imports>
> <import service="Person" type="Person">
> <schema xmlns:persons_common="
> http://collectionspace.org/services/person" name="persons_common">
> <personTermGroupList>
> <personTermGroup>
> <termDisplayName>Zelda C. Dobbs</termDisplayName>
> </personTermGroup>
> </personTermGroupList>
> <shortIdentifier>ZedaCDobbs</shortIdentifier>
> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(ZeldaCDobbs)'ZeldaC.
> Dobbs'</refName>
> <inAuthority>4b5cd4b4-9776-48e1-9258</inAuthority>
> </schema>
> </import>
> <import service="Person" type="Person">
> <!-- Another record goes here ... -->
> </import>
> </imports>
>
> Aron
>
> On Mon, Jun 13, 2016 at 3:54 PM, James Keeline <james@keeline.com> wrote:
>
> I think I will try to emulate the one on Aron's first link to my inquiry:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <imports>
> <import seq="1" service="Personauthorities" type="Personauthority">
> <schema xmlns:personauthorities_common="
> http://collectionspace.org/services/person"
> <http://collectionspace.org/services/person> name=
> "personauthorities_common">
> <personauthorities_common:displayName>American Poets</
> personauthorities_common:displayName>
> <personauthorities_common:shortIdentifier>americanpoets</
> personauthorities_common:shortIdentifier>
> <personauthorities_common:vocabType>PersonAuthority</
> personauthorities_common:vocabType>
> <personauthorities_common:refName
> >urn:cspace:core.collectionspace.org:Personauthorities:name(americanpoets)'American
> Poets'</personauthorities_common:refName>
> </schema>
> </import>
> <import seq="2" service="Personauthorities" type="Personauthority"
> CSID="11111111-2222-3333-4444-123456789012">
> <schema xmlns:personauthorities_common="
> http://collectionspace.org/services/person"
> <http://collectionspace.org/services/person> name=
> "personauthorities_common">
> <personauthorities_common:displayName>French Poets</
> personauthorities_common:displayName>
> <personauthorities_common:shortIdentifier>frenchpoets</
> personauthorities_common:shortIdentifier>
> <personauthorities_common:vocabType>PersonAuthority</
> personauthorities_common:vocabType>
> <personauthorities_common:refName
> >urn:cspace:core.collectionspace.org:Personauthorities:name(frenchpoets)'French
> Poets'</personauthorities_common:refName>
> </schema>
> </import>
> </imports>
>
> I'm not adding multiple person authorities so I'll have to use some of
> your suggestion as well. I will report back on its efficacy.
>
> This is an example of the kind of person record I will be including in the
> larger document:
>
> <?xml version="1.0" encoding="utf-8"?>
> <document name="persons">
> <ns2:persons_common xmlns:ns2="
> http://collectionspace.org/services/person" xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance">
> <inAuthority>*e5c217c5-26ad-4289-b778*</inAuthority>
> <personTermGroupList>
> <personTermGroup>
> <termType>urn:cspace:core.collectionspace.org:
> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
> <termLanguage>urn:cspace:core.collectionspace.org:
> vocabularies:name(languages):item:name(eng)'English'</termLanguage>
> <termDisplayName>Chiang Kai-shek</termDisplayName>
> <surName>Chiang</surName>
> <foreName>Kai-shek</foreName>
> </personTermGroup>
> <personTermGroup>
> <termType>urn:cspace:core.collectionspace.org:
> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
> <termLanguage>urn:cspace:core.collectionspace.org:
> vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
> <termDisplayName>蔣介石</termDisplayName>
> <surName>蔣</surName>
> <foreName>介石</foreName>
> </personTermGroup>
> </personTermGroupList>
> </ns2:persons_common>
> </document>
>
>
> This worked against core.collectionspace.org. There are a couple fields
> to add to this payload.
>
> I think though that I might wish to define the short-name so that I can
> use a known value for the object records.
>
> I'm always a bit concerned about supplying the right unique IDs for
> something like the inAuthority field. Any thoughts? It is also not clear
> to me why the second block of data in the Person Authorities example at the
> top has a unique ID (admittedly contrived) but the first one does not.
> _____
>
> Thank you both for your prompt help to this and my other inquiries.
>
> James D. Keeline
>
> ------------------------------
> *From:* Chris Hoffman <chris_h@berkeley.edu>
> *To:* Aron Roberts <aron@socrates.berkeley.edu>
> *Cc:* James Keeline <james@keeline.com>; Talk <
> talk@lists.collectionspace.org>
> *Sent:* Monday, June 13, 2016 3:03 PM
> *Subject:* Re: [Talk] XML payload with multiple people
>
> Hi James,
>
> Your typical import document is set up to support submitting multiple
> records at once. If I recall correctly, the whole document is wrapped in
> <imports></imports>. Within that you can have any number of
> <import></import> blocks, each of which represents one person record that
> you want to create. In practice, we’ve found that we can really only
> submit 5K records per batch. Otherwise we’ve had timeouts and other very
> nasty behaviors. Here’s an example with the top level elements for
> creating 3 records.
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <imports>
> <import service="Persons" type="Person”>
> ...
> </import>
> <import service="Persons" type="Person”>
> ...
> </import>
> <import service="Persons" type="Person”>
> ...
> </import>
> </imports>
>
>
> I hope this helps,
> Chris
>
> On Jun 13, 2016, at 12:04 PM, Aron Roberts <aron@socrates.berkeley.edu>
> wrote:
>
> And this is also (somewhat) helpful, as you branch out from Person
> authority records to other record types:
>
>
> https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Howtodeterminethecorrectvaluestoputintoan%22/imports/import/schema%22element
> :
>
> On Mon, Jun 13, 2016 at 12:02 PM, Aron Roberts <aron@socrates.berkeley.edu
> > wrote:
>
> One possible starting place:
>
>
> https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-ExampleRequest
>
> On Mon, Jun 13, 2016 at 11:29 AM, James Keeline <james@keeline.com> wrote:
>
> I wish to import multiple people (authors, artists). I can make a single
> XML payload.
>
> It seems to me that one can send multiple at once. What is the element
> format for this?
>
> James D. Keeline
>
>
> _______________________________________________
> Talk mailing list
> Talk@lists.collectionspace.org
>
> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
>
>
>
>
> _______________________________________________
> Talk mailing list
> Talk@lists.collectionspace.org
>
> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
>
>
>
>
>
> _______________________________________________
> Talk mailing list
> Talk@lists.collectionspace.org
>
> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
>
>
>
>
>
>
>
AR
Aron Roberts
Tue, Jun 14, 2016 2:21 AM
Have also experienced a display oddity - in the record titlebar, in the
dropdown menu below autocomplete fields, and in the Terms Used sidebar
(screenshot attached) - when using the Import service to import a Person
record whose refName display name contains Chinese characters (with or
without parens, square brackets, etc.):
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang
Junbi (黃君壁)'</refName>
If you see the same thing, we can file a bug if one doesn't already exist
... and for now, perhaps avoid adding those?
On Mon, Jun 13, 2016 at 6:03 PM, Aron Roberts aron@socrates.berkeley.edu
wrote:
Sometimes it feels like these processes are just a bit more technical
than they need to be. Perhaps it is necessary but there are a lot of
details which must be just right for success.
D'accord.
Import, in particular, is rather finicky. For sheer speed - since imports
can be quite large and performance is of the essence - the import service
is interacting in a fairly raw way with the Nuxeo enterprise content
management system that underlies CollectionSpace, in a manner that mostly
bypasses the CollectionSpace framework.
-
One thing I observed in the import payload:
<document name="persons">
<ns2:persons_common xmlns:ns2="
http://collectionspace.org/services/person"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
...
</ns2:persons_common>
</document>
(These two elements appear in the payloads that are produced and consumed
when interacting with CollectionSpace via most of its Services REST API ...)
Whereas for the Import service, the corresponding single element at this
same level of the payload might instead be <schema ...> (AIUI due to the
'bypass' mentioned above):
<schema xmlns:persons_common="
http://collectionspace.org/services/person" name="persons_common">
...
</schema>
-
As well, as mentioned in the brief convo between Chris and myself
earlier, it appears the refName element (field) is required, when importing
an authority term via the Import service.
-
If you replace the two elements above with the <schema...> element
here, and add the refName, perhaps the import will succeed?
The following payload just imported successfully for me on
qa.collectionspace.org (after substituting QA's "Local Persons" value in
the inAuthority field for the one you're using with your own server, below).
<?xml version="1.0" encoding="utf-8" ?>
<imports>
<import seq="1" service="Persons" type="Person">
<schema xmlns:persons_common="
http://collectionspace.org/services/person" name="persons_common">
<inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
<shortIdentifier>huangjunbi</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang
Junbi (黃君壁)'</refName>
<personTermGroupList>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(eng)'English'</termLanguage>
<termDisplayName>Huang Junbi</termDisplayName>
<surName>Huang</surName>
<foreName>Junbi</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
<termDisplayName>黃君壁</termDisplayName>
<surName>黃</surName>
<foreName>君壁</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
</personTermGroupList>
<birthDateGroup>
<dateLatestYear></dateLatestYear>
</birthDateGroup>
<deathDateGroup>
<dateLatestYear></dateLatestYear>
</deathDateGroup>
</schema>
</import>
</imports>
The resulting record can be viewed at:
https://qa.collectionspace.org/collectionspace/ui/core/html/person.html?csid=7606204f-67ee-4e1f-8a2e-451683c8ff03&vocab=person
Aron
On Mon, Jun 13, 2016 at 5:25 PM, James Keeline james@keeline.com wrote:
I have seen the messages since my last inquiry and I need to read them
carefully. I understand now how to "get" the unique ID for the
inAuthority value.
According to this (
http://core.collectionspace.org:8180/cspace-services/personauthorities )
there are several person authorities but the local person authority seems
to have an ID of:
<list-item>
<csid>*2937e6b9-8ec6-4e0f-b45a*</csid>
<uri>/personauthorities/2937e6b9-8ec6-4e0f-b45a</uri>
<refName>
urn:cspace:core.collectionspace.org:personauthorities:name(person)'Local
Persons'
</refName>
<updatedAt>2016-04-08T18:52:26.094Z</updatedAt>
<workflowState>project</workflowState>
<shortIdentifier>person</shortIdentifier>
<displayName>Local Persons</displayName>
</list-item>
This is what I sent to core.collectionspace.org as a test with
additional fields. It says it was created but it does not show up on a
search.
<?xml version="1.0" encoding="utf-8" ?>
<imports>
<import seq="1" service="Persons" type="Person">
<document name="persons">
<ns2:persons_common xmlns:ns2="
http://collectionspace.org/services/person"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
<shortIdentifier>huangjunbi</shortIdentifier>
<personTermGroupList>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(eng)'English'</termLanguage>
<termDisplayName>Huang Junbi</termDisplayName>
<surName>Huang</surName>
<foreName>Junbi</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
<termDisplayName>黃君壁</termDisplayName>
<surName>黃</surName>
<foreName>君壁</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
</personTermGroupList>
<birthDateGroup>
<dateLatestYear></dateLatestYear>
</birthDateGroup>
<deathDateGroup>
<dateLatestYear></dateLatestYear>
</deathDateGroup>
</ns2:persons_common>
</document>
</import>
</imports>
Perhaps this is related to my inAuthority value being different/wrong. I
tried sending to the "found" csid value but it still does not show up under
search. These are the response codes for the two attempts with the old ID
and the found one:
jameskesmacbook:BPOC keeline$ curl -X POST '
http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items'
-i -u admin@core.collectionspace.org:Administrator -H "Content-Type:
application/xml " -T testperson.xml
HTTP/1.1 100 Continue
HTTP/1.1 201 Created
Server: Apache-Coyote/1.1
Location:
http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/85b329e4-0d14-48f3-9365
Set-Cookie: JSESSIONID=E2A4F02670F864DDE3A5D4517B7A36A2;
Path=/cspace-services/; HttpOnly
Content-Length: 0
Date: Tue, 14 Jun 2016 00:05:43 GMT
jameskesmacbook:BPOC keeline$ curl -X POST '
http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items'
-i -u admin@core.collectionspace.org:Administrator -H "Content-Type:
application/xml " -T testperson.xml
HTTP/1.1 100 Continue
HTTP/1.1 201 Created
Server: Apache-Coyote/1.1
Location:
http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/18394f8b-00c4-40d2-a256
Set-Cookie: JSESSIONID=A5405E5A665EE6375E295A27E4DD53B4;
Path=/cspace-services/; HttpOnly
Content-Length: 0
Date: Tue, 14 Jun 2016 00:17:26 GMT
I'm using a PHP script to generate the XML so if there is a snippet to
extract the correct value into a variable, I will include that. I can
probably parse through it with some regex but I'll bet there's a better way
if anyone knows it.
Sometimes it feels like these processes are just a bit more technical
than they need to be. Perhaps it is necessary but there are a lot of
details which must be just right for success.
James D. Keeline
From: Aron Roberts aron@socrates.berkeley.edu
To: James Keeline james@keeline.com
Cc: Talk talk@lists.collectionspace.org; Chris Hoffman <
chris_h@berkeley.edu>
Sent: Monday, June 13, 2016 5:08 PM
Subject: Re: [Talk] XML payload with multiple people
BTW, there was a typo in the sample payload in a previous note: this
should have read <import service="Persons" type="Person"> (note: first
attribute value is now plural) rather than: <import service="Person"
type="Person">.
The (corrected) example payload:
<?xml version="1.0" encoding="utf-8"?>
<imports>
<import service="Persons" type="Person">
<schema xmlns:persons_common="
http://collectionspace.org/services/person" name="persons_common">
<personTermGroupList>
<personTermGroup>
<termDisplayName>Zelda C. Dobbs</termDisplayName>
</personTermGroup>
</personTermGroupList>
<shortIdentifier>ZedaCDobbs</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(ZeldaCDobbs)'ZeldaC.
Dobbs'</refName>
<inAuthority>4b5cd4b4-9776-48e1-9258</inAuthority>
</schema>
</import>
<import service="Persons" type="Person">
<!-- Another record goes here ... -->
</import>
</imports>
The section "How to find the service and type values" in the Imports
Service Home document,
https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Howtofindtheserviceandtypevalues,
describes how to find and enter the right values for those
two attributes, in the <import service="something_here"
type="something_else_here"> elements.
Aron
On Mon, Jun 13, 2016 at 4:54 PM, Aron Roberts <aron@socrates.berkeley.edu
Good questions, Chris!
About an hour ago, I test-imported a couple of Person records lacking
a refName and shortidentifier. It looks like an 'ID' form of the refName
was auto-created for
those records; e.g.:
urn:cspace:core.collectionspace.org:
persons:id(dbbf8c78-6c4e-470b-8765-b07ba73ff9a4)
And when listing all Person records, following that import, the following
services error occurred:
ERROR ...
[org.collectionspace.services.common.vocabulary.RefNameServiceUtils:527]
Could not retrieve a list of documents referring to the specified
authority item
java.lang.IllegalArgumentException: Malformed refName for AuthorityTerm
(too few tokens)
This might yet reflect pilot error on my part, but this at least suggests
a need
to supply values for one or both of those fields in the import payload.
On Mon, Jun 13, 2016 at 4:40 PM, Chris Hoffman chris_h@berkeley.edu
wrote:
Thanks, Aron, for this better example!
Do you know if the refname and shortidentifier elements are still needed
by the import service? I don’t see them listed in the schema needed via
the Rest API
https://wiki.collectionspace.org/display/DOC/Person+Service+REST+APIs#PersonServiceRESTAPIs-Personinstanceschema
But maybe they are still needed for the import service.
Thanks
Chris
On Jun 13, 2016, at 4:34 PM, Aron Roberts aron@socrates.berkeley.edu
wrote:
Hi James,
Sounds good. Note that these examples are for authority records,
not for the records for terms within an authority, which may be what
you're planning to add here.
(Note to self and colleagues: we really need to add the latter
examples
to this doc.)
One thing you'll need to be aware of, when importing authority term
records
(i.e. the items within a particular authority/vocabulary), the
'inAuthority' field
must be present in each such record and must reference an extant parent
authority. This associates the term with the relevant (parent) authority.
In the example below, when importing one or more persons terms into,
say, the "Local Persons" authority, the inAuthority field here contains
the
unique ID ("CSID") of that authority in the relevant CollectionSpace
system,
4b5cd4b4-9776-48e1-9258, in this instance. (You can find that CSID via a
request to http://host:port/cspace-services/personauthorities)
<?xml version="1.0" encoding="utf-8"?>
<imports>
<import service="Person" type="Person">
<schema xmlns:persons_common="
http://collectionspace.org/services/person" name="persons_common">
<personTermGroupList>
<personTermGroup>
<termDisplayName>Zelda C. Dobbs</termDisplayName>
</personTermGroup>
</personTermGroupList>
<shortIdentifier>ZedaCDobbs</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(ZeldaCDobbs)'ZeldaC.
Dobbs'</refName>
<inAuthority>4b5cd4b4-9776-48e1-9258</inAuthority>
</schema>
</import>
<import service="Person" type="Person">
<!-- Another record goes here ... -->
</import>
</imports>
Aron
On Mon, Jun 13, 2016 at 3:54 PM, James Keeline james@keeline.com wrote:
I think I will try to emulate the one on Aron's first link to my inquiry:
<?xml version="1.0" encoding="UTF-8"?>
<imports>
<import seq="1" service="Personauthorities" type="Personauthority">
<schema xmlns:personauthorities_common="
http://collectionspace.org/services/person"
<http://collectionspace.org/services/person> name=
"personauthorities_common">
<personauthorities_common:displayName>American Poets</
personauthorities_common:displayName>
<personauthorities_common:shortIdentifier>americanpoets</
personauthorities_common:shortIdentifier>
<personauthorities_common:vocabType>PersonAuthority</
personauthorities_common:vocabType>
<personauthorities_common:refName
urn:cspace:core.collectionspace.org:Personauthorities:name(americanpoets)'American
Poets'</personauthorities_common:refName>
</schema>
</import>
<import seq="2" service="Personauthorities" type="Personauthority"
CSID="11111111-2222-3333-4444-123456789012">
<schema xmlns:personauthorities_common="
http://collectionspace.org/services/person"
http://collectionspace.org/services/person name=
"personauthorities_common">
<personauthorities_common:displayName>French Poets</
personauthorities_common:displayName>
<personauthorities_common:shortIdentifier>frenchpoets</
personauthorities_common:shortIdentifier>
<personauthorities_common:vocabType>PersonAuthority</
personauthorities_common:vocabType>
<personauthorities_common:refName
urn:cspace:core.collectionspace.org:Personauthorities:name(frenchpoets)'French
Poets'</personauthorities_common:refName>
</schema>
</import>
</imports>
I'm not adding multiple person authorities so I'll have to use some of
your suggestion as well. I will report back on its efficacy.
This is an example of the kind of person record I will be including in
the larger document:
<?xml version="1.0" encoding="utf-8"?>
<document name="persons">
<ns2:persons_common xmlns:ns2="
http://collectionspace.org/services/person" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance">
<inAuthority>*e5c217c5-26ad-4289-b778*</inAuthority>
<personTermGroupList>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(eng)'English'</termLanguage>
<termDisplayName>Chiang Kai-shek</termDisplayName>
<surName>Chiang</surName>
<foreName>Kai-shek</foreName>
</personTermGroup>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
<termDisplayName>蔣介石</termDisplayName>
<surName>蔣</surName>
<foreName>介石</foreName>
</personTermGroup>
</personTermGroupList>
</ns2:persons_common>
</document>
This worked against core.collectionspace.org. There are a couple fields
to add to this payload.
I think though that I might wish to define the short-name so that I can
use a known value for the object records.
I'm always a bit concerned about supplying the right unique IDs for
something like the inAuthority field. Any thoughts? It is also not clear
to me why the second block of data in the Person Authorities example at the
top has a unique ID (admittedly contrived) but the first one does not.
Thank you both for your prompt help to this and my other inquiries.
James D. Keeline
From: Chris Hoffman chris_h@berkeley.edu
To: Aron Roberts aron@socrates.berkeley.edu
Cc: James Keeline james@keeline.com; Talk <
talk@lists.collectionspace.org>
Sent: Monday, June 13, 2016 3:03 PM
Subject: Re: [Talk] XML payload with multiple people
Hi James,
Your typical import document is set up to support submitting multiple
records at once. If I recall correctly, the whole document is wrapped in
<imports></imports>. Within that you can have any number of
<import></import> blocks, each of which represents one person record that
you want to create. In practice, we’ve found that we can really only
submit 5K records per batch. Otherwise we’ve had timeouts and other very
nasty behaviors. Here’s an example with the top level elements for
creating 3 records.
<?xml version="1.0" encoding="UTF-8"?>
<imports>
<import service="Persons" type="Person”>
...
</import>
<import service="Persons" type="Person”>
...
</import>
<import service="Persons" type="Person”>
...
</import>
</imports>
I hope this helps,
Chris
On Jun 13, 2016, at 12:04 PM, Aron Roberts aron@socrates.berkeley.edu
wrote:
And this is also (somewhat) helpful, as you branch out from Person
authority records to other record types:
https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Howtodeterminethecorrectvaluestoputintoan%22/imports/import/schema%22element
:
On Mon, Jun 13, 2016 at 12:02 PM, Aron Roberts <
aron@socrates.berkeley.edu> wrote:
One possible starting place:
https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-ExampleRequest
On Mon, Jun 13, 2016 at 11:29 AM, James Keeline james@keeline.com
wrote:
I wish to import multiple people (authors, artists). I can make a single
XML payload.
It seems to me that one can send multiple at once. What is the element
format for this?
James D. Keeline
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
Have also experienced a display oddity - in the record titlebar, in the
dropdown menu below autocomplete fields, and in the Terms Used sidebar
(screenshot attached) - when using the Import service to import a Person
record whose refName display name contains Chinese characters (with or
without parens, square brackets, etc.):
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang
Junbi (黃君壁)'</refName>
If you see the same thing, we can file a bug if one doesn't already exist
... and for now, perhaps avoid adding those?
On Mon, Jun 13, 2016 at 6:03 PM, Aron Roberts <aron@socrates.berkeley.edu>
wrote:
> > Sometimes it feels like these processes are just a bit more technical
> than they need to be. Perhaps it is necessary but there are a lot of
> details which must be just right for success.
>
> D'accord.
>
> Import, in particular, is rather finicky. For sheer speed - since imports
> can be quite large and performance is of the essence - the import service
> is interacting in a fairly raw way with the Nuxeo enterprise content
> management system that underlies CollectionSpace, in a manner that mostly
> bypasses the CollectionSpace framework.
>
> 1. One thing I observed in the import payload:
>
> <document name="persons">
> <ns2:persons_common xmlns:ns2="
> http://collectionspace.org/services/person"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> ...
> </ns2:persons_common>
> </document>
>
> (These two elements appear in the payloads that are produced and consumed
> when interacting with CollectionSpace via most of its Services REST API ...)
>
> Whereas for the Import service, the corresponding *single* element at this
> same level of the payload might instead be <schema ...> (AIUI due to the
> 'bypass' mentioned above):
>
> <schema xmlns:persons_common="
> http://collectionspace.org/services/person" name="persons_common">
> ...
> </schema>
>
> 2. As well, as mentioned in the brief convo between Chris and myself
> earlier, it appears the refName element (field) is required, when importing
> an authority term via the Import service.
>
> 3. If you replace the two elements above with the <schema...> element
> here, and add the refName, perhaps the import will succeed?
>
> The following payload just imported successfully for me on
> qa.collectionspace.org (after substituting QA's "Local Persons" value in
> the inAuthority field for the one you're using with your own server, below).
>
> <?xml version="1.0" encoding="utf-8" ?>
> <imports>
> <import seq="1" service="Persons" type="Person">
> <schema xmlns:persons_common="
> http://collectionspace.org/services/person" name="persons_common">
> <inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
> <shortIdentifier>huangjunbi</shortIdentifier>
> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang
> Junbi (黃君壁)'</refName>
>
> <personTermGroupList>
> <personTermGroup>
> <termType>urn:cspace:core.collectionspace.org:
> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
> <termLanguage>urn:cspace:core.collectionspace.org:
> vocabularies:name(languages):item:name(eng)'English'</termLanguage>
> <termDisplayName>Huang Junbi</termDisplayName>
> <surName>Huang</surName>
> <foreName>Junbi</foreName>
> <termSource></termSource>
> <termSourceID></termSourceID>
> </personTermGroup>
> <personTermGroup>
> <termType>urn:cspace:core.collectionspace.org:
> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
> <termLanguage>urn:cspace:core.collectionspace.org:
> vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
> <termDisplayName>黃君壁</termDisplayName>
> <surName>黃</surName>
> <foreName>君壁</foreName>
> <termSource></termSource>
> <termSourceID></termSourceID>
> </personTermGroup>
> </personTermGroupList>
> <birthDateGroup>
> <dateLatestYear></dateLatestYear>
> </birthDateGroup>
> <deathDateGroup>
> <dateLatestYear></dateLatestYear>
> </deathDateGroup>
> </schema>
> </import>
> </imports>
>
> The resulting record can be viewed at:
>
>
> https://qa.collectionspace.org/collectionspace/ui/core/html/person.html?csid=7606204f-67ee-4e1f-8a2e-451683c8ff03&vocab=person
>
> Aron
>
> On Mon, Jun 13, 2016 at 5:25 PM, James Keeline <james@keeline.com> wrote:
>
>> I have seen the messages since my last inquiry and I need to read them
>> carefully. I understand now how to "get" the unique ID for the
>> *inAuthority* value.
>>
>> According to this (
>> http://core.collectionspace.org:8180/cspace-services/personauthorities )
>> there are several person authorities but the local person authority seems
>> to have an ID of:
>>
>> <list-item>
>> <csid>*2937e6b9-8ec6-4e0f-b45a*</csid>
>> <uri>/personauthorities/2937e6b9-8ec6-4e0f-b45a</uri>
>> <refName>
>> urn:cspace:core.collectionspace.org:personauthorities:name(person)'Local
>> Persons'
>> </refName>
>> <updatedAt>2016-04-08T18:52:26.094Z</updatedAt>
>> <workflowState>project</workflowState>
>> <shortIdentifier>person</shortIdentifier>
>> <displayName>Local Persons</displayName>
>> </list-item>
>>
>> This is what I sent to core.collectionspace.org as a test with
>> additional fields. It says it was created but it does not show up on a
>> search.
>>
>> <?xml version="1.0" encoding="utf-8" ?>
>> <imports>
>> <import seq="1" service="Persons" type="Person">
>> <document name="persons">
>> <ns2:persons_common xmlns:ns2="
>> http://collectionspace.org/services/person"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>> <inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
>> <shortIdentifier>huangjunbi</shortIdentifier>
>> <personTermGroupList>
>> <personTermGroup>
>> <termType>urn:cspace:core.collectionspace.org:
>> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>> <termLanguage>urn:cspace:core.collectionspace.org:
>> vocabularies:name(languages):item:name(eng)'English'</termLanguage>
>> <termDisplayName>Huang Junbi</termDisplayName>
>> <surName>Huang</surName>
>> <foreName>Junbi</foreName>
>> <termSource></termSource>
>> <termSourceID></termSourceID>
>> </personTermGroup>
>> <personTermGroup>
>> <termType>urn:cspace:core.collectionspace.org:
>> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>> <termLanguage>urn:cspace:core.collectionspace.org:
>> vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
>> <termDisplayName>黃君壁</termDisplayName>
>> <surName>黃</surName>
>> <foreName>君壁</foreName>
>> <termSource></termSource>
>> <termSourceID></termSourceID>
>> </personTermGroup>
>> </personTermGroupList>
>> <birthDateGroup>
>> <dateLatestYear></dateLatestYear>
>> </birthDateGroup>
>> <deathDateGroup>
>> <dateLatestYear></dateLatestYear>
>> </deathDateGroup>
>> </ns2:persons_common>
>> </document>
>> </import>
>> </imports>
>>
>> Perhaps this is related to my inAuthority value being different/wrong. I
>> tried sending to the "found" csid value but it still does not show up under
>> search. These are the response codes for the two attempts with the old ID
>> and the found one:
>>
>> jameskesmacbook:BPOC keeline$ curl -X POST '
>> http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items'
>> -i -u admin@core.collectionspace.org:Administrator -H "Content-Type:
>> application/xml " -T testperson.xml
>> HTTP/1.1 100 Continue
>>
>> HTTP/1.1 201 Created
>> Server: Apache-Coyote/1.1
>> Location:
>> http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/85b329e4-0d14-48f3-9365
>> Set-Cookie: JSESSIONID=E2A4F02670F864DDE3A5D4517B7A36A2;
>> Path=/cspace-services/; HttpOnly
>> Content-Length: 0
>> Date: Tue, 14 Jun 2016 00:05:43 GMT
>>
>> jameskesmacbook:BPOC keeline$ curl -X POST '
>> http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items'
>> -i -u admin@core.collectionspace.org:Administrator -H "Content-Type:
>> application/xml " -T testperson.xml
>> HTTP/1.1 100 Continue
>>
>> HTTP/1.1 201 Created
>> Server: Apache-Coyote/1.1
>> Location:
>> http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/18394f8b-00c4-40d2-a256
>> Set-Cookie: JSESSIONID=A5405E5A665EE6375E295A27E4DD53B4;
>> Path=/cspace-services/; HttpOnly
>> Content-Length: 0
>> Date: Tue, 14 Jun 2016 00:17:26 GMT
>>
>> I'm using a PHP script to generate the XML so if there is a snippet to
>> extract the correct value into a variable, I will include that. I can
>> probably parse through it with some regex but I'll bet there's a better way
>> if anyone knows it.
>>
>> Sometimes it feels like these processes are just a bit more technical
>> than they need to be. Perhaps it is necessary but there are a lot of
>> details which must be just right for success.
>>
>> James D. Keeline
>>
>> ------------------------------
>> *From:* Aron Roberts <aron@socrates.berkeley.edu>
>> *To:* James Keeline <james@keeline.com>
>> *Cc:* Talk <talk@lists.collectionspace.org>; Chris Hoffman <
>> chris_h@berkeley.edu>
>> *Sent:* Monday, June 13, 2016 5:08 PM
>>
>> *Subject:* Re: [Talk] XML payload with multiple people
>>
>> BTW, there was a typo in the sample payload in a previous note: this
>> should have read <import service="Persons" type="Person"> (note: first
>> attribute value is now plural) rather than: <import service="Person"
>> type="Person">.
>>
>> The (corrected) example payload:
>>
>> <?xml version="1.0" encoding="utf-8"?>
>> <imports>
>> <import service="Persons" type="Person">
>> <schema xmlns:persons_common="
>> http://collectionspace.org/services/person" name="persons_common">
>> <personTermGroupList>
>> <personTermGroup>
>> <termDisplayName>Zelda C. Dobbs</termDisplayName>
>> </personTermGroup>
>> </personTermGroupList>
>> <shortIdentifier>ZedaCDobbs</shortIdentifier>
>> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(ZeldaCDobbs)'ZeldaC.
>> Dobbs'</refName>
>> <inAuthority>4b5cd4b4-9776-48e1-9258</inAuthority>
>> </schema>
>> </import>
>> <import service="Persons" type="Person">
>> <!-- Another record goes here ... -->
>> </import>
>> </imports>
>>
>> The section "How to find the service and type values" in the Imports
>> Service Home document,
>> https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Howtofindtheserviceandtypevalues,
>> describes how to find and enter the right values for those
>> two attributes, in the <import service="something_here"
>> type="something_else_here"> elements.
>>
>> Aron
>>
>>
>> On Mon, Jun 13, 2016 at 4:54 PM, Aron Roberts <aron@socrates.berkeley.edu
>> > wrote:
>>
>> Good questions, Chris!
>>
>> About an hour ago, I test-imported a couple of Person records lacking
>> a refName and shortidentifier. It looks like an 'ID' form of the refName
>> was auto-created for
>> those records; e.g.:
>> urn:cspace:core.collectionspace.org:
>> persons:id(dbbf8c78-6c4e-470b-8765-b07ba73ff9a4)
>>
>> And when listing all Person records, following that import, the following
>> services error occurred:
>>
>> ERROR ...
>> [org.collectionspace.services.common.vocabulary.RefNameServiceUtils:527]
>> Could not retrieve a list of documents referring to the specified
>> authority item
>> java.lang.IllegalArgumentException: Malformed refName for AuthorityTerm
>> (too few tokens)
>>
>> This might yet reflect pilot error on my part, but this at least suggests
>> a need
>> to supply values for one or both of those fields in the import payload.
>>
>> On Mon, Jun 13, 2016 at 4:40 PM, Chris Hoffman <chris_h@berkeley.edu>
>> wrote:
>>
>> Thanks, Aron, for this better example!
>>
>> Do you know if the refname and shortidentifier elements are still needed
>> by the import service? I don’t see them listed in the schema needed via
>> the Rest API
>> <https://wiki.collectionspace.org/display/DOC/Person+Service+REST+APIs#PersonServiceRESTAPIs-Personinstanceschema>
>>
>> But maybe they are still needed for the import service.
>>
>> Thanks
>> Chris
>>
>>
>> On Jun 13, 2016, at 4:34 PM, Aron Roberts <aron@socrates.berkeley.edu>
>> wrote:
>>
>> Hi James,
>>
>> Sounds good. Note that these examples are for *authority* records,
>> not for the records for terms *within* an authority, which may be what
>> you're planning to add here.
>>
>> (Note to self and colleagues: we *really* need to add the latter
>> examples
>> to this doc.)
>>
>> One thing you'll need to be aware of, when importing authority term
>> records
>> (i.e. the items within a particular authority/vocabulary), the
>> 'inAuthority' field
>> must be present in each such record and must reference an extant parent
>> authority. This associates the term with the relevant (parent) authority.
>>
>> In the example below, when importing one or more persons terms into,
>> say, the "Local Persons" authority, the inAuthority field here contains
>> the
>> unique ID ("CSID") of that authority in the relevant CollectionSpace
>> system,
>> 4b5cd4b4-9776-48e1-9258, in this instance. (You can find that CSID via a
>> request to http://host:port/cspace-services/personauthorities)
>>
>> <?xml version="1.0" encoding="utf-8"?>
>> <imports>
>> <import service="Person" type="Person">
>> <schema xmlns:persons_common="
>> http://collectionspace.org/services/person" name="persons_common">
>> <personTermGroupList>
>> <personTermGroup>
>> <termDisplayName>Zelda C. Dobbs</termDisplayName>
>> </personTermGroup>
>> </personTermGroupList>
>> <shortIdentifier>ZedaCDobbs</shortIdentifier>
>> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(ZeldaCDobbs)'ZeldaC.
>> Dobbs'</refName>
>> <inAuthority>4b5cd4b4-9776-48e1-9258</inAuthority>
>> </schema>
>> </import>
>> <import service="Person" type="Person">
>> <!-- Another record goes here ... -->
>> </import>
>> </imports>
>>
>> Aron
>>
>> On Mon, Jun 13, 2016 at 3:54 PM, James Keeline <james@keeline.com> wrote:
>>
>> I think I will try to emulate the one on Aron's first link to my inquiry:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <imports>
>> <import seq="1" service="Personauthorities" type="Personauthority">
>> <schema xmlns:personauthorities_common="
>> http://collectionspace.org/services/person"
>> <http://collectionspace.org/services/person> name=
>> "personauthorities_common">
>> <personauthorities_common:displayName>American Poets</
>> personauthorities_common:displayName>
>> <personauthorities_common:shortIdentifier>americanpoets</
>> personauthorities_common:shortIdentifier>
>> <personauthorities_common:vocabType>PersonAuthority</
>> personauthorities_common:vocabType>
>> <personauthorities_common:refName
>> >urn:cspace:core.collectionspace.org:Personauthorities:name(americanpoets)'American
>> Poets'</personauthorities_common:refName>
>> </schema>
>> </import>
>> <import seq="2" service="Personauthorities" type="Personauthority"
>> CSID="11111111-2222-3333-4444-123456789012">
>> <schema xmlns:personauthorities_common="
>> http://collectionspace.org/services/person"
>> <http://collectionspace.org/services/person> name=
>> "personauthorities_common">
>> <personauthorities_common:displayName>French Poets</
>> personauthorities_common:displayName>
>> <personauthorities_common:shortIdentifier>frenchpoets</
>> personauthorities_common:shortIdentifier>
>> <personauthorities_common:vocabType>PersonAuthority</
>> personauthorities_common:vocabType>
>> <personauthorities_common:refName
>> >urn:cspace:core.collectionspace.org:Personauthorities:name(frenchpoets)'French
>> Poets'</personauthorities_common:refName>
>> </schema>
>> </import>
>> </imports>
>>
>> I'm not adding multiple person authorities so I'll have to use some of
>> your suggestion as well. I will report back on its efficacy.
>>
>> This is an example of the kind of person record I will be including in
>> the larger document:
>>
>> <?xml version="1.0" encoding="utf-8"?>
>> <document name="persons">
>> <ns2:persons_common xmlns:ns2="
>> http://collectionspace.org/services/person" xmlns:xsi="
>> http://www.w3.org/2001/XMLSchema-instance">
>> <inAuthority>*e5c217c5-26ad-4289-b778*</inAuthority>
>> <personTermGroupList>
>> <personTermGroup>
>> <termType>urn:cspace:core.collectionspace.org:
>> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>> <termLanguage>urn:cspace:core.collectionspace.org:
>> vocabularies:name(languages):item:name(eng)'English'</termLanguage>
>> <termDisplayName>Chiang Kai-shek</termDisplayName>
>> <surName>Chiang</surName>
>> <foreName>Kai-shek</foreName>
>> </personTermGroup>
>> <personTermGroup>
>> <termType>urn:cspace:core.collectionspace.org:
>> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>> <termLanguage>urn:cspace:core.collectionspace.org:
>> vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
>> <termDisplayName>蔣介石</termDisplayName>
>> <surName>蔣</surName>
>> <foreName>介石</foreName>
>> </personTermGroup>
>> </personTermGroupList>
>> </ns2:persons_common>
>> </document>
>>
>>
>> This worked against core.collectionspace.org. There are a couple fields
>> to add to this payload.
>>
>> I think though that I might wish to define the short-name so that I can
>> use a known value for the object records.
>>
>> I'm always a bit concerned about supplying the right unique IDs for
>> something like the inAuthority field. Any thoughts? It is also not clear
>> to me why the second block of data in the Person Authorities example at the
>> top has a unique ID (admittedly contrived) but the first one does not.
>> _____
>>
>> Thank you both for your prompt help to this and my other inquiries.
>>
>> James D. Keeline
>>
>> ------------------------------
>> *From:* Chris Hoffman <chris_h@berkeley.edu>
>> *To:* Aron Roberts <aron@socrates.berkeley.edu>
>> *Cc:* James Keeline <james@keeline.com>; Talk <
>> talk@lists.collectionspace.org>
>> *Sent:* Monday, June 13, 2016 3:03 PM
>> *Subject:* Re: [Talk] XML payload with multiple people
>>
>> Hi James,
>>
>> Your typical import document is set up to support submitting multiple
>> records at once. If I recall correctly, the whole document is wrapped in
>> <imports></imports>. Within that you can have any number of
>> <import></import> blocks, each of which represents one person record that
>> you want to create. In practice, we’ve found that we can really only
>> submit 5K records per batch. Otherwise we’ve had timeouts and other very
>> nasty behaviors. Here’s an example with the top level elements for
>> creating 3 records.
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>>
>> <imports>
>> <import service="Persons" type="Person”>
>> ...
>> </import>
>> <import service="Persons" type="Person”>
>> ...
>> </import>
>> <import service="Persons" type="Person”>
>> ...
>> </import>
>> </imports>
>>
>>
>> I hope this helps,
>> Chris
>>
>> On Jun 13, 2016, at 12:04 PM, Aron Roberts <aron@socrates.berkeley.edu>
>> wrote:
>>
>> And this is also (somewhat) helpful, as you branch out from Person
>> authority records to other record types:
>>
>>
>> https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Howtodeterminethecorrectvaluestoputintoan%22/imports/import/schema%22element
>> :
>>
>> On Mon, Jun 13, 2016 at 12:02 PM, Aron Roberts <
>> aron@socrates.berkeley.edu> wrote:
>>
>> One possible starting place:
>>
>>
>> https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-ExampleRequest
>>
>> On Mon, Jun 13, 2016 at 11:29 AM, James Keeline <james@keeline.com>
>> wrote:
>>
>> I wish to import multiple people (authors, artists). I can make a single
>> XML payload.
>>
>> It seems to me that one can send multiple at once. What is the element
>> format for this?
>>
>> James D. Keeline
>>
>>
>> _______________________________________________
>> Talk mailing list
>> Talk@lists.collectionspace.org
>>
>> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
>>
>>
>>
>>
>> _______________________________________________
>> Talk mailing list
>> Talk@lists.collectionspace.org
>>
>> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
>>
>>
>>
>>
>>
>> _______________________________________________
>> Talk mailing list
>> Talk@lists.collectionspace.org
>>
>> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
>>
>>
>>
>>
>>
>>
>>
>
JK
James Keeline
Tue, Jun 14, 2016 5:38 AM
I am still not having success. That is, I get a response code that suggests that a record is created but it is not showing up in search.
I was mainly testing against core.collectionspace.org and using the reported Local Persons person authority ID. I found it with this method:
http://core.collectionspace.org/cspace-services/personauthorities
and the relevant result seems to be:
<list-item> <csid>2937e6b9-8ec6-4e0f-b45a</csid> <uri>/personauthorities/2937e6b9-8ec6-4e0f-b45a</uri> <refName> urn:cspace:core.collectionspace.org:personauthorities:name(person)'Local Persons' </refName> <updatedAt>2016-04-08T18:52:26.094Z</updatedAt> <workflowState>project</workflowState> <shortIdentifier>person</shortIdentifier> <displayName>Local Persons</displayName></list-item>
The XML I am trying to send is:
<?xml version="1.0" encoding="utf-8" ?><imports> <import seq="1" service="Persons" type="Person"> <document name="persons"> <schema xmlns:persons_common="http://collectionspace.org/services/person" name="persons_common"> <inAuthority>2937e6b9-8ec6-4e0f-b45a</inAuthority> <shortIdentifier>huangjunbi</shortIdentifier> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang Junbi 黃君壁'</refName> <personTermGroupList> <personTermGroup> <termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType> <termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'</termLanguage> <termDisplayName>Huang Junbi</termDisplayName> <surName>Huang</surName> <foreName>Junbi</foreName> <termSource></termSource> <termSourceID></termSourceID> </personTermGroup> <personTermGroup> <termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType> <termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage> <termDisplayName>黃君壁</termDisplayName> <surName>黃</surName> <foreName>君壁</foreName> <termSource></termSource> <termSourceID></termSourceID> </personTermGroup> </personTermGroupList> <birthDateGroup> <dateLatestYear></dateLatestYear> </birthDateGroup> <deathDateGroup> <dateLatestYear></dateLatestYear> </deathDateGroup> </schema> </document> </import></imports>
Note that I have modified to <schema> as suggested. When I send the XML payload to the server with this method (is it correct?) I get a response code that indicates that a record was sent. However, it is not showing up in search as I though tit would.
$ curl -X POST 'http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items' -i -u admin@core.collectionspace.org:Administrator -H "Content-Type: application/xml " -T testperson.xml
HTTP/1.1 100 Continue
HTTP/1.1 201 CreatedServer: Apache-Coyote/1.1Location: http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/bee20f53-4ffb-4751-a727Set-Cookie: JSESSIONID=4E542E1C6CAF477ABDC72AD64EA06962; Path=/cspace-services/; HttpOnlyContent-Length: 0Date: Tue, 14 Jun 2016 05:28:41 GMT
I suppose that if I can get one working, I can send larger numbers of values at once, perhaps even the 800 people at once. However, there is some little thing that is not working.
I have also tried this on my local installation, with the corresponding inAuthority number retrieved from that system. Again it claims to create it but nothing can be found in search.
The XML returned from this URL provided in the response code has essentially empty elements, none of the data I provided.
http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/bee20f53-4ffb-4751-a727
Perhaps someone reading has a suggestion of a mistake in my XML or methods.
James D. Keeline
From: Aron Roberts <aron@socrates.berkeley.edu>
To: James Keeline james@keeline.com
Cc: Talk talk@lists.collectionspace.org; Chris Hoffman chris_h@berkeley.edu
Sent: Monday, June 13, 2016 7:21 PM
Subject: Re: [Talk] XML payload with multiple people
Have also experienced a display oddity - in the record titlebar, in the dropdown menu below autocomplete fields, and in the Terms Used sidebar (screenshot attached) - when using the Import service to import a Person record whose refName display name contains Chinese characters (with or without parens, square brackets, etc.):
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang Junbi (黃君壁)'</refName>
If you see the same thing, we can file a bug if one doesn't already exist ... and for now, perhaps avoid adding those?
On Mon, Jun 13, 2016 at 6:03 PM, Aron Roberts aron@socrates.berkeley.edu wrote:
Sometimes it feels like these processes are just a bit more technical than they need to be. Perhaps it is necessary but there are a lot of details which must be just right for success.
D'accord.
Import, in particular, is rather finicky. For sheer speed - since imports can be quite large and performance is of the essence - the import service is interacting in a fairly raw way with the Nuxeo enterprise content management system that underlies CollectionSpace, in a manner that mostly bypasses the CollectionSpace framework.
- One thing I observed in the import payload:
<document name="persons">
<ns2:persons_common xmlns:ns2="http://collectionspace.org/services/person"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
...
</ns2:persons_common>
</document>
(These two elements appear in the payloads that are produced and consumed when interacting with CollectionSpace via most of its Services REST API ...)
Whereas for the Import service, the corresponding single element at this same level of the payload might instead be <schema ...> (AIUI due to the 'bypass' mentioned above):
<schema xmlns:persons_common="http://collectionspace.org/services/person" name="persons_common">
...
</schema>
2. As well, as mentioned in the brief convo between Chris and myself earlier, it appears the refName element (field) is required, when importing an authority term via the Import service.
3. If you replace the two elements above with the <schema...> element here, and add the refName, perhaps the import will succeed?
The following payload just imported successfully for me on qa.collectionspace.org (after substituting QA's "Local Persons" value in the inAuthority field for the one you're using with your own server, below).
<?xml version="1.0" encoding="utf-8" ?>
<imports>
<import seq="1" service="Persons" type="Person">
<schema xmlns:persons_common="http://collectionspace.org/services/person" name="persons_common">
<inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
<shortIdentifier>huangjunbi</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang Junbi (黃君壁)'</refName>
<personTermGroupList>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'</termLanguage>
<termDisplayName>Huang Junbi</termDisplayName>
<surName>Huang</surName>
<foreName>Junbi</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
<termDisplayName>黃君壁</termDisplayName>
<surName>黃</surName>
<foreName>君壁</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
</personTermGroupList>
<birthDateGroup>
<dateLatestYear></dateLatestYear>
</birthDateGroup>
<deathDateGroup>
<dateLatestYear></dateLatestYear>
</deathDateGroup>
</schema>
</import>
</imports>
The resulting record can be viewed at:
https://qa.collectionspace.org/collectionspace/ui/core/html/person.html?csid=7606204f-67ee-4e1f-8a2e-451683c8ff03&vocab=person
Aron
On Mon, Jun 13, 2016 at 5:25 PM, James Keeline james@keeline.com wrote:
I have seen the messages since my last inquiry and I need to read them carefully. I understand now how to "get" the unique ID for the inAuthority value.
According to this ( http://core.collectionspace.org:8180/cspace-services/personauthorities ) there are several person authorities but the local person authority seems to have an ID of:
<list-item><csid>2937e6b9-8ec6-4e0f-b45a</csid><uri>/personauthorities/2937e6b9-8ec6-4e0f-b45a</uri><refName>urn:cspace:core.collectionspace.org:personauthorities:name(person)'Local Persons'</refName><updatedAt>2016-04-08T18:52:26.094Z</updatedAt><workflowState>project</workflowState><shortIdentifier>person</shortIdentifier><displayName>Local Persons</displayName></list-item>
This is what I sent to core.collectionspace.org as a test with additional fields. It says it was created but it does not show up on a search.
<?xml version="1.0" encoding="utf-8" ?><imports> <import seq="1" service="Persons" type="Person"> <document name="persons"> <ns2:persons_common xmlns:ns2="http://collectionspace.org/services/person" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <inAuthority>e5c217c5-26ad-4289-b778</inAuthority> <shortIdentifier>huangjunbi</shortIdentifier> <personTermGroupList> <personTermGroup> <termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType> <termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'</termLanguage> <termDisplayName>Huang Junbi</termDisplayName> <surName>Huang</surName> <foreName>Junbi</foreName> <termSource></termSource> <termSourceID></termSourceID> </personTermGroup> <personTermGroup> <termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType> <termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage> <termDisplayName>黃君壁</termDisplayName> <surName>黃</surName> <foreName>君壁</foreName> <termSource></termSource> <termSourceID></termSourceID> </personTermGroup> </personTermGroupList> <birthDateGroup> <dateLatestYear></dateLatestYear> </birthDateGroup> <deathDateGroup> <dateLatestYear></dateLatestYear> </deathDateGroup> </ns2:persons_common> </document> </import></imports>
Perhaps this is related to my inAuthority value being different/wrong. I tried sending to the "found" csid value but it still does not show up under search. These are the response codes for the two attempts with the old ID and the found one:
jameskesmacbook:BPOC keeline$ curl -X POST 'http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items' -i -u admin@core.collectionspace.org:Administrator -H "Content-Type: application/xml " -T testperson.xmlHTTP/1.1 100 Continue
HTTP/1.1 201 CreatedServer: Apache-Coyote/1.1Location: http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/85b329e4-0d14-48f3-9365Set-Cookie: JSESSIONID=E2A4F02670F864DDE3A5D4517B7A36A2; Path=/cspace-services/; HttpOnlyContent-Length: 0Date: Tue, 14 Jun 2016 00:05:43 GMT
jameskesmacbook:BPOC keeline$ curl -X POST 'http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items' -i -u admin@core.collectionspace.org:Administrator -H "Content-Type: application/xml " -T testperson.xmlHTTP/1.1 100 Continue
HTTP/1.1 201 CreatedServer: Apache-Coyote/1.1Location: http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/18394f8b-00c4-40d2-a256Set-Cookie: JSESSIONID=A5405E5A665EE6375E295A27E4DD53B4; Path=/cspace-services/; HttpOnlyContent-Length: 0Date: Tue, 14 Jun 2016 00:17:26 GMT
I'm using a PHP script to generate the XML so if there is a snippet to extract the correct value into a variable, I will include that. I can probably parse through it with some regex but I'll bet there's a better way if anyone knows it.
Sometimes it feels like these processes are just a bit more technical than they need to be. Perhaps it is necessary but there are a lot of details which must be just right for success. James D. Keeline
From: Aron Roberts <aron@socrates.berkeley.edu>
To: James Keeline james@keeline.com
Cc: Talk talk@lists.collectionspace.org; Chris Hoffman chris_h@berkeley.edu
Sent: Monday, June 13, 2016 5:08 PM
Subject: Re: [Talk] XML payload with multiple people
BTW, there was a typo in the sample payload in a previous note: this should have read <import service="Persons" type="Person"> (note: first attribute value is now plural) rather than: <import service="Person" type="Person">.
The (corrected) example payload:
<?xml version="1.0" encoding="utf-8"?>
<imports>
<import service="Persons" type="Person">
<schema xmlns:persons_common="http://collectionspace.org/services/person" name="persons_common">
<personTermGroupList>
<personTermGroup>
<termDisplayName>Zelda C. Dobbs</termDisplayName>
</personTermGroup>
</personTermGroupList>
<shortIdentifier>ZedaCDobbs</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(ZeldaCDobbs)'ZeldaC. Dobbs'</refName>
<inAuthority>4b5cd4b4-9776-48e1-9258</inAuthority>
</schema>
</import>
<import service="Persons" type="Person">
<!-- Another record goes here ... -->
</import>
</imports>
The section "How to find the service and type values" in the Imports Service Home document, https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Howtofindtheserviceandtypevalues, describes how to find and enter the right values for those
two attributes, in the <import service="something_here" type="something_else_here"> elements.
Aron
On Mon, Jun 13, 2016 at 4:54 PM, Aron Roberts aron@socrates.berkeley.edu wrote:
Good questions, Chris!
About an hour ago, I test-imported a couple of Person records lacking
a refName and shortidentifier. It looks like an 'ID' form of the refName was auto-created for
those records; e.g.:
urn:cspace:core.collectionspace.org:persons:id(dbbf8c78-6c4e-470b-8765-b07ba73ff9a4)
And when listing all Person records, following that import, the following services error occurred:
ERROR ... [org.collectionspace.services.common.vocabulary.RefNameServiceUtils:527]
Could not retrieve a list of documents referring to the specified authority item
java.lang.IllegalArgumentException: Malformed refName for AuthorityTerm (too few tokens)
This might yet reflect pilot error on my part, but this at least suggests a need
to supply values for one or both of those fields in the import payload.
On Mon, Jun 13, 2016 at 4:40 PM, Chris Hoffman chris_h@berkeley.edu wrote:
Thanks, Aron, for this better example!
Do you know if the refname and shortidentifier elements are still needed by the import service? I don’t see them listed in the schema needed via the Rest API
But maybe they are still needed for the import service.
ThanksChris
On Jun 13, 2016, at 4:34 PM, Aron Roberts aron@socrates.berkeley.edu wrote:
Hi James,
Sounds good. Note that these examples are for authority records,
not for the records for terms within an authority, which may be what
you're planning to add here.
(Note to self and colleagues: we really need to add the latter examples
to this doc.)
One thing you'll need to be aware of, when importing authority term records
(i.e. the items within a particular authority/vocabulary), the 'inAuthority' field
must be present in each such record and must reference an extant parent
authority. This associates the term with the relevant (parent) authority.
In the example below, when importing one or more persons terms into,
say, the "Local Persons" authority, the inAuthority field here contains the
unique ID ("CSID") of that authority in the relevant CollectionSpace system,
4b5cd4b4-9776-48e1-9258, in this instance. (You can find that CSID via a
request to http://host:port/cspace-services/personauthorities)
<?xml version="1.0" encoding="utf-8"?>
<imports>
<import service="Person" type="Person">
<schema xmlns:persons_common="http://collectionspace.org/services/person" name="persons_common">
<personTermGroupList>
<personTermGroup>
<termDisplayName>Zelda C. Dobbs</termDisplayName>
</personTermGroup>
</personTermGroupList>
<shortIdentifier>ZedaCDobbs</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(ZeldaCDobbs)'ZeldaC. Dobbs'</refName>
<inAuthority>4b5cd4b4-9776-48e1-9258</inAuthority>
</schema>
</import>
<import service="Person" type="Person">
<!-- Another record goes here ... -->
</import>
</imports>
Aron
On Mon, Jun 13, 2016 at 3:54 PM, James Keeline james@keeline.com wrote:
I think I will try to emulate the one on Aron's first link to my inquiry:
<?xml version="1.0" encoding="UTF-8"?><imports> <import seq="1" service="Personauthorities" type="Personauthority"> <schema xmlns:personauthorities_common="http://collectionspace.org/services/person" name="personauthorities_common"> <personauthorities_common:displayName>American Poets</personauthorities_common:displayName> <personauthorities_common:shortIdentifier>americanpoets</personauthorities_common:shortIdentifier> <personauthorities_common:vocabType>PersonAuthority</personauthorities_common:vocabType> <personauthorities_common:refName>urn:cspace:core.collectionspace.org:Personauthorities:name(americanpoets)'American Poets'</personauthorities_common:refName> </schema> </import> <import seq="2" service="Personauthorities" type="Personauthority" CSID="11111111-2222-3333-4444-123456789012"> <schema xmlns:personauthorities_common="http://collectionspace.org/services/person" name="personauthorities_common"> <personauthorities_common:displayName>French Poets</personauthorities_common:displayName> <personauthorities_common:shortIdentifier>frenchpoets</personauthorities_common:shortIdentifier> <personauthorities_common:vocabType>PersonAuthority</personauthorities_common:vocabType> <personauthorities_common:refName>urn:cspace:core.collectionspace.org:Personauthorities:name(frenchpoets)'French Poets'</personauthorities_common:refName> </schema> </import></imports> I'm not adding multiple person authorities so I'll have to use some of your suggestion as well. I will report back on its efficacy.
This is an example of the kind of person record I will be including in the larger document:
<?xml version="1.0" encoding="utf-8"?><document name="persons"> <ns2:persons_common xmlns:ns2="http://collectionspace.org/services/person" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <inAuthority>e5c217c5-26ad-4289-b778</inAuthority> <personTermGroupList> <personTermGroup> <termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType> <termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'</termLanguage> <termDisplayName>Chiang Kai-shek</termDisplayName> <surName>Chiang</surName> <foreName>Kai-shek</foreName> </personTermGroup> <personTermGroup> <termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType> <termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage> <termDisplayName>蔣介石</termDisplayName> <surName>蔣</surName> <foreName>介石</foreName> </personTermGroup> </personTermGroupList> </ns2:persons_common></document>
This worked against core.collectionspace.org. There are a couple fields to add to this payload.
I think though that I might wish to define the short-name so that I can use a known value for the object records.
I'm always a bit concerned about supplying the right unique IDs for something like the inAuthority field. Any thoughts? It is also not clear to me why the second block of data in the Person Authorities example at the top has a unique ID (admittedly contrived) but the first one does not._____
Thank you both for your prompt help to this and my other inquiries.
James D. Keeline
From: Chris Hoffman <chris_h@berkeley.edu>
To: Aron Roberts aron@socrates.berkeley.edu
Cc: James Keeline james@keeline.com; Talk talk@lists.collectionspace.org
Sent: Monday, June 13, 2016 3:03 PM
Subject: Re: [Talk] XML payload with multiple people
Hi James,
Your typical import document is set up to support submitting multiple records at once. If I recall correctly, the whole document is wrapped in <imports></imports>. Within that you can have any number of <import></import> blocks, each of which represents one person record that you want to create. In practice, we’ve found that we can really only submit 5K records per batch. Otherwise we’ve had timeouts and other very nasty behaviors. Here’s an example with the top level elements for creating 3 records.
<?xml version="1.0" encoding="UTF-8"?>
<imports> <import service="Persons" type="Person”> ... </import> <import service="Persons" type="Person”> ... </import> <import service="Persons" type="Person”> ... </import></imports>
I hope this helps,Chris
On Jun 13, 2016, at 12:04 PM, Aron Roberts aron@socrates.berkeley.edu wrote:
And this is also (somewhat) helpful, as you branch out from Person authority records to other record types:
https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Howtodeterminethecorrectvaluestoputintoan%22/imports/import/schema%22element:
On Mon, Jun 13, 2016 at 12:02 PM, Aron Roberts aron@socrates.berkeley.edu wrote:
One possible starting place:
https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-ExampleRequest
On Mon, Jun 13, 2016 at 11:29 AM, James Keeline james@keeline.com wrote:
I wish to import multiple people (authors, artists). I can make a single XML payload.
It seems to me that one can send multiple at once. What is the element format for this? James D. Keeline
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
I am still not having success. That is, I get a response code that suggests that a record is created but it is not showing up in search.
I was mainly testing against core.collectionspace.org and using the reported Local Persons person authority ID. I found it with this method:
http://core.collectionspace.org/cspace-services/personauthorities
and the relevant result seems to be:
<list-item> <csid>2937e6b9-8ec6-4e0f-b45a</csid> <uri>/personauthorities/2937e6b9-8ec6-4e0f-b45a</uri> <refName> urn:cspace:core.collectionspace.org:personauthorities:name(person)'Local Persons' </refName> <updatedAt>2016-04-08T18:52:26.094Z</updatedAt> <workflowState>project</workflowState> <shortIdentifier>person</shortIdentifier> <displayName>Local Persons</displayName></list-item>
The XML I am trying to send is:
<?xml version="1.0" encoding="utf-8" ?><imports> <import seq="1" service="Persons" type="Person"> <document name="persons"> <schema xmlns:persons_common="http://collectionspace.org/services/person" name="persons_common"> <inAuthority>2937e6b9-8ec6-4e0f-b45a</inAuthority> <shortIdentifier>huangjunbi</shortIdentifier> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang Junbi 黃君壁'</refName> <personTermGroupList> <personTermGroup> <termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType> <termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'</termLanguage> <termDisplayName>Huang Junbi</termDisplayName> <surName>Huang</surName> <foreName>Junbi</foreName> <termSource></termSource> <termSourceID></termSourceID> </personTermGroup> <personTermGroup> <termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType> <termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage> <termDisplayName>黃君壁</termDisplayName> <surName>黃</surName> <foreName>君壁</foreName> <termSource></termSource> <termSourceID></termSourceID> </personTermGroup> </personTermGroupList> <birthDateGroup> <dateLatestYear></dateLatestYear> </birthDateGroup> <deathDateGroup> <dateLatestYear></dateLatestYear> </deathDateGroup> </schema> </document> </import></imports>
Note that I have modified to <schema> as suggested. When I send the XML payload to the server with this method (is it correct?) I get a response code that indicates that a record was sent. However, it is not showing up in search as I though tit would.
$ curl -X POST 'http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items' -i -u admin@core.collectionspace.org:Administrator -H "Content-Type: application/xml " -T testperson.xml
HTTP/1.1 100 Continue
HTTP/1.1 201 CreatedServer: Apache-Coyote/1.1Location: http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/bee20f53-4ffb-4751-a727Set-Cookie: JSESSIONID=4E542E1C6CAF477ABDC72AD64EA06962; Path=/cspace-services/; HttpOnlyContent-Length: 0Date: Tue, 14 Jun 2016 05:28:41 GMT
I suppose that if I can get one working, I can send larger numbers of values at once, perhaps even the 800 people at once. However, there is some little thing that is not working.
I have also tried this on my local installation, with the corresponding inAuthority number retrieved from that system. Again it claims to create it but nothing can be found in search.
The XML returned from this URL provided in the response code has essentially empty elements, none of the data I provided.
http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/bee20f53-4ffb-4751-a727
Perhaps someone reading has a suggestion of a mistake in my XML or methods.
James D. Keeline
From: Aron Roberts <aron@socrates.berkeley.edu>
To: James Keeline <james@keeline.com>
Cc: Talk <talk@lists.collectionspace.org>; Chris Hoffman <chris_h@berkeley.edu>
Sent: Monday, June 13, 2016 7:21 PM
Subject: Re: [Talk] XML payload with multiple people
Have also experienced a display oddity - in the record titlebar, in the dropdown menu below autocomplete fields, and in the Terms Used sidebar (screenshot attached) - when using the Import service to import a Person record whose refName display name contains Chinese characters (with or without parens, square brackets, etc.):
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang Junbi (黃君壁)'</refName>
If you see the same thing, we can file a bug if one doesn't already exist ... and for now, perhaps avoid adding those?
On Mon, Jun 13, 2016 at 6:03 PM, Aron Roberts <aron@socrates.berkeley.edu> wrote:
> Sometimes it feels like these processes are just a bit more technical than they need to be. Perhaps it is necessary but there are a lot of details which must be just right for success.
D'accord.
Import, in particular, is rather finicky. For sheer speed - since imports can be quite large and performance is of the essence - the import service is interacting in a fairly raw way with the Nuxeo enterprise content management system that underlies CollectionSpace, in a manner that mostly bypasses the CollectionSpace framework.
1. One thing I observed in the import payload:
<document name="persons">
<ns2:persons_common xmlns:ns2="http://collectionspace.org/services/person"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
...
</ns2:persons_common>
</document>
(These two elements appear in the payloads that are produced and consumed when interacting with CollectionSpace via most of its Services REST API ...)
Whereas for the Import service, the corresponding *single* element at this same level of the payload might instead be <schema ...> (AIUI due to the 'bypass' mentioned above):
<schema xmlns:persons_common="http://collectionspace.org/services/person" name="persons_common">
...
</schema>
2. As well, as mentioned in the brief convo between Chris and myself earlier, it appears the refName element (field) is required, when importing an authority term via the Import service.
3. If you replace the two elements above with the <schema...> element here, and add the refName, perhaps the import will succeed?
The following payload just imported successfully for me on qa.collectionspace.org (after substituting QA's "Local Persons" value in the inAuthority field for the one you're using with your own server, below).
<?xml version="1.0" encoding="utf-8" ?>
<imports>
<import seq="1" service="Persons" type="Person">
<schema xmlns:persons_common="http://collectionspace.org/services/person" name="persons_common">
<inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
<shortIdentifier>huangjunbi</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang Junbi (黃君壁)'</refName>
<personTermGroupList>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'</termLanguage>
<termDisplayName>Huang Junbi</termDisplayName>
<surName>Huang</surName>
<foreName>Junbi</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
<termDisplayName>黃君壁</termDisplayName>
<surName>黃</surName>
<foreName>君壁</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
</personTermGroupList>
<birthDateGroup>
<dateLatestYear></dateLatestYear>
</birthDateGroup>
<deathDateGroup>
<dateLatestYear></dateLatestYear>
</deathDateGroup>
</schema>
</import>
</imports>
The resulting record can be viewed at:
https://qa.collectionspace.org/collectionspace/ui/core/html/person.html?csid=7606204f-67ee-4e1f-8a2e-451683c8ff03&vocab=person
Aron
On Mon, Jun 13, 2016 at 5:25 PM, James Keeline <james@keeline.com> wrote:
I have seen the messages since my last inquiry and I need to read them carefully. I understand now how to "get" the unique ID for the inAuthority value.
According to this ( http://core.collectionspace.org:8180/cspace-services/personauthorities ) there are several person authorities but the local person authority seems to have an ID of:
<list-item><csid>2937e6b9-8ec6-4e0f-b45a</csid><uri>/personauthorities/2937e6b9-8ec6-4e0f-b45a</uri><refName>urn:cspace:core.collectionspace.org:personauthorities:name(person)'Local Persons'</refName><updatedAt>2016-04-08T18:52:26.094Z</updatedAt><workflowState>project</workflowState><shortIdentifier>person</shortIdentifier><displayName>Local Persons</displayName></list-item>
This is what I sent to core.collectionspace.org as a test with additional fields. It says it was created but it does not show up on a search.
<?xml version="1.0" encoding="utf-8" ?><imports> <import seq="1" service="Persons" type="Person"> <document name="persons"> <ns2:persons_common xmlns:ns2="http://collectionspace.org/services/person" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <inAuthority>e5c217c5-26ad-4289-b778</inAuthority> <shortIdentifier>huangjunbi</shortIdentifier> <personTermGroupList> <personTermGroup> <termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType> <termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'</termLanguage> <termDisplayName>Huang Junbi</termDisplayName> <surName>Huang</surName> <foreName>Junbi</foreName> <termSource></termSource> <termSourceID></termSourceID> </personTermGroup> <personTermGroup> <termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType> <termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage> <termDisplayName>黃君壁</termDisplayName> <surName>黃</surName> <foreName>君壁</foreName> <termSource></termSource> <termSourceID></termSourceID> </personTermGroup> </personTermGroupList> <birthDateGroup> <dateLatestYear></dateLatestYear> </birthDateGroup> <deathDateGroup> <dateLatestYear></dateLatestYear> </deathDateGroup> </ns2:persons_common> </document> </import></imports>
Perhaps this is related to my inAuthority value being different/wrong. I tried sending to the "found" csid value but it still does not show up under search. These are the response codes for the two attempts with the old ID and the found one:
jameskesmacbook:BPOC keeline$ curl -X POST 'http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items' -i -u admin@core.collectionspace.org:Administrator -H "Content-Type: application/xml " -T testperson.xmlHTTP/1.1 100 Continue
HTTP/1.1 201 CreatedServer: Apache-Coyote/1.1Location: http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/85b329e4-0d14-48f3-9365Set-Cookie: JSESSIONID=E2A4F02670F864DDE3A5D4517B7A36A2; Path=/cspace-services/; HttpOnlyContent-Length: 0Date: Tue, 14 Jun 2016 00:05:43 GMT
jameskesmacbook:BPOC keeline$ curl -X POST 'http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items' -i -u admin@core.collectionspace.org:Administrator -H "Content-Type: application/xml " -T testperson.xmlHTTP/1.1 100 Continue
HTTP/1.1 201 CreatedServer: Apache-Coyote/1.1Location: http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/18394f8b-00c4-40d2-a256Set-Cookie: JSESSIONID=A5405E5A665EE6375E295A27E4DD53B4; Path=/cspace-services/; HttpOnlyContent-Length: 0Date: Tue, 14 Jun 2016 00:17:26 GMT
I'm using a PHP script to generate the XML so if there is a snippet to extract the correct value into a variable, I will include that. I can probably parse through it with some regex but I'll bet there's a better way if anyone knows it.
Sometimes it feels like these processes are just a bit more technical than they need to be. Perhaps it is necessary but there are a lot of details which must be just right for success. James D. Keeline
From: Aron Roberts <aron@socrates.berkeley.edu>
To: James Keeline <james@keeline.com>
Cc: Talk <talk@lists.collectionspace.org>; Chris Hoffman <chris_h@berkeley.edu>
Sent: Monday, June 13, 2016 5:08 PM
Subject: Re: [Talk] XML payload with multiple people
BTW, there was a typo in the sample payload in a previous note: this should have read <import service="Persons" type="Person"> (note: first attribute value is now plural) rather than: <import service="Person" type="Person">.
The (corrected) example payload:
<?xml version="1.0" encoding="utf-8"?>
<imports>
<import service="Persons" type="Person">
<schema xmlns:persons_common="http://collectionspace.org/services/person" name="persons_common">
<personTermGroupList>
<personTermGroup>
<termDisplayName>Zelda C. Dobbs</termDisplayName>
</personTermGroup>
</personTermGroupList>
<shortIdentifier>ZedaCDobbs</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(ZeldaCDobbs)'ZeldaC. Dobbs'</refName>
<inAuthority>4b5cd4b4-9776-48e1-9258</inAuthority>
</schema>
</import>
<import service="Persons" type="Person">
<!-- Another record goes here ... -->
</import>
</imports>
The section "How to find the service and type values" in the Imports Service Home document, https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Howtofindtheserviceandtypevalues, describes how to find and enter the right values for those
two attributes, in the <import service="something_here" type="something_else_here"> elements.
Aron
On Mon, Jun 13, 2016 at 4:54 PM, Aron Roberts <aron@socrates.berkeley.edu> wrote:
Good questions, Chris!
About an hour ago, I test-imported a couple of Person records lacking
a refName and shortidentifier. It looks like an 'ID' form of the refName was auto-created for
those records; e.g.:
urn:cspace:core.collectionspace.org:persons:id(dbbf8c78-6c4e-470b-8765-b07ba73ff9a4)
And when listing all Person records, following that import, the following services error occurred:
ERROR ... [org.collectionspace.services.common.vocabulary.RefNameServiceUtils:527]
Could not retrieve a list of documents referring to the specified authority item
java.lang.IllegalArgumentException: Malformed refName for AuthorityTerm (too few tokens)
This might yet reflect pilot error on my part, but this at least suggests a need
to supply values for one or both of those fields in the import payload.
On Mon, Jun 13, 2016 at 4:40 PM, Chris Hoffman <chris_h@berkeley.edu> wrote:
Thanks, Aron, for this better example!
Do you know if the refname and shortidentifier elements are still needed by the import service? I don’t see them listed in the schema needed via the Rest API
But maybe they are still needed for the import service.
ThanksChris
On Jun 13, 2016, at 4:34 PM, Aron Roberts <aron@socrates.berkeley.edu> wrote:
Hi James,
Sounds good. Note that these examples are for *authority* records,
not for the records for terms *within* an authority, which may be what
you're planning to add here.
(Note to self and colleagues: we *really* need to add the latter examples
to this doc.)
One thing you'll need to be aware of, when importing authority term records
(i.e. the items within a particular authority/vocabulary), the 'inAuthority' field
must be present in each such record and must reference an extant parent
authority. This associates the term with the relevant (parent) authority.
In the example below, when importing one or more persons terms into,
say, the "Local Persons" authority, the inAuthority field here contains the
unique ID ("CSID") of that authority in the relevant CollectionSpace system,
4b5cd4b4-9776-48e1-9258, in this instance. (You can find that CSID via a
request to http://host:port/cspace-services/personauthorities)
<?xml version="1.0" encoding="utf-8"?>
<imports>
<import service="Person" type="Person">
<schema xmlns:persons_common="http://collectionspace.org/services/person" name="persons_common">
<personTermGroupList>
<personTermGroup>
<termDisplayName>Zelda C. Dobbs</termDisplayName>
</personTermGroup>
</personTermGroupList>
<shortIdentifier>ZedaCDobbs</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(ZeldaCDobbs)'ZeldaC. Dobbs'</refName>
<inAuthority>4b5cd4b4-9776-48e1-9258</inAuthority>
</schema>
</import>
<import service="Person" type="Person">
<!-- Another record goes here ... -->
</import>
</imports>
Aron
On Mon, Jun 13, 2016 at 3:54 PM, James Keeline <james@keeline.com> wrote:
I think I will try to emulate the one on Aron's first link to my inquiry:
<?xml version="1.0" encoding="UTF-8"?><imports> <import seq="1" service="Personauthorities" type="Personauthority"> <schema xmlns:personauthorities_common="http://collectionspace.org/services/person" name="personauthorities_common"> <personauthorities_common:displayName>American Poets</personauthorities_common:displayName> <personauthorities_common:shortIdentifier>americanpoets</personauthorities_common:shortIdentifier> <personauthorities_common:vocabType>PersonAuthority</personauthorities_common:vocabType> <personauthorities_common:refName>urn:cspace:core.collectionspace.org:Personauthorities:name(americanpoets)'American Poets'</personauthorities_common:refName> </schema> </import> <import seq="2" service="Personauthorities" type="Personauthority" CSID="11111111-2222-3333-4444-123456789012"> <schema xmlns:personauthorities_common="http://collectionspace.org/services/person" name="personauthorities_common"> <personauthorities_common:displayName>French Poets</personauthorities_common:displayName> <personauthorities_common:shortIdentifier>frenchpoets</personauthorities_common:shortIdentifier> <personauthorities_common:vocabType>PersonAuthority</personauthorities_common:vocabType> <personauthorities_common:refName>urn:cspace:core.collectionspace.org:Personauthorities:name(frenchpoets)'French Poets'</personauthorities_common:refName> </schema> </import></imports> I'm not adding multiple person authorities so I'll have to use some of your suggestion as well. I will report back on its efficacy.
This is an example of the kind of person record I will be including in the larger document:
<?xml version="1.0" encoding="utf-8"?><document name="persons"> <ns2:persons_common xmlns:ns2="http://collectionspace.org/services/person" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <inAuthority>e5c217c5-26ad-4289-b778</inAuthority> <personTermGroupList> <personTermGroup> <termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType> <termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'</termLanguage> <termDisplayName>Chiang Kai-shek</termDisplayName> <surName>Chiang</surName> <foreName>Kai-shek</foreName> </personTermGroup> <personTermGroup> <termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType> <termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage> <termDisplayName>蔣介石</termDisplayName> <surName>蔣</surName> <foreName>介石</foreName> </personTermGroup> </personTermGroupList> </ns2:persons_common></document>
This worked against core.collectionspace.org. There are a couple fields to add to this payload.
I think though that I might wish to define the short-name so that I can use a known value for the object records.
I'm always a bit concerned about supplying the right unique IDs for something like the inAuthority field. Any thoughts? It is also not clear to me why the second block of data in the Person Authorities example at the top has a unique ID (admittedly contrived) but the first one does not._____
Thank you both for your prompt help to this and my other inquiries.
James D. Keeline
From: Chris Hoffman <chris_h@berkeley.edu>
To: Aron Roberts <aron@socrates.berkeley.edu>
Cc: James Keeline <james@keeline.com>; Talk <talk@lists.collectionspace.org>
Sent: Monday, June 13, 2016 3:03 PM
Subject: Re: [Talk] XML payload with multiple people
Hi James,
Your typical import document is set up to support submitting multiple records at once. If I recall correctly, the whole document is wrapped in <imports></imports>. Within that you can have any number of <import></import> blocks, each of which represents one person record that you want to create. In practice, we’ve found that we can really only submit 5K records per batch. Otherwise we’ve had timeouts and other very nasty behaviors. Here’s an example with the top level elements for creating 3 records.
<?xml version="1.0" encoding="UTF-8"?>
<imports> <import service="Persons" type="Person”> ... </import> <import service="Persons" type="Person”> ... </import> <import service="Persons" type="Person”> ... </import></imports>
I hope this helps,Chris
On Jun 13, 2016, at 12:04 PM, Aron Roberts <aron@socrates.berkeley.edu> wrote:
And this is also (somewhat) helpful, as you branch out from Person authority records to other record types:
https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Howtodeterminethecorrectvaluestoputintoan%22/imports/import/schema%22element:
On Mon, Jun 13, 2016 at 12:02 PM, Aron Roberts <aron@socrates.berkeley.edu> wrote:
One possible starting place:
https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-ExampleRequest
On Mon, Jun 13, 2016 at 11:29 AM, James Keeline <james@keeline.com> wrote:
I wish to import multiple people (authors, artists). I can make a single XML payload.
It seems to me that one can send multiple at once. What is the element format for this? James D. Keeline
_______________________________________________
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
_______________________________________________
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
_______________________________________________
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
SS
Susan STONE
Tue, Jun 14, 2016 6:32 AM
James,
I think you are missing the collectionspace_core part of the import record
(in addition to the persons_common part) , e.g. (these are not your values
but pasted in from something I have):
<schema name="collectionspace_core" xmlns:collectionspace_core="
http://collectionspace.org/collectionspace_core/">
<collectionspace_core:uri>/personauthorities/82d438d8-da87-4479-9b68/items/b6ac65f6-7f9d-4dc4-9a18-641e4de1cf65</collectionspace_core:uri>
<collectionspace_core:refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(p224)'A.
Smith'</collectionspace_core:refName>
</schema>
Susan
On Mon, Jun 13, 2016 at 10:38 PM, James Keeline james@keeline.com wrote:
I am still not having success. That is, I get a response code that
suggests that a record is created but it is not showing up in search.
I was mainly testing against core.collectionspace.org and using the
reported Local Persons person authority ID. I found it with this method:
http://core.collectionspace.org/cspace-services/personauthorities
and the relevant result seems to be:
<list-item>
<csid>*2937e6b9-8ec6-4e0f-b45a*</csid>
<uri>/personauthorities/2937e6b9-8ec6-4e0f-b45a</uri>
<refName>
urn:cspace:core.collectionspace.org:personauthorities:name(person)'Local
Persons'
</refName>
<updatedAt>2016-04-08T18:52:26.094Z</updatedAt>
<workflowState>project</workflowState>
<shortIdentifier>person</shortIdentifier>
<displayName>Local Persons</displayName>
</list-item>
The XML I am trying to send is:
<?xml version="1.0" encoding="utf-8" ?>
<imports>
<import seq="1" service="Persons" type="Person">
<document name="persons">
<schema xmlns:persons_common="
http://collectionspace.org/services/person" name="persons_common">
<inAuthority>*2937e6b9-8ec6-4e0f-b45a*</inAuthority>
<shortIdentifier>huangjunbi</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang
Junbi 黃君壁'</refName>
<personTermGroupList>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(eng)'English'</termLanguage>
<termDisplayName>Huang Junbi</termDisplayName>
<surName>Huang</surName>
<foreName>Junbi</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
<termDisplayName>黃君壁</termDisplayName>
<surName>黃</surName>
<foreName>君壁</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
</personTermGroupList>
<birthDateGroup>
<dateLatestYear></dateLatestYear>
</birthDateGroup>
<deathDateGroup>
<dateLatestYear></dateLatestYear>
</deathDateGroup>
</schema>
</document>
</import>
</imports>
Note that I have modified to <schema> as suggested. When I send the XML
payload to the server with this method (is it correct?) I get a response
code that indicates that a record was sent. However, it is not showing up
in search as I though tit would.
$ curl -X POST '
http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items'
-i -u admin@core.collectionspace.org:Administrator -H "Content-Type:
application/xml " -T testperson.xml
HTTP/1.1 100 Continue
HTTP/1.1 201 Created
Server: Apache-Coyote/1.1
Location:
http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/bee20f53-4ffb-4751-a727
Set-Cookie: JSESSIONID=4E542E1C6CAF477ABDC72AD64EA06962;
Path=/cspace-services/; HttpOnly
Content-Length: 0
Date: Tue, 14 Jun 2016 05:28:41 GMT
I suppose that if I can get one working, I can send larger numbers of
values at once, perhaps even the 800 people at once. However, there is
some little thing that is not working.
I have also tried this on my local installation, with the corresponding
inAuthority number retrieved from that system. Again it claims to create
it but nothing can be found in search.
The XML returned from this URL provided in the response code has
essentially empty elements, none of the data I provided.
http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/bee20f53-4ffb-4751-a727
Perhaps someone reading has a suggestion of a mistake in my XML or methods.
James D. Keeline
From: Aron Roberts aron@socrates.berkeley.edu
To: James Keeline james@keeline.com
Cc: Talk talk@lists.collectionspace.org; Chris Hoffman <
chris_h@berkeley.edu>
Sent: Monday, June 13, 2016 7:21 PM
Subject: Re: [Talk] XML payload with multiple people
Have also experienced a display oddity - in the record titlebar, in the
dropdown menu below autocomplete fields, and in the Terms Used sidebar
(screenshot attached) - when using the Import service to import a Person
record whose refName display name contains Chinese characters (with or
without parens, square brackets, etc.):
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang
Junbi (黃君壁)'</refName>
If you see the same thing, we can file a bug if one doesn't already exist
... and for now, perhaps avoid adding those?
On Mon, Jun 13, 2016 at 6:03 PM, Aron Roberts aron@socrates.berkeley.edu
wrote:
Sometimes it feels like these processes are just a bit more technical
than they need to be. Perhaps it is necessary but there are a lot of
details which must be just right for success.
D'accord.
Import, in particular, is rather finicky. For sheer speed - since imports
can be quite large and performance is of the essence - the import service
is interacting in a fairly raw way with the Nuxeo enterprise content
management system that underlies CollectionSpace, in a manner that mostly
bypasses the CollectionSpace framework.
-
One thing I observed in the import payload:
<document name="persons">
<ns2:persons_common xmlns:ns2="
http://collectionspace.org/services/person"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
...
</ns2:persons_common>
</document>
(These two elements appear in the payloads that are produced and consumed
when interacting with CollectionSpace via most of its Services REST API ...)
Whereas for the Import service, the corresponding single element at this
same level of the payload might instead be <schema ...> (AIUI due to the
'bypass' mentioned above):
<schema xmlns:persons_common="
http://collectionspace.org/services/person" name="persons_common">
...
</schema>
-
As well, as mentioned in the brief convo between Chris and myself
earlier, it appears the refName element (field) is required, when importing
an authority term via the Import service.
-
If you replace the two elements above with the <schema...> element
here, and add the refName, perhaps the import will succeed?
The following payload just imported successfully for me on
qa.collectionspace.org (after substituting QA's "Local Persons" value in
the inAuthority field for the one you're using with your own server, below).
<?xml version="1.0" encoding="utf-8" ?>
<imports>
<import seq="1" service="Persons" type="Person">
<schema xmlns:persons_common="
http://collectionspace.org/services/person" name="persons_common">
<inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
<shortIdentifier>huangjunbi</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang
Junbi (黃君壁)'</refName>
<personTermGroupList>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(eng)'English'</termLanguage>
<termDisplayName>Huang Junbi</termDisplayName>
<surName>Huang</surName>
<foreName>Junbi</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
<termDisplayName>黃君壁</termDisplayName>
<surName>黃</surName>
<foreName>君壁</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
</personTermGroupList>
<birthDateGroup>
<dateLatestYear></dateLatestYear>
</birthDateGroup>
<deathDateGroup>
<dateLatestYear></dateLatestYear>
</deathDateGroup>
</schema>
</import>
</imports>
The resulting record can be viewed at:
https://qa.collectionspace.org/collectionspace/ui/core/html/person.html?csid=7606204f-67ee-4e1f-8a2e-451683c8ff03&vocab=person
Aron
On Mon, Jun 13, 2016 at 5:25 PM, James Keeline james@keeline.com wrote:
I have seen the messages since my last inquiry and I need to read them
carefully. I understand now how to "get" the unique ID for the
inAuthority value.
According to this (
http://core.collectionspace.org:8180/cspace-services/personauthorities )
there are several person authorities but the local person authority seems
to have an ID of:
<list-item>
<csid>*2937e6b9-8ec6-4e0f-b45a*</csid>
<uri>/personauthorities/2937e6b9-8ec6-4e0f-b45a</uri>
<refName>
urn:cspace:core.collectionspace.org:personauthorities:name(person)'Local
Persons'
</refName>
<updatedAt>2016-04-08T18:52:26.094Z</updatedAt>
<workflowState>project</workflowState>
<shortIdentifier>person</shortIdentifier>
<displayName>Local Persons</displayName>
</list-item>
This is what I sent to core.collectionspace.org as a test with additional
fields. It says it was created but it does not show up on a search.
<?xml version="1.0" encoding="utf-8" ?>
<imports>
<import seq="1" service="Persons" type="Person">
<document name="persons">
<ns2:persons_common xmlns:ns2="
http://collectionspace.org/services/person"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
<shortIdentifier>huangjunbi</shortIdentifier>
<personTermGroupList>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(eng)'English'</termLanguage>
<termDisplayName>Huang Junbi</termDisplayName>
<surName>Huang</surName>
<foreName>Junbi</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
<termDisplayName>黃君壁</termDisplayName>
<surName>黃</surName>
<foreName>君壁</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
</personTermGroupList>
<birthDateGroup>
<dateLatestYear></dateLatestYear>
</birthDateGroup>
<deathDateGroup>
<dateLatestYear></dateLatestYear>
</deathDateGroup>
</ns2:persons_common>
</document>
</import>
</imports>
Perhaps this is related to my inAuthority value being different/wrong. I
tried sending to the "found" csid value but it still does not show up under
search. These are the response codes for the two attempts with the old ID
and the found one:
jameskesmacbook:BPOC keeline$ curl -X POST '
http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items'
-i -u admin@core.collectionspace.org:Administrator -H "Content-Type:
application/xml " -T testperson.xml
HTTP/1.1 100 Continue
HTTP/1.1 201 Created
Server: Apache-Coyote/1.1
Location:
http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/85b329e4-0d14-48f3-9365
Set-Cookie: JSESSIONID=E2A4F02670F864DDE3A5D4517B7A36A2;
Path=/cspace-services/; HttpOnly
Content-Length: 0
Date: Tue, 14 Jun 2016 00:05:43 GMT
jameskesmacbook:BPOC keeline$ curl -X POST '
http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items'
-i -u admin@core.collectionspace.org:Administrator -H "Content-Type:
application/xml " -T testperson.xml
HTTP/1.1 100 Continue
HTTP/1.1 201 Created
Server: Apache-Coyote/1.1
Location:
http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/18394f8b-00c4-40d2-a256
Set-Cookie: JSESSIONID=A5405E5A665EE6375E295A27E4DD53B4;
Path=/cspace-services/; HttpOnly
Content-Length: 0
Date: Tue, 14 Jun 2016 00:17:26 GMT
I'm using a PHP script to generate the XML so if there is a snippet to
extract the correct value into a variable, I will include that. I can
probably parse through it with some regex but I'll bet there's a better way
if anyone knows it.
Sometimes it feels like these processes are just a bit more technical than
they need to be. Perhaps it is necessary but there are a lot of details
which must be just right for success.
James D. Keeline
From: Aron Roberts aron@socrates.berkeley.edu
To: James Keeline james@keeline.com
Cc: Talk talk@lists.collectionspace.org; Chris Hoffman <
chris_h@berkeley.edu>
Sent: Monday, June 13, 2016 5:08 PM
Subject: Re: [Talk] XML payload with multiple people
BTW, there was a typo in the sample payload in a previous note: this
should have read <import service="Persons" type="Person"> (note: first
attribute value is now plural) rather than: <import service="Person"
type="Person">.
The (corrected) example payload:
<?xml version="1.0" encoding="utf-8"?>
<imports>
<import service="Persons" type="Person">
<schema xmlns:persons_common="
http://collectionspace.org/services/person" name="persons_common">
<personTermGroupList>
<personTermGroup>
<termDisplayName>Zelda C. Dobbs</termDisplayName>
</personTermGroup>
</personTermGroupList>
<shortIdentifier>ZedaCDobbs</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(ZeldaCDobbs)'ZeldaC.
Dobbs'</refName>
<inAuthority>4b5cd4b4-9776-48e1-9258</inAuthority>
</schema>
</import>
<import service="Persons" type="Person">
<!-- Another record goes here ... -->
</import>
</imports>
The section "How to find the service and type values" in the Imports
Service Home document,
https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Howtofindtheserviceandtypevalues,
describes how to find and enter the right values for those
two attributes, in the <import service="something_here"
type="something_else_here"> elements.
Aron
On Mon, Jun 13, 2016 at 4:54 PM, Aron Roberts aron@socrates.berkeley.edu
wrote:
Good questions, Chris!
About an hour ago, I test-imported a couple of Person records lacking
a refName and shortidentifier. It looks like an 'ID' form of the refName
was auto-created for
those records; e.g.:
urn:cspace:core.collectionspace.org:
persons:id(dbbf8c78-6c4e-470b-8765-b07ba73ff9a4)
And when listing all Person records, following that import, the following
services error occurred:
ERROR ...
[org.collectionspace.services.common.vocabulary.RefNameServiceUtils:527]
Could not retrieve a list of documents referring to the specified
authority item
java.lang.IllegalArgumentException: Malformed refName for AuthorityTerm
(too few tokens)
This might yet reflect pilot error on my part, but this at least suggests
a need
to supply values for one or both of those fields in the import payload.
On Mon, Jun 13, 2016 at 4:40 PM, Chris Hoffman chris_h@berkeley.edu
wrote:
Thanks, Aron, for this better example!
Do you know if the refname and shortidentifier elements are still needed
by the import service? I don’t see them listed in the schema needed via
the Rest API
https://wiki.collectionspace.org/display/DOC/Person+Service+REST+APIs#PersonServiceRESTAPIs-Personinstanceschema
But maybe they are still needed for the import service.
Thanks
Chris
On Jun 13, 2016, at 4:34 PM, Aron Roberts aron@socrates.berkeley.edu
wrote:
Hi James,
Sounds good. Note that these examples are for authority records,
not for the records for terms within an authority, which may be what
you're planning to add here.
(Note to self and colleagues: we really need to add the latter examples
to this doc.)
One thing you'll need to be aware of, when importing authority term
records
(i.e. the items within a particular authority/vocabulary), the
'inAuthority' field
must be present in each such record and must reference an extant parent
authority. This associates the term with the relevant (parent) authority.
In the example below, when importing one or more persons terms into,
say, the "Local Persons" authority, the inAuthority field here contains the
unique ID ("CSID") of that authority in the relevant CollectionSpace
system,
4b5cd4b4-9776-48e1-9258, in this instance. (You can find that CSID via a
request to http://host:port/cspace-services/personauthorities)
<?xml version="1.0" encoding="utf-8"?>
<imports>
<import service="Person" type="Person">
<schema xmlns:persons_common="
http://collectionspace.org/services/person" name="persons_common">
<personTermGroupList>
<personTermGroup>
<termDisplayName>Zelda C. Dobbs</termDisplayName>
</personTermGroup>
</personTermGroupList>
<shortIdentifier>ZedaCDobbs</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(ZeldaCDobbs)'ZeldaC.
Dobbs'</refName>
<inAuthority>4b5cd4b4-9776-48e1-9258</inAuthority>
</schema>
</import>
<import service="Person" type="Person">
<!-- Another record goes here ... -->
</import>
</imports>
Aron
On Mon, Jun 13, 2016 at 3:54 PM, James Keeline james@keeline.com wrote:
I think I will try to emulate the one on Aron's first link to my inquiry:
<?xml version="1.0" encoding="UTF-8"?>
<imports>
<import seq="1" service="Personauthorities" type="Personauthority">
<schema xmlns:personauthorities_common="
http://collectionspace.org/services/person"
<http://collectionspace.org/services/person> name=
"personauthorities_common">
<personauthorities_common:displayName>American Poets</
personauthorities_common:displayName>
<personauthorities_common:shortIdentifier>americanpoets</
personauthorities_common:shortIdentifier>
<personauthorities_common:vocabType>PersonAuthority</
personauthorities_common:vocabType>
<personauthorities_common:refName
urn:cspace:core.collectionspace.org:Personauthorities:name(americanpoets)'American
Poets'</personauthorities_common:refName>
</schema>
</import>
<import seq="2" service="Personauthorities" type="Personauthority"
CSID="11111111-2222-3333-4444-123456789012">
<schema xmlns:personauthorities_common="
http://collectionspace.org/services/person"
http://collectionspace.org/services/person name=
"personauthorities_common">
<personauthorities_common:displayName>French Poets</
personauthorities_common:displayName>
<personauthorities_common:shortIdentifier>frenchpoets</
personauthorities_common:shortIdentifier>
<personauthorities_common:vocabType>PersonAuthority</
personauthorities_common:vocabType>
<personauthorities_common:refName
urn:cspace:core.collectionspace.org:Personauthorities:name(frenchpoets)'French
Poets'</personauthorities_common:refName>
</schema>
</import>
</imports>
I'm not adding multiple person authorities so I'll have to use some of
your suggestion as well. I will report back on its efficacy.
This is an example of the kind of person record I will be including in the
larger document:
<?xml version="1.0" encoding="utf-8"?>
<document name="persons">
<ns2:persons_common xmlns:ns2="
http://collectionspace.org/services/person" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance">
<inAuthority>*e5c217c5-26ad-4289-b778*</inAuthority>
<personTermGroupList>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(eng)'English'</termLanguage>
<termDisplayName>Chiang Kai-shek</termDisplayName>
<surName>Chiang</surName>
<foreName>Kai-shek</foreName>
</personTermGroup>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
<termDisplayName>蔣介石</termDisplayName>
<surName>蔣</surName>
<foreName>介石</foreName>
</personTermGroup>
</personTermGroupList>
</ns2:persons_common>
</document>
This worked against core.collectionspace.org. There are a couple fields
to add to this payload.
I think though that I might wish to define the short-name so that I can
use a known value for the object records.
I'm always a bit concerned about supplying the right unique IDs for
something like the inAuthority field. Any thoughts? It is also not clear
to me why the second block of data in the Person Authorities example at the
top has a unique ID (admittedly contrived) but the first one does not.
Thank you both for your prompt help to this and my other inquiries.
James D. Keeline
From: Chris Hoffman chris_h@berkeley.edu
To: Aron Roberts aron@socrates.berkeley.edu
Cc: James Keeline james@keeline.com; Talk <
talk@lists.collectionspace.org>
Sent: Monday, June 13, 2016 3:03 PM
Subject: Re: [Talk] XML payload with multiple people
Hi James,
Your typical import document is set up to support submitting multiple
records at once. If I recall correctly, the whole document is wrapped in
<imports></imports>. Within that you can have any number of
<import></import> blocks, each of which represents one person record that
you want to create. In practice, we’ve found that we can really only
submit 5K records per batch. Otherwise we’ve had timeouts and other very
nasty behaviors. Here’s an example with the top level elements for
creating 3 records.
<?xml version="1.0" encoding="UTF-8"?>
<imports>
<import service="Persons" type="Person”>
...
</import>
<import service="Persons" type="Person”>
...
</import>
<import service="Persons" type="Person”>
...
</import>
</imports>
I hope this helps,
Chris
On Jun 13, 2016, at 12:04 PM, Aron Roberts aron@socrates.berkeley.edu
wrote:
And this is also (somewhat) helpful, as you branch out from Person
authority records to other record types:
https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Howtodeterminethecorrectvaluestoputintoan%22/imports/import/schema%22element
:
On Mon, Jun 13, 2016 at 12:02 PM, Aron Roberts <aron@socrates.berkeley.edu
James,
I think you are missing the collectionspace_core part of the import record
(in addition to the persons_common part) , e.g. (these are not your values
but pasted in from something I have):
<schema name="collectionspace_core" xmlns:collectionspace_core="
http://collectionspace.org/collectionspace_core/">
<collectionspace_core:uri>/personauthorities/82d438d8-da87-4479-9b68/items/b6ac65f6-7f9d-4dc4-9a18-641e4de1cf65</collectionspace_core:uri>
<collectionspace_core:refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(p224)'A.
Smith'</collectionspace_core:refName>
</schema>
Susan
On Mon, Jun 13, 2016 at 10:38 PM, James Keeline <james@keeline.com> wrote:
> I am still not having success. That is, I get a response code that
> suggests that a record is created but it is not showing up in search.
>
> I was mainly testing against core.collectionspace.org and using the
> reported Local Persons person authority ID. I found it with this method:
>
> http://core.collectionspace.org/cspace-services/personauthorities
>
> and the relevant result seems to be:
>
> <list-item>
> <csid>*2937e6b9-8ec6-4e0f-b45a*</csid>
> <uri>/personauthorities/2937e6b9-8ec6-4e0f-b45a</uri>
> <refName>
> urn:cspace:core.collectionspace.org:personauthorities:name(person)'Local
> Persons'
> </refName>
> <updatedAt>2016-04-08T18:52:26.094Z</updatedAt>
> <workflowState>project</workflowState>
> <shortIdentifier>person</shortIdentifier>
> <displayName>Local Persons</displayName>
> </list-item>
>
> The XML I am trying to send is:
>
> <?xml version="1.0" encoding="utf-8" ?>
> <imports>
> <import seq="1" service="Persons" type="Person">
> <document name="persons">
> <schema xmlns:persons_common="
> http://collectionspace.org/services/person" name="persons_common">
> <inAuthority>*2937e6b9-8ec6-4e0f-b45a*</inAuthority>
> <shortIdentifier>huangjunbi</shortIdentifier>
> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang
> Junbi 黃君壁'</refName>
> <personTermGroupList>
> <personTermGroup>
> <termType>urn:cspace:core.collectionspace.org:
> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
> <termLanguage>urn:cspace:core.collectionspace.org:
> vocabularies:name(languages):item:name(eng)'English'</termLanguage>
> <termDisplayName>Huang Junbi</termDisplayName>
> <surName>Huang</surName>
> <foreName>Junbi</foreName>
> <termSource></termSource>
> <termSourceID></termSourceID>
> </personTermGroup>
> <personTermGroup>
> <termType>urn:cspace:core.collectionspace.org:
> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
> <termLanguage>urn:cspace:core.collectionspace.org:
> vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
> <termDisplayName>黃君壁</termDisplayName>
> <surName>黃</surName>
> <foreName>君壁</foreName>
> <termSource></termSource>
> <termSourceID></termSourceID>
> </personTermGroup>
> </personTermGroupList>
> <birthDateGroup>
> <dateLatestYear></dateLatestYear>
> </birthDateGroup>
> <deathDateGroup>
> <dateLatestYear></dateLatestYear>
> </deathDateGroup>
> </schema>
> </document>
> </import>
> </imports>
>
> Note that I have modified to <schema> as suggested. When I send the XML
> payload to the server with this method (is it correct?) I get a response
> code that indicates that a record was sent. However, it is not showing up
> in search as I though tit would.
>
> $ curl -X POST '
> http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items'
> -i -u admin@core.collectionspace.org:Administrator -H "Content-Type:
> application/xml " -T testperson.xml
>
> HTTP/1.1 100 Continue
>
> *HTTP/1.1 201 Created*
> Server: Apache-Coyote/1.1
> Location:
> http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/bee20f53-4ffb-4751-a727
> Set-Cookie: JSESSIONID=4E542E1C6CAF477ABDC72AD64EA06962;
> Path=/cspace-services/; HttpOnly
> Content-Length: 0
> Date: Tue, 14 Jun 2016 05:28:41 GMT
>
> I suppose that if I can get one working, I can send larger numbers of
> values at once, perhaps even the 800 people at once. However, there is
> some little thing that is not working.
>
> I have also tried this on my local installation, with the corresponding
> inAuthority number retrieved from that system. Again it claims to create
> it but nothing can be found in search.
>
> The XML returned from this URL provided in the response code has
> essentially empty elements, none of the data I provided.
>
>
> http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/bee20f53-4ffb-4751-a727
>
> Perhaps someone reading has a suggestion of a mistake in my XML or methods.
>
> James D. Keeline
>
> ------------------------------
> *From:* Aron Roberts <aron@socrates.berkeley.edu>
> *To:* James Keeline <james@keeline.com>
> *Cc:* Talk <talk@lists.collectionspace.org>; Chris Hoffman <
> chris_h@berkeley.edu>
> *Sent:* Monday, June 13, 2016 7:21 PM
> *Subject:* Re: [Talk] XML payload with multiple people
>
> Have also experienced a display oddity - in the record titlebar, in the
> dropdown menu below autocomplete fields, and in the Terms Used sidebar
> (screenshot attached) - when using the Import service to import a Person
> record whose refName display name contains Chinese characters (with or
> without parens, square brackets, etc.):
>
> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang
> Junbi (黃君壁)'</refName>
>
> If you see the same thing, we can file a bug if one doesn't already exist
> ... and for now, perhaps avoid adding those?
>
> On Mon, Jun 13, 2016 at 6:03 PM, Aron Roberts <aron@socrates.berkeley.edu>
> wrote:
>
> > Sometimes it feels like these processes are just a bit more technical
> than they need to be. Perhaps it is necessary but there are a lot of
> details which must be just right for success.
>
> D'accord.
>
> Import, in particular, is rather finicky. For sheer speed - since imports
> can be quite large and performance is of the essence - the import service
> is interacting in a fairly raw way with the Nuxeo enterprise content
> management system that underlies CollectionSpace, in a manner that mostly
> bypasses the CollectionSpace framework.
>
> 1. One thing I observed in the import payload:
>
> <document name="persons">
> <ns2:persons_common xmlns:ns2="
> http://collectionspace.org/services/person"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> ...
> </ns2:persons_common>
> </document>
>
> (These two elements appear in the payloads that are produced and consumed
> when interacting with CollectionSpace via most of its Services REST API ...)
>
> Whereas for the Import service, the corresponding *single* element at this
> same level of the payload might instead be <schema ...> (AIUI due to the
> 'bypass' mentioned above):
>
> <schema xmlns:persons_common="
> http://collectionspace.org/services/person" name="persons_common">
> ...
> </schema>
>
> 2. As well, as mentioned in the brief convo between Chris and myself
> earlier, it appears the refName element (field) is required, when importing
> an authority term via the Import service.
>
> 3. If you replace the two elements above with the <schema...> element
> here, and add the refName, perhaps the import will succeed?
>
> The following payload just imported successfully for me on
> qa.collectionspace.org (after substituting QA's "Local Persons" value in
> the inAuthority field for the one you're using with your own server, below).
>
> <?xml version="1.0" encoding="utf-8" ?>
> <imports>
> <import seq="1" service="Persons" type="Person">
> <schema xmlns:persons_common="
> http://collectionspace.org/services/person" name="persons_common">
> <inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
> <shortIdentifier>huangjunbi</shortIdentifier>
> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang
> Junbi (黃君壁)'</refName>
>
> <personTermGroupList>
> <personTermGroup>
> <termType>urn:cspace:core.collectionspace.org:
> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
> <termLanguage>urn:cspace:core.collectionspace.org:
> vocabularies:name(languages):item:name(eng)'English'</termLanguage>
> <termDisplayName>Huang Junbi</termDisplayName>
> <surName>Huang</surName>
> <foreName>Junbi</foreName>
> <termSource></termSource>
> <termSourceID></termSourceID>
> </personTermGroup>
> <personTermGroup>
> <termType>urn:cspace:core.collectionspace.org:
> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
> <termLanguage>urn:cspace:core.collectionspace.org:
> vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
> <termDisplayName>黃君壁</termDisplayName>
> <surName>黃</surName>
> <foreName>君壁</foreName>
> <termSource></termSource>
> <termSourceID></termSourceID>
> </personTermGroup>
> </personTermGroupList>
> <birthDateGroup>
> <dateLatestYear></dateLatestYear>
> </birthDateGroup>
> <deathDateGroup>
> <dateLatestYear></dateLatestYear>
> </deathDateGroup>
> </schema>
> </import>
> </imports>
>
> The resulting record can be viewed at:
>
>
> https://qa.collectionspace.org/collectionspace/ui/core/html/person.html?csid=7606204f-67ee-4e1f-8a2e-451683c8ff03&vocab=person
>
> Aron
>
> On Mon, Jun 13, 2016 at 5:25 PM, James Keeline <james@keeline.com> wrote:
>
> I have seen the messages since my last inquiry and I need to read them
> carefully. I understand now how to "get" the unique ID for the
> *inAuthority* value.
>
> According to this (
> http://core.collectionspace.org:8180/cspace-services/personauthorities )
> there are several person authorities but the local person authority seems
> to have an ID of:
>
> <list-item>
> <csid>*2937e6b9-8ec6-4e0f-b45a*</csid>
> <uri>/personauthorities/2937e6b9-8ec6-4e0f-b45a</uri>
> <refName>
> urn:cspace:core.collectionspace.org:personauthorities:name(person)'Local
> Persons'
> </refName>
> <updatedAt>2016-04-08T18:52:26.094Z</updatedAt>
> <workflowState>project</workflowState>
> <shortIdentifier>person</shortIdentifier>
> <displayName>Local Persons</displayName>
> </list-item>
>
> This is what I sent to core.collectionspace.org as a test with additional
> fields. It says it was created but it does not show up on a search.
>
> <?xml version="1.0" encoding="utf-8" ?>
> <imports>
> <import seq="1" service="Persons" type="Person">
> <document name="persons">
> <ns2:persons_common xmlns:ns2="
> http://collectionspace.org/services/person"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
> <shortIdentifier>huangjunbi</shortIdentifier>
> <personTermGroupList>
> <personTermGroup>
> <termType>urn:cspace:core.collectionspace.org:
> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
> <termLanguage>urn:cspace:core.collectionspace.org:
> vocabularies:name(languages):item:name(eng)'English'</termLanguage>
> <termDisplayName>Huang Junbi</termDisplayName>
> <surName>Huang</surName>
> <foreName>Junbi</foreName>
> <termSource></termSource>
> <termSourceID></termSourceID>
> </personTermGroup>
> <personTermGroup>
> <termType>urn:cspace:core.collectionspace.org:
> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
> <termLanguage>urn:cspace:core.collectionspace.org:
> vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
> <termDisplayName>黃君壁</termDisplayName>
> <surName>黃</surName>
> <foreName>君壁</foreName>
> <termSource></termSource>
> <termSourceID></termSourceID>
> </personTermGroup>
> </personTermGroupList>
> <birthDateGroup>
> <dateLatestYear></dateLatestYear>
> </birthDateGroup>
> <deathDateGroup>
> <dateLatestYear></dateLatestYear>
> </deathDateGroup>
> </ns2:persons_common>
> </document>
> </import>
> </imports>
>
> Perhaps this is related to my inAuthority value being different/wrong. I
> tried sending to the "found" csid value but it still does not show up under
> search. These are the response codes for the two attempts with the old ID
> and the found one:
>
> jameskesmacbook:BPOC keeline$ curl -X POST '
> http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items'
> -i -u admin@core.collectionspace.org:Administrator -H "Content-Type:
> application/xml " -T testperson.xml
> HTTP/1.1 100 Continue
>
> HTTP/1.1 201 Created
> Server: Apache-Coyote/1.1
> Location:
> http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/85b329e4-0d14-48f3-9365
> Set-Cookie: JSESSIONID=E2A4F02670F864DDE3A5D4517B7A36A2;
> Path=/cspace-services/; HttpOnly
> Content-Length: 0
> Date: Tue, 14 Jun 2016 00:05:43 GMT
>
> jameskesmacbook:BPOC keeline$ curl -X POST '
> http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items'
> -i -u admin@core.collectionspace.org:Administrator -H "Content-Type:
> application/xml " -T testperson.xml
> HTTP/1.1 100 Continue
>
> HTTP/1.1 201 Created
> Server: Apache-Coyote/1.1
> Location:
> http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/18394f8b-00c4-40d2-a256
> Set-Cookie: JSESSIONID=A5405E5A665EE6375E295A27E4DD53B4;
> Path=/cspace-services/; HttpOnly
> Content-Length: 0
> Date: Tue, 14 Jun 2016 00:17:26 GMT
>
> I'm using a PHP script to generate the XML so if there is a snippet to
> extract the correct value into a variable, I will include that. I can
> probably parse through it with some regex but I'll bet there's a better way
> if anyone knows it.
>
> Sometimes it feels like these processes are just a bit more technical than
> they need to be. Perhaps it is necessary but there are a lot of details
> which must be just right for success.
>
> James D. Keeline
>
> ------------------------------
> *From:* Aron Roberts <aron@socrates.berkeley.edu>
> *To:* James Keeline <james@keeline.com>
> *Cc:* Talk <talk@lists.collectionspace.org>; Chris Hoffman <
> chris_h@berkeley.edu>
> *Sent:* Monday, June 13, 2016 5:08 PM
>
> *Subject:* Re: [Talk] XML payload with multiple people
>
> BTW, there was a typo in the sample payload in a previous note: this
> should have read <import service="Persons" type="Person"> (note: first
> attribute value is now plural) rather than: <import service="Person"
> type="Person">.
>
> The (corrected) example payload:
>
> <?xml version="1.0" encoding="utf-8"?>
> <imports>
> <import service="Persons" type="Person">
> <schema xmlns:persons_common="
> http://collectionspace.org/services/person" name="persons_common">
> <personTermGroupList>
> <personTermGroup>
> <termDisplayName>Zelda C. Dobbs</termDisplayName>
> </personTermGroup>
> </personTermGroupList>
> <shortIdentifier>ZedaCDobbs</shortIdentifier>
> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(ZeldaCDobbs)'ZeldaC.
> Dobbs'</refName>
> <inAuthority>4b5cd4b4-9776-48e1-9258</inAuthority>
> </schema>
> </import>
> <import service="Persons" type="Person">
> <!-- Another record goes here ... -->
> </import>
> </imports>
>
> The section "How to find the service and type values" in the Imports
> Service Home document,
> https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Howtofindtheserviceandtypevalues,
> describes how to find and enter the right values for those
> two attributes, in the <import service="something_here"
> type="something_else_here"> elements.
>
> Aron
>
>
> On Mon, Jun 13, 2016 at 4:54 PM, Aron Roberts <aron@socrates.berkeley.edu>
> wrote:
>
> Good questions, Chris!
>
> About an hour ago, I test-imported a couple of Person records lacking
> a refName and shortidentifier. It looks like an 'ID' form of the refName
> was auto-created for
> those records; e.g.:
> urn:cspace:core.collectionspace.org:
> persons:id(dbbf8c78-6c4e-470b-8765-b07ba73ff9a4)
>
> And when listing all Person records, following that import, the following
> services error occurred:
>
> ERROR ...
> [org.collectionspace.services.common.vocabulary.RefNameServiceUtils:527]
> Could not retrieve a list of documents referring to the specified
> authority item
> java.lang.IllegalArgumentException: Malformed refName for AuthorityTerm
> (too few tokens)
>
> This might yet reflect pilot error on my part, but this at least suggests
> a need
> to supply values for one or both of those fields in the import payload.
>
> On Mon, Jun 13, 2016 at 4:40 PM, Chris Hoffman <chris_h@berkeley.edu>
> wrote:
>
> Thanks, Aron, for this better example!
>
> Do you know if the refname and shortidentifier elements are still needed
> by the import service? I don’t see them listed in the schema needed via
> the Rest API
> <https://wiki.collectionspace.org/display/DOC/Person+Service+REST+APIs#PersonServiceRESTAPIs-Personinstanceschema>
>
> But maybe they are still needed for the import service.
>
> Thanks
> Chris
>
>
> On Jun 13, 2016, at 4:34 PM, Aron Roberts <aron@socrates.berkeley.edu>
> wrote:
>
> Hi James,
>
> Sounds good. Note that these examples are for *authority* records,
> not for the records for terms *within* an authority, which may be what
> you're planning to add here.
>
> (Note to self and colleagues: we *really* need to add the latter examples
> to this doc.)
>
> One thing you'll need to be aware of, when importing authority term
> records
> (i.e. the items within a particular authority/vocabulary), the
> 'inAuthority' field
> must be present in each such record and must reference an extant parent
> authority. This associates the term with the relevant (parent) authority.
>
> In the example below, when importing one or more persons terms into,
> say, the "Local Persons" authority, the inAuthority field here contains the
> unique ID ("CSID") of that authority in the relevant CollectionSpace
> system,
> 4b5cd4b4-9776-48e1-9258, in this instance. (You can find that CSID via a
> request to http://host:port/cspace-services/personauthorities)
>
> <?xml version="1.0" encoding="utf-8"?>
> <imports>
> <import service="Person" type="Person">
> <schema xmlns:persons_common="
> http://collectionspace.org/services/person" name="persons_common">
> <personTermGroupList>
> <personTermGroup>
> <termDisplayName>Zelda C. Dobbs</termDisplayName>
> </personTermGroup>
> </personTermGroupList>
> <shortIdentifier>ZedaCDobbs</shortIdentifier>
> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(ZeldaCDobbs)'ZeldaC.
> Dobbs'</refName>
> <inAuthority>4b5cd4b4-9776-48e1-9258</inAuthority>
> </schema>
> </import>
> <import service="Person" type="Person">
> <!-- Another record goes here ... -->
> </import>
> </imports>
>
> Aron
>
> On Mon, Jun 13, 2016 at 3:54 PM, James Keeline <james@keeline.com> wrote:
>
> I think I will try to emulate the one on Aron's first link to my inquiry:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <imports>
> <import seq="1" service="Personauthorities" type="Personauthority">
> <schema xmlns:personauthorities_common="
> http://collectionspace.org/services/person"
> <http://collectionspace.org/services/person> name=
> "personauthorities_common">
> <personauthorities_common:displayName>American Poets</
> personauthorities_common:displayName>
> <personauthorities_common:shortIdentifier>americanpoets</
> personauthorities_common:shortIdentifier>
> <personauthorities_common:vocabType>PersonAuthority</
> personauthorities_common:vocabType>
> <personauthorities_common:refName
> >urn:cspace:core.collectionspace.org:Personauthorities:name(americanpoets)'American
> Poets'</personauthorities_common:refName>
> </schema>
> </import>
> <import seq="2" service="Personauthorities" type="Personauthority"
> CSID="11111111-2222-3333-4444-123456789012">
> <schema xmlns:personauthorities_common="
> http://collectionspace.org/services/person"
> <http://collectionspace.org/services/person> name=
> "personauthorities_common">
> <personauthorities_common:displayName>French Poets</
> personauthorities_common:displayName>
> <personauthorities_common:shortIdentifier>frenchpoets</
> personauthorities_common:shortIdentifier>
> <personauthorities_common:vocabType>PersonAuthority</
> personauthorities_common:vocabType>
> <personauthorities_common:refName
> >urn:cspace:core.collectionspace.org:Personauthorities:name(frenchpoets)'French
> Poets'</personauthorities_common:refName>
> </schema>
> </import>
> </imports>
>
> I'm not adding multiple person authorities so I'll have to use some of
> your suggestion as well. I will report back on its efficacy.
>
> This is an example of the kind of person record I will be including in the
> larger document:
>
> <?xml version="1.0" encoding="utf-8"?>
> <document name="persons">
> <ns2:persons_common xmlns:ns2="
> http://collectionspace.org/services/person" xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance">
> <inAuthority>*e5c217c5-26ad-4289-b778*</inAuthority>
> <personTermGroupList>
> <personTermGroup>
> <termType>urn:cspace:core.collectionspace.org:
> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
> <termLanguage>urn:cspace:core.collectionspace.org:
> vocabularies:name(languages):item:name(eng)'English'</termLanguage>
> <termDisplayName>Chiang Kai-shek</termDisplayName>
> <surName>Chiang</surName>
> <foreName>Kai-shek</foreName>
> </personTermGroup>
> <personTermGroup>
> <termType>urn:cspace:core.collectionspace.org:
> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
> <termLanguage>urn:cspace:core.collectionspace.org:
> vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
> <termDisplayName>蔣介石</termDisplayName>
> <surName>蔣</surName>
> <foreName>介石</foreName>
> </personTermGroup>
> </personTermGroupList>
> </ns2:persons_common>
> </document>
>
>
> This worked against core.collectionspace.org. There are a couple fields
> to add to this payload.
>
> I think though that I might wish to define the short-name so that I can
> use a known value for the object records.
>
> I'm always a bit concerned about supplying the right unique IDs for
> something like the inAuthority field. Any thoughts? It is also not clear
> to me why the second block of data in the Person Authorities example at the
> top has a unique ID (admittedly contrived) but the first one does not.
> _____
>
> Thank you both for your prompt help to this and my other inquiries.
>
> James D. Keeline
>
> ------------------------------
> *From:* Chris Hoffman <chris_h@berkeley.edu>
> *To:* Aron Roberts <aron@socrates.berkeley.edu>
> *Cc:* James Keeline <james@keeline.com>; Talk <
> talk@lists.collectionspace.org>
> *Sent:* Monday, June 13, 2016 3:03 PM
> *Subject:* Re: [Talk] XML payload with multiple people
>
> Hi James,
>
> Your typical import document is set up to support submitting multiple
> records at once. If I recall correctly, the whole document is wrapped in
> <imports></imports>. Within that you can have any number of
> <import></import> blocks, each of which represents one person record that
> you want to create. In practice, we’ve found that we can really only
> submit 5K records per batch. Otherwise we’ve had timeouts and other very
> nasty behaviors. Here’s an example with the top level elements for
> creating 3 records.
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <imports>
> <import service="Persons" type="Person”>
> ...
> </import>
> <import service="Persons" type="Person”>
> ...
> </import>
> <import service="Persons" type="Person”>
> ...
> </import>
> </imports>
>
>
> I hope this helps,
> Chris
>
> On Jun 13, 2016, at 12:04 PM, Aron Roberts <aron@socrates.berkeley.edu>
> wrote:
>
> And this is also (somewhat) helpful, as you branch out from Person
> authority records to other record types:
>
>
> https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Howtodeterminethecorrectvaluestoputintoan%22/imports/import/schema%22element
> :
>
> On Mon, Jun 13, 2016 at 12:02 PM, Aron Roberts <aron@socrates.berkeley.edu
> > wrote:
>
> One possible starting place:
>
>
> https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-ExampleRequest
>
> On Mon, Jun 13, 2016 at 11:29 AM, James Keeline <james@keeline.com> wrote:
>
> I wish to import multiple people (authors, artists). I can make a single
> XML payload.
>
> It seems to me that one can send multiple at once. What is the element
> format for this?
>
> James D. Keeline
>
>
> _______________________________________________
> Talk mailing list
> Talk@lists.collectionspace.org
>
> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
>
>
>
>
> _______________________________________________
> Talk mailing list
> Talk@lists.collectionspace.org
>
> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
>
>
>
>
>
> _______________________________________________
> Talk mailing list
> Talk@lists.collectionspace.org
>
> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
>
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
> Talk mailing list
> Talk@lists.collectionspace.org
>
> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
>
>
AR
Aron Roberts
Tue, Jun 14, 2016 6:56 AM
There's some possible confusion (which I missed seeing in your earlier
email) between:
-
Importing records, via the Imports service. (This is the method
generally used when bulk importing hundreds or thousands of records.)
-
Creating a record, by POSTing to the relevant person authority via the
Services REST API.
These use subtly different payloads, an artifact resulting from the fact
that the Imports service bypasses most of the Services framework and talks
more or less directly to Nuxeo, which expects to encounter its own payload
format.
The payload included in an earlier message, repeated below with a few
trivial tweaks (uppercasing UTF-8 as per W3C doc conventions, removing the
'seq=1' attribute, removing empty repeatable groups), should likely work
for you method 1, calling the Imports service, via either of the following
formats:
https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Sendingtherequest
<?xml version="1.0" encoding="UTF-8" ?>
<imports>
<import service="Persons" type="Person">
<schema xmlns:persons_common="
http://collectionspace.org/services/person" name="persons_common">
<inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
<shortIdentifier>huangjunbi</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang
Junbi (黃君壁)'</refName>
<personTermGroupList>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(eng)'English'</termLanguage>
<termDisplayName>Huang Junbi</termDisplayName>
<surName>Huang</surName>
<foreName>Junbi</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
<termDisplayName>黃君壁</termDisplayName>
<surName>黃</surName>
<foreName>君壁</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
</personTermGroupList>
</schema>
</import>
</imports>
If you're going to be using method 2, POSTing an individual record via
the Services REST APIs, via a call like:
$ curl -X POST '
http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items'
-i -u admin@core.collectionspace.org:Administrator -H "Content-Type:
application/xml " -T testperson.xml
Then your payload will start with something similar to this:
<?xml version="1.0" encoding="UTF-8"?>
<document name="persons">
<ns2:persons_common xmlns:ns2="
http://collectionspace.org/services/person">
...
Rather than the Import payload's preamble:
<?xml version="1.0" encoding="UTF-8" ?>
<imports>
<import service="Persons" type="Person">
<schema xmlns:persons_common="
http://collectionspace.org/services/person" name="persons_common">
...
I don't believe the CollectionSpace 'core' schema part needs to be
included; that this part will get automatically created by CollectionSpace
when you POST. But this is all from memory, since I'm currently away from
access to my past working examples of Person authority term payloads.
Aron
On Mon, Jun 13, 2016 at 11:32 PM, Susan STONE sstone@berkeley.edu wrote:
James,
I think you are missing the collectionspace_core part of the import record
(in addition to the persons_common part) , e.g. (these are not your values
but pasted in from something I have):
<schema name="collectionspace_core" xmlns:collectionspace_core="
http://collectionspace.org/collectionspace_core/">
<collectionspace_core:uri>/personauthorities/82d438d8-da87-4479-9b68/items/b6ac65f6-7f9d-4dc4-9a18-641e4de1cf65</collectionspace_core:uri>
<collectionspace_core:refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(p224)'A.
Smith'</collectionspace_core:refName>
</schema>
Susan
On Mon, Jun 13, 2016 at 10:38 PM, James Keeline james@keeline.com wrote:
I am still not having success. That is, I get a response code that
suggests that a record is created but it is not showing up in search.
I was mainly testing against core.collectionspace.org and using the
reported Local Persons person authority ID. I found it with this method:
http://core.collectionspace.org/cspace-services/personauthorities
and the relevant result seems to be:
<list-item>
<csid>*2937e6b9-8ec6-4e0f-b45a*</csid>
<uri>/personauthorities/2937e6b9-8ec6-4e0f-b45a</uri>
<refName>
urn:cspace:core.collectionspace.org:personauthorities:name(person)'Local
Persons'
</refName>
<updatedAt>2016-04-08T18:52:26.094Z</updatedAt>
<workflowState>project</workflowState>
<shortIdentifier>person</shortIdentifier>
<displayName>Local Persons</displayName>
</list-item>
The XML I am trying to send is:
<?xml version="1.0" encoding="utf-8" ?>
<imports>
<import seq="1" service="Persons" type="Person">
<document name="persons">
<schema xmlns:persons_common="
http://collectionspace.org/services/person" name="persons_common">
<inAuthority>*2937e6b9-8ec6-4e0f-b45a*</inAuthority>
<shortIdentifier>huangjunbi</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang
Junbi 黃君壁'</refName>
<personTermGroupList>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(eng)'English'</termLanguage>
<termDisplayName>Huang Junbi</termDisplayName>
<surName>Huang</surName>
<foreName>Junbi</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
<termDisplayName>黃君壁</termDisplayName>
<surName>黃</surName>
<foreName>君壁</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
</personTermGroupList>
<birthDateGroup>
<dateLatestYear></dateLatestYear>
</birthDateGroup>
<deathDateGroup>
<dateLatestYear></dateLatestYear>
</deathDateGroup>
</schema>
</document>
</import>
</imports>
Note that I have modified to <schema> as suggested. When I send the XML
payload to the server with this method (is it correct?) I get a response
code that indicates that a record was sent. However, it is not showing up
in search as I though tit would.
$ curl -X POST '
http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items'
-i -u admin@core.collectionspace.org:Administrator -H "Content-Type:
application/xml " -T testperson.xml
HTTP/1.1 100 Continue
HTTP/1.1 201 Created
Server: Apache-Coyote/1.1
Location:
http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/bee20f53-4ffb-4751-a727
Set-Cookie: JSESSIONID=4E542E1C6CAF477ABDC72AD64EA06962;
Path=/cspace-services/; HttpOnly
Content-Length: 0
Date: Tue, 14 Jun 2016 05:28:41 GMT
I suppose that if I can get one working, I can send larger numbers of
values at once, perhaps even the 800 people at once. However, there is
some little thing that is not working.
I have also tried this on my local installation, with the corresponding
inAuthority number retrieved from that system. Again it claims to create
it but nothing can be found in search.
The XML returned from this URL provided in the response code has
essentially empty elements, none of the data I provided.
http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/bee20f53-4ffb-4751-a727
Perhaps someone reading has a suggestion of a mistake in my XML or
methods.
James D. Keeline
From: Aron Roberts aron@socrates.berkeley.edu
To: James Keeline james@keeline.com
Cc: Talk talk@lists.collectionspace.org; Chris Hoffman <
chris_h@berkeley.edu>
Sent: Monday, June 13, 2016 7:21 PM
Subject: Re: [Talk] XML payload with multiple people
Have also experienced a display oddity - in the record titlebar, in the
dropdown menu below autocomplete fields, and in the Terms Used sidebar
(screenshot attached) - when using the Import service to import a Person
record whose refName display name contains Chinese characters (with or
without parens, square brackets, etc.):
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang
Junbi (黃君壁)'</refName>
If you see the same thing, we can file a bug if one doesn't already exist
... and for now, perhaps avoid adding those?
On Mon, Jun 13, 2016 at 6:03 PM, Aron Roberts <aron@socrates.berkeley.edu
Sometimes it feels like these processes are just a bit more technical
than they need to be. Perhaps it is necessary but there are a lot of
details which must be just right for success.
D'accord.
Import, in particular, is rather finicky. For sheer speed - since imports
can be quite large and performance is of the essence - the import service
is interacting in a fairly raw way with the Nuxeo enterprise content
management system that underlies CollectionSpace, in a manner that mostly
bypasses the CollectionSpace framework.
-
One thing I observed in the import payload:
<document name="persons">
<ns2:persons_common xmlns:ns2="
http://collectionspace.org/services/person"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
...
</ns2:persons_common>
</document>
(These two elements appear in the payloads that are produced and consumed
when interacting with CollectionSpace via most of its Services REST API ...)
Whereas for the Import service, the corresponding single element at
this same level of the payload might instead be <schema ...> (AIUI due to
the 'bypass' mentioned above):
<schema xmlns:persons_common="
http://collectionspace.org/services/person" name="persons_common">
...
</schema>
-
As well, as mentioned in the brief convo between Chris and myself
earlier, it appears the refName element (field) is required, when importing
an authority term via the Import service.
-
If you replace the two elements above with the <schema...> element
here, and add the refName, perhaps the import will succeed?
The following payload just imported successfully for me on
qa.collectionspace.org (after substituting QA's "Local Persons" value in
the inAuthority field for the one you're using with your own server, below).
<?xml version="1.0" encoding="utf-8" ?>
<imports>
<import seq="1" service="Persons" type="Person">
<schema xmlns:persons_common="
http://collectionspace.org/services/person" name="persons_common">
<inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
<shortIdentifier>huangjunbi</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang
Junbi (黃君壁)'</refName>
<personTermGroupList>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(eng)'English'</termLanguage>
<termDisplayName>Huang Junbi</termDisplayName>
<surName>Huang</surName>
<foreName>Junbi</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
<termDisplayName>黃君壁</termDisplayName>
<surName>黃</surName>
<foreName>君壁</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
</personTermGroupList>
<birthDateGroup>
<dateLatestYear></dateLatestYear>
</birthDateGroup>
<deathDateGroup>
<dateLatestYear></dateLatestYear>
</deathDateGroup>
</schema>
</import>
</imports>
The resulting record can be viewed at:
https://qa.collectionspace.org/collectionspace/ui/core/html/person.html?csid=7606204f-67ee-4e1f-8a2e-451683c8ff03&vocab=person
Aron
On Mon, Jun 13, 2016 at 5:25 PM, James Keeline james@keeline.com wrote:
I have seen the messages since my last inquiry and I need to read them
carefully. I understand now how to "get" the unique ID for the
inAuthority value.
According to this (
http://core.collectionspace.org:8180/cspace-services/personauthorities )
there are several person authorities but the local person authority seems
to have an ID of:
<list-item>
<csid>*2937e6b9-8ec6-4e0f-b45a*</csid>
<uri>/personauthorities/2937e6b9-8ec6-4e0f-b45a</uri>
<refName>
urn:cspace:core.collectionspace.org:personauthorities:name(person)'Local
Persons'
</refName>
<updatedAt>2016-04-08T18:52:26.094Z</updatedAt>
<workflowState>project</workflowState>
<shortIdentifier>person</shortIdentifier>
<displayName>Local Persons</displayName>
</list-item>
This is what I sent to core.collectionspace.org as a test with
additional fields. It says it was created but it does not show up on a
search.
<?xml version="1.0" encoding="utf-8" ?>
<imports>
<import seq="1" service="Persons" type="Person">
<document name="persons">
<ns2:persons_common xmlns:ns2="
http://collectionspace.org/services/person"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
<shortIdentifier>huangjunbi</shortIdentifier>
<personTermGroupList>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(eng)'English'</termLanguage>
<termDisplayName>Huang Junbi</termDisplayName>
<surName>Huang</surName>
<foreName>Junbi</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
<termDisplayName>黃君壁</termDisplayName>
<surName>黃</surName>
<foreName>君壁</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
</personTermGroupList>
<birthDateGroup>
<dateLatestYear></dateLatestYear>
</birthDateGroup>
<deathDateGroup>
<dateLatestYear></dateLatestYear>
</deathDateGroup>
</ns2:persons_common>
</document>
</import>
</imports>
Perhaps this is related to my inAuthority value being different/wrong. I
tried sending to the "found" csid value but it still does not show up under
search. These are the response codes for the two attempts with the old ID
and the found one:
jameskesmacbook:BPOC keeline$ curl -X POST '
http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items'
-i -u admin@core.collectionspace.org:Administrator -H "Content-Type:
application/xml " -T testperson.xml
HTTP/1.1 100 Continue
HTTP/1.1 201 Created
Server: Apache-Coyote/1.1
Location:
http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/85b329e4-0d14-48f3-9365
Set-Cookie: JSESSIONID=E2A4F02670F864DDE3A5D4517B7A36A2;
Path=/cspace-services/; HttpOnly
Content-Length: 0
Date: Tue, 14 Jun 2016 00:05:43 GMT
jameskesmacbook:BPOC keeline$ curl -X POST '
http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items'
-i -u admin@core.collectionspace.org:Administrator -H "Content-Type:
application/xml " -T testperson.xml
HTTP/1.1 100 Continue
HTTP/1.1 201 Created
Server: Apache-Coyote/1.1
Location:
http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/18394f8b-00c4-40d2-a256
Set-Cookie: JSESSIONID=A5405E5A665EE6375E295A27E4DD53B4;
Path=/cspace-services/; HttpOnly
Content-Length: 0
Date: Tue, 14 Jun 2016 00:17:26 GMT
I'm using a PHP script to generate the XML so if there is a snippet to
extract the correct value into a variable, I will include that. I can
probably parse through it with some regex but I'll bet there's a better way
if anyone knows it.
Sometimes it feels like these processes are just a bit more technical
than they need to be. Perhaps it is necessary but there are a lot of
details which must be just right for success.
James D. Keeline
From: Aron Roberts aron@socrates.berkeley.edu
To: James Keeline james@keeline.com
Cc: Talk talk@lists.collectionspace.org; Chris Hoffman <
chris_h@berkeley.edu>
Sent: Monday, June 13, 2016 5:08 PM
Subject: Re: [Talk] XML payload with multiple people
BTW, there was a typo in the sample payload in a previous note: this
should have read <import service="Persons" type="Person"> (note: first
attribute value is now plural) rather than: <import service="Person"
type="Person">.
The (corrected) example payload:
<?xml version="1.0" encoding="utf-8"?>
<imports>
<import service="Persons" type="Person">
<schema xmlns:persons_common="
http://collectionspace.org/services/person" name="persons_common">
<personTermGroupList>
<personTermGroup>
<termDisplayName>Zelda C. Dobbs</termDisplayName>
</personTermGroup>
</personTermGroupList>
<shortIdentifier>ZedaCDobbs</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(ZeldaCDobbs)'ZeldaC.
Dobbs'</refName>
<inAuthority>4b5cd4b4-9776-48e1-9258</inAuthority>
</schema>
</import>
<import service="Persons" type="Person">
<!-- Another record goes here ... -->
</import>
</imports>
The section "How to find the service and type values" in the Imports
Service Home document,
https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Howtofindtheserviceandtypevalues,
describes how to find and enter the right values for those
two attributes, in the <import service="something_here"
type="something_else_here"> elements.
Aron
On Mon, Jun 13, 2016 at 4:54 PM, Aron Roberts <aron@socrates.berkeley.edu
Good questions, Chris!
About an hour ago, I test-imported a couple of Person records lacking
a refName and shortidentifier. It looks like an 'ID' form of the refName
was auto-created for
those records; e.g.:
urn:cspace:core.collectionspace.org:
persons:id(dbbf8c78-6c4e-470b-8765-b07ba73ff9a4)
And when listing all Person records, following that import, the following
services error occurred:
ERROR ...
[org.collectionspace.services.common.vocabulary.RefNameServiceUtils:527]
Could not retrieve a list of documents referring to the specified
authority item
java.lang.IllegalArgumentException: Malformed refName for AuthorityTerm
(too few tokens)
This might yet reflect pilot error on my part, but this at least suggests
a need
to supply values for one or both of those fields in the import payload.
On Mon, Jun 13, 2016 at 4:40 PM, Chris Hoffman chris_h@berkeley.edu
wrote:
Thanks, Aron, for this better example!
Do you know if the refname and shortidentifier elements are still needed
by the import service? I don’t see them listed in the schema needed via
the Rest API
https://wiki.collectionspace.org/display/DOC/Person+Service+REST+APIs#PersonServiceRESTAPIs-Personinstanceschema
But maybe they are still needed for the import service.
Thanks
Chris
On Jun 13, 2016, at 4:34 PM, Aron Roberts aron@socrates.berkeley.edu
wrote:
Hi James,
Sounds good. Note that these examples are for authority records,
not for the records for terms within an authority, which may be what
you're planning to add here.
(Note to self and colleagues: we really need to add the latter
examples
to this doc.)
One thing you'll need to be aware of, when importing authority term
records
(i.e. the items within a particular authority/vocabulary), the
'inAuthority' field
must be present in each such record and must reference an extant parent
authority. This associates the term with the relevant (parent) authority.
In the example below, when importing one or more persons terms into,
say, the "Local Persons" authority, the inAuthority field here contains
the
unique ID ("CSID") of that authority in the relevant CollectionSpace
system,
4b5cd4b4-9776-48e1-9258, in this instance. (You can find that CSID via a
request to http://host:port/cspace-services/personauthorities)
<?xml version="1.0" encoding="utf-8"?>
<imports>
<import service="Person" type="Person">
<schema xmlns:persons_common="
http://collectionspace.org/services/person" name="persons_common">
<personTermGroupList>
<personTermGroup>
<termDisplayName>Zelda C. Dobbs</termDisplayName>
</personTermGroup>
</personTermGroupList>
<shortIdentifier>ZedaCDobbs</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(ZeldaCDobbs)'ZeldaC.
Dobbs'</refName>
<inAuthority>4b5cd4b4-9776-48e1-9258</inAuthority>
</schema>
</import>
<import service="Person" type="Person">
<!-- Another record goes here ... -->
</import>
</imports>
Aron
On Mon, Jun 13, 2016 at 3:54 PM, James Keeline james@keeline.com wrote:
I think I will try to emulate the one on Aron's first link to my inquiry:
<?xml version="1.0" encoding="UTF-8"?>
<imports>
<import seq="1" service="Personauthorities" type="Personauthority">
<schema xmlns:personauthorities_common="
http://collectionspace.org/services/person"
<http://collectionspace.org/services/person> name=
"personauthorities_common">
<personauthorities_common:displayName>American Poets</
personauthorities_common:displayName>
<personauthorities_common:shortIdentifier>americanpoets</
personauthorities_common:shortIdentifier>
<personauthorities_common:vocabType>PersonAuthority</
personauthorities_common:vocabType>
<personauthorities_common:refName
urn:cspace:core.collectionspace.org:Personauthorities:name(americanpoets)'American
Poets'</personauthorities_common:refName>
</schema>
</import>
<import seq="2" service="Personauthorities" type="Personauthority"
CSID="11111111-2222-3333-4444-123456789012">
<schema xmlns:personauthorities_common="
http://collectionspace.org/services/person"
http://collectionspace.org/services/person name=
"personauthorities_common">
<personauthorities_common:displayName>French Poets</
personauthorities_common:displayName>
<personauthorities_common:shortIdentifier>frenchpoets</
personauthorities_common:shortIdentifier>
<personauthorities_common:vocabType>PersonAuthority</
personauthorities_common:vocabType>
<personauthorities_common:refName
urn:cspace:core.collectionspace.org:Personauthorities:name(frenchpoets)'French
Poets'</personauthorities_common:refName>
</schema>
</import>
</imports>
I'm not adding multiple person authorities so I'll have to use some of
your suggestion as well. I will report back on its efficacy.
This is an example of the kind of person record I will be including in
the larger document:
<?xml version="1.0" encoding="utf-8"?>
<document name="persons">
<ns2:persons_common xmlns:ns2="
http://collectionspace.org/services/person" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance">
<inAuthority>*e5c217c5-26ad-4289-b778*</inAuthority>
<personTermGroupList>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(eng)'English'</termLanguage>
<termDisplayName>Chiang Kai-shek</termDisplayName>
<surName>Chiang</surName>
<foreName>Kai-shek</foreName>
</personTermGroup>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
<termDisplayName>蔣介石</termDisplayName>
<surName>蔣</surName>
<foreName>介石</foreName>
</personTermGroup>
</personTermGroupList>
</ns2:persons_common>
</document>
This worked against core.collectionspace.org. There are a couple fields
to add to this payload.
I think though that I might wish to define the short-name so that I can
use a known value for the object records.
I'm always a bit concerned about supplying the right unique IDs for
something like the inAuthority field. Any thoughts? It is also not clear
to me why the second block of data in the Person Authorities example at the
top has a unique ID (admittedly contrived) but the first one does not.
Thank you both for your prompt help to this and my other inquiries.
James D. Keeline
From: Chris Hoffman chris_h@berkeley.edu
To: Aron Roberts aron@socrates.berkeley.edu
Cc: James Keeline james@keeline.com; Talk <
talk@lists.collectionspace.org>
Sent: Monday, June 13, 2016 3:03 PM
Subject: Re: [Talk] XML payload with multiple people
Hi James,
Your typical import document is set up to support submitting multiple
records at once. If I recall correctly, the whole document is wrapped in
<imports></imports>. Within that you can have any number of
<import></import> blocks, each of which represents one person record that
you want to create. In practice, we’ve found that we can really only
submit 5K records per batch. Otherwise we’ve had timeouts and other very
nasty behaviors. Here’s an example with the top level elements for
creating 3 records.
<?xml version="1.0" encoding="UTF-8"?>
<imports>
<import service="Persons" type="Person”>
...
</import>
<import service="Persons" type="Person”>
...
</import>
<import service="Persons" type="Person”>
...
</import>
</imports>
I hope this helps,
Chris
On Jun 13, 2016, at 12:04 PM, Aron Roberts aron@socrates.berkeley.edu
wrote:
And this is also (somewhat) helpful, as you branch out from Person
authority records to other record types:
https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Howtodeterminethecorrectvaluestoputintoan%22/imports/import/schema%22element
:
On Mon, Jun 13, 2016 at 12:02 PM, Aron Roberts <
aron@socrates.berkeley.edu> wrote:
One possible starting place:
https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-ExampleRequest
On Mon, Jun 13, 2016 at 11:29 AM, James Keeline james@keeline.com
wrote:
I wish to import multiple people (authors, artists). I can make a single
XML payload.
It seems to me that one can send multiple at once. What is the element
format for this?
James D. Keeline
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
There's some possible confusion (which I missed seeing in your earlier
email) between:
1. Importing records, via the Imports service. (This is the method
generally used when bulk importing hundreds or thousands of records.)
2. Creating a record, by POSTing to the relevant person authority via the
Services REST API.
These use *subtly different payloads*, an artifact resulting from the fact
that the Imports service bypasses most of the Services framework and talks
more or less directly to Nuxeo, which expects to encounter its own payload
format.
The payload included in an earlier message, repeated below with a few
trivial tweaks (uppercasing UTF-8 as per W3C doc conventions, removing the
'seq=1' attribute, removing empty repeatable groups), should likely work
for you method 1, calling the Imports service, via either of the following
formats:
https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Sendingtherequest
<?xml version="1.0" encoding="UTF-8" ?>
<imports>
<import service="Persons" type="Person">
<schema xmlns:persons_common="
http://collectionspace.org/services/person" name="persons_common">
<inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
<shortIdentifier>huangjunbi</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang
Junbi (黃君壁)'</refName>
<personTermGroupList>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(eng)'English'</termLanguage>
<termDisplayName>Huang Junbi</termDisplayName>
<surName>Huang</surName>
<foreName>Junbi</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
<termDisplayName>黃君壁</termDisplayName>
<surName>黃</surName>
<foreName>君壁</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
</personTermGroupList>
</schema>
</import>
</imports>
If you're going to be using method 2, POSTing an individual record via
the Services REST APIs, via a call like:
$ curl -X POST '
http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items'
-i -u admin@core.collectionspace.org:Administrator -H "Content-Type:
application/xml " -T testperson.xml
Then your payload will start with something similar to this:
<?xml version="1.0" encoding="UTF-8"?>
<document name="persons">
<ns2:persons_common xmlns:ns2="
http://collectionspace.org/services/person">
...
Rather than the Import payload's preamble:
<?xml version="1.0" encoding="UTF-8" ?>
<imports>
<import service="Persons" type="Person">
<schema xmlns:persons_common="
http://collectionspace.org/services/person" name="persons_common">
...
I don't believe the CollectionSpace 'core' schema part needs to be
included; that this part will get automatically created by CollectionSpace
when you POST. But this is all from memory, since I'm currently away from
access to my past working examples of Person authority term payloads.
Aron
On Mon, Jun 13, 2016 at 11:32 PM, Susan STONE <sstone@berkeley.edu> wrote:
> James,
>
> I think you are missing the collectionspace_core part of the import record
> (in addition to the persons_common part) , e.g. (these are not your values
> but pasted in from something I have):
>
> <schema name="collectionspace_core" xmlns:collectionspace_core="
> http://collectionspace.org/collectionspace_core/">
>
> <collectionspace_core:uri>/personauthorities/82d438d8-da87-4479-9b68/items/b6ac65f6-7f9d-4dc4-9a18-641e4de1cf65</collectionspace_core:uri>
> <collectionspace_core:refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(p224)'A.
> Smith'</collectionspace_core:refName>
> </schema>
>
>
> Susan
>
>
> On Mon, Jun 13, 2016 at 10:38 PM, James Keeline <james@keeline.com> wrote:
>
>> I am still not having success. That is, I get a response code that
>> suggests that a record is created but it is not showing up in search.
>>
>> I was mainly testing against core.collectionspace.org and using the
>> reported Local Persons person authority ID. I found it with this method:
>>
>> http://core.collectionspace.org/cspace-services/personauthorities
>>
>> and the relevant result seems to be:
>>
>> <list-item>
>> <csid>*2937e6b9-8ec6-4e0f-b45a*</csid>
>> <uri>/personauthorities/2937e6b9-8ec6-4e0f-b45a</uri>
>> <refName>
>> urn:cspace:core.collectionspace.org:personauthorities:name(person)'Local
>> Persons'
>> </refName>
>> <updatedAt>2016-04-08T18:52:26.094Z</updatedAt>
>> <workflowState>project</workflowState>
>> <shortIdentifier>person</shortIdentifier>
>> <displayName>Local Persons</displayName>
>> </list-item>
>>
>> The XML I am trying to send is:
>>
>> <?xml version="1.0" encoding="utf-8" ?>
>> <imports>
>> <import seq="1" service="Persons" type="Person">
>> <document name="persons">
>> <schema xmlns:persons_common="
>> http://collectionspace.org/services/person" name="persons_common">
>> <inAuthority>*2937e6b9-8ec6-4e0f-b45a*</inAuthority>
>> <shortIdentifier>huangjunbi</shortIdentifier>
>> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang
>> Junbi 黃君壁'</refName>
>> <personTermGroupList>
>> <personTermGroup>
>> <termType>urn:cspace:core.collectionspace.org:
>> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>> <termLanguage>urn:cspace:core.collectionspace.org:
>> vocabularies:name(languages):item:name(eng)'English'</termLanguage>
>> <termDisplayName>Huang Junbi</termDisplayName>
>> <surName>Huang</surName>
>> <foreName>Junbi</foreName>
>> <termSource></termSource>
>> <termSourceID></termSourceID>
>> </personTermGroup>
>> <personTermGroup>
>> <termType>urn:cspace:core.collectionspace.org:
>> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>> <termLanguage>urn:cspace:core.collectionspace.org:
>> vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
>> <termDisplayName>黃君壁</termDisplayName>
>> <surName>黃</surName>
>> <foreName>君壁</foreName>
>> <termSource></termSource>
>> <termSourceID></termSourceID>
>> </personTermGroup>
>> </personTermGroupList>
>> <birthDateGroup>
>> <dateLatestYear></dateLatestYear>
>> </birthDateGroup>
>> <deathDateGroup>
>> <dateLatestYear></dateLatestYear>
>> </deathDateGroup>
>> </schema>
>> </document>
>> </import>
>> </imports>
>>
>> Note that I have modified to <schema> as suggested. When I send the XML
>> payload to the server with this method (is it correct?) I get a response
>> code that indicates that a record was sent. However, it is not showing up
>> in search as I though tit would.
>>
>> $ curl -X POST '
>> http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items'
>> -i -u admin@core.collectionspace.org:Administrator -H "Content-Type:
>> application/xml " -T testperson.xml
>>
>> HTTP/1.1 100 Continue
>>
>> *HTTP/1.1 201 Created*
>> Server: Apache-Coyote/1.1
>> Location:
>> http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/bee20f53-4ffb-4751-a727
>> Set-Cookie: JSESSIONID=4E542E1C6CAF477ABDC72AD64EA06962;
>> Path=/cspace-services/; HttpOnly
>> Content-Length: 0
>> Date: Tue, 14 Jun 2016 05:28:41 GMT
>>
>> I suppose that if I can get one working, I can send larger numbers of
>> values at once, perhaps even the 800 people at once. However, there is
>> some little thing that is not working.
>>
>> I have also tried this on my local installation, with the corresponding
>> inAuthority number retrieved from that system. Again it claims to create
>> it but nothing can be found in search.
>>
>> The XML returned from this URL provided in the response code has
>> essentially empty elements, none of the data I provided.
>>
>>
>> http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/bee20f53-4ffb-4751-a727
>>
>> Perhaps someone reading has a suggestion of a mistake in my XML or
>> methods.
>>
>> James D. Keeline
>>
>> ------------------------------
>> *From:* Aron Roberts <aron@socrates.berkeley.edu>
>> *To:* James Keeline <james@keeline.com>
>> *Cc:* Talk <talk@lists.collectionspace.org>; Chris Hoffman <
>> chris_h@berkeley.edu>
>> *Sent:* Monday, June 13, 2016 7:21 PM
>> *Subject:* Re: [Talk] XML payload with multiple people
>>
>> Have also experienced a display oddity - in the record titlebar, in the
>> dropdown menu below autocomplete fields, and in the Terms Used sidebar
>> (screenshot attached) - when using the Import service to import a Person
>> record whose refName display name contains Chinese characters (with or
>> without parens, square brackets, etc.):
>>
>> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang
>> Junbi (黃君壁)'</refName>
>>
>> If you see the same thing, we can file a bug if one doesn't already exist
>> ... and for now, perhaps avoid adding those?
>>
>> On Mon, Jun 13, 2016 at 6:03 PM, Aron Roberts <aron@socrates.berkeley.edu
>> > wrote:
>>
>> > Sometimes it feels like these processes are just a bit more technical
>> than they need to be. Perhaps it is necessary but there are a lot of
>> details which must be just right for success.
>>
>> D'accord.
>>
>> Import, in particular, is rather finicky. For sheer speed - since imports
>> can be quite large and performance is of the essence - the import service
>> is interacting in a fairly raw way with the Nuxeo enterprise content
>> management system that underlies CollectionSpace, in a manner that mostly
>> bypasses the CollectionSpace framework.
>>
>> 1. One thing I observed in the import payload:
>>
>> <document name="persons">
>> <ns2:persons_common xmlns:ns2="
>> http://collectionspace.org/services/person"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>> ...
>> </ns2:persons_common>
>> </document>
>>
>> (These two elements appear in the payloads that are produced and consumed
>> when interacting with CollectionSpace via most of its Services REST API ...)
>>
>> Whereas for the Import service, the corresponding *single* element at
>> this same level of the payload might instead be <schema ...> (AIUI due to
>> the 'bypass' mentioned above):
>>
>> <schema xmlns:persons_common="
>> http://collectionspace.org/services/person" name="persons_common">
>> ...
>> </schema>
>>
>> 2. As well, as mentioned in the brief convo between Chris and myself
>> earlier, it appears the refName element (field) is required, when importing
>> an authority term via the Import service.
>>
>> 3. If you replace the two elements above with the <schema...> element
>> here, and add the refName, perhaps the import will succeed?
>>
>> The following payload just imported successfully for me on
>> qa.collectionspace.org (after substituting QA's "Local Persons" value in
>> the inAuthority field for the one you're using with your own server, below).
>>
>> <?xml version="1.0" encoding="utf-8" ?>
>> <imports>
>> <import seq="1" service="Persons" type="Person">
>> <schema xmlns:persons_common="
>> http://collectionspace.org/services/person" name="persons_common">
>> <inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
>> <shortIdentifier>huangjunbi</shortIdentifier>
>> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang
>> Junbi (黃君壁)'</refName>
>>
>> <personTermGroupList>
>> <personTermGroup>
>> <termType>urn:cspace:core.collectionspace.org:
>> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>> <termLanguage>urn:cspace:core.collectionspace.org:
>> vocabularies:name(languages):item:name(eng)'English'</termLanguage>
>> <termDisplayName>Huang Junbi</termDisplayName>
>> <surName>Huang</surName>
>> <foreName>Junbi</foreName>
>> <termSource></termSource>
>> <termSourceID></termSourceID>
>> </personTermGroup>
>> <personTermGroup>
>> <termType>urn:cspace:core.collectionspace.org:
>> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>> <termLanguage>urn:cspace:core.collectionspace.org:
>> vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
>> <termDisplayName>黃君壁</termDisplayName>
>> <surName>黃</surName>
>> <foreName>君壁</foreName>
>> <termSource></termSource>
>> <termSourceID></termSourceID>
>> </personTermGroup>
>> </personTermGroupList>
>> <birthDateGroup>
>> <dateLatestYear></dateLatestYear>
>> </birthDateGroup>
>> <deathDateGroup>
>> <dateLatestYear></dateLatestYear>
>> </deathDateGroup>
>> </schema>
>> </import>
>> </imports>
>>
>> The resulting record can be viewed at:
>>
>>
>> https://qa.collectionspace.org/collectionspace/ui/core/html/person.html?csid=7606204f-67ee-4e1f-8a2e-451683c8ff03&vocab=person
>>
>> Aron
>>
>> On Mon, Jun 13, 2016 at 5:25 PM, James Keeline <james@keeline.com> wrote:
>>
>> I have seen the messages since my last inquiry and I need to read them
>> carefully. I understand now how to "get" the unique ID for the
>> *inAuthority* value.
>>
>> According to this (
>> http://core.collectionspace.org:8180/cspace-services/personauthorities )
>> there are several person authorities but the local person authority seems
>> to have an ID of:
>>
>> <list-item>
>> <csid>*2937e6b9-8ec6-4e0f-b45a*</csid>
>> <uri>/personauthorities/2937e6b9-8ec6-4e0f-b45a</uri>
>> <refName>
>> urn:cspace:core.collectionspace.org:personauthorities:name(person)'Local
>> Persons'
>> </refName>
>> <updatedAt>2016-04-08T18:52:26.094Z</updatedAt>
>> <workflowState>project</workflowState>
>> <shortIdentifier>person</shortIdentifier>
>> <displayName>Local Persons</displayName>
>> </list-item>
>>
>> This is what I sent to core.collectionspace.org as a test with
>> additional fields. It says it was created but it does not show up on a
>> search.
>>
>> <?xml version="1.0" encoding="utf-8" ?>
>> <imports>
>> <import seq="1" service="Persons" type="Person">
>> <document name="persons">
>> <ns2:persons_common xmlns:ns2="
>> http://collectionspace.org/services/person"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>> <inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
>> <shortIdentifier>huangjunbi</shortIdentifier>
>> <personTermGroupList>
>> <personTermGroup>
>> <termType>urn:cspace:core.collectionspace.org:
>> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>> <termLanguage>urn:cspace:core.collectionspace.org:
>> vocabularies:name(languages):item:name(eng)'English'</termLanguage>
>> <termDisplayName>Huang Junbi</termDisplayName>
>> <surName>Huang</surName>
>> <foreName>Junbi</foreName>
>> <termSource></termSource>
>> <termSourceID></termSourceID>
>> </personTermGroup>
>> <personTermGroup>
>> <termType>urn:cspace:core.collectionspace.org:
>> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>> <termLanguage>urn:cspace:core.collectionspace.org:
>> vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
>> <termDisplayName>黃君壁</termDisplayName>
>> <surName>黃</surName>
>> <foreName>君壁</foreName>
>> <termSource></termSource>
>> <termSourceID></termSourceID>
>> </personTermGroup>
>> </personTermGroupList>
>> <birthDateGroup>
>> <dateLatestYear></dateLatestYear>
>> </birthDateGroup>
>> <deathDateGroup>
>> <dateLatestYear></dateLatestYear>
>> </deathDateGroup>
>> </ns2:persons_common>
>> </document>
>> </import>
>> </imports>
>>
>> Perhaps this is related to my inAuthority value being different/wrong. I
>> tried sending to the "found" csid value but it still does not show up under
>> search. These are the response codes for the two attempts with the old ID
>> and the found one:
>>
>> jameskesmacbook:BPOC keeline$ curl -X POST '
>> http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items'
>> -i -u admin@core.collectionspace.org:Administrator -H "Content-Type:
>> application/xml " -T testperson.xml
>> HTTP/1.1 100 Continue
>>
>> HTTP/1.1 201 Created
>> Server: Apache-Coyote/1.1
>> Location:
>> http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/85b329e4-0d14-48f3-9365
>> Set-Cookie: JSESSIONID=E2A4F02670F864DDE3A5D4517B7A36A2;
>> Path=/cspace-services/; HttpOnly
>> Content-Length: 0
>> Date: Tue, 14 Jun 2016 00:05:43 GMT
>>
>> jameskesmacbook:BPOC keeline$ curl -X POST '
>> http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items'
>> -i -u admin@core.collectionspace.org:Administrator -H "Content-Type:
>> application/xml " -T testperson.xml
>> HTTP/1.1 100 Continue
>>
>> HTTP/1.1 201 Created
>> Server: Apache-Coyote/1.1
>> Location:
>> http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/18394f8b-00c4-40d2-a256
>> Set-Cookie: JSESSIONID=A5405E5A665EE6375E295A27E4DD53B4;
>> Path=/cspace-services/; HttpOnly
>> Content-Length: 0
>> Date: Tue, 14 Jun 2016 00:17:26 GMT
>>
>> I'm using a PHP script to generate the XML so if there is a snippet to
>> extract the correct value into a variable, I will include that. I can
>> probably parse through it with some regex but I'll bet there's a better way
>> if anyone knows it.
>>
>> Sometimes it feels like these processes are just a bit more technical
>> than they need to be. Perhaps it is necessary but there are a lot of
>> details which must be just right for success.
>>
>> James D. Keeline
>>
>> ------------------------------
>> *From:* Aron Roberts <aron@socrates.berkeley.edu>
>> *To:* James Keeline <james@keeline.com>
>> *Cc:* Talk <talk@lists.collectionspace.org>; Chris Hoffman <
>> chris_h@berkeley.edu>
>> *Sent:* Monday, June 13, 2016 5:08 PM
>>
>> *Subject:* Re: [Talk] XML payload with multiple people
>>
>> BTW, there was a typo in the sample payload in a previous note: this
>> should have read <import service="Persons" type="Person"> (note: first
>> attribute value is now plural) rather than: <import service="Person"
>> type="Person">.
>>
>> The (corrected) example payload:
>>
>> <?xml version="1.0" encoding="utf-8"?>
>> <imports>
>> <import service="Persons" type="Person">
>> <schema xmlns:persons_common="
>> http://collectionspace.org/services/person" name="persons_common">
>> <personTermGroupList>
>> <personTermGroup>
>> <termDisplayName>Zelda C. Dobbs</termDisplayName>
>> </personTermGroup>
>> </personTermGroupList>
>> <shortIdentifier>ZedaCDobbs</shortIdentifier>
>> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(ZeldaCDobbs)'ZeldaC.
>> Dobbs'</refName>
>> <inAuthority>4b5cd4b4-9776-48e1-9258</inAuthority>
>> </schema>
>> </import>
>> <import service="Persons" type="Person">
>> <!-- Another record goes here ... -->
>> </import>
>> </imports>
>>
>> The section "How to find the service and type values" in the Imports
>> Service Home document,
>> https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Howtofindtheserviceandtypevalues,
>> describes how to find and enter the right values for those
>> two attributes, in the <import service="something_here"
>> type="something_else_here"> elements.
>>
>> Aron
>>
>>
>> On Mon, Jun 13, 2016 at 4:54 PM, Aron Roberts <aron@socrates.berkeley.edu
>> > wrote:
>>
>> Good questions, Chris!
>>
>> About an hour ago, I test-imported a couple of Person records lacking
>> a refName and shortidentifier. It looks like an 'ID' form of the refName
>> was auto-created for
>> those records; e.g.:
>> urn:cspace:core.collectionspace.org:
>> persons:id(dbbf8c78-6c4e-470b-8765-b07ba73ff9a4)
>>
>> And when listing all Person records, following that import, the following
>> services error occurred:
>>
>> ERROR ...
>> [org.collectionspace.services.common.vocabulary.RefNameServiceUtils:527]
>> Could not retrieve a list of documents referring to the specified
>> authority item
>> java.lang.IllegalArgumentException: Malformed refName for AuthorityTerm
>> (too few tokens)
>>
>> This might yet reflect pilot error on my part, but this at least suggests
>> a need
>> to supply values for one or both of those fields in the import payload.
>>
>> On Mon, Jun 13, 2016 at 4:40 PM, Chris Hoffman <chris_h@berkeley.edu>
>> wrote:
>>
>> Thanks, Aron, for this better example!
>>
>> Do you know if the refname and shortidentifier elements are still needed
>> by the import service? I don’t see them listed in the schema needed via
>> the Rest API
>> <https://wiki.collectionspace.org/display/DOC/Person+Service+REST+APIs#PersonServiceRESTAPIs-Personinstanceschema>
>>
>> But maybe they are still needed for the import service.
>>
>> Thanks
>> Chris
>>
>>
>> On Jun 13, 2016, at 4:34 PM, Aron Roberts <aron@socrates.berkeley.edu>
>> wrote:
>>
>> Hi James,
>>
>> Sounds good. Note that these examples are for *authority* records,
>> not for the records for terms *within* an authority, which may be what
>> you're planning to add here.
>>
>> (Note to self and colleagues: we *really* need to add the latter
>> examples
>> to this doc.)
>>
>> One thing you'll need to be aware of, when importing authority term
>> records
>> (i.e. the items within a particular authority/vocabulary), the
>> 'inAuthority' field
>> must be present in each such record and must reference an extant parent
>> authority. This associates the term with the relevant (parent) authority.
>>
>> In the example below, when importing one or more persons terms into,
>> say, the "Local Persons" authority, the inAuthority field here contains
>> the
>> unique ID ("CSID") of that authority in the relevant CollectionSpace
>> system,
>> 4b5cd4b4-9776-48e1-9258, in this instance. (You can find that CSID via a
>> request to http://host:port/cspace-services/personauthorities)
>>
>> <?xml version="1.0" encoding="utf-8"?>
>> <imports>
>> <import service="Person" type="Person">
>> <schema xmlns:persons_common="
>> http://collectionspace.org/services/person" name="persons_common">
>> <personTermGroupList>
>> <personTermGroup>
>> <termDisplayName>Zelda C. Dobbs</termDisplayName>
>> </personTermGroup>
>> </personTermGroupList>
>> <shortIdentifier>ZedaCDobbs</shortIdentifier>
>> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(ZeldaCDobbs)'ZeldaC.
>> Dobbs'</refName>
>> <inAuthority>4b5cd4b4-9776-48e1-9258</inAuthority>
>> </schema>
>> </import>
>> <import service="Person" type="Person">
>> <!-- Another record goes here ... -->
>> </import>
>> </imports>
>>
>> Aron
>>
>> On Mon, Jun 13, 2016 at 3:54 PM, James Keeline <james@keeline.com> wrote:
>>
>> I think I will try to emulate the one on Aron's first link to my inquiry:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <imports>
>> <import seq="1" service="Personauthorities" type="Personauthority">
>> <schema xmlns:personauthorities_common="
>> http://collectionspace.org/services/person"
>> <http://collectionspace.org/services/person> name=
>> "personauthorities_common">
>> <personauthorities_common:displayName>American Poets</
>> personauthorities_common:displayName>
>> <personauthorities_common:shortIdentifier>americanpoets</
>> personauthorities_common:shortIdentifier>
>> <personauthorities_common:vocabType>PersonAuthority</
>> personauthorities_common:vocabType>
>> <personauthorities_common:refName
>> >urn:cspace:core.collectionspace.org:Personauthorities:name(americanpoets)'American
>> Poets'</personauthorities_common:refName>
>> </schema>
>> </import>
>> <import seq="2" service="Personauthorities" type="Personauthority"
>> CSID="11111111-2222-3333-4444-123456789012">
>> <schema xmlns:personauthorities_common="
>> http://collectionspace.org/services/person"
>> <http://collectionspace.org/services/person> name=
>> "personauthorities_common">
>> <personauthorities_common:displayName>French Poets</
>> personauthorities_common:displayName>
>> <personauthorities_common:shortIdentifier>frenchpoets</
>> personauthorities_common:shortIdentifier>
>> <personauthorities_common:vocabType>PersonAuthority</
>> personauthorities_common:vocabType>
>> <personauthorities_common:refName
>> >urn:cspace:core.collectionspace.org:Personauthorities:name(frenchpoets)'French
>> Poets'</personauthorities_common:refName>
>> </schema>
>> </import>
>> </imports>
>>
>> I'm not adding multiple person authorities so I'll have to use some of
>> your suggestion as well. I will report back on its efficacy.
>>
>> This is an example of the kind of person record I will be including in
>> the larger document:
>>
>> <?xml version="1.0" encoding="utf-8"?>
>> <document name="persons">
>> <ns2:persons_common xmlns:ns2="
>> http://collectionspace.org/services/person" xmlns:xsi="
>> http://www.w3.org/2001/XMLSchema-instance">
>> <inAuthority>*e5c217c5-26ad-4289-b778*</inAuthority>
>> <personTermGroupList>
>> <personTermGroup>
>> <termType>urn:cspace:core.collectionspace.org:
>> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>> <termLanguage>urn:cspace:core.collectionspace.org:
>> vocabularies:name(languages):item:name(eng)'English'</termLanguage>
>> <termDisplayName>Chiang Kai-shek</termDisplayName>
>> <surName>Chiang</surName>
>> <foreName>Kai-shek</foreName>
>> </personTermGroup>
>> <personTermGroup>
>> <termType>urn:cspace:core.collectionspace.org:
>> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>> <termLanguage>urn:cspace:core.collectionspace.org:
>> vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
>> <termDisplayName>蔣介石</termDisplayName>
>> <surName>蔣</surName>
>> <foreName>介石</foreName>
>> </personTermGroup>
>> </personTermGroupList>
>> </ns2:persons_common>
>> </document>
>>
>>
>> This worked against core.collectionspace.org. There are a couple fields
>> to add to this payload.
>>
>> I think though that I might wish to define the short-name so that I can
>> use a known value for the object records.
>>
>> I'm always a bit concerned about supplying the right unique IDs for
>> something like the inAuthority field. Any thoughts? It is also not clear
>> to me why the second block of data in the Person Authorities example at the
>> top has a unique ID (admittedly contrived) but the first one does not.
>> _____
>>
>> Thank you both for your prompt help to this and my other inquiries.
>>
>> James D. Keeline
>>
>> ------------------------------
>> *From:* Chris Hoffman <chris_h@berkeley.edu>
>> *To:* Aron Roberts <aron@socrates.berkeley.edu>
>> *Cc:* James Keeline <james@keeline.com>; Talk <
>> talk@lists.collectionspace.org>
>> *Sent:* Monday, June 13, 2016 3:03 PM
>> *Subject:* Re: [Talk] XML payload with multiple people
>>
>> Hi James,
>>
>> Your typical import document is set up to support submitting multiple
>> records at once. If I recall correctly, the whole document is wrapped in
>> <imports></imports>. Within that you can have any number of
>> <import></import> blocks, each of which represents one person record that
>> you want to create. In practice, we’ve found that we can really only
>> submit 5K records per batch. Otherwise we’ve had timeouts and other very
>> nasty behaviors. Here’s an example with the top level elements for
>> creating 3 records.
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>>
>> <imports>
>> <import service="Persons" type="Person”>
>> ...
>> </import>
>> <import service="Persons" type="Person”>
>> ...
>> </import>
>> <import service="Persons" type="Person”>
>> ...
>> </import>
>> </imports>
>>
>>
>> I hope this helps,
>> Chris
>>
>> On Jun 13, 2016, at 12:04 PM, Aron Roberts <aron@socrates.berkeley.edu>
>> wrote:
>>
>> And this is also (somewhat) helpful, as you branch out from Person
>> authority records to other record types:
>>
>>
>> https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Howtodeterminethecorrectvaluestoputintoan%22/imports/import/schema%22element
>> :
>>
>> On Mon, Jun 13, 2016 at 12:02 PM, Aron Roberts <
>> aron@socrates.berkeley.edu> wrote:
>>
>> One possible starting place:
>>
>>
>> https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-ExampleRequest
>>
>> On Mon, Jun 13, 2016 at 11:29 AM, James Keeline <james@keeline.com>
>> wrote:
>>
>> I wish to import multiple people (authors, artists). I can make a single
>> XML payload.
>>
>> It seems to me that one can send multiple at once. What is the element
>> format for this?
>>
>> James D. Keeline
>>
>>
>> _______________________________________________
>> Talk mailing list
>> Talk@lists.collectionspace.org
>>
>> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
>>
>>
>>
>>
>> _______________________________________________
>> Talk mailing list
>> Talk@lists.collectionspace.org
>>
>> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
>>
>>
>>
>>
>>
>> _______________________________________________
>> Talk mailing list
>> Talk@lists.collectionspace.org
>>
>> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> Talk mailing list
>> Talk@lists.collectionspace.org
>>
>> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
>>
>>
>
SS
Susan STONE
Tue, Jun 14, 2016 7:00 AM
Aron,
Unless it has changed back again, the collectionspace_core part is needed
in an import though it wasn't originally.
Susan
On Mon, Jun 13, 2016 at 11:56 PM, Aron Roberts aron@socrates.berkeley.edu
wrote:
There's some possible confusion (which I missed seeing in your earlier
email) between:
-
Importing records, via the Imports service. (This is the method
generally used when bulk importing hundreds or thousands of records.)
-
Creating a record, by POSTing to the relevant person authority via the
Services REST API.
These use subtly different payloads, an artifact resulting from the fact
that the Imports service bypasses most of the Services framework and talks
more or less directly to Nuxeo, which expects to encounter its own payload
format.
The payload included in an earlier message, repeated below with a few
trivial tweaks (uppercasing UTF-8 as per W3C doc conventions, removing the
'seq=1' attribute, removing empty repeatable groups), should likely work
for you method 1, calling the Imports service, via either of the following
formats:
https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Sendingtherequest
<?xml version="1.0" encoding="UTF-8" ?>
<imports>
<import service="Persons" type="Person">
<schema xmlns:persons_common="
http://collectionspace.org/services/person" name="persons_common">
<inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
<shortIdentifier>huangjunbi</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang
Junbi (黃君壁)'</refName>
<personTermGroupList>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(eng)'English'</termLanguage>
<termDisplayName>Huang Junbi</termDisplayName>
<surName>Huang</surName>
<foreName>Junbi</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
<termDisplayName>黃君壁</termDisplayName>
<surName>黃</surName>
<foreName>君壁</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
</personTermGroupList>
</schema>
</import>
</imports>
If you're going to be using method 2, POSTing an individual record via
the Services REST APIs, via a call like:
$ curl -X POST '
http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items'
-i -u admin@core.collectionspace.org:Administrator -H "Content-Type:
application/xml " -T testperson.xml
Then your payload will start with something similar to this:
<?xml version="1.0" encoding="UTF-8"?>
<document name="persons">
<ns2:persons_common xmlns:ns2="
http://collectionspace.org/services/person">
...
Rather than the Import payload's preamble:
<?xml version="1.0" encoding="UTF-8" ?>
<imports>
<import service="Persons" type="Person">
<schema xmlns:persons_common="
http://collectionspace.org/services/person" name="persons_common">
...
I don't believe the CollectionSpace 'core' schema part needs to be
included; that this part will get automatically created by CollectionSpace
when you POST. But this is all from memory, since I'm currently away from
access to my past working examples of Person authority term payloads.
Aron
On Mon, Jun 13, 2016 at 11:32 PM, Susan STONE sstone@berkeley.edu wrote:
James,
I think you are missing the collectionspace_core part of the import
record (in addition to the persons_common part) , e.g. (these are not your
values but pasted in from something I have):
<schema name="collectionspace_core" xmlns:collectionspace_core="
http://collectionspace.org/collectionspace_core/">
<collectionspace_core:uri>/personauthorities/82d438d8-da87-4479-9b68/items/b6ac65f6-7f9d-4dc4-9a18-641e4de1cf65</collectionspace_core:uri>
<collectionspace_core:refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(p224)'A.
Smith'</collectionspace_core:refName>
</schema>
Susan
On Mon, Jun 13, 2016 at 10:38 PM, James Keeline james@keeline.com
wrote:
I am still not having success. That is, I get a response code that
suggests that a record is created but it is not showing up in search.
I was mainly testing against core.collectionspace.org and using the
reported Local Persons person authority ID. I found it with this method:
http://core.collectionspace.org/cspace-services/personauthorities
and the relevant result seems to be:
<list-item>
<csid>*2937e6b9-8ec6-4e0f-b45a*</csid>
<uri>/personauthorities/2937e6b9-8ec6-4e0f-b45a</uri>
<refName>
urn:cspace:core.collectionspace.org:personauthorities:name(person)'Local
Persons'
</refName>
<updatedAt>2016-04-08T18:52:26.094Z</updatedAt>
<workflowState>project</workflowState>
<shortIdentifier>person</shortIdentifier>
<displayName>Local Persons</displayName>
</list-item>
The XML I am trying to send is:
<?xml version="1.0" encoding="utf-8" ?>
<imports>
<import seq="1" service="Persons" type="Person">
<document name="persons">
<schema xmlns:persons_common="
http://collectionspace.org/services/person" name="persons_common">
<inAuthority>*2937e6b9-8ec6-4e0f-b45a*</inAuthority>
<shortIdentifier>huangjunbi</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang
Junbi 黃君壁'</refName>
<personTermGroupList>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(eng)'English'</termLanguage>
<termDisplayName>Huang Junbi</termDisplayName>
<surName>Huang</surName>
<foreName>Junbi</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
<termDisplayName>黃君壁</termDisplayName>
<surName>黃</surName>
<foreName>君壁</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
</personTermGroupList>
<birthDateGroup>
<dateLatestYear></dateLatestYear>
</birthDateGroup>
<deathDateGroup>
<dateLatestYear></dateLatestYear>
</deathDateGroup>
</schema>
</document>
</import>
</imports>
Note that I have modified to <schema> as suggested. When I send the XML
payload to the server with this method (is it correct?) I get a response
code that indicates that a record was sent. However, it is not showing up
in search as I though tit would.
$ curl -X POST '
http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items'
-i -u admin@core.collectionspace.org:Administrator -H "Content-Type:
application/xml " -T testperson.xml
HTTP/1.1 100 Continue
HTTP/1.1 201 Created
Server: Apache-Coyote/1.1
Location:
http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/bee20f53-4ffb-4751-a727
Set-Cookie: JSESSIONID=4E542E1C6CAF477ABDC72AD64EA06962;
Path=/cspace-services/; HttpOnly
Content-Length: 0
Date: Tue, 14 Jun 2016 05:28:41 GMT
I suppose that if I can get one working, I can send larger numbers of
values at once, perhaps even the 800 people at once. However, there is
some little thing that is not working.
I have also tried this on my local installation, with the corresponding
inAuthority number retrieved from that system. Again it claims to create
it but nothing can be found in search.
The XML returned from this URL provided in the response code has
essentially empty elements, none of the data I provided.
http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/bee20f53-4ffb-4751-a727
Perhaps someone reading has a suggestion of a mistake in my XML or
methods.
James D. Keeline
From: Aron Roberts aron@socrates.berkeley.edu
To: James Keeline james@keeline.com
Cc: Talk talk@lists.collectionspace.org; Chris Hoffman <
chris_h@berkeley.edu>
Sent: Monday, June 13, 2016 7:21 PM
Subject: Re: [Talk] XML payload with multiple people
Have also experienced a display oddity - in the record titlebar, in the
dropdown menu below autocomplete fields, and in the Terms Used sidebar
(screenshot attached) - when using the Import service to import a Person
record whose refName display name contains Chinese characters (with or
without parens, square brackets, etc.):
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang
Junbi (黃君壁)'</refName>
If you see the same thing, we can file a bug if one doesn't already
exist ... and for now, perhaps avoid adding those?
On Mon, Jun 13, 2016 at 6:03 PM, Aron Roberts <
aron@socrates.berkeley.edu> wrote:
Sometimes it feels like these processes are just a bit more technical
than they need to be. Perhaps it is necessary but there are a lot of
details which must be just right for success.
D'accord.
Import, in particular, is rather finicky. For sheer speed - since
imports can be quite large and performance is of the essence - the import
service is interacting in a fairly raw way with the Nuxeo enterprise
content management system that underlies CollectionSpace, in a manner that
mostly bypasses the CollectionSpace framework.
-
One thing I observed in the import payload:
<document name="persons">
<ns2:persons_common xmlns:ns2="
http://collectionspace.org/services/person"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
...
</ns2:persons_common>
</document>
(These two elements appear in the payloads that are produced and
consumed when interacting with CollectionSpace via most of its Services
REST API ...)
Whereas for the Import service, the corresponding single element at
this same level of the payload might instead be <schema ...> (AIUI due to
the 'bypass' mentioned above):
<schema xmlns:persons_common="
http://collectionspace.org/services/person" name="persons_common">
...
</schema>
-
As well, as mentioned in the brief convo between Chris and myself
earlier, it appears the refName element (field) is required, when importing
an authority term via the Import service.
-
If you replace the two elements above with the <schema...> element
here, and add the refName, perhaps the import will succeed?
The following payload just imported successfully for me on
qa.collectionspace.org (after substituting QA's "Local Persons" value
in the inAuthority field for the one you're using with your own server,
below).
<?xml version="1.0" encoding="utf-8" ?>
<imports>
<import seq="1" service="Persons" type="Person">
<schema xmlns:persons_common="
http://collectionspace.org/services/person" name="persons_common">
<inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
<shortIdentifier>huangjunbi</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang
Junbi (黃君壁)'</refName>
<personTermGroupList>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(eng)'English'</termLanguage>
<termDisplayName>Huang Junbi</termDisplayName>
<surName>Huang</surName>
<foreName>Junbi</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
<termDisplayName>黃君壁</termDisplayName>
<surName>黃</surName>
<foreName>君壁</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
</personTermGroupList>
<birthDateGroup>
<dateLatestYear></dateLatestYear>
</birthDateGroup>
<deathDateGroup>
<dateLatestYear></dateLatestYear>
</deathDateGroup>
</schema>
</import>
</imports>
The resulting record can be viewed at:
https://qa.collectionspace.org/collectionspace/ui/core/html/person.html?csid=7606204f-67ee-4e1f-8a2e-451683c8ff03&vocab=person
Aron
On Mon, Jun 13, 2016 at 5:25 PM, James Keeline james@keeline.com
wrote:
I have seen the messages since my last inquiry and I need to read them
carefully. I understand now how to "get" the unique ID for the
inAuthority value.
According to this (
http://core.collectionspace.org:8180/cspace-services/personauthorities )
there are several person authorities but the local person authority seems
to have an ID of:
<list-item>
<csid>*2937e6b9-8ec6-4e0f-b45a*</csid>
<uri>/personauthorities/2937e6b9-8ec6-4e0f-b45a</uri>
<refName>
urn:cspace:core.collectionspace.org:personauthorities:name(person)'Local
Persons'
</refName>
<updatedAt>2016-04-08T18:52:26.094Z</updatedAt>
<workflowState>project</workflowState>
<shortIdentifier>person</shortIdentifier>
<displayName>Local Persons</displayName>
</list-item>
This is what I sent to core.collectionspace.org as a test with
additional fields. It says it was created but it does not show up on a
search.
<?xml version="1.0" encoding="utf-8" ?>
<imports>
<import seq="1" service="Persons" type="Person">
<document name="persons">
<ns2:persons_common xmlns:ns2="
http://collectionspace.org/services/person"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
<shortIdentifier>huangjunbi</shortIdentifier>
<personTermGroupList>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(eng)'English'</termLanguage>
<termDisplayName>Huang Junbi</termDisplayName>
<surName>Huang</surName>
<foreName>Junbi</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
<termDisplayName>黃君壁</termDisplayName>
<surName>黃</surName>
<foreName>君壁</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
</personTermGroupList>
<birthDateGroup>
<dateLatestYear></dateLatestYear>
</birthDateGroup>
<deathDateGroup>
<dateLatestYear></dateLatestYear>
</deathDateGroup>
</ns2:persons_common>
</document>
</import>
</imports>
Perhaps this is related to my inAuthority value being different/wrong.
I tried sending to the "found" csid value but it still does not show up
under search. These are the response codes for the two attempts with the
old ID and the found one:
jameskesmacbook:BPOC keeline$ curl -X POST '
http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items'
-i -u admin@core.collectionspace.org:Administrator -H "Content-Type:
application/xml " -T testperson.xml
HTTP/1.1 100 Continue
HTTP/1.1 201 Created
Server: Apache-Coyote/1.1
Location:
http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/85b329e4-0d14-48f3-9365
Set-Cookie: JSESSIONID=E2A4F02670F864DDE3A5D4517B7A36A2;
Path=/cspace-services/; HttpOnly
Content-Length: 0
Date: Tue, 14 Jun 2016 00:05:43 GMT
jameskesmacbook:BPOC keeline$ curl -X POST '
http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items'
-i -u admin@core.collectionspace.org:Administrator -H "Content-Type:
application/xml " -T testperson.xml
HTTP/1.1 100 Continue
HTTP/1.1 201 Created
Server: Apache-Coyote/1.1
Location:
http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/18394f8b-00c4-40d2-a256
Set-Cookie: JSESSIONID=A5405E5A665EE6375E295A27E4DD53B4;
Path=/cspace-services/; HttpOnly
Content-Length: 0
Date: Tue, 14 Jun 2016 00:17:26 GMT
I'm using a PHP script to generate the XML so if there is a snippet to
extract the correct value into a variable, I will include that. I can
probably parse through it with some regex but I'll bet there's a better way
if anyone knows it.
Sometimes it feels like these processes are just a bit more technical
than they need to be. Perhaps it is necessary but there are a lot of
details which must be just right for success.
James D. Keeline
From: Aron Roberts aron@socrates.berkeley.edu
To: James Keeline james@keeline.com
Cc: Talk talk@lists.collectionspace.org; Chris Hoffman <
chris_h@berkeley.edu>
Sent: Monday, June 13, 2016 5:08 PM
Subject: Re: [Talk] XML payload with multiple people
BTW, there was a typo in the sample payload in a previous note: this
should have read <import service="Persons" type="Person"> (note: first
attribute value is now plural) rather than: <import service="Person"
type="Person">.
The (corrected) example payload:
<?xml version="1.0" encoding="utf-8"?>
<imports>
<import service="Persons" type="Person">
<schema xmlns:persons_common="
http://collectionspace.org/services/person" name="persons_common">
<personTermGroupList>
<personTermGroup>
<termDisplayName>Zelda C. Dobbs</termDisplayName>
</personTermGroup>
</personTermGroupList>
<shortIdentifier>ZedaCDobbs</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(ZeldaCDobbs)'ZeldaC.
Dobbs'</refName>
<inAuthority>4b5cd4b4-9776-48e1-9258</inAuthority>
</schema>
</import>
<import service="Persons" type="Person">
<!-- Another record goes here ... -->
</import>
</imports>
The section "How to find the service and type values" in the Imports
Service Home document,
https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Howtofindtheserviceandtypevalues,
describes how to find and enter the right values for those
two attributes, in the <import service="something_here"
type="something_else_here"> elements.
Aron
On Mon, Jun 13, 2016 at 4:54 PM, Aron Roberts <
aron@socrates.berkeley.edu> wrote:
Good questions, Chris!
About an hour ago, I test-imported a couple of Person records lacking
a refName and shortidentifier. It looks like an 'ID' form of the refName
was auto-created for
those records; e.g.:
urn:cspace:core.collectionspace.org:
persons:id(dbbf8c78-6c4e-470b-8765-b07ba73ff9a4)
And when listing all Person records, following that import, the
following services error occurred:
ERROR ...
[org.collectionspace.services.common.vocabulary.RefNameServiceUtils:527]
Could not retrieve a list of documents referring to the specified
authority item
java.lang.IllegalArgumentException: Malformed refName for AuthorityTerm
(too few tokens)
This might yet reflect pilot error on my part, but this at least
suggests a need
to supply values for one or both of those fields in the import payload.
On Mon, Jun 13, 2016 at 4:40 PM, Chris Hoffman chris_h@berkeley.edu
wrote:
Thanks, Aron, for this better example!
Do you know if the refname and shortidentifier elements are still needed
by the import service? I don’t see them listed in the schema needed via
the Rest API
https://wiki.collectionspace.org/display/DOC/Person+Service+REST+APIs#PersonServiceRESTAPIs-Personinstanceschema
But maybe they are still needed for the import service.
Thanks
Chris
On Jun 13, 2016, at 4:34 PM, Aron Roberts aron@socrates.berkeley.edu
wrote:
Hi James,
Sounds good. Note that these examples are for authority records,
not for the records for terms within an authority, which may be what
you're planning to add here.
(Note to self and colleagues: we really need to add the latter
examples
to this doc.)
One thing you'll need to be aware of, when importing authority term
records
(i.e. the items within a particular authority/vocabulary), the
'inAuthority' field
must be present in each such record and must reference an extant parent
authority. This associates the term with the relevant (parent) authority.
In the example below, when importing one or more persons terms into,
say, the "Local Persons" authority, the inAuthority field here contains
the
unique ID ("CSID") of that authority in the relevant CollectionSpace
system,
4b5cd4b4-9776-48e1-9258, in this instance. (You can find that CSID via a
request to http://host:port/cspace-services/personauthorities)
<?xml version="1.0" encoding="utf-8"?>
<imports>
<import service="Person" type="Person">
<schema xmlns:persons_common="
http://collectionspace.org/services/person" name="persons_common">
<personTermGroupList>
<personTermGroup>
<termDisplayName>Zelda C. Dobbs</termDisplayName>
</personTermGroup>
</personTermGroupList>
<shortIdentifier>ZedaCDobbs</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(ZeldaCDobbs)'ZeldaC.
Dobbs'</refName>
<inAuthority>4b5cd4b4-9776-48e1-9258</inAuthority>
</schema>
</import>
<import service="Person" type="Person">
<!-- Another record goes here ... -->
</import>
</imports>
Aron
On Mon, Jun 13, 2016 at 3:54 PM, James Keeline james@keeline.com
wrote:
I think I will try to emulate the one on Aron's first link to my inquiry:
<?xml version="1.0" encoding="UTF-8"?>
<imports>
<import seq="1" service="Personauthorities" type="Personauthority">
<schema xmlns:personauthorities_common="
http://collectionspace.org/services/person"
<http://collectionspace.org/services/person> name=
"personauthorities_common">
<personauthorities_common:displayName>American Poets</
personauthorities_common:displayName>
<personauthorities_common:shortIdentifier>americanpoets</
personauthorities_common:shortIdentifier>
<personauthorities_common:vocabType>PersonAuthority</
personauthorities_common:vocabType>
<personauthorities_common:refName
urn:cspace:core.collectionspace.org:Personauthorities:name(americanpoets)'American
Poets'</personauthorities_common:refName>
</schema>
</import>
<import seq="2" service="Personauthorities" type="Personauthority"
CSID="11111111-2222-3333-4444-123456789012">
<schema xmlns:personauthorities_common="
http://collectionspace.org/services/person"
http://collectionspace.org/services/person name=
"personauthorities_common">
<personauthorities_common:displayName>French Poets</
personauthorities_common:displayName>
<personauthorities_common:shortIdentifier>frenchpoets</
personauthorities_common:shortIdentifier>
<personauthorities_common:vocabType>PersonAuthority</
personauthorities_common:vocabType>
<personauthorities_common:refName
urn:cspace:core.collectionspace.org:Personauthorities:name(frenchpoets)'French
Poets'</personauthorities_common:refName>
</schema>
</import>
</imports>
I'm not adding multiple person authorities so I'll have to use some of
your suggestion as well. I will report back on its efficacy.
This is an example of the kind of person record I will be including in
the larger document:
<?xml version="1.0" encoding="utf-8"?>
<document name="persons">
<ns2:persons_common xmlns:ns2="
http://collectionspace.org/services/person" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance">
<inAuthority>*e5c217c5-26ad-4289-b778*</inAuthority>
<personTermGroupList>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(eng)'English'</termLanguage>
<termDisplayName>Chiang Kai-shek</termDisplayName>
<surName>Chiang</surName>
<foreName>Kai-shek</foreName>
</personTermGroup>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
<termDisplayName>蔣介石</termDisplayName>
<surName>蔣</surName>
<foreName>介石</foreName>
</personTermGroup>
</personTermGroupList>
</ns2:persons_common>
</document>
This worked against core.collectionspace.org. There are a couple
fields to add to this payload.
I think though that I might wish to define the short-name so that I can
use a known value for the object records.
I'm always a bit concerned about supplying the right unique IDs for
something like the inAuthority field. Any thoughts? It is also not clear
to me why the second block of data in the Person Authorities example at the
top has a unique ID (admittedly contrived) but the first one does not.
Thank you both for your prompt help to this and my other inquiries.
James D. Keeline
From: Chris Hoffman chris_h@berkeley.edu
To: Aron Roberts aron@socrates.berkeley.edu
Cc: James Keeline james@keeline.com; Talk <
talk@lists.collectionspace.org>
Sent: Monday, June 13, 2016 3:03 PM
Subject: Re: [Talk] XML payload with multiple people
Hi James,
Your typical import document is set up to support submitting multiple
records at once. If I recall correctly, the whole document is wrapped in
<imports></imports>. Within that you can have any number of
<import></import> blocks, each of which represents one person record that
you want to create. In practice, we’ve found that we can really only
submit 5K records per batch. Otherwise we’ve had timeouts and other very
nasty behaviors. Here’s an example with the top level elements for
creating 3 records.
<?xml version="1.0" encoding="UTF-8"?>
<imports>
<import service="Persons" type="Person”>
...
</import>
<import service="Persons" type="Person”>
...
</import>
<import service="Persons" type="Person”>
...
</import>
</imports>
I hope this helps,
Chris
On Jun 13, 2016, at 12:04 PM, Aron Roberts aron@socrates.berkeley.edu
wrote:
And this is also (somewhat) helpful, as you branch out from Person
authority records to other record types:
https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Howtodeterminethecorrectvaluestoputintoan%22/imports/import/schema%22element
:
On Mon, Jun 13, 2016 at 12:02 PM, Aron Roberts <
aron@socrates.berkeley.edu> wrote:
One possible starting place:
https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-ExampleRequest
On Mon, Jun 13, 2016 at 11:29 AM, James Keeline james@keeline.com
wrote:
I wish to import multiple people (authors, artists). I can make a
single XML payload.
It seems to me that one can send multiple at once. What is the element
format for this?
James D. Keeline
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
Aron,
Unless it has changed back again, the collectionspace_core part is needed
in an import though it wasn't originally.
Susan
On Mon, Jun 13, 2016 at 11:56 PM, Aron Roberts <aron@socrates.berkeley.edu>
wrote:
> There's some possible confusion (which I missed seeing in your earlier
> email) between:
>
> 1. Importing records, via the Imports service. (This is the method
> generally used when bulk importing hundreds or thousands of records.)
>
> 2. Creating a record, by POSTing to the relevant person authority via the
> Services REST API.
>
> These use *subtly different payloads*, an artifact resulting from the fact
> that the Imports service bypasses most of the Services framework and talks
> more or less directly to Nuxeo, which expects to encounter its own payload
> format.
>
> The payload included in an earlier message, repeated below with a few
> trivial tweaks (uppercasing UTF-8 as per W3C doc conventions, removing the
> 'seq=1' attribute, removing empty repeatable groups), should likely work
> for you method 1, calling the Imports service, via either of the following
> formats:
>
>
> https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Sendingtherequest
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <imports>
> <import service="Persons" type="Person">
> <schema xmlns:persons_common="
> http://collectionspace.org/services/person" name="persons_common">
> <inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
> <shortIdentifier>huangjunbi</shortIdentifier>
> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang
> Junbi (黃君壁)'</refName>
>
> <personTermGroupList>
> <personTermGroup>
> <termType>urn:cspace:core.collectionspace.org:
> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
> <termLanguage>urn:cspace:core.collectionspace.org:
> vocabularies:name(languages):item:name(eng)'English'</termLanguage>
> <termDisplayName>Huang Junbi</termDisplayName>
> <surName>Huang</surName>
> <foreName>Junbi</foreName>
> <termSource></termSource>
> <termSourceID></termSourceID>
> </personTermGroup>
> <personTermGroup>
> <termType>urn:cspace:core.collectionspace.org:
> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
> <termLanguage>urn:cspace:core.collectionspace.org:
> vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
> <termDisplayName>黃君壁</termDisplayName>
> <surName>黃</surName>
> <foreName>君壁</foreName>
> <termSource></termSource>
> <termSourceID></termSourceID>
> </personTermGroup>
> </personTermGroupList>
> </schema>
> </import>
> </imports>
>
> If you're going to be using method 2, POSTing an individual record via
> the Services REST APIs, via a call like:
>
> $ curl -X POST '
> http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items'
> -i -u admin@core.collectionspace.org:Administrator -H "Content-Type:
> application/xml " -T testperson.xml
>
> Then your payload will start with something similar to this:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <document name="persons">
> <ns2:persons_common xmlns:ns2="
> http://collectionspace.org/services/person">
> ...
>
> Rather than the Import payload's preamble:
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <imports>
> <import service="Persons" type="Person">
> <schema xmlns:persons_common="
> http://collectionspace.org/services/person" name="persons_common">
> ...
>
> I don't believe the CollectionSpace 'core' schema part needs to be
> included; that this part will get automatically created by CollectionSpace
> when you POST. But this is all from memory, since I'm currently away from
> access to my past working examples of Person authority term payloads.
>
> Aron
>
>
>
> On Mon, Jun 13, 2016 at 11:32 PM, Susan STONE <sstone@berkeley.edu> wrote:
>
>> James,
>>
>> I think you are missing the collectionspace_core part of the import
>> record (in addition to the persons_common part) , e.g. (these are not your
>> values but pasted in from something I have):
>>
>> <schema name="collectionspace_core" xmlns:collectionspace_core="
>> http://collectionspace.org/collectionspace_core/">
>>
>> <collectionspace_core:uri>/personauthorities/82d438d8-da87-4479-9b68/items/b6ac65f6-7f9d-4dc4-9a18-641e4de1cf65</collectionspace_core:uri>
>> <collectionspace_core:refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(p224)'A.
>> Smith'</collectionspace_core:refName>
>> </schema>
>>
>>
>> Susan
>>
>>
>> On Mon, Jun 13, 2016 at 10:38 PM, James Keeline <james@keeline.com>
>> wrote:
>>
>>> I am still not having success. That is, I get a response code that
>>> suggests that a record is created but it is not showing up in search.
>>>
>>> I was mainly testing against core.collectionspace.org and using the
>>> reported Local Persons person authority ID. I found it with this method:
>>>
>>> http://core.collectionspace.org/cspace-services/personauthorities
>>>
>>> and the relevant result seems to be:
>>>
>>> <list-item>
>>> <csid>*2937e6b9-8ec6-4e0f-b45a*</csid>
>>> <uri>/personauthorities/2937e6b9-8ec6-4e0f-b45a</uri>
>>> <refName>
>>> urn:cspace:core.collectionspace.org:personauthorities:name(person)'Local
>>> Persons'
>>> </refName>
>>> <updatedAt>2016-04-08T18:52:26.094Z</updatedAt>
>>> <workflowState>project</workflowState>
>>> <shortIdentifier>person</shortIdentifier>
>>> <displayName>Local Persons</displayName>
>>> </list-item>
>>>
>>> The XML I am trying to send is:
>>>
>>> <?xml version="1.0" encoding="utf-8" ?>
>>> <imports>
>>> <import seq="1" service="Persons" type="Person">
>>> <document name="persons">
>>> <schema xmlns:persons_common="
>>> http://collectionspace.org/services/person" name="persons_common">
>>> <inAuthority>*2937e6b9-8ec6-4e0f-b45a*</inAuthority>
>>> <shortIdentifier>huangjunbi</shortIdentifier>
>>> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang
>>> Junbi 黃君壁'</refName>
>>> <personTermGroupList>
>>> <personTermGroup>
>>> <termType>urn:cspace:core.collectionspace.org:
>>> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>>> <termLanguage>urn:cspace:core.collectionspace.org:
>>> vocabularies:name(languages):item:name(eng)'English'</termLanguage>
>>> <termDisplayName>Huang Junbi</termDisplayName>
>>> <surName>Huang</surName>
>>> <foreName>Junbi</foreName>
>>> <termSource></termSource>
>>> <termSourceID></termSourceID>
>>> </personTermGroup>
>>> <personTermGroup>
>>> <termType>urn:cspace:core.collectionspace.org:
>>> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>>> <termLanguage>urn:cspace:core.collectionspace.org:
>>> vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
>>> <termDisplayName>黃君壁</termDisplayName>
>>> <surName>黃</surName>
>>> <foreName>君壁</foreName>
>>> <termSource></termSource>
>>> <termSourceID></termSourceID>
>>> </personTermGroup>
>>> </personTermGroupList>
>>> <birthDateGroup>
>>> <dateLatestYear></dateLatestYear>
>>> </birthDateGroup>
>>> <deathDateGroup>
>>> <dateLatestYear></dateLatestYear>
>>> </deathDateGroup>
>>> </schema>
>>> </document>
>>> </import>
>>> </imports>
>>>
>>> Note that I have modified to <schema> as suggested. When I send the XML
>>> payload to the server with this method (is it correct?) I get a response
>>> code that indicates that a record was sent. However, it is not showing up
>>> in search as I though tit would.
>>>
>>> $ curl -X POST '
>>> http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items'
>>> -i -u admin@core.collectionspace.org:Administrator -H "Content-Type:
>>> application/xml " -T testperson.xml
>>>
>>> HTTP/1.1 100 Continue
>>>
>>> *HTTP/1.1 201 Created*
>>> Server: Apache-Coyote/1.1
>>> Location:
>>> http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/bee20f53-4ffb-4751-a727
>>> Set-Cookie: JSESSIONID=4E542E1C6CAF477ABDC72AD64EA06962;
>>> Path=/cspace-services/; HttpOnly
>>> Content-Length: 0
>>> Date: Tue, 14 Jun 2016 05:28:41 GMT
>>>
>>> I suppose that if I can get one working, I can send larger numbers of
>>> values at once, perhaps even the 800 people at once. However, there is
>>> some little thing that is not working.
>>>
>>> I have also tried this on my local installation, with the corresponding
>>> inAuthority number retrieved from that system. Again it claims to create
>>> it but nothing can be found in search.
>>>
>>> The XML returned from this URL provided in the response code has
>>> essentially empty elements, none of the data I provided.
>>>
>>>
>>> http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/bee20f53-4ffb-4751-a727
>>>
>>> Perhaps someone reading has a suggestion of a mistake in my XML or
>>> methods.
>>>
>>> James D. Keeline
>>>
>>> ------------------------------
>>> *From:* Aron Roberts <aron@socrates.berkeley.edu>
>>> *To:* James Keeline <james@keeline.com>
>>> *Cc:* Talk <talk@lists.collectionspace.org>; Chris Hoffman <
>>> chris_h@berkeley.edu>
>>> *Sent:* Monday, June 13, 2016 7:21 PM
>>> *Subject:* Re: [Talk] XML payload with multiple people
>>>
>>> Have also experienced a display oddity - in the record titlebar, in the
>>> dropdown menu below autocomplete fields, and in the Terms Used sidebar
>>> (screenshot attached) - when using the Import service to import a Person
>>> record whose refName display name contains Chinese characters (with or
>>> without parens, square brackets, etc.):
>>>
>>> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang
>>> Junbi (黃君壁)'</refName>
>>>
>>> If you see the same thing, we can file a bug if one doesn't already
>>> exist ... and for now, perhaps avoid adding those?
>>>
>>> On Mon, Jun 13, 2016 at 6:03 PM, Aron Roberts <
>>> aron@socrates.berkeley.edu> wrote:
>>>
>>> > Sometimes it feels like these processes are just a bit more technical
>>> than they need to be. Perhaps it is necessary but there are a lot of
>>> details which must be just right for success.
>>>
>>> D'accord.
>>>
>>> Import, in particular, is rather finicky. For sheer speed - since
>>> imports can be quite large and performance is of the essence - the import
>>> service is interacting in a fairly raw way with the Nuxeo enterprise
>>> content management system that underlies CollectionSpace, in a manner that
>>> mostly bypasses the CollectionSpace framework.
>>>
>>> 1. One thing I observed in the import payload:
>>>
>>> <document name="persons">
>>> <ns2:persons_common xmlns:ns2="
>>> http://collectionspace.org/services/person"
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>>> ...
>>> </ns2:persons_common>
>>> </document>
>>>
>>> (These two elements appear in the payloads that are produced and
>>> consumed when interacting with CollectionSpace via most of its Services
>>> REST API ...)
>>>
>>> Whereas for the Import service, the corresponding *single* element at
>>> this same level of the payload might instead be <schema ...> (AIUI due to
>>> the 'bypass' mentioned above):
>>>
>>> <schema xmlns:persons_common="
>>> http://collectionspace.org/services/person" name="persons_common">
>>> ...
>>> </schema>
>>>
>>> 2. As well, as mentioned in the brief convo between Chris and myself
>>> earlier, it appears the refName element (field) is required, when importing
>>> an authority term via the Import service.
>>>
>>> 3. If you replace the two elements above with the <schema...> element
>>> here, and add the refName, perhaps the import will succeed?
>>>
>>> The following payload just imported successfully for me on
>>> qa.collectionspace.org (after substituting QA's "Local Persons" value
>>> in the inAuthority field for the one you're using with your own server,
>>> below).
>>>
>>> <?xml version="1.0" encoding="utf-8" ?>
>>> <imports>
>>> <import seq="1" service="Persons" type="Person">
>>> <schema xmlns:persons_common="
>>> http://collectionspace.org/services/person" name="persons_common">
>>> <inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
>>> <shortIdentifier>huangjunbi</shortIdentifier>
>>> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang
>>> Junbi (黃君壁)'</refName>
>>>
>>> <personTermGroupList>
>>> <personTermGroup>
>>> <termType>urn:cspace:core.collectionspace.org:
>>> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>>> <termLanguage>urn:cspace:core.collectionspace.org:
>>> vocabularies:name(languages):item:name(eng)'English'</termLanguage>
>>> <termDisplayName>Huang Junbi</termDisplayName>
>>> <surName>Huang</surName>
>>> <foreName>Junbi</foreName>
>>> <termSource></termSource>
>>> <termSourceID></termSourceID>
>>> </personTermGroup>
>>> <personTermGroup>
>>> <termType>urn:cspace:core.collectionspace.org:
>>> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>>> <termLanguage>urn:cspace:core.collectionspace.org:
>>> vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
>>> <termDisplayName>黃君壁</termDisplayName>
>>> <surName>黃</surName>
>>> <foreName>君壁</foreName>
>>> <termSource></termSource>
>>> <termSourceID></termSourceID>
>>> </personTermGroup>
>>> </personTermGroupList>
>>> <birthDateGroup>
>>> <dateLatestYear></dateLatestYear>
>>> </birthDateGroup>
>>> <deathDateGroup>
>>> <dateLatestYear></dateLatestYear>
>>> </deathDateGroup>
>>> </schema>
>>> </import>
>>> </imports>
>>>
>>> The resulting record can be viewed at:
>>>
>>>
>>> https://qa.collectionspace.org/collectionspace/ui/core/html/person.html?csid=7606204f-67ee-4e1f-8a2e-451683c8ff03&vocab=person
>>>
>>> Aron
>>>
>>> On Mon, Jun 13, 2016 at 5:25 PM, James Keeline <james@keeline.com>
>>> wrote:
>>>
>>> I have seen the messages since my last inquiry and I need to read them
>>> carefully. I understand now how to "get" the unique ID for the
>>> *inAuthority* value.
>>>
>>> According to this (
>>> http://core.collectionspace.org:8180/cspace-services/personauthorities )
>>> there are several person authorities but the local person authority seems
>>> to have an ID of:
>>>
>>> <list-item>
>>> <csid>*2937e6b9-8ec6-4e0f-b45a*</csid>
>>> <uri>/personauthorities/2937e6b9-8ec6-4e0f-b45a</uri>
>>> <refName>
>>> urn:cspace:core.collectionspace.org:personauthorities:name(person)'Local
>>> Persons'
>>> </refName>
>>> <updatedAt>2016-04-08T18:52:26.094Z</updatedAt>
>>> <workflowState>project</workflowState>
>>> <shortIdentifier>person</shortIdentifier>
>>> <displayName>Local Persons</displayName>
>>> </list-item>
>>>
>>> This is what I sent to core.collectionspace.org as a test with
>>> additional fields. It says it was created but it does not show up on a
>>> search.
>>>
>>> <?xml version="1.0" encoding="utf-8" ?>
>>> <imports>
>>> <import seq="1" service="Persons" type="Person">
>>> <document name="persons">
>>> <ns2:persons_common xmlns:ns2="
>>> http://collectionspace.org/services/person"
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>>> <inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
>>> <shortIdentifier>huangjunbi</shortIdentifier>
>>> <personTermGroupList>
>>> <personTermGroup>
>>> <termType>urn:cspace:core.collectionspace.org:
>>> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>>> <termLanguage>urn:cspace:core.collectionspace.org:
>>> vocabularies:name(languages):item:name(eng)'English'</termLanguage>
>>> <termDisplayName>Huang Junbi</termDisplayName>
>>> <surName>Huang</surName>
>>> <foreName>Junbi</foreName>
>>> <termSource></termSource>
>>> <termSourceID></termSourceID>
>>> </personTermGroup>
>>> <personTermGroup>
>>> <termType>urn:cspace:core.collectionspace.org:
>>> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>>> <termLanguage>urn:cspace:core.collectionspace.org:
>>> vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
>>> <termDisplayName>黃君壁</termDisplayName>
>>> <surName>黃</surName>
>>> <foreName>君壁</foreName>
>>> <termSource></termSource>
>>> <termSourceID></termSourceID>
>>> </personTermGroup>
>>> </personTermGroupList>
>>> <birthDateGroup>
>>> <dateLatestYear></dateLatestYear>
>>> </birthDateGroup>
>>> <deathDateGroup>
>>> <dateLatestYear></dateLatestYear>
>>> </deathDateGroup>
>>> </ns2:persons_common>
>>> </document>
>>> </import>
>>> </imports>
>>>
>>> Perhaps this is related to my inAuthority value being different/wrong.
>>> I tried sending to the "found" csid value but it still does not show up
>>> under search. These are the response codes for the two attempts with the
>>> old ID and the found one:
>>>
>>> jameskesmacbook:BPOC keeline$ curl -X POST '
>>> http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items'
>>> -i -u admin@core.collectionspace.org:Administrator -H "Content-Type:
>>> application/xml " -T testperson.xml
>>> HTTP/1.1 100 Continue
>>>
>>> HTTP/1.1 201 Created
>>> Server: Apache-Coyote/1.1
>>> Location:
>>> http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/85b329e4-0d14-48f3-9365
>>> Set-Cookie: JSESSIONID=E2A4F02670F864DDE3A5D4517B7A36A2;
>>> Path=/cspace-services/; HttpOnly
>>> Content-Length: 0
>>> Date: Tue, 14 Jun 2016 00:05:43 GMT
>>>
>>> jameskesmacbook:BPOC keeline$ curl -X POST '
>>> http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items'
>>> -i -u admin@core.collectionspace.org:Administrator -H "Content-Type:
>>> application/xml " -T testperson.xml
>>> HTTP/1.1 100 Continue
>>>
>>> HTTP/1.1 201 Created
>>> Server: Apache-Coyote/1.1
>>> Location:
>>> http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/18394f8b-00c4-40d2-a256
>>> Set-Cookie: JSESSIONID=A5405E5A665EE6375E295A27E4DD53B4;
>>> Path=/cspace-services/; HttpOnly
>>> Content-Length: 0
>>> Date: Tue, 14 Jun 2016 00:17:26 GMT
>>>
>>> I'm using a PHP script to generate the XML so if there is a snippet to
>>> extract the correct value into a variable, I will include that. I can
>>> probably parse through it with some regex but I'll bet there's a better way
>>> if anyone knows it.
>>>
>>> Sometimes it feels like these processes are just a bit more technical
>>> than they need to be. Perhaps it is necessary but there are a lot of
>>> details which must be just right for success.
>>>
>>> James D. Keeline
>>>
>>> ------------------------------
>>> *From:* Aron Roberts <aron@socrates.berkeley.edu>
>>> *To:* James Keeline <james@keeline.com>
>>> *Cc:* Talk <talk@lists.collectionspace.org>; Chris Hoffman <
>>> chris_h@berkeley.edu>
>>> *Sent:* Monday, June 13, 2016 5:08 PM
>>>
>>> *Subject:* Re: [Talk] XML payload with multiple people
>>>
>>> BTW, there was a typo in the sample payload in a previous note: this
>>> should have read <import service="Persons" type="Person"> (note: first
>>> attribute value is now plural) rather than: <import service="Person"
>>> type="Person">.
>>>
>>> The (corrected) example payload:
>>>
>>> <?xml version="1.0" encoding="utf-8"?>
>>> <imports>
>>> <import service="Persons" type="Person">
>>> <schema xmlns:persons_common="
>>> http://collectionspace.org/services/person" name="persons_common">
>>> <personTermGroupList>
>>> <personTermGroup>
>>> <termDisplayName>Zelda C. Dobbs</termDisplayName>
>>> </personTermGroup>
>>> </personTermGroupList>
>>> <shortIdentifier>ZedaCDobbs</shortIdentifier>
>>> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(ZeldaCDobbs)'ZeldaC.
>>> Dobbs'</refName>
>>> <inAuthority>4b5cd4b4-9776-48e1-9258</inAuthority>
>>> </schema>
>>> </import>
>>> <import service="Persons" type="Person">
>>> <!-- Another record goes here ... -->
>>> </import>
>>> </imports>
>>>
>>> The section "How to find the service and type values" in the Imports
>>> Service Home document,
>>> https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Howtofindtheserviceandtypevalues,
>>> describes how to find and enter the right values for those
>>> two attributes, in the <import service="something_here"
>>> type="something_else_here"> elements.
>>>
>>> Aron
>>>
>>>
>>> On Mon, Jun 13, 2016 at 4:54 PM, Aron Roberts <
>>> aron@socrates.berkeley.edu> wrote:
>>>
>>> Good questions, Chris!
>>>
>>> About an hour ago, I test-imported a couple of Person records lacking
>>> a refName and shortidentifier. It looks like an 'ID' form of the refName
>>> was auto-created for
>>> those records; e.g.:
>>> urn:cspace:core.collectionspace.org:
>>> persons:id(dbbf8c78-6c4e-470b-8765-b07ba73ff9a4)
>>>
>>> And when listing all Person records, following that import, the
>>> following services error occurred:
>>>
>>> ERROR ...
>>> [org.collectionspace.services.common.vocabulary.RefNameServiceUtils:527]
>>> Could not retrieve a list of documents referring to the specified
>>> authority item
>>> java.lang.IllegalArgumentException: Malformed refName for AuthorityTerm
>>> (too few tokens)
>>>
>>> This might yet reflect pilot error on my part, but this at least
>>> suggests a need
>>> to supply values for one or both of those fields in the import payload.
>>>
>>> On Mon, Jun 13, 2016 at 4:40 PM, Chris Hoffman <chris_h@berkeley.edu>
>>> wrote:
>>>
>>> Thanks, Aron, for this better example!
>>>
>>> Do you know if the refname and shortidentifier elements are still needed
>>> by the import service? I don’t see them listed in the schema needed via
>>> the Rest API
>>> <https://wiki.collectionspace.org/display/DOC/Person+Service+REST+APIs#PersonServiceRESTAPIs-Personinstanceschema>
>>>
>>> But maybe they are still needed for the import service.
>>>
>>> Thanks
>>> Chris
>>>
>>>
>>> On Jun 13, 2016, at 4:34 PM, Aron Roberts <aron@socrates.berkeley.edu>
>>> wrote:
>>>
>>> Hi James,
>>>
>>> Sounds good. Note that these examples are for *authority* records,
>>> not for the records for terms *within* an authority, which may be what
>>> you're planning to add here.
>>>
>>> (Note to self and colleagues: we *really* need to add the latter
>>> examples
>>> to this doc.)
>>>
>>> One thing you'll need to be aware of, when importing authority term
>>> records
>>> (i.e. the items within a particular authority/vocabulary), the
>>> 'inAuthority' field
>>> must be present in each such record and must reference an extant parent
>>> authority. This associates the term with the relevant (parent) authority.
>>>
>>> In the example below, when importing one or more persons terms into,
>>> say, the "Local Persons" authority, the inAuthority field here contains
>>> the
>>> unique ID ("CSID") of that authority in the relevant CollectionSpace
>>> system,
>>> 4b5cd4b4-9776-48e1-9258, in this instance. (You can find that CSID via a
>>> request to http://host:port/cspace-services/personauthorities)
>>>
>>> <?xml version="1.0" encoding="utf-8"?>
>>> <imports>
>>> <import service="Person" type="Person">
>>> <schema xmlns:persons_common="
>>> http://collectionspace.org/services/person" name="persons_common">
>>> <personTermGroupList>
>>> <personTermGroup>
>>> <termDisplayName>Zelda C. Dobbs</termDisplayName>
>>> </personTermGroup>
>>> </personTermGroupList>
>>> <shortIdentifier>ZedaCDobbs</shortIdentifier>
>>> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(ZeldaCDobbs)'ZeldaC.
>>> Dobbs'</refName>
>>> <inAuthority>4b5cd4b4-9776-48e1-9258</inAuthority>
>>> </schema>
>>> </import>
>>> <import service="Person" type="Person">
>>> <!-- Another record goes here ... -->
>>> </import>
>>> </imports>
>>>
>>> Aron
>>>
>>> On Mon, Jun 13, 2016 at 3:54 PM, James Keeline <james@keeline.com>
>>> wrote:
>>>
>>> I think I will try to emulate the one on Aron's first link to my inquiry:
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <imports>
>>> <import seq="1" service="Personauthorities" type="Personauthority">
>>> <schema xmlns:personauthorities_common="
>>> http://collectionspace.org/services/person"
>>> <http://collectionspace.org/services/person> name=
>>> "personauthorities_common">
>>> <personauthorities_common:displayName>American Poets</
>>> personauthorities_common:displayName>
>>> <personauthorities_common:shortIdentifier>americanpoets</
>>> personauthorities_common:shortIdentifier>
>>> <personauthorities_common:vocabType>PersonAuthority</
>>> personauthorities_common:vocabType>
>>> <personauthorities_common:refName
>>> >urn:cspace:core.collectionspace.org:Personauthorities:name(americanpoets)'American
>>> Poets'</personauthorities_common:refName>
>>> </schema>
>>> </import>
>>> <import seq="2" service="Personauthorities" type="Personauthority"
>>> CSID="11111111-2222-3333-4444-123456789012">
>>> <schema xmlns:personauthorities_common="
>>> http://collectionspace.org/services/person"
>>> <http://collectionspace.org/services/person> name=
>>> "personauthorities_common">
>>> <personauthorities_common:displayName>French Poets</
>>> personauthorities_common:displayName>
>>> <personauthorities_common:shortIdentifier>frenchpoets</
>>> personauthorities_common:shortIdentifier>
>>> <personauthorities_common:vocabType>PersonAuthority</
>>> personauthorities_common:vocabType>
>>> <personauthorities_common:refName
>>> >urn:cspace:core.collectionspace.org:Personauthorities:name(frenchpoets)'French
>>> Poets'</personauthorities_common:refName>
>>> </schema>
>>> </import>
>>> </imports>
>>>
>>> I'm not adding multiple person authorities so I'll have to use some of
>>> your suggestion as well. I will report back on its efficacy.
>>>
>>> This is an example of the kind of person record I will be including in
>>> the larger document:
>>>
>>> <?xml version="1.0" encoding="utf-8"?>
>>> <document name="persons">
>>> <ns2:persons_common xmlns:ns2="
>>> http://collectionspace.org/services/person" xmlns:xsi="
>>> http://www.w3.org/2001/XMLSchema-instance">
>>> <inAuthority>*e5c217c5-26ad-4289-b778*</inAuthority>
>>> <personTermGroupList>
>>> <personTermGroup>
>>> <termType>urn:cspace:core.collectionspace.org:
>>> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>>> <termLanguage>urn:cspace:core.collectionspace.org:
>>> vocabularies:name(languages):item:name(eng)'English'</termLanguage>
>>> <termDisplayName>Chiang Kai-shek</termDisplayName>
>>> <surName>Chiang</surName>
>>> <foreName>Kai-shek</foreName>
>>> </personTermGroup>
>>> <personTermGroup>
>>> <termType>urn:cspace:core.collectionspace.org:
>>> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>>> <termLanguage>urn:cspace:core.collectionspace.org:
>>> vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
>>> <termDisplayName>蔣介石</termDisplayName>
>>> <surName>蔣</surName>
>>> <foreName>介石</foreName>
>>> </personTermGroup>
>>> </personTermGroupList>
>>> </ns2:persons_common>
>>> </document>
>>>
>>>
>>> This worked against core.collectionspace.org. There are a couple
>>> fields to add to this payload.
>>>
>>> I think though that I might wish to define the short-name so that I can
>>> use a known value for the object records.
>>>
>>> I'm always a bit concerned about supplying the right unique IDs for
>>> something like the inAuthority field. Any thoughts? It is also not clear
>>> to me why the second block of data in the Person Authorities example at the
>>> top has a unique ID (admittedly contrived) but the first one does not.
>>> _____
>>>
>>> Thank you both for your prompt help to this and my other inquiries.
>>>
>>> James D. Keeline
>>>
>>> ------------------------------
>>> *From:* Chris Hoffman <chris_h@berkeley.edu>
>>> *To:* Aron Roberts <aron@socrates.berkeley.edu>
>>> *Cc:* James Keeline <james@keeline.com>; Talk <
>>> talk@lists.collectionspace.org>
>>> *Sent:* Monday, June 13, 2016 3:03 PM
>>> *Subject:* Re: [Talk] XML payload with multiple people
>>>
>>> Hi James,
>>>
>>> Your typical import document is set up to support submitting multiple
>>> records at once. If I recall correctly, the whole document is wrapped in
>>> <imports></imports>. Within that you can have any number of
>>> <import></import> blocks, each of which represents one person record that
>>> you want to create. In practice, we’ve found that we can really only
>>> submit 5K records per batch. Otherwise we’ve had timeouts and other very
>>> nasty behaviors. Here’s an example with the top level elements for
>>> creating 3 records.
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>>
>>> <imports>
>>> <import service="Persons" type="Person”>
>>> ...
>>> </import>
>>> <import service="Persons" type="Person”>
>>> ...
>>> </import>
>>> <import service="Persons" type="Person”>
>>> ...
>>> </import>
>>> </imports>
>>>
>>>
>>> I hope this helps,
>>> Chris
>>>
>>> On Jun 13, 2016, at 12:04 PM, Aron Roberts <aron@socrates.berkeley.edu>
>>> wrote:
>>>
>>> And this is also (somewhat) helpful, as you branch out from Person
>>> authority records to other record types:
>>>
>>>
>>> https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Howtodeterminethecorrectvaluestoputintoan%22/imports/import/schema%22element
>>> :
>>>
>>> On Mon, Jun 13, 2016 at 12:02 PM, Aron Roberts <
>>> aron@socrates.berkeley.edu> wrote:
>>>
>>> One possible starting place:
>>>
>>>
>>> https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-ExampleRequest
>>>
>>> On Mon, Jun 13, 2016 at 11:29 AM, James Keeline <james@keeline.com>
>>> wrote:
>>>
>>> I wish to import multiple people (authors, artists). I can make a
>>> single XML payload.
>>>
>>> It seems to me that one can send multiple at once. What is the element
>>> format for this?
>>>
>>> James D. Keeline
>>>
>>>
>>> _______________________________________________
>>> Talk mailing list
>>> Talk@lists.collectionspace.org
>>>
>>> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Talk mailing list
>>> Talk@lists.collectionspace.org
>>>
>>> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Talk mailing list
>>> Talk@lists.collectionspace.org
>>>
>>> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Talk mailing list
>>> Talk@lists.collectionspace.org
>>>
>>> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
>>>
>>>
>>
>
CR
Christopher R. HOFFMAN
Wed, Jun 15, 2016 1:27 AM
Hi Susan, I think we no longer need to create that schema and data
manually. Lam Voong checked her scripts from our last implementation, and
we did not need to populate that URI.
Thanks,
Chris
On Jun 14, 2016, at 12:01 AM, Susan STONE sstone@berkeley.edu wrote:
Aron,
Unless it has changed back again, the collectionspace_core part is needed
in an import though it wasn't originally.
Susan
On Mon, Jun 13, 2016 at 11:56 PM, Aron Roberts aron@socrates.berkeley.edu
wrote:
There's some possible confusion (which I missed seeing in your earlier
email) between:
-
Importing records, via the Imports service. (This is the method
generally used when bulk importing hundreds or thousands of records.)
-
Creating a record, by POSTing to the relevant person authority via the
Services REST API.
These use subtly different payloads, an artifact resulting from the fact
that the Imports service bypasses most of the Services framework and talks
more or less directly to Nuxeo, which expects to encounter its own payload
format.
The payload included in an earlier message, repeated below with a few
trivial tweaks (uppercasing UTF-8 as per W3C doc conventions, removing the
'seq=1' attribute, removing empty repeatable groups), should likely work
for you method 1, calling the Imports service, via either of the following
formats:
https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Sendingtherequest
<?xml version="1.0" encoding="UTF-8" ?>
<imports>
<import service="Persons" type="Person">
<schema xmlns:persons_common="
http://collectionspace.org/services/person" name="persons_common">
<inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
<shortIdentifier>huangjunbi</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang
Junbi (黃君壁)'</refName>
<personTermGroupList>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(eng)'English'</termLanguage>
<termDisplayName>Huang Junbi</termDisplayName>
<surName>Huang</surName>
<foreName>Junbi</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
<termDisplayName>黃君壁</termDisplayName>
<surName>黃</surName>
<foreName>君壁</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
</personTermGroupList>
</schema>
</import>
</imports>
If you're going to be using method 2, POSTing an individual record via
the Services REST APIs, via a call like:
$ curl -X POST '
http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items'
-i -u admin@core.collectionspace.org:Administrator -H "Content-Type:
application/xml " -T testperson.xml
Then your payload will start with something similar to this:
<?xml version="1.0" encoding="UTF-8"?>
<document name="persons">
<ns2:persons_common xmlns:ns2="
http://collectionspace.org/services/person">
...
Rather than the Import payload's preamble:
<?xml version="1.0" encoding="UTF-8" ?>
<imports>
<import service="Persons" type="Person">
<schema xmlns:persons_common="
http://collectionspace.org/services/person" name="persons_common">
...
I don't believe the CollectionSpace 'core' schema part needs to be
included; that this part will get automatically created by CollectionSpace
when you POST. But this is all from memory, since I'm currently away from
access to my past working examples of Person authority term payloads.
Aron
On Mon, Jun 13, 2016 at 11:32 PM, Susan STONE sstone@berkeley.edu wrote:
James,
I think you are missing the collectionspace_core part of the import
record (in addition to the persons_common part) , e.g. (these are not your
values but pasted in from something I have):
<schema name="collectionspace_core" xmlns:collectionspace_core="
http://collectionspace.org/collectionspace_core/">
<collectionspace_core:uri>/personauthorities/82d438d8-da87-4479-9b68/items/b6ac65f6-7f9d-4dc4-9a18-641e4de1cf65</collectionspace_core:uri>
<collectionspace_core:refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(p224)'A.
Smith'</collectionspace_core:refName>
</schema>
Susan
On Mon, Jun 13, 2016 at 10:38 PM, James Keeline james@keeline.com
wrote:
I am still not having success. That is, I get a response code that
suggests that a record is created but it is not showing up in search.
I was mainly testing against core.collectionspace.org and using the
reported Local Persons person authority ID. I found it with this method:
http://core.collectionspace.org/cspace-services/personauthorities
and the relevant result seems to be:
<list-item>
<csid>*2937e6b9-8ec6-4e0f-b45a*</csid>
<uri>/personauthorities/2937e6b9-8ec6-4e0f-b45a</uri>
<refName>
urn:cspace:core.collectionspace.org:personauthorities:name(person)'Local
Persons'
</refName>
<updatedAt>2016-04-08T18:52:26.094Z</updatedAt>
<workflowState>project</workflowState>
<shortIdentifier>person</shortIdentifier>
<displayName>Local Persons</displayName>
</list-item>
The XML I am trying to send is:
<?xml version="1.0" encoding="utf-8" ?>
<imports>
<import seq="1" service="Persons" type="Person">
<document name="persons">
<schema xmlns:persons_common="
http://collectionspace.org/services/person" name="persons_common">
<inAuthority>*2937e6b9-8ec6-4e0f-b45a*</inAuthority>
<shortIdentifier>huangjunbi</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang
Junbi 黃君壁'</refName>
<personTermGroupList>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(eng)'English'</termLanguage>
<termDisplayName>Huang Junbi</termDisplayName>
<surName>Huang</surName>
<foreName>Junbi</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
<termDisplayName>黃君壁</termDisplayName>
<surName>黃</surName>
<foreName>君壁</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
</personTermGroupList>
<birthDateGroup>
<dateLatestYear></dateLatestYear>
</birthDateGroup>
<deathDateGroup>
<dateLatestYear></dateLatestYear>
</deathDateGroup>
</schema>
</document>
</import>
</imports>
Note that I have modified to <schema> as suggested. When I send the XML
payload to the server with this method (is it correct?) I get a response
code that indicates that a record was sent. However, it is not showing up
in search as I though tit would.
$ curl -X POST '
http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items'
-i -u admin@core.collectionspace.org:Administrator -H "Content-Type:
application/xml " -T testperson.xml
HTTP/1.1 100 Continue
HTTP/1.1 201 Created
Server: Apache-Coyote/1.1
Location:
http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/bee20f53-4ffb-4751-a727
Set-Cookie: JSESSIONID=4E542E1C6CAF477ABDC72AD64EA06962;
Path=/cspace-services/; HttpOnly
Content-Length: 0
Date: Tue, 14 Jun 2016 05:28:41 GMT
I suppose that if I can get one working, I can send larger numbers of
values at once, perhaps even the 800 people at once. However, there is
some little thing that is not working.
I have also tried this on my local installation, with the corresponding
inAuthority number retrieved from that system. Again it claims to create
it but nothing can be found in search.
The XML returned from this URL provided in the response code has
essentially empty elements, none of the data I provided.
http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/bee20f53-4ffb-4751-a727
Perhaps someone reading has a suggestion of a mistake in my XML or
methods.
James D. Keeline
From: Aron Roberts aron@socrates.berkeley.edu
To: James Keeline james@keeline.com
Cc: Talk talk@lists.collectionspace.org; Chris Hoffman <
chris_h@berkeley.edu>
Sent: Monday, June 13, 2016 7:21 PM
Subject: Re: [Talk] XML payload with multiple people
Have also experienced a display oddity - in the record titlebar, in the
dropdown menu below autocomplete fields, and in the Terms Used sidebar
(screenshot attached) - when using the Import service to import a Person
record whose refName display name contains Chinese characters (with or
without parens, square brackets, etc.):
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang
Junbi (黃君壁)'</refName>
If you see the same thing, we can file a bug if one doesn't already
exist ... and for now, perhaps avoid adding those?
On Mon, Jun 13, 2016 at 6:03 PM, Aron Roberts <
aron@socrates.berkeley.edu> wrote:
Sometimes it feels like these processes are just a bit more technical
than they need to be. Perhaps it is necessary but there are a lot of
details which must be just right for success.
D'accord.
Import, in particular, is rather finicky. For sheer speed - since
imports can be quite large and performance is of the essence - the import
service is interacting in a fairly raw way with the Nuxeo enterprise
content management system that underlies CollectionSpace, in a manner that
mostly bypasses the CollectionSpace framework.
-
One thing I observed in the import payload:
<document name="persons">
<ns2:persons_common xmlns:ns2="
http://collectionspace.org/services/person"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
...
</ns2:persons_common>
</document>
(These two elements appear in the payloads that are produced and
consumed when interacting with CollectionSpace via most of its Services
REST API ...)
Whereas for the Import service, the corresponding single element at
this same level of the payload might instead be <schema ...> (AIUI due to
the 'bypass' mentioned above):
<schema xmlns:persons_common="
http://collectionspace.org/services/person" name="persons_common">
...
</schema>
-
As well, as mentioned in the brief convo between Chris and myself
earlier, it appears the refName element (field) is required, when importing
an authority term via the Import service.
-
If you replace the two elements above with the <schema...> element
here, and add the refName, perhaps the import will succeed?
The following payload just imported successfully for me on
qa.collectionspace.org (after substituting QA's "Local Persons" value
in the inAuthority field for the one you're using with your own server,
below).
<?xml version="1.0" encoding="utf-8" ?>
<imports>
<import seq="1" service="Persons" type="Person">
<schema xmlns:persons_common="
http://collectionspace.org/services/person" name="persons_common">
<inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
<shortIdentifier>huangjunbi</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang
Junbi (黃君壁)'</refName>
<personTermGroupList>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(eng)'English'</termLanguage>
<termDisplayName>Huang Junbi</termDisplayName>
<surName>Huang</surName>
<foreName>Junbi</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
<termDisplayName>黃君壁</termDisplayName>
<surName>黃</surName>
<foreName>君壁</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
</personTermGroupList>
<birthDateGroup>
<dateLatestYear></dateLatestYear>
</birthDateGroup>
<deathDateGroup>
<dateLatestYear></dateLatestYear>
</deathDateGroup>
</schema>
</import>
</imports>
The resulting record can be viewed at:
https://qa.collectionspace.org/collectionspace/ui/core/html/person.html?csid=7606204f-67ee-4e1f-8a2e-451683c8ff03&vocab=person
Aron
On Mon, Jun 13, 2016 at 5:25 PM, James Keeline james@keeline.com
wrote:
I have seen the messages since my last inquiry and I need to read them
carefully. I understand now how to "get" the unique ID for the
inAuthority value.
According to this (
http://core.collectionspace.org:8180/cspace-services/personauthorities )
there are several person authorities but the local person authority seems
to have an ID of:
<list-item>
<csid>*2937e6b9-8ec6-4e0f-b45a*</csid>
<uri>/personauthorities/2937e6b9-8ec6-4e0f-b45a</uri>
<refName>
urn:cspace:core.collectionspace.org:personauthorities:name(person)'Local
Persons'
</refName>
<updatedAt>2016-04-08T18:52:26.094Z</updatedAt>
<workflowState>project</workflowState>
<shortIdentifier>person</shortIdentifier>
<displayName>Local Persons</displayName>
</list-item>
This is what I sent to core.collectionspace.org as a test with
additional fields. It says it was created but it does not show up on a
search.
<?xml version="1.0" encoding="utf-8" ?>
<imports>
<import seq="1" service="Persons" type="Person">
<document name="persons">
<ns2:persons_common xmlns:ns2="
http://collectionspace.org/services/person"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
<shortIdentifier>huangjunbi</shortIdentifier>
<personTermGroupList>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(eng)'English'</termLanguage>
<termDisplayName>Huang Junbi</termDisplayName>
<surName>Huang</surName>
<foreName>Junbi</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
<termDisplayName>黃君壁</termDisplayName>
<surName>黃</surName>
<foreName>君壁</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
</personTermGroupList>
<birthDateGroup>
<dateLatestYear></dateLatestYear>
</birthDateGroup>
<deathDateGroup>
<dateLatestYear></dateLatestYear>
</deathDateGroup>
</ns2:persons_common>
</document>
</import>
</imports>
Perhaps this is related to my inAuthority value being different/wrong.
I tried sending to the "found" csid value but it still does not show up
under search. These are the response codes for the two attempts with the
old ID and the found one:
jameskesmacbook:BPOC keeline$ curl -X POST '
http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items'
-i -u admin@core.collectionspace.org:Administrator -H "Content-Type:
application/xml " -T testperson.xml
HTTP/1.1 100 Continue
HTTP/1.1 201 Created
Server: Apache-Coyote/1.1
Location:
http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/85b329e4-0d14-48f3-9365
Set-Cookie: JSESSIONID=E2A4F02670F864DDE3A5D4517B7A36A2;
Path=/cspace-services/; HttpOnly
Content-Length: 0
Date: Tue, 14 Jun 2016 00:05:43 GMT
jameskesmacbook:BPOC keeline$ curl -X POST '
http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items'
-i -u admin@core.collectionspace.org:Administrator -H "Content-Type:
application/xml " -T testperson.xml
HTTP/1.1 100 Continue
HTTP/1.1 201 Created
Server: Apache-Coyote/1.1
Location:
http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/18394f8b-00c4-40d2-a256
Set-Cookie: JSESSIONID=A5405E5A665EE6375E295A27E4DD53B4;
Path=/cspace-services/; HttpOnly
Content-Length: 0
Date: Tue, 14 Jun 2016 00:17:26 GMT
I'm using a PHP script to generate the XML so if there is a snippet to
extract the correct value into a variable, I will include that. I can
probably parse through it with some regex but I'll bet there's a better way
if anyone knows it.
Sometimes it feels like these processes are just a bit more technical
than they need to be. Perhaps it is necessary but there are a lot of
details which must be just right for success.
James D. Keeline
From: Aron Roberts aron@socrates.berkeley.edu
To: James Keeline james@keeline.com
Cc: Talk talk@lists.collectionspace.org; Chris Hoffman <
chris_h@berkeley.edu>
Sent: Monday, June 13, 2016 5:08 PM
Subject: Re: [Talk] XML payload with multiple people
BTW, there was a typo in the sample payload in a previous note: this
should have read <import service="Persons" type="Person"> (note: first
attribute value is now plural) rather than: <import service="Person"
type="Person">.
The (corrected) example payload:
<?xml version="1.0" encoding="utf-8"?>
<imports>
<import service="Persons" type="Person">
<schema xmlns:persons_common="
http://collectionspace.org/services/person" name="persons_common">
<personTermGroupList>
<personTermGroup>
<termDisplayName>Zelda C. Dobbs</termDisplayName>
</personTermGroup>
</personTermGroupList>
<shortIdentifier>ZedaCDobbs</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(ZeldaCDobbs)'ZeldaC.
Dobbs'</refName>
<inAuthority>4b5cd4b4-9776-48e1-9258</inAuthority>
</schema>
</import>
<import service="Persons" type="Person">
<!-- Another record goes here ... -->
</import>
</imports>
The section "How to find the service and type values" in the Imports
Service Home document,
https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Howtofindtheserviceandtypevalues,
describes how to find and enter the right values for those
two attributes, in the <import service="something_here"
type="something_else_here"> elements.
Aron
On Mon, Jun 13, 2016 at 4:54 PM, Aron Roberts <
aron@socrates.berkeley.edu> wrote:
Good questions, Chris!
About an hour ago, I test-imported a couple of Person records lacking
a refName and shortidentifier. It looks like an 'ID' form of the refName
was auto-created for
those records; e.g.:
urn:cspace:core.collectionspace.org:
persons:id(dbbf8c78-6c4e-470b-8765-b07ba73ff9a4)
And when listing all Person records, following that import, the
following services error occurred:
ERROR ...
[org.collectionspace.services.common.vocabulary.RefNameServiceUtils:527]
Could not retrieve a list of documents referring to the specified
authority item
java.lang.IllegalArgumentException: Malformed refName for AuthorityTerm
(too few tokens)
This might yet reflect pilot error on my part, but this at least
suggests a need
to supply values for one or both of those fields in the import payload.
On Mon, Jun 13, 2016 at 4:40 PM, Chris Hoffman chris_h@berkeley.edu
wrote:
Thanks, Aron, for this better example!
Do you know if the refname and shortidentifier elements are still needed
by the import service? I don’t see them listed in the schema needed via
the Rest API
https://wiki.collectionspace.org/display/DOC/Person+Service+REST+APIs#PersonServiceRESTAPIs-Personinstanceschema
But maybe they are still needed for the import service.
Thanks
Chris
On Jun 13, 2016, at 4:34 PM, Aron Roberts aron@socrates.berkeley.edu
wrote:
Hi James,
Sounds good. Note that these examples are for authority records,
not for the records for terms within an authority, which may be what
you're planning to add here.
(Note to self and colleagues: we really need to add the latter
examples
to this doc.)
One thing you'll need to be aware of, when importing authority term
records
(i.e. the items within a particular authority/vocabulary), the
'inAuthority' field
must be present in each such record and must reference an extant parent
authority. This associates the term with the relevant (parent) authority.
In the example below, when importing one or more persons terms into,
say, the "Local Persons" authority, the inAuthority field here contains
the
unique ID ("CSID") of that authority in the relevant CollectionSpace
system,
4b5cd4b4-9776-48e1-9258, in this instance. (You can find that CSID via a
request to http://host:port/cspace-services/personauthorities)
<?xml version="1.0" encoding="utf-8"?>
<imports>
<import service="Person" type="Person">
<schema xmlns:persons_common="
http://collectionspace.org/services/person" name="persons_common">
<personTermGroupList>
<personTermGroup>
<termDisplayName>Zelda C. Dobbs</termDisplayName>
</personTermGroup>
</personTermGroupList>
<shortIdentifier>ZedaCDobbs</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(ZeldaCDobbs)'ZeldaC.
Dobbs'</refName>
<inAuthority>4b5cd4b4-9776-48e1-9258</inAuthority>
</schema>
</import>
<import service="Person" type="Person">
<!-- Another record goes here ... -->
</import>
</imports>
Aron
On Mon, Jun 13, 2016 at 3:54 PM, James Keeline james@keeline.com
wrote:
I think I will try to emulate the one on Aron's first link to my inquiry:
<?xml version="1.0" encoding="UTF-8"?>
<imports>
<import seq="1" service="Personauthorities" type="Personauthority">
<schema xmlns:personauthorities_common="
http://collectionspace.org/services/person"
<http://collectionspace.org/services/person> name=
"personauthorities_common">
<personauthorities_common:displayName>American Poets</
personauthorities_common:displayName>
<personauthorities_common:shortIdentifier>americanpoets</
personauthorities_common:shortIdentifier>
<personauthorities_common:vocabType>PersonAuthority</
personauthorities_common:vocabType>
<personauthorities_common:refName
urn:cspace:core.collectionspace.org:Personauthorities:name(americanpoets)'American
Poets'</personauthorities_common:refName>
</schema>
</import>
<import seq="2" service="Personauthorities" type="Personauthority"
CSID="11111111-2222-3333-4444-123456789012">
<schema xmlns:personauthorities_common="
http://collectionspace.org/services/person"
http://collectionspace.org/services/person name=
"personauthorities_common">
<personauthorities_common:displayName>French Poets</
personauthorities_common:displayName>
<personauthorities_common:shortIdentifier>frenchpoets</
personauthorities_common:shortIdentifier>
<personauthorities_common:vocabType>PersonAuthority</
personauthorities_common:vocabType>
<personauthorities_common:refName
urn:cspace:core.collectionspace.org:Personauthorities:name(frenchpoets)'French
Poets'</personauthorities_common:refName>
</schema>
</import>
</imports>
I'm not adding multiple person authorities so I'll have to use some of
your suggestion as well. I will report back on its efficacy.
This is an example of the kind of person record I will be including in
the larger document:
<?xml version="1.0" encoding="utf-8"?>
<document name="persons">
<ns2:persons_common xmlns:ns2="
http://collectionspace.org/services/person" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance">
<inAuthority>*e5c217c5-26ad-4289-b778*</inAuthority>
<personTermGroupList>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(eng)'English'</termLanguage>
<termDisplayName>Chiang Kai-shek</termDisplayName>
<surName>Chiang</surName>
<foreName>Kai-shek</foreName>
</personTermGroup>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
<termDisplayName>蔣介石</termDisplayName>
<surName>蔣</surName>
<foreName>介石</foreName>
</personTermGroup>
</personTermGroupList>
</ns2:persons_common>
</document>
This worked against core.collectionspace.org. There are a couple
fields to add to this payload.
I think though that I might wish to define the short-name so that I can
use a known value for the object records.
I'm always a bit concerned about supplying the right unique IDs for
something like the inAuthority field. Any thoughts? It is also not clear
to me why the second block of data in the Person Authorities example at the
top has a unique ID (admittedly contrived) but the first one does not.
Thank you both for your prompt help to this and my other inquiries.
James D. Keeline
From: Chris Hoffman chris_h@berkeley.edu
To: Aron Roberts aron@socrates.berkeley.edu
Cc: James Keeline james@keeline.com; Talk <
talk@lists.collectionspace.org>
Sent: Monday, June 13, 2016 3:03 PM
Subject: Re: [Talk] XML payload with multiple people
Hi James,
Your typical import document is set up to support submitting multiple
records at once. If I recall correctly, the whole document is wrapped in
<imports></imports>. Within that you can have any number of
<import></import> blocks, each of which represents one person record that
you want to create. In practice, we’ve found that we can really only
submit 5K records per batch. Otherwise we’ve had timeouts and other very
nasty behaviors. Here’s an example with the top level elements for
creating 3 records.
<?xml version="1.0" encoding="UTF-8"?>
<imports>
<import service="Persons" type="Person”>
...
</import>
<import service="Persons" type="Person”>
...
</import>
<import service="Persons" type="Person”>
...
</import>
</imports>
I hope this helps,
Chris
On Jun 13, 2016, at 12:04 PM, Aron Roberts aron@socrates.berkeley.edu
wrote:
And this is also (somewhat) helpful, as you branch out from Person
authority records to other record types:
https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Howtodeterminethecorrectvaluestoputintoan%22/imports/import/schema%22element
:
On Mon, Jun 13, 2016 at 12:02 PM, Aron Roberts <
aron@socrates.berkeley.edu> wrote:
One possible starting place:
https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-ExampleRequest
On Mon, Jun 13, 2016 at 11:29 AM, James Keeline james@keeline.com
wrote:
I wish to import multiple people (authors, artists). I can make a
single XML payload.
It seems to me that one can send multiple at once. What is the element
format for this?
James D. Keeline
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
Hi Susan, I think we no longer need to create that schema and data
manually. Lam Voong checked her scripts from our last implementation, and
we did not need to populate that URI.
Thanks,
Chris
On Jun 14, 2016, at 12:01 AM, Susan STONE <sstone@berkeley.edu> wrote:
Aron,
Unless it has changed back again, the collectionspace_core part is needed
in an import though it wasn't originally.
Susan
On Mon, Jun 13, 2016 at 11:56 PM, Aron Roberts <aron@socrates.berkeley.edu>
wrote:
> There's some possible confusion (which I missed seeing in your earlier
> email) between:
>
> 1. Importing records, via the Imports service. (This is the method
> generally used when bulk importing hundreds or thousands of records.)
>
> 2. Creating a record, by POSTing to the relevant person authority via the
> Services REST API.
>
> These use *subtly different payloads*, an artifact resulting from the fact
> that the Imports service bypasses most of the Services framework and talks
> more or less directly to Nuxeo, which expects to encounter its own payload
> format.
>
> The payload included in an earlier message, repeated below with a few
> trivial tweaks (uppercasing UTF-8 as per W3C doc conventions, removing the
> 'seq=1' attribute, removing empty repeatable groups), should likely work
> for you method 1, calling the Imports service, via either of the following
> formats:
>
>
> https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Sendingtherequest
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <imports>
> <import service="Persons" type="Person">
> <schema xmlns:persons_common="
> http://collectionspace.org/services/person" name="persons_common">
> <inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
> <shortIdentifier>huangjunbi</shortIdentifier>
> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang
> Junbi (黃君壁)'</refName>
>
> <personTermGroupList>
> <personTermGroup>
> <termType>urn:cspace:core.collectionspace.org:
> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
> <termLanguage>urn:cspace:core.collectionspace.org:
> vocabularies:name(languages):item:name(eng)'English'</termLanguage>
> <termDisplayName>Huang Junbi</termDisplayName>
> <surName>Huang</surName>
> <foreName>Junbi</foreName>
> <termSource></termSource>
> <termSourceID></termSourceID>
> </personTermGroup>
> <personTermGroup>
> <termType>urn:cspace:core.collectionspace.org:
> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
> <termLanguage>urn:cspace:core.collectionspace.org:
> vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
> <termDisplayName>黃君壁</termDisplayName>
> <surName>黃</surName>
> <foreName>君壁</foreName>
> <termSource></termSource>
> <termSourceID></termSourceID>
> </personTermGroup>
> </personTermGroupList>
> </schema>
> </import>
> </imports>
>
> If you're going to be using method 2, POSTing an individual record via
> the Services REST APIs, via a call like:
>
> $ curl -X POST '
> http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items'
> -i -u admin@core.collectionspace.org:Administrator -H "Content-Type:
> application/xml " -T testperson.xml
>
> Then your payload will start with something similar to this:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <document name="persons">
> <ns2:persons_common xmlns:ns2="
> http://collectionspace.org/services/person">
> ...
>
> Rather than the Import payload's preamble:
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <imports>
> <import service="Persons" type="Person">
> <schema xmlns:persons_common="
> http://collectionspace.org/services/person" name="persons_common">
> ...
>
> I don't believe the CollectionSpace 'core' schema part needs to be
> included; that this part will get automatically created by CollectionSpace
> when you POST. But this is all from memory, since I'm currently away from
> access to my past working examples of Person authority term payloads.
>
> Aron
>
>
>
> On Mon, Jun 13, 2016 at 11:32 PM, Susan STONE <sstone@berkeley.edu> wrote:
>
>> James,
>>
>> I think you are missing the collectionspace_core part of the import
>> record (in addition to the persons_common part) , e.g. (these are not your
>> values but pasted in from something I have):
>>
>> <schema name="collectionspace_core" xmlns:collectionspace_core="
>> http://collectionspace.org/collectionspace_core/">
>>
>> <collectionspace_core:uri>/personauthorities/82d438d8-da87-4479-9b68/items/b6ac65f6-7f9d-4dc4-9a18-641e4de1cf65</collectionspace_core:uri>
>> <collectionspace_core:refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(p224)'A.
>> Smith'</collectionspace_core:refName>
>> </schema>
>>
>>
>> Susan
>>
>>
>> On Mon, Jun 13, 2016 at 10:38 PM, James Keeline <james@keeline.com>
>> wrote:
>>
>>> I am still not having success. That is, I get a response code that
>>> suggests that a record is created but it is not showing up in search.
>>>
>>> I was mainly testing against core.collectionspace.org and using the
>>> reported Local Persons person authority ID. I found it with this method:
>>>
>>> http://core.collectionspace.org/cspace-services/personauthorities
>>>
>>> and the relevant result seems to be:
>>>
>>> <list-item>
>>> <csid>*2937e6b9-8ec6-4e0f-b45a*</csid>
>>> <uri>/personauthorities/2937e6b9-8ec6-4e0f-b45a</uri>
>>> <refName>
>>> urn:cspace:core.collectionspace.org:personauthorities:name(person)'Local
>>> Persons'
>>> </refName>
>>> <updatedAt>2016-04-08T18:52:26.094Z</updatedAt>
>>> <workflowState>project</workflowState>
>>> <shortIdentifier>person</shortIdentifier>
>>> <displayName>Local Persons</displayName>
>>> </list-item>
>>>
>>> The XML I am trying to send is:
>>>
>>> <?xml version="1.0" encoding="utf-8" ?>
>>> <imports>
>>> <import seq="1" service="Persons" type="Person">
>>> <document name="persons">
>>> <schema xmlns:persons_common="
>>> http://collectionspace.org/services/person" name="persons_common">
>>> <inAuthority>*2937e6b9-8ec6-4e0f-b45a*</inAuthority>
>>> <shortIdentifier>huangjunbi</shortIdentifier>
>>> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang
>>> Junbi 黃君壁'</refName>
>>> <personTermGroupList>
>>> <personTermGroup>
>>> <termType>urn:cspace:core.collectionspace.org:
>>> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>>> <termLanguage>urn:cspace:core.collectionspace.org:
>>> vocabularies:name(languages):item:name(eng)'English'</termLanguage>
>>> <termDisplayName>Huang Junbi</termDisplayName>
>>> <surName>Huang</surName>
>>> <foreName>Junbi</foreName>
>>> <termSource></termSource>
>>> <termSourceID></termSourceID>
>>> </personTermGroup>
>>> <personTermGroup>
>>> <termType>urn:cspace:core.collectionspace.org:
>>> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>>> <termLanguage>urn:cspace:core.collectionspace.org:
>>> vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
>>> <termDisplayName>黃君壁</termDisplayName>
>>> <surName>黃</surName>
>>> <foreName>君壁</foreName>
>>> <termSource></termSource>
>>> <termSourceID></termSourceID>
>>> </personTermGroup>
>>> </personTermGroupList>
>>> <birthDateGroup>
>>> <dateLatestYear></dateLatestYear>
>>> </birthDateGroup>
>>> <deathDateGroup>
>>> <dateLatestYear></dateLatestYear>
>>> </deathDateGroup>
>>> </schema>
>>> </document>
>>> </import>
>>> </imports>
>>>
>>> Note that I have modified to <schema> as suggested. When I send the XML
>>> payload to the server with this method (is it correct?) I get a response
>>> code that indicates that a record was sent. However, it is not showing up
>>> in search as I though tit would.
>>>
>>> $ curl -X POST '
>>> http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items'
>>> -i -u admin@core.collectionspace.org:Administrator -H "Content-Type:
>>> application/xml " -T testperson.xml
>>>
>>> HTTP/1.1 100 Continue
>>>
>>> *HTTP/1.1 201 Created*
>>> Server: Apache-Coyote/1.1
>>> Location:
>>> http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/bee20f53-4ffb-4751-a727
>>> Set-Cookie: JSESSIONID=4E542E1C6CAF477ABDC72AD64EA06962;
>>> Path=/cspace-services/; HttpOnly
>>> Content-Length: 0
>>> Date: Tue, 14 Jun 2016 05:28:41 GMT
>>>
>>> I suppose that if I can get one working, I can send larger numbers of
>>> values at once, perhaps even the 800 people at once. However, there is
>>> some little thing that is not working.
>>>
>>> I have also tried this on my local installation, with the corresponding
>>> inAuthority number retrieved from that system. Again it claims to create
>>> it but nothing can be found in search.
>>>
>>> The XML returned from this URL provided in the response code has
>>> essentially empty elements, none of the data I provided.
>>>
>>>
>>> http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/bee20f53-4ffb-4751-a727
>>>
>>> Perhaps someone reading has a suggestion of a mistake in my XML or
>>> methods.
>>>
>>> James D. Keeline
>>>
>>> ------------------------------
>>> *From:* Aron Roberts <aron@socrates.berkeley.edu>
>>> *To:* James Keeline <james@keeline.com>
>>> *Cc:* Talk <talk@lists.collectionspace.org>; Chris Hoffman <
>>> chris_h@berkeley.edu>
>>> *Sent:* Monday, June 13, 2016 7:21 PM
>>> *Subject:* Re: [Talk] XML payload with multiple people
>>>
>>> Have also experienced a display oddity - in the record titlebar, in the
>>> dropdown menu below autocomplete fields, and in the Terms Used sidebar
>>> (screenshot attached) - when using the Import service to import a Person
>>> record whose refName display name contains Chinese characters (with or
>>> without parens, square brackets, etc.):
>>>
>>> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang
>>> Junbi (黃君壁)'</refName>
>>>
>>> If you see the same thing, we can file a bug if one doesn't already
>>> exist ... and for now, perhaps avoid adding those?
>>>
>>> On Mon, Jun 13, 2016 at 6:03 PM, Aron Roberts <
>>> aron@socrates.berkeley.edu> wrote:
>>>
>>> > Sometimes it feels like these processes are just a bit more technical
>>> than they need to be. Perhaps it is necessary but there are a lot of
>>> details which must be just right for success.
>>>
>>> D'accord.
>>>
>>> Import, in particular, is rather finicky. For sheer speed - since
>>> imports can be quite large and performance is of the essence - the import
>>> service is interacting in a fairly raw way with the Nuxeo enterprise
>>> content management system that underlies CollectionSpace, in a manner that
>>> mostly bypasses the CollectionSpace framework.
>>>
>>> 1. One thing I observed in the import payload:
>>>
>>> <document name="persons">
>>> <ns2:persons_common xmlns:ns2="
>>> http://collectionspace.org/services/person"
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>>> ...
>>> </ns2:persons_common>
>>> </document>
>>>
>>> (These two elements appear in the payloads that are produced and
>>> consumed when interacting with CollectionSpace via most of its Services
>>> REST API ...)
>>>
>>> Whereas for the Import service, the corresponding *single* element at
>>> this same level of the payload might instead be <schema ...> (AIUI due to
>>> the 'bypass' mentioned above):
>>>
>>> <schema xmlns:persons_common="
>>> http://collectionspace.org/services/person" name="persons_common">
>>> ...
>>> </schema>
>>>
>>> 2. As well, as mentioned in the brief convo between Chris and myself
>>> earlier, it appears the refName element (field) is required, when importing
>>> an authority term via the Import service.
>>>
>>> 3. If you replace the two elements above with the <schema...> element
>>> here, and add the refName, perhaps the import will succeed?
>>>
>>> The following payload just imported successfully for me on
>>> qa.collectionspace.org (after substituting QA's "Local Persons" value
>>> in the inAuthority field for the one you're using with your own server,
>>> below).
>>>
>>> <?xml version="1.0" encoding="utf-8" ?>
>>> <imports>
>>> <import seq="1" service="Persons" type="Person">
>>> <schema xmlns:persons_common="
>>> http://collectionspace.org/services/person" name="persons_common">
>>> <inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
>>> <shortIdentifier>huangjunbi</shortIdentifier>
>>> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang
>>> Junbi (黃君壁)'</refName>
>>>
>>> <personTermGroupList>
>>> <personTermGroup>
>>> <termType>urn:cspace:core.collectionspace.org:
>>> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>>> <termLanguage>urn:cspace:core.collectionspace.org:
>>> vocabularies:name(languages):item:name(eng)'English'</termLanguage>
>>> <termDisplayName>Huang Junbi</termDisplayName>
>>> <surName>Huang</surName>
>>> <foreName>Junbi</foreName>
>>> <termSource></termSource>
>>> <termSourceID></termSourceID>
>>> </personTermGroup>
>>> <personTermGroup>
>>> <termType>urn:cspace:core.collectionspace.org:
>>> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>>> <termLanguage>urn:cspace:core.collectionspace.org:
>>> vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
>>> <termDisplayName>黃君壁</termDisplayName>
>>> <surName>黃</surName>
>>> <foreName>君壁</foreName>
>>> <termSource></termSource>
>>> <termSourceID></termSourceID>
>>> </personTermGroup>
>>> </personTermGroupList>
>>> <birthDateGroup>
>>> <dateLatestYear></dateLatestYear>
>>> </birthDateGroup>
>>> <deathDateGroup>
>>> <dateLatestYear></dateLatestYear>
>>> </deathDateGroup>
>>> </schema>
>>> </import>
>>> </imports>
>>>
>>> The resulting record can be viewed at:
>>>
>>>
>>> https://qa.collectionspace.org/collectionspace/ui/core/html/person.html?csid=7606204f-67ee-4e1f-8a2e-451683c8ff03&vocab=person
>>>
>>> Aron
>>>
>>> On Mon, Jun 13, 2016 at 5:25 PM, James Keeline <james@keeline.com>
>>> wrote:
>>>
>>> I have seen the messages since my last inquiry and I need to read them
>>> carefully. I understand now how to "get" the unique ID for the
>>> *inAuthority* value.
>>>
>>> According to this (
>>> http://core.collectionspace.org:8180/cspace-services/personauthorities )
>>> there are several person authorities but the local person authority seems
>>> to have an ID of:
>>>
>>> <list-item>
>>> <csid>*2937e6b9-8ec6-4e0f-b45a*</csid>
>>> <uri>/personauthorities/2937e6b9-8ec6-4e0f-b45a</uri>
>>> <refName>
>>> urn:cspace:core.collectionspace.org:personauthorities:name(person)'Local
>>> Persons'
>>> </refName>
>>> <updatedAt>2016-04-08T18:52:26.094Z</updatedAt>
>>> <workflowState>project</workflowState>
>>> <shortIdentifier>person</shortIdentifier>
>>> <displayName>Local Persons</displayName>
>>> </list-item>
>>>
>>> This is what I sent to core.collectionspace.org as a test with
>>> additional fields. It says it was created but it does not show up on a
>>> search.
>>>
>>> <?xml version="1.0" encoding="utf-8" ?>
>>> <imports>
>>> <import seq="1" service="Persons" type="Person">
>>> <document name="persons">
>>> <ns2:persons_common xmlns:ns2="
>>> http://collectionspace.org/services/person"
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>>> <inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
>>> <shortIdentifier>huangjunbi</shortIdentifier>
>>> <personTermGroupList>
>>> <personTermGroup>
>>> <termType>urn:cspace:core.collectionspace.org:
>>> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>>> <termLanguage>urn:cspace:core.collectionspace.org:
>>> vocabularies:name(languages):item:name(eng)'English'</termLanguage>
>>> <termDisplayName>Huang Junbi</termDisplayName>
>>> <surName>Huang</surName>
>>> <foreName>Junbi</foreName>
>>> <termSource></termSource>
>>> <termSourceID></termSourceID>
>>> </personTermGroup>
>>> <personTermGroup>
>>> <termType>urn:cspace:core.collectionspace.org:
>>> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>>> <termLanguage>urn:cspace:core.collectionspace.org:
>>> vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
>>> <termDisplayName>黃君壁</termDisplayName>
>>> <surName>黃</surName>
>>> <foreName>君壁</foreName>
>>> <termSource></termSource>
>>> <termSourceID></termSourceID>
>>> </personTermGroup>
>>> </personTermGroupList>
>>> <birthDateGroup>
>>> <dateLatestYear></dateLatestYear>
>>> </birthDateGroup>
>>> <deathDateGroup>
>>> <dateLatestYear></dateLatestYear>
>>> </deathDateGroup>
>>> </ns2:persons_common>
>>> </document>
>>> </import>
>>> </imports>
>>>
>>> Perhaps this is related to my inAuthority value being different/wrong.
>>> I tried sending to the "found" csid value but it still does not show up
>>> under search. These are the response codes for the two attempts with the
>>> old ID and the found one:
>>>
>>> jameskesmacbook:BPOC keeline$ curl -X POST '
>>> http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items'
>>> -i -u admin@core.collectionspace.org:Administrator -H "Content-Type:
>>> application/xml " -T testperson.xml
>>> HTTP/1.1 100 Continue
>>>
>>> HTTP/1.1 201 Created
>>> Server: Apache-Coyote/1.1
>>> Location:
>>> http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/85b329e4-0d14-48f3-9365
>>> Set-Cookie: JSESSIONID=E2A4F02670F864DDE3A5D4517B7A36A2;
>>> Path=/cspace-services/; HttpOnly
>>> Content-Length: 0
>>> Date: Tue, 14 Jun 2016 00:05:43 GMT
>>>
>>> jameskesmacbook:BPOC keeline$ curl -X POST '
>>> http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items'
>>> -i -u admin@core.collectionspace.org:Administrator -H "Content-Type:
>>> application/xml " -T testperson.xml
>>> HTTP/1.1 100 Continue
>>>
>>> HTTP/1.1 201 Created
>>> Server: Apache-Coyote/1.1
>>> Location:
>>> http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/18394f8b-00c4-40d2-a256
>>> Set-Cookie: JSESSIONID=A5405E5A665EE6375E295A27E4DD53B4;
>>> Path=/cspace-services/; HttpOnly
>>> Content-Length: 0
>>> Date: Tue, 14 Jun 2016 00:17:26 GMT
>>>
>>> I'm using a PHP script to generate the XML so if there is a snippet to
>>> extract the correct value into a variable, I will include that. I can
>>> probably parse through it with some regex but I'll bet there's a better way
>>> if anyone knows it.
>>>
>>> Sometimes it feels like these processes are just a bit more technical
>>> than they need to be. Perhaps it is necessary but there are a lot of
>>> details which must be just right for success.
>>>
>>> James D. Keeline
>>>
>>> ------------------------------
>>> *From:* Aron Roberts <aron@socrates.berkeley.edu>
>>> *To:* James Keeline <james@keeline.com>
>>> *Cc:* Talk <talk@lists.collectionspace.org>; Chris Hoffman <
>>> chris_h@berkeley.edu>
>>> *Sent:* Monday, June 13, 2016 5:08 PM
>>>
>>> *Subject:* Re: [Talk] XML payload with multiple people
>>>
>>> BTW, there was a typo in the sample payload in a previous note: this
>>> should have read <import service="Persons" type="Person"> (note: first
>>> attribute value is now plural) rather than: <import service="Person"
>>> type="Person">.
>>>
>>> The (corrected) example payload:
>>>
>>> <?xml version="1.0" encoding="utf-8"?>
>>> <imports>
>>> <import service="Persons" type="Person">
>>> <schema xmlns:persons_common="
>>> http://collectionspace.org/services/person" name="persons_common">
>>> <personTermGroupList>
>>> <personTermGroup>
>>> <termDisplayName>Zelda C. Dobbs</termDisplayName>
>>> </personTermGroup>
>>> </personTermGroupList>
>>> <shortIdentifier>ZedaCDobbs</shortIdentifier>
>>> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(ZeldaCDobbs)'ZeldaC.
>>> Dobbs'</refName>
>>> <inAuthority>4b5cd4b4-9776-48e1-9258</inAuthority>
>>> </schema>
>>> </import>
>>> <import service="Persons" type="Person">
>>> <!-- Another record goes here ... -->
>>> </import>
>>> </imports>
>>>
>>> The section "How to find the service and type values" in the Imports
>>> Service Home document,
>>> https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Howtofindtheserviceandtypevalues,
>>> describes how to find and enter the right values for those
>>> two attributes, in the <import service="something_here"
>>> type="something_else_here"> elements.
>>>
>>> Aron
>>>
>>>
>>> On Mon, Jun 13, 2016 at 4:54 PM, Aron Roberts <
>>> aron@socrates.berkeley.edu> wrote:
>>>
>>> Good questions, Chris!
>>>
>>> About an hour ago, I test-imported a couple of Person records lacking
>>> a refName and shortidentifier. It looks like an 'ID' form of the refName
>>> was auto-created for
>>> those records; e.g.:
>>> urn:cspace:core.collectionspace.org:
>>> persons:id(dbbf8c78-6c4e-470b-8765-b07ba73ff9a4)
>>>
>>> And when listing all Person records, following that import, the
>>> following services error occurred:
>>>
>>> ERROR ...
>>> [org.collectionspace.services.common.vocabulary.RefNameServiceUtils:527]
>>> Could not retrieve a list of documents referring to the specified
>>> authority item
>>> java.lang.IllegalArgumentException: Malformed refName for AuthorityTerm
>>> (too few tokens)
>>>
>>> This might yet reflect pilot error on my part, but this at least
>>> suggests a need
>>> to supply values for one or both of those fields in the import payload.
>>>
>>> On Mon, Jun 13, 2016 at 4:40 PM, Chris Hoffman <chris_h@berkeley.edu>
>>> wrote:
>>>
>>> Thanks, Aron, for this better example!
>>>
>>> Do you know if the refname and shortidentifier elements are still needed
>>> by the import service? I don’t see them listed in the schema needed via
>>> the Rest API
>>> <https://wiki.collectionspace.org/display/DOC/Person+Service+REST+APIs#PersonServiceRESTAPIs-Personinstanceschema>
>>>
>>> But maybe they are still needed for the import service.
>>>
>>> Thanks
>>> Chris
>>>
>>>
>>> On Jun 13, 2016, at 4:34 PM, Aron Roberts <aron@socrates.berkeley.edu>
>>> wrote:
>>>
>>> Hi James,
>>>
>>> Sounds good. Note that these examples are for *authority* records,
>>> not for the records for terms *within* an authority, which may be what
>>> you're planning to add here.
>>>
>>> (Note to self and colleagues: we *really* need to add the latter
>>> examples
>>> to this doc.)
>>>
>>> One thing you'll need to be aware of, when importing authority term
>>> records
>>> (i.e. the items within a particular authority/vocabulary), the
>>> 'inAuthority' field
>>> must be present in each such record and must reference an extant parent
>>> authority. This associates the term with the relevant (parent) authority.
>>>
>>> In the example below, when importing one or more persons terms into,
>>> say, the "Local Persons" authority, the inAuthority field here contains
>>> the
>>> unique ID ("CSID") of that authority in the relevant CollectionSpace
>>> system,
>>> 4b5cd4b4-9776-48e1-9258, in this instance. (You can find that CSID via a
>>> request to http://host:port/cspace-services/personauthorities)
>>>
>>> <?xml version="1.0" encoding="utf-8"?>
>>> <imports>
>>> <import service="Person" type="Person">
>>> <schema xmlns:persons_common="
>>> http://collectionspace.org/services/person" name="persons_common">
>>> <personTermGroupList>
>>> <personTermGroup>
>>> <termDisplayName>Zelda C. Dobbs</termDisplayName>
>>> </personTermGroup>
>>> </personTermGroupList>
>>> <shortIdentifier>ZedaCDobbs</shortIdentifier>
>>> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(ZeldaCDobbs)'ZeldaC.
>>> Dobbs'</refName>
>>> <inAuthority>4b5cd4b4-9776-48e1-9258</inAuthority>
>>> </schema>
>>> </import>
>>> <import service="Person" type="Person">
>>> <!-- Another record goes here ... -->
>>> </import>
>>> </imports>
>>>
>>> Aron
>>>
>>> On Mon, Jun 13, 2016 at 3:54 PM, James Keeline <james@keeline.com>
>>> wrote:
>>>
>>> I think I will try to emulate the one on Aron's first link to my inquiry:
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <imports>
>>> <import seq="1" service="Personauthorities" type="Personauthority">
>>> <schema xmlns:personauthorities_common="
>>> http://collectionspace.org/services/person"
>>> <http://collectionspace.org/services/person> name=
>>> "personauthorities_common">
>>> <personauthorities_common:displayName>American Poets</
>>> personauthorities_common:displayName>
>>> <personauthorities_common:shortIdentifier>americanpoets</
>>> personauthorities_common:shortIdentifier>
>>> <personauthorities_common:vocabType>PersonAuthority</
>>> personauthorities_common:vocabType>
>>> <personauthorities_common:refName
>>> >urn:cspace:core.collectionspace.org:Personauthorities:name(americanpoets)'American
>>> Poets'</personauthorities_common:refName>
>>> </schema>
>>> </import>
>>> <import seq="2" service="Personauthorities" type="Personauthority"
>>> CSID="11111111-2222-3333-4444-123456789012">
>>> <schema xmlns:personauthorities_common="
>>> http://collectionspace.org/services/person"
>>> <http://collectionspace.org/services/person> name=
>>> "personauthorities_common">
>>> <personauthorities_common:displayName>French Poets</
>>> personauthorities_common:displayName>
>>> <personauthorities_common:shortIdentifier>frenchpoets</
>>> personauthorities_common:shortIdentifier>
>>> <personauthorities_common:vocabType>PersonAuthority</
>>> personauthorities_common:vocabType>
>>> <personauthorities_common:refName
>>> >urn:cspace:core.collectionspace.org:Personauthorities:name(frenchpoets)'French
>>> Poets'</personauthorities_common:refName>
>>> </schema>
>>> </import>
>>> </imports>
>>>
>>> I'm not adding multiple person authorities so I'll have to use some of
>>> your suggestion as well. I will report back on its efficacy.
>>>
>>> This is an example of the kind of person record I will be including in
>>> the larger document:
>>>
>>> <?xml version="1.0" encoding="utf-8"?>
>>> <document name="persons">
>>> <ns2:persons_common xmlns:ns2="
>>> http://collectionspace.org/services/person" xmlns:xsi="
>>> http://www.w3.org/2001/XMLSchema-instance">
>>> <inAuthority>*e5c217c5-26ad-4289-b778*</inAuthority>
>>> <personTermGroupList>
>>> <personTermGroup>
>>> <termType>urn:cspace:core.collectionspace.org:
>>> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>>> <termLanguage>urn:cspace:core.collectionspace.org:
>>> vocabularies:name(languages):item:name(eng)'English'</termLanguage>
>>> <termDisplayName>Chiang Kai-shek</termDisplayName>
>>> <surName>Chiang</surName>
>>> <foreName>Kai-shek</foreName>
>>> </personTermGroup>
>>> <personTermGroup>
>>> <termType>urn:cspace:core.collectionspace.org:
>>> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>>> <termLanguage>urn:cspace:core.collectionspace.org:
>>> vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
>>> <termDisplayName>蔣介石</termDisplayName>
>>> <surName>蔣</surName>
>>> <foreName>介石</foreName>
>>> </personTermGroup>
>>> </personTermGroupList>
>>> </ns2:persons_common>
>>> </document>
>>>
>>>
>>> This worked against core.collectionspace.org. There are a couple
>>> fields to add to this payload.
>>>
>>> I think though that I might wish to define the short-name so that I can
>>> use a known value for the object records.
>>>
>>> I'm always a bit concerned about supplying the right unique IDs for
>>> something like the inAuthority field. Any thoughts? It is also not clear
>>> to me why the second block of data in the Person Authorities example at the
>>> top has a unique ID (admittedly contrived) but the first one does not.
>>> _____
>>>
>>> Thank you both for your prompt help to this and my other inquiries.
>>>
>>> James D. Keeline
>>>
>>> ------------------------------
>>> *From:* Chris Hoffman <chris_h@berkeley.edu>
>>> *To:* Aron Roberts <aron@socrates.berkeley.edu>
>>> *Cc:* James Keeline <james@keeline.com>; Talk <
>>> talk@lists.collectionspace.org>
>>> *Sent:* Monday, June 13, 2016 3:03 PM
>>> *Subject:* Re: [Talk] XML payload with multiple people
>>>
>>> Hi James,
>>>
>>> Your typical import document is set up to support submitting multiple
>>> records at once. If I recall correctly, the whole document is wrapped in
>>> <imports></imports>. Within that you can have any number of
>>> <import></import> blocks, each of which represents one person record that
>>> you want to create. In practice, we’ve found that we can really only
>>> submit 5K records per batch. Otherwise we’ve had timeouts and other very
>>> nasty behaviors. Here’s an example with the top level elements for
>>> creating 3 records.
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>>
>>> <imports>
>>> <import service="Persons" type="Person”>
>>> ...
>>> </import>
>>> <import service="Persons" type="Person”>
>>> ...
>>> </import>
>>> <import service="Persons" type="Person”>
>>> ...
>>> </import>
>>> </imports>
>>>
>>>
>>> I hope this helps,
>>> Chris
>>>
>>> On Jun 13, 2016, at 12:04 PM, Aron Roberts <aron@socrates.berkeley.edu>
>>> wrote:
>>>
>>> And this is also (somewhat) helpful, as you branch out from Person
>>> authority records to other record types:
>>>
>>>
>>> https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Howtodeterminethecorrectvaluestoputintoan%22/imports/import/schema%22element
>>> :
>>>
>>> On Mon, Jun 13, 2016 at 12:02 PM, Aron Roberts <
>>> aron@socrates.berkeley.edu> wrote:
>>>
>>> One possible starting place:
>>>
>>>
>>> https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-ExampleRequest
>>>
>>> On Mon, Jun 13, 2016 at 11:29 AM, James Keeline <james@keeline.com>
>>> wrote:
>>>
>>> I wish to import multiple people (authors, artists). I can make a
>>> single XML payload.
>>>
>>> It seems to me that one can send multiple at once. What is the element
>>> format for this?
>>>
>>> James D. Keeline
>>>
>>>
>>> _______________________________________________
>>> Talk mailing list
>>> Talk@lists.collectionspace.org
>>>
>>> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Talk mailing list
>>> Talk@lists.collectionspace.org
>>>
>>> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Talk mailing list
>>> Talk@lists.collectionspace.org
>>>
>>> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Talk mailing list
>>> Talk@lists.collectionspace.org
>>>
>>> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
>>>
>>>
>>
>
_______________________________________________
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
SS
Susan STONE
Wed, Jun 15, 2016 1:38 AM
Right. This appears to have changed.
On Tue, Jun 14, 2016 at 6:27 PM, Christopher R. HOFFMAN <
chris_h@berkeley.edu> wrote:
Hi Susan, I think we no longer need to create that schema and data
manually. Lam Voong checked her scripts from our last implementation, and
we did not need to populate that URI.
Thanks,
Chris
On Jun 14, 2016, at 12:01 AM, Susan STONE sstone@berkeley.edu wrote:
Aron,
Unless it has changed back again, the collectionspace_core part is needed
in an import though it wasn't originally.
Susan
On Mon, Jun 13, 2016 at 11:56 PM, Aron Roberts <aron@socrates.berkeley.edu
There's some possible confusion (which I missed seeing in your earlier
email) between:
-
Importing records, via the Imports service. (This is the method
generally used when bulk importing hundreds or thousands of records.)
-
Creating a record, by POSTing to the relevant person authority via the
Services REST API.
These use subtly different payloads, an artifact resulting from the
fact that the Imports service bypasses most of the Services framework and
talks more or less directly to Nuxeo, which expects to encounter its own
payload format.
The payload included in an earlier message, repeated below with a few
trivial tweaks (uppercasing UTF-8 as per W3C doc conventions, removing the
'seq=1' attribute, removing empty repeatable groups), should likely work
for you method 1, calling the Imports service, via either of the following
formats:
https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Sendingtherequest
<?xml version="1.0" encoding="UTF-8" ?>
<imports>
<import service="Persons" type="Person">
<schema xmlns:persons_common="
http://collectionspace.org/services/person" name="persons_common">
<inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
<shortIdentifier>huangjunbi</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang
Junbi (黃君壁)'</refName>
<personTermGroupList>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(eng)'English'</termLanguage>
<termDisplayName>Huang Junbi</termDisplayName>
<surName>Huang</surName>
<foreName>Junbi</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
<termDisplayName>黃君壁</termDisplayName>
<surName>黃</surName>
<foreName>君壁</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
</personTermGroupList>
</schema>
</import>
</imports>
If you're going to be using method 2, POSTing an individual record via
the Services REST APIs, via a call like:
$ curl -X POST '
http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items'
-i -u admin@core.collectionspace.org:Administrator -H "Content-Type:
application/xml " -T testperson.xml
Then your payload will start with something similar to this:
<?xml version="1.0" encoding="UTF-8"?>
<document name="persons">
<ns2:persons_common xmlns:ns2="
http://collectionspace.org/services/person">
...
Rather than the Import payload's preamble:
<?xml version="1.0" encoding="UTF-8" ?>
<imports>
<import service="Persons" type="Person">
<schema xmlns:persons_common="
http://collectionspace.org/services/person" name="persons_common">
...
I don't believe the CollectionSpace 'core' schema part needs to be
included; that this part will get automatically created by CollectionSpace
when you POST. But this is all from memory, since I'm currently away from
access to my past working examples of Person authority term payloads.
Aron
On Mon, Jun 13, 2016 at 11:32 PM, Susan STONE sstone@berkeley.edu
wrote:
James,
I think you are missing the collectionspace_core part of the import
record (in addition to the persons_common part) , e.g. (these are not your
values but pasted in from something I have):
<schema name="collectionspace_core" xmlns:collectionspace_core="
http://collectionspace.org/collectionspace_core/">
<collectionspace_core:uri>/personauthorities/82d438d8-da87-4479-9b68/items/b6ac65f6-7f9d-4dc4-9a18-641e4de1cf65</collectionspace_core:uri>
<collectionspace_core:refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(p224)'A.
Smith'</collectionspace_core:refName>
</schema>
Susan
On Mon, Jun 13, 2016 at 10:38 PM, James Keeline james@keeline.com
wrote:
I am still not having success. That is, I get a response code that
suggests that a record is created but it is not showing up in search.
I was mainly testing against core.collectionspace.org and using the
reported Local Persons person authority ID. I found it with this method:
http://core.collectionspace.org/cspace-services/personauthorities
and the relevant result seems to be:
<list-item>
<csid>*2937e6b9-8ec6-4e0f-b45a*</csid>
<uri>/personauthorities/2937e6b9-8ec6-4e0f-b45a</uri>
<refName>
urn:cspace:core.collectionspace.org:personauthorities:name(person)'Local
Persons'
</refName>
<updatedAt>2016-04-08T18:52:26.094Z</updatedAt>
<workflowState>project</workflowState>
<shortIdentifier>person</shortIdentifier>
<displayName>Local Persons</displayName>
</list-item>
The XML I am trying to send is:
<?xml version="1.0" encoding="utf-8" ?>
<imports>
<import seq="1" service="Persons" type="Person">
<document name="persons">
<schema xmlns:persons_common="
http://collectionspace.org/services/person" name="persons_common">
<inAuthority>*2937e6b9-8ec6-4e0f-b45a*</inAuthority>
<shortIdentifier>huangjunbi</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang
Junbi 黃君壁'</refName>
<personTermGroupList>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(eng)'English'</termLanguage>
<termDisplayName>Huang Junbi</termDisplayName>
<surName>Huang</surName>
<foreName>Junbi</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
<termDisplayName>黃君壁</termDisplayName>
<surName>黃</surName>
<foreName>君壁</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
</personTermGroupList>
<birthDateGroup>
<dateLatestYear></dateLatestYear>
</birthDateGroup>
<deathDateGroup>
<dateLatestYear></dateLatestYear>
</deathDateGroup>
</schema>
</document>
</import>
</imports>
Note that I have modified to <schema> as suggested. When I send the
XML payload to the server with this method (is it correct?) I get a
response code that indicates that a record was sent. However, it is not
showing up in search as I though tit would.
$ curl -X POST '
http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items'
-i -u admin@core.collectionspace.org:Administrator -H "Content-Type:
application/xml " -T testperson.xml
HTTP/1.1 100 Continue
HTTP/1.1 201 Created
Server: Apache-Coyote/1.1
Location:
http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/bee20f53-4ffb-4751-a727
Set-Cookie: JSESSIONID=4E542E1C6CAF477ABDC72AD64EA06962;
Path=/cspace-services/; HttpOnly
Content-Length: 0
Date: Tue, 14 Jun 2016 05:28:41 GMT
I suppose that if I can get one working, I can send larger numbers of
values at once, perhaps even the 800 people at once. However, there is
some little thing that is not working.
I have also tried this on my local installation, with the corresponding
inAuthority number retrieved from that system. Again it claims to create
it but nothing can be found in search.
The XML returned from this URL provided in the response code has
essentially empty elements, none of the data I provided.
http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/bee20f53-4ffb-4751-a727
Perhaps someone reading has a suggestion of a mistake in my XML or
methods.
James D. Keeline
From: Aron Roberts aron@socrates.berkeley.edu
To: James Keeline james@keeline.com
Cc: Talk talk@lists.collectionspace.org; Chris Hoffman <
chris_h@berkeley.edu>
Sent: Monday, June 13, 2016 7:21 PM
Subject: Re: [Talk] XML payload with multiple people
Have also experienced a display oddity - in the record titlebar, in the
dropdown menu below autocomplete fields, and in the Terms Used sidebar
(screenshot attached) - when using the Import service to import a Person
record whose refName display name contains Chinese characters (with or
without parens, square brackets, etc.):
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang
Junbi (黃君壁)'</refName>
If you see the same thing, we can file a bug if one doesn't already
exist ... and for now, perhaps avoid adding those?
On Mon, Jun 13, 2016 at 6:03 PM, Aron Roberts <
aron@socrates.berkeley.edu> wrote:
Sometimes it feels like these processes are just a bit more technical
than they need to be. Perhaps it is necessary but there are a lot of
details which must be just right for success.
D'accord.
Import, in particular, is rather finicky. For sheer speed - since
imports can be quite large and performance is of the essence - the import
service is interacting in a fairly raw way with the Nuxeo enterprise
content management system that underlies CollectionSpace, in a manner that
mostly bypasses the CollectionSpace framework.
-
One thing I observed in the import payload:
<document name="persons">
<ns2:persons_common xmlns:ns2="
http://collectionspace.org/services/person"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
...
</ns2:persons_common>
</document>
(These two elements appear in the payloads that are produced and
consumed when interacting with CollectionSpace via most of its Services
REST API ...)
Whereas for the Import service, the corresponding single element at
this same level of the payload might instead be <schema ...> (AIUI due to
the 'bypass' mentioned above):
<schema xmlns:persons_common="
http://collectionspace.org/services/person" name="persons_common">
...
</schema>
-
As well, as mentioned in the brief convo between Chris and myself
earlier, it appears the refName element (field) is required, when importing
an authority term via the Import service.
-
If you replace the two elements above with the <schema...> element
here, and add the refName, perhaps the import will succeed?
The following payload just imported successfully for me on
qa.collectionspace.org (after substituting QA's "Local Persons" value
in the inAuthority field for the one you're using with your own server,
below).
<?xml version="1.0" encoding="utf-8" ?>
<imports>
<import seq="1" service="Persons" type="Person">
<schema xmlns:persons_common="
http://collectionspace.org/services/person" name="persons_common">
<inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
<shortIdentifier>huangjunbi</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang
Junbi (黃君壁)'</refName>
<personTermGroupList>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(eng)'English'</termLanguage>
<termDisplayName>Huang Junbi</termDisplayName>
<surName>Huang</surName>
<foreName>Junbi</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
<termDisplayName>黃君壁</termDisplayName>
<surName>黃</surName>
<foreName>君壁</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
</personTermGroupList>
<birthDateGroup>
<dateLatestYear></dateLatestYear>
</birthDateGroup>
<deathDateGroup>
<dateLatestYear></dateLatestYear>
</deathDateGroup>
</schema>
</import>
</imports>
The resulting record can be viewed at:
https://qa.collectionspace.org/collectionspace/ui/core/html/person.html?csid=7606204f-67ee-4e1f-8a2e-451683c8ff03&vocab=person
Aron
On Mon, Jun 13, 2016 at 5:25 PM, James Keeline james@keeline.com
wrote:
I have seen the messages since my last inquiry and I need to read them
carefully. I understand now how to "get" the unique ID for the
inAuthority value.
According to this (
http://core.collectionspace.org:8180/cspace-services/personauthorities )
there are several person authorities but the local person authority seems
to have an ID of:
<list-item>
<csid>*2937e6b9-8ec6-4e0f-b45a*</csid>
<uri>/personauthorities/2937e6b9-8ec6-4e0f-b45a</uri>
<refName>
urn:cspace:core.collectionspace.org:personauthorities:name(person)'Local
Persons'
</refName>
<updatedAt>2016-04-08T18:52:26.094Z</updatedAt>
<workflowState>project</workflowState>
<shortIdentifier>person</shortIdentifier>
<displayName>Local Persons</displayName>
</list-item>
This is what I sent to core.collectionspace.org as a test with
additional fields. It says it was created but it does not show up on a
search.
<?xml version="1.0" encoding="utf-8" ?>
<imports>
<import seq="1" service="Persons" type="Person">
<document name="persons">
<ns2:persons_common xmlns:ns2="
http://collectionspace.org/services/person"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
<shortIdentifier>huangjunbi</shortIdentifier>
<personTermGroupList>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(eng)'English'</termLanguage>
<termDisplayName>Huang Junbi</termDisplayName>
<surName>Huang</surName>
<foreName>Junbi</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
<termDisplayName>黃君壁</termDisplayName>
<surName>黃</surName>
<foreName>君壁</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
</personTermGroupList>
<birthDateGroup>
<dateLatestYear></dateLatestYear>
</birthDateGroup>
<deathDateGroup>
<dateLatestYear></dateLatestYear>
</deathDateGroup>
</ns2:persons_common>
</document>
</import>
</imports>
Perhaps this is related to my inAuthority value being different/wrong.
I tried sending to the "found" csid value but it still does not show up
under search. These are the response codes for the two attempts with the
old ID and the found one:
jameskesmacbook:BPOC keeline$ curl -X POST '
http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items'
-i -u admin@core.collectionspace.org:Administrator -H "Content-Type:
application/xml " -T testperson.xml
HTTP/1.1 100 Continue
HTTP/1.1 201 Created
Server: Apache-Coyote/1.1
Location:
http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/85b329e4-0d14-48f3-9365
Set-Cookie: JSESSIONID=E2A4F02670F864DDE3A5D4517B7A36A2;
Path=/cspace-services/; HttpOnly
Content-Length: 0
Date: Tue, 14 Jun 2016 00:05:43 GMT
jameskesmacbook:BPOC keeline$ curl -X POST '
http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items'
-i -u admin@core.collectionspace.org:Administrator -H "Content-Type:
application/xml " -T testperson.xml
HTTP/1.1 100 Continue
HTTP/1.1 201 Created
Server: Apache-Coyote/1.1
Location:
http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/18394f8b-00c4-40d2-a256
Set-Cookie: JSESSIONID=A5405E5A665EE6375E295A27E4DD53B4;
Path=/cspace-services/; HttpOnly
Content-Length: 0
Date: Tue, 14 Jun 2016 00:17:26 GMT
I'm using a PHP script to generate the XML so if there is a snippet to
extract the correct value into a variable, I will include that. I can
probably parse through it with some regex but I'll bet there's a better way
if anyone knows it.
Sometimes it feels like these processes are just a bit more technical
than they need to be. Perhaps it is necessary but there are a lot of
details which must be just right for success.
James D. Keeline
From: Aron Roberts aron@socrates.berkeley.edu
To: James Keeline james@keeline.com
Cc: Talk talk@lists.collectionspace.org; Chris Hoffman <
chris_h@berkeley.edu>
Sent: Monday, June 13, 2016 5:08 PM
Subject: Re: [Talk] XML payload with multiple people
BTW, there was a typo in the sample payload in a previous note: this
should have read <import service="Persons" type="Person"> (note: first
attribute value is now plural) rather than: <import service="Person"
type="Person">.
The (corrected) example payload:
<?xml version="1.0" encoding="utf-8"?>
<imports>
<import service="Persons" type="Person">
<schema xmlns:persons_common="
http://collectionspace.org/services/person" name="persons_common">
<personTermGroupList>
<personTermGroup>
<termDisplayName>Zelda C. Dobbs</termDisplayName>
</personTermGroup>
</personTermGroupList>
<shortIdentifier>ZedaCDobbs</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(ZeldaCDobbs)'ZeldaC.
Dobbs'</refName>
<inAuthority>4b5cd4b4-9776-48e1-9258</inAuthority>
</schema>
</import>
<import service="Persons" type="Person">
<!-- Another record goes here ... -->
</import>
</imports>
The section "How to find the service and type values" in the Imports
Service Home document,
https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Howtofindtheserviceandtypevalues,
describes how to find and enter the right values for those
two attributes, in the <import service="something_here"
type="something_else_here"> elements.
Aron
On Mon, Jun 13, 2016 at 4:54 PM, Aron Roberts <
aron@socrates.berkeley.edu> wrote:
Good questions, Chris!
About an hour ago, I test-imported a couple of Person records lacking
a refName and shortidentifier. It looks like an 'ID' form of the
refName was auto-created for
those records; e.g.:
urn:cspace:core.collectionspace.org:
persons:id(dbbf8c78-6c4e-470b-8765-b07ba73ff9a4)
And when listing all Person records, following that import, the
following services error occurred:
ERROR ...
[org.collectionspace.services.common.vocabulary.RefNameServiceUtils:527]
Could not retrieve a list of documents referring to the specified
authority item
java.lang.IllegalArgumentException: Malformed refName for AuthorityTerm
(too few tokens)
This might yet reflect pilot error on my part, but this at least
suggests a need
to supply values for one or both of those fields in the import payload.
On Mon, Jun 13, 2016 at 4:40 PM, Chris Hoffman chris_h@berkeley.edu
wrote:
Thanks, Aron, for this better example!
Do you know if the refname and shortidentifier elements are still
needed by the import service? I don’t see them listed in the schema needed
via the Rest API
https://wiki.collectionspace.org/display/DOC/Person+Service+REST+APIs#PersonServiceRESTAPIs-Personinstanceschema
But maybe they are still needed for the import service.
Thanks
Chris
On Jun 13, 2016, at 4:34 PM, Aron Roberts aron@socrates.berkeley.edu
wrote:
Hi James,
Sounds good. Note that these examples are for authority records,
not for the records for terms within an authority, which may be what
you're planning to add here.
(Note to self and colleagues: we really need to add the latter
examples
to this doc.)
One thing you'll need to be aware of, when importing authority term
records
(i.e. the items within a particular authority/vocabulary), the
'inAuthority' field
must be present in each such record and must reference an extant parent
authority. This associates the term with the relevant (parent)
authority.
In the example below, when importing one or more persons terms into,
say, the "Local Persons" authority, the inAuthority field here contains
the
unique ID ("CSID") of that authority in the relevant CollectionSpace
system,
4b5cd4b4-9776-48e1-9258, in this instance. (You can find that CSID via a
request to http://host:port/cspace-services/personauthorities)
<?xml version="1.0" encoding="utf-8"?>
<imports>
<import service="Person" type="Person">
<schema xmlns:persons_common="
http://collectionspace.org/services/person" name="persons_common">
<personTermGroupList>
<personTermGroup>
<termDisplayName>Zelda C. Dobbs</termDisplayName>
</personTermGroup>
</personTermGroupList>
<shortIdentifier>ZedaCDobbs</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(ZeldaCDobbs)'ZeldaC.
Dobbs'</refName>
<inAuthority>4b5cd4b4-9776-48e1-9258</inAuthority>
</schema>
</import>
<import service="Person" type="Person">
<!-- Another record goes here ... -->
</import>
</imports>
Aron
On Mon, Jun 13, 2016 at 3:54 PM, James Keeline james@keeline.com
wrote:
I think I will try to emulate the one on Aron's first link to my
inquiry:
<?xml version="1.0" encoding="UTF-8"?>
<imports>
<import seq="1" service="Personauthorities" type="Personauthority">
<schema xmlns:personauthorities_common="
http://collectionspace.org/services/person"
<http://collectionspace.org/services/person> name=
"personauthorities_common">
<personauthorities_common:displayName>American Poets</
personauthorities_common:displayName>
<personauthorities_common:shortIdentifier>americanpoets</
personauthorities_common:shortIdentifier>
<personauthorities_common:vocabType>PersonAuthority</
personauthorities_common:vocabType>
<personauthorities_common:refName
urn:cspace:core.collectionspace.org:Personauthorities:name(americanpoets)'American
Poets'</personauthorities_common:refName>
</schema>
</import>
<import seq="2" service="Personauthorities" type="Personauthority"
CSID="11111111-2222-3333-4444-123456789012">
<schema xmlns:personauthorities_common="
http://collectionspace.org/services/person"
http://collectionspace.org/services/person name=
"personauthorities_common">
<personauthorities_common:displayName>French Poets</
personauthorities_common:displayName>
<personauthorities_common:shortIdentifier>frenchpoets</
personauthorities_common:shortIdentifier>
<personauthorities_common:vocabType>PersonAuthority</
personauthorities_common:vocabType>
<personauthorities_common:refName
urn:cspace:core.collectionspace.org:Personauthorities:name(frenchpoets)'French
Poets'</personauthorities_common:refName>
</schema>
</import>
</imports>
I'm not adding multiple person authorities so I'll have to use some of
your suggestion as well. I will report back on its efficacy.
This is an example of the kind of person record I will be including in
the larger document:
<?xml version="1.0" encoding="utf-8"?>
<document name="persons">
<ns2:persons_common xmlns:ns2="
http://collectionspace.org/services/person" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance">
<inAuthority>*e5c217c5-26ad-4289-b778*</inAuthority>
<personTermGroupList>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(eng)'English'</termLanguage>
<termDisplayName>Chiang Kai-shek</termDisplayName>
<surName>Chiang</surName>
<foreName>Kai-shek</foreName>
</personTermGroup>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:
vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:
vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
<termDisplayName>蔣介石</termDisplayName>
<surName>蔣</surName>
<foreName>介石</foreName>
</personTermGroup>
</personTermGroupList>
</ns2:persons_common>
</document>
This worked against core.collectionspace.org. There are a couple
fields to add to this payload.
I think though that I might wish to define the short-name so that I can
use a known value for the object records.
I'm always a bit concerned about supplying the right unique IDs for
something like the inAuthority field. Any thoughts? It is also not clear
to me why the second block of data in the Person Authorities example at the
top has a unique ID (admittedly contrived) but the first one does not.
Thank you both for your prompt help to this and my other inquiries.
James D. Keeline
From: Chris Hoffman chris_h@berkeley.edu
To: Aron Roberts aron@socrates.berkeley.edu
Cc: James Keeline james@keeline.com; Talk <
talk@lists.collectionspace.org>
Sent: Monday, June 13, 2016 3:03 PM
Subject: Re: [Talk] XML payload with multiple people
Hi James,
Your typical import document is set up to support submitting multiple
records at once. If I recall correctly, the whole document is wrapped in
<imports></imports>. Within that you can have any number of
<import></import> blocks, each of which represents one person record that
you want to create. In practice, we’ve found that we can really only
submit 5K records per batch. Otherwise we’ve had timeouts and other very
nasty behaviors. Here’s an example with the top level elements for
creating 3 records.
<?xml version="1.0" encoding="UTF-8"?>
<imports>
<import service="Persons" type="Person”>
...
</import>
<import service="Persons" type="Person”>
...
</import>
<import service="Persons" type="Person”>
...
</import>
</imports>
I hope this helps,
Chris
On Jun 13, 2016, at 12:04 PM, Aron Roberts aron@socrates.berkeley.edu
wrote:
And this is also (somewhat) helpful, as you branch out from Person
authority records to other record types:
https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Howtodeterminethecorrectvaluestoputintoan%22/imports/import/schema%22element
:
On Mon, Jun 13, 2016 at 12:02 PM, Aron Roberts <
aron@socrates.berkeley.edu> wrote:
One possible starting place:
https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-ExampleRequest
On Mon, Jun 13, 2016 at 11:29 AM, James Keeline james@keeline.com
wrote:
I wish to import multiple people (authors, artists). I can make a
single XML payload.
It seems to me that one can send multiple at once. What is the element
format for this?
James D. Keeline
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
Right. This appears to have changed.
On Tue, Jun 14, 2016 at 6:27 PM, Christopher R. HOFFMAN <
chris_h@berkeley.edu> wrote:
> Hi Susan, I think we no longer need to create that schema and data
> manually. Lam Voong checked her scripts from our last implementation, and
> we did not need to populate that URI.
> Thanks,
> Chris
>
> On Jun 14, 2016, at 12:01 AM, Susan STONE <sstone@berkeley.edu> wrote:
>
> Aron,
>
> Unless it has changed back again, the collectionspace_core part is needed
> in an import though it wasn't originally.
>
> Susan
>
> On Mon, Jun 13, 2016 at 11:56 PM, Aron Roberts <aron@socrates.berkeley.edu
> > wrote:
>
>> There's some possible confusion (which I missed seeing in your earlier
>> email) between:
>>
>> 1. Importing records, via the Imports service. (This is the method
>> generally used when bulk importing hundreds or thousands of records.)
>>
>> 2. Creating a record, by POSTing to the relevant person authority via the
>> Services REST API.
>>
>> These use *subtly different payloads*, an artifact resulting from the
>> fact that the Imports service bypasses most of the Services framework and
>> talks more or less directly to Nuxeo, which expects to encounter its own
>> payload format.
>>
>> The payload included in an earlier message, repeated below with a few
>> trivial tweaks (uppercasing UTF-8 as per W3C doc conventions, removing the
>> 'seq=1' attribute, removing empty repeatable groups), should likely work
>> for you method 1, calling the Imports service, via either of the following
>> formats:
>>
>>
>> https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Sendingtherequest
>>
>> <?xml version="1.0" encoding="UTF-8" ?>
>> <imports>
>> <import service="Persons" type="Person">
>> <schema xmlns:persons_common="
>> http://collectionspace.org/services/person" name="persons_common">
>> <inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
>> <shortIdentifier>huangjunbi</shortIdentifier>
>> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang
>> Junbi (黃君壁)'</refName>
>>
>> <personTermGroupList>
>> <personTermGroup>
>> <termType>urn:cspace:core.collectionspace.org:
>> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>> <termLanguage>urn:cspace:core.collectionspace.org:
>> vocabularies:name(languages):item:name(eng)'English'</termLanguage>
>> <termDisplayName>Huang Junbi</termDisplayName>
>> <surName>Huang</surName>
>> <foreName>Junbi</foreName>
>> <termSource></termSource>
>> <termSourceID></termSourceID>
>> </personTermGroup>
>> <personTermGroup>
>> <termType>urn:cspace:core.collectionspace.org:
>> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>> <termLanguage>urn:cspace:core.collectionspace.org:
>> vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
>> <termDisplayName>黃君壁</termDisplayName>
>> <surName>黃</surName>
>> <foreName>君壁</foreName>
>> <termSource></termSource>
>> <termSourceID></termSourceID>
>> </personTermGroup>
>> </personTermGroupList>
>> </schema>
>> </import>
>> </imports>
>>
>> If you're going to be using method 2, POSTing an individual record via
>> the Services REST APIs, via a call like:
>>
>> $ curl -X POST '
>> http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items'
>> -i -u admin@core.collectionspace.org:Administrator -H "Content-Type:
>> application/xml " -T testperson.xml
>>
>> Then your payload will start with something similar to this:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <document name="persons">
>> <ns2:persons_common xmlns:ns2="
>> http://collectionspace.org/services/person">
>> ...
>>
>> Rather than the Import payload's preamble:
>>
>> <?xml version="1.0" encoding="UTF-8" ?>
>> <imports>
>> <import service="Persons" type="Person">
>> <schema xmlns:persons_common="
>> http://collectionspace.org/services/person" name="persons_common">
>> ...
>>
>> I don't believe the CollectionSpace 'core' schema part needs to be
>> included; that this part will get automatically created by CollectionSpace
>> when you POST. But this is all from memory, since I'm currently away from
>> access to my past working examples of Person authority term payloads.
>>
>> Aron
>>
>>
>>
>> On Mon, Jun 13, 2016 at 11:32 PM, Susan STONE <sstone@berkeley.edu>
>> wrote:
>>
>>> James,
>>>
>>> I think you are missing the collectionspace_core part of the import
>>> record (in addition to the persons_common part) , e.g. (these are not your
>>> values but pasted in from something I have):
>>>
>>> <schema name="collectionspace_core" xmlns:collectionspace_core="
>>> http://collectionspace.org/collectionspace_core/">
>>>
>>> <collectionspace_core:uri>/personauthorities/82d438d8-da87-4479-9b68/items/b6ac65f6-7f9d-4dc4-9a18-641e4de1cf65</collectionspace_core:uri>
>>> <collectionspace_core:refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(p224)'A.
>>> Smith'</collectionspace_core:refName>
>>> </schema>
>>>
>>>
>>> Susan
>>>
>>>
>>> On Mon, Jun 13, 2016 at 10:38 PM, James Keeline <james@keeline.com>
>>> wrote:
>>>
>>>> I am still not having success. That is, I get a response code that
>>>> suggests that a record is created but it is not showing up in search.
>>>>
>>>> I was mainly testing against core.collectionspace.org and using the
>>>> reported Local Persons person authority ID. I found it with this method:
>>>>
>>>> http://core.collectionspace.org/cspace-services/personauthorities
>>>>
>>>> and the relevant result seems to be:
>>>>
>>>> <list-item>
>>>> <csid>*2937e6b9-8ec6-4e0f-b45a*</csid>
>>>> <uri>/personauthorities/2937e6b9-8ec6-4e0f-b45a</uri>
>>>> <refName>
>>>> urn:cspace:core.collectionspace.org:personauthorities:name(person)'Local
>>>> Persons'
>>>> </refName>
>>>> <updatedAt>2016-04-08T18:52:26.094Z</updatedAt>
>>>> <workflowState>project</workflowState>
>>>> <shortIdentifier>person</shortIdentifier>
>>>> <displayName>Local Persons</displayName>
>>>> </list-item>
>>>>
>>>> The XML I am trying to send is:
>>>>
>>>> <?xml version="1.0" encoding="utf-8" ?>
>>>> <imports>
>>>> <import seq="1" service="Persons" type="Person">
>>>> <document name="persons">
>>>> <schema xmlns:persons_common="
>>>> http://collectionspace.org/services/person" name="persons_common">
>>>> <inAuthority>*2937e6b9-8ec6-4e0f-b45a*</inAuthority>
>>>> <shortIdentifier>huangjunbi</shortIdentifier>
>>>> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang
>>>> Junbi 黃君壁'</refName>
>>>> <personTermGroupList>
>>>> <personTermGroup>
>>>> <termType>urn:cspace:core.collectionspace.org:
>>>> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>>>> <termLanguage>urn:cspace:core.collectionspace.org:
>>>> vocabularies:name(languages):item:name(eng)'English'</termLanguage>
>>>> <termDisplayName>Huang Junbi</termDisplayName>
>>>> <surName>Huang</surName>
>>>> <foreName>Junbi</foreName>
>>>> <termSource></termSource>
>>>> <termSourceID></termSourceID>
>>>> </personTermGroup>
>>>> <personTermGroup>
>>>> <termType>urn:cspace:core.collectionspace.org:
>>>> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>>>> <termLanguage>urn:cspace:core.collectionspace.org:
>>>> vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
>>>> <termDisplayName>黃君壁</termDisplayName>
>>>> <surName>黃</surName>
>>>> <foreName>君壁</foreName>
>>>> <termSource></termSource>
>>>> <termSourceID></termSourceID>
>>>> </personTermGroup>
>>>> </personTermGroupList>
>>>> <birthDateGroup>
>>>> <dateLatestYear></dateLatestYear>
>>>> </birthDateGroup>
>>>> <deathDateGroup>
>>>> <dateLatestYear></dateLatestYear>
>>>> </deathDateGroup>
>>>> </schema>
>>>> </document>
>>>> </import>
>>>> </imports>
>>>>
>>>> Note that I have modified to <schema> as suggested. When I send the
>>>> XML payload to the server with this method (is it correct?) I get a
>>>> response code that indicates that a record was sent. However, it is not
>>>> showing up in search as I though tit would.
>>>>
>>>> $ curl -X POST '
>>>> http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items'
>>>> -i -u admin@core.collectionspace.org:Administrator -H "Content-Type:
>>>> application/xml " -T testperson.xml
>>>>
>>>> HTTP/1.1 100 Continue
>>>>
>>>> *HTTP/1.1 201 Created*
>>>> Server: Apache-Coyote/1.1
>>>> Location:
>>>> http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/bee20f53-4ffb-4751-a727
>>>> Set-Cookie: JSESSIONID=4E542E1C6CAF477ABDC72AD64EA06962;
>>>> Path=/cspace-services/; HttpOnly
>>>> Content-Length: 0
>>>> Date: Tue, 14 Jun 2016 05:28:41 GMT
>>>>
>>>> I suppose that if I can get one working, I can send larger numbers of
>>>> values at once, perhaps even the 800 people at once. However, there is
>>>> some little thing that is not working.
>>>>
>>>> I have also tried this on my local installation, with the corresponding
>>>> inAuthority number retrieved from that system. Again it claims to create
>>>> it but nothing can be found in search.
>>>>
>>>> The XML returned from this URL provided in the response code has
>>>> essentially empty elements, none of the data I provided.
>>>>
>>>>
>>>> http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/bee20f53-4ffb-4751-a727
>>>>
>>>> Perhaps someone reading has a suggestion of a mistake in my XML or
>>>> methods.
>>>>
>>>> James D. Keeline
>>>>
>>>> ------------------------------
>>>> *From:* Aron Roberts <aron@socrates.berkeley.edu>
>>>> *To:* James Keeline <james@keeline.com>
>>>> *Cc:* Talk <talk@lists.collectionspace.org>; Chris Hoffman <
>>>> chris_h@berkeley.edu>
>>>> *Sent:* Monday, June 13, 2016 7:21 PM
>>>> *Subject:* Re: [Talk] XML payload with multiple people
>>>>
>>>> Have also experienced a display oddity - in the record titlebar, in the
>>>> dropdown menu below autocomplete fields, and in the Terms Used sidebar
>>>> (screenshot attached) - when using the Import service to import a Person
>>>> record whose refName display name contains Chinese characters (with or
>>>> without parens, square brackets, etc.):
>>>>
>>>> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang
>>>> Junbi (黃君壁)'</refName>
>>>>
>>>> If you see the same thing, we can file a bug if one doesn't already
>>>> exist ... and for now, perhaps avoid adding those?
>>>>
>>>> On Mon, Jun 13, 2016 at 6:03 PM, Aron Roberts <
>>>> aron@socrates.berkeley.edu> wrote:
>>>>
>>>> > Sometimes it feels like these processes are just a bit more technical
>>>> than they need to be. Perhaps it is necessary but there are a lot of
>>>> details which must be just right for success.
>>>>
>>>> D'accord.
>>>>
>>>> Import, in particular, is rather finicky. For sheer speed - since
>>>> imports can be quite large and performance is of the essence - the import
>>>> service is interacting in a fairly raw way with the Nuxeo enterprise
>>>> content management system that underlies CollectionSpace, in a manner that
>>>> mostly bypasses the CollectionSpace framework.
>>>>
>>>> 1. One thing I observed in the import payload:
>>>>
>>>> <document name="persons">
>>>> <ns2:persons_common xmlns:ns2="
>>>> http://collectionspace.org/services/person"
>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>>>> ...
>>>> </ns2:persons_common>
>>>> </document>
>>>>
>>>> (These two elements appear in the payloads that are produced and
>>>> consumed when interacting with CollectionSpace via most of its Services
>>>> REST API ...)
>>>>
>>>> Whereas for the Import service, the corresponding *single* element at
>>>> this same level of the payload might instead be <schema ...> (AIUI due to
>>>> the 'bypass' mentioned above):
>>>>
>>>> <schema xmlns:persons_common="
>>>> http://collectionspace.org/services/person" name="persons_common">
>>>> ...
>>>> </schema>
>>>>
>>>> 2. As well, as mentioned in the brief convo between Chris and myself
>>>> earlier, it appears the refName element (field) is required, when importing
>>>> an authority term via the Import service.
>>>>
>>>> 3. If you replace the two elements above with the <schema...> element
>>>> here, and add the refName, perhaps the import will succeed?
>>>>
>>>> The following payload just imported successfully for me on
>>>> qa.collectionspace.org (after substituting QA's "Local Persons" value
>>>> in the inAuthority field for the one you're using with your own server,
>>>> below).
>>>>
>>>> <?xml version="1.0" encoding="utf-8" ?>
>>>> <imports>
>>>> <import seq="1" service="Persons" type="Person">
>>>> <schema xmlns:persons_common="
>>>> http://collectionspace.org/services/person" name="persons_common">
>>>> <inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
>>>> <shortIdentifier>huangjunbi</shortIdentifier>
>>>> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang
>>>> Junbi (黃君壁)'</refName>
>>>>
>>>> <personTermGroupList>
>>>> <personTermGroup>
>>>> <termType>urn:cspace:core.collectionspace.org:
>>>> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>>>> <termLanguage>urn:cspace:core.collectionspace.org:
>>>> vocabularies:name(languages):item:name(eng)'English'</termLanguage>
>>>> <termDisplayName>Huang Junbi</termDisplayName>
>>>> <surName>Huang</surName>
>>>> <foreName>Junbi</foreName>
>>>> <termSource></termSource>
>>>> <termSourceID></termSourceID>
>>>> </personTermGroup>
>>>> <personTermGroup>
>>>> <termType>urn:cspace:core.collectionspace.org:
>>>> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>>>> <termLanguage>urn:cspace:core.collectionspace.org:
>>>> vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
>>>> <termDisplayName>黃君壁</termDisplayName>
>>>> <surName>黃</surName>
>>>> <foreName>君壁</foreName>
>>>> <termSource></termSource>
>>>> <termSourceID></termSourceID>
>>>> </personTermGroup>
>>>> </personTermGroupList>
>>>> <birthDateGroup>
>>>> <dateLatestYear></dateLatestYear>
>>>> </birthDateGroup>
>>>> <deathDateGroup>
>>>> <dateLatestYear></dateLatestYear>
>>>> </deathDateGroup>
>>>> </schema>
>>>> </import>
>>>> </imports>
>>>>
>>>> The resulting record can be viewed at:
>>>>
>>>>
>>>> https://qa.collectionspace.org/collectionspace/ui/core/html/person.html?csid=7606204f-67ee-4e1f-8a2e-451683c8ff03&vocab=person
>>>>
>>>> Aron
>>>>
>>>> On Mon, Jun 13, 2016 at 5:25 PM, James Keeline <james@keeline.com>
>>>> wrote:
>>>>
>>>> I have seen the messages since my last inquiry and I need to read them
>>>> carefully. I understand now how to "get" the unique ID for the
>>>> *inAuthority* value.
>>>>
>>>> According to this (
>>>> http://core.collectionspace.org:8180/cspace-services/personauthorities )
>>>> there are several person authorities but the local person authority seems
>>>> to have an ID of:
>>>>
>>>> <list-item>
>>>> <csid>*2937e6b9-8ec6-4e0f-b45a*</csid>
>>>> <uri>/personauthorities/2937e6b9-8ec6-4e0f-b45a</uri>
>>>> <refName>
>>>> urn:cspace:core.collectionspace.org:personauthorities:name(person)'Local
>>>> Persons'
>>>> </refName>
>>>> <updatedAt>2016-04-08T18:52:26.094Z</updatedAt>
>>>> <workflowState>project</workflowState>
>>>> <shortIdentifier>person</shortIdentifier>
>>>> <displayName>Local Persons</displayName>
>>>> </list-item>
>>>>
>>>> This is what I sent to core.collectionspace.org as a test with
>>>> additional fields. It says it was created but it does not show up on a
>>>> search.
>>>>
>>>> <?xml version="1.0" encoding="utf-8" ?>
>>>> <imports>
>>>> <import seq="1" service="Persons" type="Person">
>>>> <document name="persons">
>>>> <ns2:persons_common xmlns:ns2="
>>>> http://collectionspace.org/services/person"
>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>>>> <inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
>>>> <shortIdentifier>huangjunbi</shortIdentifier>
>>>> <personTermGroupList>
>>>> <personTermGroup>
>>>> <termType>urn:cspace:core.collectionspace.org:
>>>> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>>>> <termLanguage>urn:cspace:core.collectionspace.org:
>>>> vocabularies:name(languages):item:name(eng)'English'</termLanguage>
>>>> <termDisplayName>Huang Junbi</termDisplayName>
>>>> <surName>Huang</surName>
>>>> <foreName>Junbi</foreName>
>>>> <termSource></termSource>
>>>> <termSourceID></termSourceID>
>>>> </personTermGroup>
>>>> <personTermGroup>
>>>> <termType>urn:cspace:core.collectionspace.org:
>>>> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>>>> <termLanguage>urn:cspace:core.collectionspace.org:
>>>> vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
>>>> <termDisplayName>黃君壁</termDisplayName>
>>>> <surName>黃</surName>
>>>> <foreName>君壁</foreName>
>>>> <termSource></termSource>
>>>> <termSourceID></termSourceID>
>>>> </personTermGroup>
>>>> </personTermGroupList>
>>>> <birthDateGroup>
>>>> <dateLatestYear></dateLatestYear>
>>>> </birthDateGroup>
>>>> <deathDateGroup>
>>>> <dateLatestYear></dateLatestYear>
>>>> </deathDateGroup>
>>>> </ns2:persons_common>
>>>> </document>
>>>> </import>
>>>> </imports>
>>>>
>>>> Perhaps this is related to my inAuthority value being different/wrong.
>>>> I tried sending to the "found" csid value but it still does not show up
>>>> under search. These are the response codes for the two attempts with the
>>>> old ID and the found one:
>>>>
>>>> jameskesmacbook:BPOC keeline$ curl -X POST '
>>>> http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items'
>>>> -i -u admin@core.collectionspace.org:Administrator -H "Content-Type:
>>>> application/xml " -T testperson.xml
>>>> HTTP/1.1 100 Continue
>>>>
>>>> HTTP/1.1 201 Created
>>>> Server: Apache-Coyote/1.1
>>>> Location:
>>>> http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/85b329e4-0d14-48f3-9365
>>>> Set-Cookie: JSESSIONID=E2A4F02670F864DDE3A5D4517B7A36A2;
>>>> Path=/cspace-services/; HttpOnly
>>>> Content-Length: 0
>>>> Date: Tue, 14 Jun 2016 00:05:43 GMT
>>>>
>>>> jameskesmacbook:BPOC keeline$ curl -X POST '
>>>> http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items'
>>>> -i -u admin@core.collectionspace.org:Administrator -H "Content-Type:
>>>> application/xml " -T testperson.xml
>>>> HTTP/1.1 100 Continue
>>>>
>>>> HTTP/1.1 201 Created
>>>> Server: Apache-Coyote/1.1
>>>> Location:
>>>> http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/18394f8b-00c4-40d2-a256
>>>> Set-Cookie: JSESSIONID=A5405E5A665EE6375E295A27E4DD53B4;
>>>> Path=/cspace-services/; HttpOnly
>>>> Content-Length: 0
>>>> Date: Tue, 14 Jun 2016 00:17:26 GMT
>>>>
>>>> I'm using a PHP script to generate the XML so if there is a snippet to
>>>> extract the correct value into a variable, I will include that. I can
>>>> probably parse through it with some regex but I'll bet there's a better way
>>>> if anyone knows it.
>>>>
>>>> Sometimes it feels like these processes are just a bit more technical
>>>> than they need to be. Perhaps it is necessary but there are a lot of
>>>> details which must be just right for success.
>>>>
>>>> James D. Keeline
>>>>
>>>> ------------------------------
>>>> *From:* Aron Roberts <aron@socrates.berkeley.edu>
>>>> *To:* James Keeline <james@keeline.com>
>>>> *Cc:* Talk <talk@lists.collectionspace.org>; Chris Hoffman <
>>>> chris_h@berkeley.edu>
>>>> *Sent:* Monday, June 13, 2016 5:08 PM
>>>>
>>>> *Subject:* Re: [Talk] XML payload with multiple people
>>>>
>>>> BTW, there was a typo in the sample payload in a previous note: this
>>>> should have read <import service="Persons" type="Person"> (note: first
>>>> attribute value is now plural) rather than: <import service="Person"
>>>> type="Person">.
>>>>
>>>> The (corrected) example payload:
>>>>
>>>> <?xml version="1.0" encoding="utf-8"?>
>>>> <imports>
>>>> <import service="Persons" type="Person">
>>>> <schema xmlns:persons_common="
>>>> http://collectionspace.org/services/person" name="persons_common">
>>>> <personTermGroupList>
>>>> <personTermGroup>
>>>> <termDisplayName>Zelda C. Dobbs</termDisplayName>
>>>> </personTermGroup>
>>>> </personTermGroupList>
>>>> <shortIdentifier>ZedaCDobbs</shortIdentifier>
>>>> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(ZeldaCDobbs)'ZeldaC.
>>>> Dobbs'</refName>
>>>> <inAuthority>4b5cd4b4-9776-48e1-9258</inAuthority>
>>>> </schema>
>>>> </import>
>>>> <import service="Persons" type="Person">
>>>> <!-- Another record goes here ... -->
>>>> </import>
>>>> </imports>
>>>>
>>>> The section "How to find the service and type values" in the Imports
>>>> Service Home document,
>>>> https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Howtofindtheserviceandtypevalues,
>>>> describes how to find and enter the right values for those
>>>> two attributes, in the <import service="something_here"
>>>> type="something_else_here"> elements.
>>>>
>>>> Aron
>>>>
>>>>
>>>> On Mon, Jun 13, 2016 at 4:54 PM, Aron Roberts <
>>>> aron@socrates.berkeley.edu> wrote:
>>>>
>>>> Good questions, Chris!
>>>>
>>>> About an hour ago, I test-imported a couple of Person records lacking
>>>> a refName and shortidentifier. It looks like an 'ID' form of the
>>>> refName was auto-created for
>>>> those records; e.g.:
>>>> urn:cspace:core.collectionspace.org:
>>>> persons:id(dbbf8c78-6c4e-470b-8765-b07ba73ff9a4)
>>>>
>>>> And when listing all Person records, following that import, the
>>>> following services error occurred:
>>>>
>>>> ERROR ...
>>>> [org.collectionspace.services.common.vocabulary.RefNameServiceUtils:527]
>>>> Could not retrieve a list of documents referring to the specified
>>>> authority item
>>>> java.lang.IllegalArgumentException: Malformed refName for AuthorityTerm
>>>> (too few tokens)
>>>>
>>>> This might yet reflect pilot error on my part, but this at least
>>>> suggests a need
>>>> to supply values for one or both of those fields in the import payload.
>>>>
>>>> On Mon, Jun 13, 2016 at 4:40 PM, Chris Hoffman <chris_h@berkeley.edu>
>>>> wrote:
>>>>
>>>> Thanks, Aron, for this better example!
>>>>
>>>> Do you know if the refname and shortidentifier elements are still
>>>> needed by the import service? I don’t see them listed in the schema needed
>>>> via the Rest API
>>>> <https://wiki.collectionspace.org/display/DOC/Person+Service+REST+APIs#PersonServiceRESTAPIs-Personinstanceschema>
>>>>
>>>> But maybe they are still needed for the import service.
>>>>
>>>> Thanks
>>>> Chris
>>>>
>>>>
>>>> On Jun 13, 2016, at 4:34 PM, Aron Roberts <aron@socrates.berkeley.edu>
>>>> wrote:
>>>>
>>>> Hi James,
>>>>
>>>> Sounds good. Note that these examples are for *authority* records,
>>>> not for the records for terms *within* an authority, which may be what
>>>> you're planning to add here.
>>>>
>>>> (Note to self and colleagues: we *really* need to add the latter
>>>> examples
>>>> to this doc.)
>>>>
>>>> One thing you'll need to be aware of, when importing authority term
>>>> records
>>>> (i.e. the items within a particular authority/vocabulary), the
>>>> 'inAuthority' field
>>>> must be present in each such record and must reference an extant parent
>>>> authority. This associates the term with the relevant (parent)
>>>> authority.
>>>>
>>>> In the example below, when importing one or more persons terms into,
>>>> say, the "Local Persons" authority, the inAuthority field here contains
>>>> the
>>>> unique ID ("CSID") of that authority in the relevant CollectionSpace
>>>> system,
>>>> 4b5cd4b4-9776-48e1-9258, in this instance. (You can find that CSID via a
>>>> request to http://host:port/cspace-services/personauthorities)
>>>>
>>>> <?xml version="1.0" encoding="utf-8"?>
>>>> <imports>
>>>> <import service="Person" type="Person">
>>>> <schema xmlns:persons_common="
>>>> http://collectionspace.org/services/person" name="persons_common">
>>>> <personTermGroupList>
>>>> <personTermGroup>
>>>> <termDisplayName>Zelda C. Dobbs</termDisplayName>
>>>> </personTermGroup>
>>>> </personTermGroupList>
>>>> <shortIdentifier>ZedaCDobbs</shortIdentifier>
>>>> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(ZeldaCDobbs)'ZeldaC.
>>>> Dobbs'</refName>
>>>> <inAuthority>4b5cd4b4-9776-48e1-9258</inAuthority>
>>>> </schema>
>>>> </import>
>>>> <import service="Person" type="Person">
>>>> <!-- Another record goes here ... -->
>>>> </import>
>>>> </imports>
>>>>
>>>> Aron
>>>>
>>>> On Mon, Jun 13, 2016 at 3:54 PM, James Keeline <james@keeline.com>
>>>> wrote:
>>>>
>>>> I think I will try to emulate the one on Aron's first link to my
>>>> inquiry:
>>>>
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <imports>
>>>> <import seq="1" service="Personauthorities" type="Personauthority">
>>>> <schema xmlns:personauthorities_common="
>>>> http://collectionspace.org/services/person"
>>>> <http://collectionspace.org/services/person> name=
>>>> "personauthorities_common">
>>>> <personauthorities_common:displayName>American Poets</
>>>> personauthorities_common:displayName>
>>>> <personauthorities_common:shortIdentifier>americanpoets</
>>>> personauthorities_common:shortIdentifier>
>>>> <personauthorities_common:vocabType>PersonAuthority</
>>>> personauthorities_common:vocabType>
>>>> <personauthorities_common:refName
>>>> >urn:cspace:core.collectionspace.org:Personauthorities:name(americanpoets)'American
>>>> Poets'</personauthorities_common:refName>
>>>> </schema>
>>>> </import>
>>>> <import seq="2" service="Personauthorities" type="Personauthority"
>>>> CSID="11111111-2222-3333-4444-123456789012">
>>>> <schema xmlns:personauthorities_common="
>>>> http://collectionspace.org/services/person"
>>>> <http://collectionspace.org/services/person> name=
>>>> "personauthorities_common">
>>>> <personauthorities_common:displayName>French Poets</
>>>> personauthorities_common:displayName>
>>>> <personauthorities_common:shortIdentifier>frenchpoets</
>>>> personauthorities_common:shortIdentifier>
>>>> <personauthorities_common:vocabType>PersonAuthority</
>>>> personauthorities_common:vocabType>
>>>> <personauthorities_common:refName
>>>> >urn:cspace:core.collectionspace.org:Personauthorities:name(frenchpoets)'French
>>>> Poets'</personauthorities_common:refName>
>>>> </schema>
>>>> </import>
>>>> </imports>
>>>>
>>>> I'm not adding multiple person authorities so I'll have to use some of
>>>> your suggestion as well. I will report back on its efficacy.
>>>>
>>>> This is an example of the kind of person record I will be including in
>>>> the larger document:
>>>>
>>>> <?xml version="1.0" encoding="utf-8"?>
>>>> <document name="persons">
>>>> <ns2:persons_common xmlns:ns2="
>>>> http://collectionspace.org/services/person" xmlns:xsi="
>>>> http://www.w3.org/2001/XMLSchema-instance">
>>>> <inAuthority>*e5c217c5-26ad-4289-b778*</inAuthority>
>>>> <personTermGroupList>
>>>> <personTermGroup>
>>>> <termType>urn:cspace:core.collectionspace.org:
>>>> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>>>> <termLanguage>urn:cspace:core.collectionspace.org:
>>>> vocabularies:name(languages):item:name(eng)'English'</termLanguage>
>>>> <termDisplayName>Chiang Kai-shek</termDisplayName>
>>>> <surName>Chiang</surName>
>>>> <foreName>Kai-shek</foreName>
>>>> </personTermGroup>
>>>> <personTermGroup>
>>>> <termType>urn:cspace:core.collectionspace.org:
>>>> vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>>>> <termLanguage>urn:cspace:core.collectionspace.org:
>>>> vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
>>>> <termDisplayName>蔣介石</termDisplayName>
>>>> <surName>蔣</surName>
>>>> <foreName>介石</foreName>
>>>> </personTermGroup>
>>>> </personTermGroupList>
>>>> </ns2:persons_common>
>>>> </document>
>>>>
>>>>
>>>> This worked against core.collectionspace.org. There are a couple
>>>> fields to add to this payload.
>>>>
>>>> I think though that I might wish to define the short-name so that I can
>>>> use a known value for the object records.
>>>>
>>>> I'm always a bit concerned about supplying the right unique IDs for
>>>> something like the inAuthority field. Any thoughts? It is also not clear
>>>> to me why the second block of data in the Person Authorities example at the
>>>> top has a unique ID (admittedly contrived) but the first one does not.
>>>> _____
>>>>
>>>> Thank you both for your prompt help to this and my other inquiries.
>>>>
>>>> James D. Keeline
>>>>
>>>> ------------------------------
>>>> *From:* Chris Hoffman <chris_h@berkeley.edu>
>>>> *To:* Aron Roberts <aron@socrates.berkeley.edu>
>>>> *Cc:* James Keeline <james@keeline.com>; Talk <
>>>> talk@lists.collectionspace.org>
>>>> *Sent:* Monday, June 13, 2016 3:03 PM
>>>> *Subject:* Re: [Talk] XML payload with multiple people
>>>>
>>>> Hi James,
>>>>
>>>> Your typical import document is set up to support submitting multiple
>>>> records at once. If I recall correctly, the whole document is wrapped in
>>>> <imports></imports>. Within that you can have any number of
>>>> <import></import> blocks, each of which represents one person record that
>>>> you want to create. In practice, we’ve found that we can really only
>>>> submit 5K records per batch. Otherwise we’ve had timeouts and other very
>>>> nasty behaviors. Here’s an example with the top level elements for
>>>> creating 3 records.
>>>>
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>
>>>> <imports>
>>>> <import service="Persons" type="Person”>
>>>> ...
>>>> </import>
>>>> <import service="Persons" type="Person”>
>>>> ...
>>>> </import>
>>>> <import service="Persons" type="Person”>
>>>> ...
>>>> </import>
>>>> </imports>
>>>>
>>>>
>>>> I hope this helps,
>>>> Chris
>>>>
>>>> On Jun 13, 2016, at 12:04 PM, Aron Roberts <aron@socrates.berkeley.edu>
>>>> wrote:
>>>>
>>>> And this is also (somewhat) helpful, as you branch out from Person
>>>> authority records to other record types:
>>>>
>>>>
>>>> https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Howtodeterminethecorrectvaluestoputintoan%22/imports/import/schema%22element
>>>> :
>>>>
>>>> On Mon, Jun 13, 2016 at 12:02 PM, Aron Roberts <
>>>> aron@socrates.berkeley.edu> wrote:
>>>>
>>>> One possible starting place:
>>>>
>>>>
>>>> https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-ExampleRequest
>>>>
>>>> On Mon, Jun 13, 2016 at 11:29 AM, James Keeline <james@keeline.com>
>>>> wrote:
>>>>
>>>> I wish to import multiple people (authors, artists). I can make a
>>>> single XML payload.
>>>>
>>>> It seems to me that one can send multiple at once. What is the element
>>>> format for this?
>>>>
>>>> James D. Keeline
>>>>
>>>>
>>>> _______________________________________________
>>>> Talk mailing list
>>>> Talk@lists.collectionspace.org
>>>>
>>>> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Talk mailing list
>>>> Talk@lists.collectionspace.org
>>>>
>>>> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Talk mailing list
>>>> Talk@lists.collectionspace.org
>>>>
>>>> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Talk mailing list
>>>> Talk@lists.collectionspace.org
>>>>
>>>> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
>>>>
>>>>
>>>
>>
> _______________________________________________
> Talk mailing list
> Talk@lists.collectionspace.org
>
> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
>
>
JK
James Keeline
Wed, Jun 15, 2016 5:09 AM
For the record, here is what worked for me.
I had to get the unique ID from http://192.168.56.10:8180/cspace-services/personauthorities
<list-item><csid>004bb42f-dadc-469c-acfa</csid><uri>/personauthorities/004bb42f-dadc-469c-acfa</uri><refName>urn:cspace:core.collectionspace.org:personauthorities:name(person)'Local Persons'</refName><updatedAt>2016-06-10T17:20:02.062Z</updatedAt><workflowState>project</workflowState><shortIdentifier>person</shortIdentifier><displayName>Local Persons</displayName></list-item>
I stored this payload in a file:
<?xml version="1.0" encoding="utf-8" ?><imports> <import seq="3" service="Persons" type="Person">
<schema xmlns:persons_common="http://collectionspace.org/services/person" name="persons_common"> <inAuthority>004bb42f-dadc-469c-acfa</inAuthority> <shortIdentifier>chiangkaishek</shortIdentifier> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(chiangkaishek)'Chiang Kai-shek 蔣介石'</refName> <personTermGroupList> <personTermGroup> <termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType> <termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'</termLanguage> <termDisplayName>Chiang Kai-shek</termDisplayName> <surName>Chiang</surName> <foreName>Kai-shek</foreName> <termSource></termSource> <termSourceID></termSourceID> </personTermGroup> <personTermGroup> <termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType> <termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage> <termDisplayName>蔣介石</termDisplayName> <surName>蔣</surName> <foreName>介石</foreName> <termSource></termSource> <termSourceID></termSourceID> </personTermGroup> </personTermGroupList> <birthDateGroup> <dateDisplayDate></dateDisplayDate> <dateLatestYear></dateLatestYear> </birthDateGroup> <deathDateGroup> <dateDisplayDate></dateDisplayDate> <dateLatestYear></dateLatestYear> </deathDateGroup> </schema> </import> <import seq="4" service="Persons" type="Person"> <schema xmlns:persons_common="http://collectionspace.org/services/person" name="persons_common"> <inAuthority>004bb42f-dadc-469c-acfa</inAuthority> <shortIdentifier>huangjunbi</shortIdentifier> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang Junbi 黃君壁'</refName> <personTermGroupList> <personTermGroup> <termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType> <termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'</termLanguage> <termDisplayName>Huang Junbi</termDisplayName> <surName>Huang</surName> <foreName>Junbi</foreName> <termSource></termSource> <termSourceID></termSourceID> </personTermGroup> <personTermGroup> <termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType> <termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage> <termDisplayName>黃君壁</termDisplayName> <surName>黃</surName> <foreName>君壁</foreName> <termSource></termSource> <termSourceID></termSourceID> </personTermGroup> </personTermGroupList> <birthDateGroup> <dateDisplayDate></dateDisplayDate> <dateLatestYear></dateLatestYear> </birthDateGroup> <deathDateGroup> <dateDisplayDate></dateDisplayDate> <dateLatestYear></dateLatestYear> </deathDateGroup> </schema> </import></imports>
I used a command like this to send the file to the import service:
curl -X POST http://192.168.56.10:8180/cspace-services/imports -i -u admin@core.collectionspace.org:Administrator -H "Content-Type: application/xml" -T payload.xml
James D. Keeline
From: Susan STONE <sstone@berkeley.edu>
To: Christopher R. HOFFMAN chris_h@berkeley.edu
Cc: Talk talk@lists.collectionspace.org
Sent: Tuesday, June 14, 2016 6:38 PM
Subject: Re: [Talk] XML payload with multiple people
Right. This appears to have changed.
On Tue, Jun 14, 2016 at 6:27 PM, Christopher R. HOFFMAN chris_h@berkeley.edu wrote:
Hi Susan, I think we no longer need to create that schema and data manually. Lam Voong checked her scripts from our last implementation, and we did not need to populate that URI. Thanks,Chris
On Jun 14, 2016, at 12:01 AM, Susan STONE sstone@berkeley.edu wrote:
Aron,
Unless it has changed back again, the collectionspace_core part is needed in an import though it wasn't originally.
Susan
On Mon, Jun 13, 2016 at 11:56 PM, Aron Roberts aron@socrates.berkeley.edu wrote:
There's some possible confusion (which I missed seeing in your earlier email) between:
-
Importing records, via the Imports service. (This is the method generally used when bulk importing hundreds or thousands of records.)
-
Creating a record, by POSTing to the relevant person authority via the Services REST API.
These use subtly different payloads, an artifact resulting from the fact that the Imports service bypasses most of the Services framework and talks more or less directly to Nuxeo, which expects to encounter its own payload format.
The payload included in an earlier message, repeated below with a few trivial tweaks (uppercasing UTF-8 as per W3C doc conventions, removing the 'seq=1' attribute, removing empty repeatable groups), should likely work for you method 1, calling the Imports service, via either of the following formats:
https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Sendingtherequest
<?xml version="1.0" encoding="UTF-8" ?>
<imports>
<import service="Persons" type="Person">
<schema xmlns:persons_common="http://collectionspace.org/services/person" name="persons_common">
<inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
<shortIdentifier>huangjunbi</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang Junbi (黃君壁)'</refName>
<personTermGroupList>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'</termLanguage>
<termDisplayName>Huang Junbi</termDisplayName>
<surName>Huang</surName>
<foreName>Junbi</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
<termDisplayName>黃君壁</termDisplayName>
<surName>黃</surName>
<foreName>君壁</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
</personTermGroupList>
</schema>
</import>
</imports>
If you're going to be using method 2, POSTing an individual record via the Services REST APIs, via a call like:
$ curl -X POST 'http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items' -i -u admin@core.collectionspace.org:Administrator -H "Content-Type: application/xml " -T testperson.xml
Then your payload will start with something similar to this:
<?xml version="1.0" encoding="UTF-8"?>
<document name="persons">
<ns2:persons_common xmlns:ns2="http://collectionspace.org/services/person">
...
Rather than the Import payload's preamble:
<?xml version="1.0" encoding="UTF-8" ?>
<imports>
<import service="Persons" type="Person">
<schema xmlns:persons_common="http://collectionspace.org/services/person" name="persons_common">
...
I don't believe the CollectionSpace 'core' schema part needs to be included; that this part will get automatically created by CollectionSpace when you POST. But this is all from memory, since I'm currently away from access to my past working examples of Person authority term payloads.
Aron
On Mon, Jun 13, 2016 at 11:32 PM, Susan STONE sstone@berkeley.edu wrote:
James,
I think you are missing the collectionspace_core part of the import record (in addition to the persons_common part) , e.g. (these are not your values but pasted in from something I have):
<schema name="collectionspace_core" xmlns:collectionspace_core="http://collectionspace.org/collectionspace_core/">
<collectionspace_core:uri>/personauthorities/82d438d8-da87-4479-9b68/items/b6ac65f6-7f9d-4dc4-9a18-641e4de1cf65</collectionspace_core:uri>
<collectionspace_core:refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(p224)'A. Smith'</collectionspace_core:refName>
</schema>
Susan
On Mon, Jun 13, 2016 at 10:38 PM, James Keeline james@keeline.com wrote:
I am still not having success. That is, I get a response code that suggests that a record is created but it is not showing up in search.
I was mainly testing against core.collectionspace.org and using the reported Local Persons person authority ID. I found it with this method:
http://core.collectionspace.org/cspace-services/personauthorities
and the relevant result seems to be:
<list-item> <csid>2937e6b9-8ec6-4e0f-b45a</csid> <uri>/personauthorities/2937e6b9-8ec6-4e0f-b45a</uri> <refName> urn:cspace:core.collectionspace.org:personauthorities:name(person)'Local Persons' </refName> <updatedAt>2016-04-08T18:52:26.094Z</updatedAt> <workflowState>project</workflowState> <shortIdentifier>person</shortIdentifier> <displayName>Local Persons</displayName></list-item>
The XML I am trying to send is:
<?xml version="1.0" encoding="utf-8" ?><imports> <import seq="1" service="Persons" type="Person"> <document name="persons"> <schema xmlns:persons_common="http://collectionspace.org/services/person" name="persons_common"> <inAuthority>2937e6b9-8ec6-4e0f-b45a</inAuthority> <shortIdentifier>huangjunbi</shortIdentifier> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang Junbi 黃君壁'</refName> <personTermGroupList> <personTermGroup> <termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType> <termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'</termLanguage> <termDisplayName>Huang Junbi</termDisplayName> <surName>Huang</surName> <foreName>Junbi</foreName> <termSource></termSource> <termSourceID></termSourceID> </personTermGroup> <personTermGroup> <termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType> <termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage> <termDisplayName>黃君壁</termDisplayName> <surName>黃</surName> <foreName>君壁</foreName> <termSource></termSource> <termSourceID></termSourceID> </personTermGroup> </personTermGroupList> <birthDateGroup> <dateLatestYear></dateLatestYear> </birthDateGroup> <deathDateGroup> <dateLatestYear></dateLatestYear> </deathDateGroup> </schema> </document> </import></imports>
Note that I have modified to <schema> as suggested. When I send the XML payload to the server with this method (is it correct?) I get a response code that indicates that a record was sent. However, it is not showing up in search as I though tit would.
$ curl -X POST 'http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items' -i -u admin@core.collectionspace.org:Administrator -H "Content-Type: application/xml " -T testperson.xml
HTTP/1.1 100 Continue
HTTP/1.1 201 CreatedServer: Apache-Coyote/1.1Location: http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/bee20f53-4ffb-4751-a727Set-Cookie: JSESSIONID=4E542E1C6CAF477ABDC72AD64EA06962; Path=/cspace-services/; HttpOnlyContent-Length: 0Date: Tue, 14 Jun 2016 05:28:41 GMT
I suppose that if I can get one working, I can send larger numbers of values at once, perhaps even the 800 people at once. However, there is some little thing that is not working.
I have also tried this on my local installation, with the corresponding inAuthority number retrieved from that system. Again it claims to create it but nothing can be found in search.
The XML returned from this URL provided in the response code has essentially empty elements, none of the data I provided.
http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/bee20f53-4ffb-4751-a727
Perhaps someone reading has a suggestion of a mistake in my XML or methods.
James D. Keeline
From: Aron Roberts <aron@socrates.berkeley.edu>
To: James Keeline james@keeline.com
Cc: Talk talk@lists.collectionspace.org; Chris Hoffman chris_h@berkeley.edu
Sent: Monday, June 13, 2016 7:21 PM
Subject: Re: [Talk] XML payload with multiple people
Have also experienced a display oddity - in the record titlebar, in the dropdown menu below autocomplete fields, and in the Terms Used sidebar (screenshot attached) - when using the Import service to import a Person record whose refName display name contains Chinese characters (with or without parens, square brackets, etc.):
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang Junbi (黃君壁)'</refName>
If you see the same thing, we can file a bug if one doesn't already exist ... and for now, perhaps avoid adding those?
On Mon, Jun 13, 2016 at 6:03 PM, Aron Roberts aron@socrates.berkeley.edu wrote:
Sometimes it feels like these processes are just a bit more technical than they need to be. Perhaps it is necessary but there are a lot of details which must be just right for success.
D'accord.
Import, in particular, is rather finicky. For sheer speed - since imports can be quite large and performance is of the essence - the import service is interacting in a fairly raw way with the Nuxeo enterprise content management system that underlies CollectionSpace, in a manner that mostly bypasses the CollectionSpace framework.
- One thing I observed in the import payload:
<document name="persons">
<ns2:persons_common xmlns:ns2="http://collectionspace.org/services/person"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
...
</ns2:persons_common>
</document>
(These two elements appear in the payloads that are produced and consumed when interacting with CollectionSpace via most of its Services REST API ...)
Whereas for the Import service, the corresponding single element at this same level of the payload might instead be <schema ...> (AIUI due to the 'bypass' mentioned above):
<schema xmlns:persons_common="http://collectionspace.org/services/person" name="persons_common">
...
</schema>
2. As well, as mentioned in the brief convo between Chris and myself earlier, it appears the refName element (field) is required, when importing an authority term via the Import service.
3. If you replace the two elements above with the <schema...> element here, and add the refName, perhaps the import will succeed?
The following payload just imported successfully for me on qa.collectionspace.org (after substituting QA's "Local Persons" value in the inAuthority field for the one you're using with your own server, below).
<?xml version="1.0" encoding="utf-8" ?>
<imports>
<import seq="1" service="Persons" type="Person">
<schema xmlns:persons_common="http://collectionspace.org/services/person" name="persons_common">
<inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
<shortIdentifier>huangjunbi</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang Junbi (黃君壁)'</refName>
<personTermGroupList>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'</termLanguage>
<termDisplayName>Huang Junbi</termDisplayName>
<surName>Huang</surName>
<foreName>Junbi</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
<termDisplayName>黃君壁</termDisplayName>
<surName>黃</surName>
<foreName>君壁</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
</personTermGroupList>
<birthDateGroup>
<dateLatestYear></dateLatestYear>
</birthDateGroup>
<deathDateGroup>
<dateLatestYear></dateLatestYear>
</deathDateGroup>
</schema>
</import>
</imports>
The resulting record can be viewed at:
https://qa.collectionspace.org/collectionspace/ui/core/html/person.html?csid=7606204f-67ee-4e1f-8a2e-451683c8ff03&vocab=person
Aron
On Mon, Jun 13, 2016 at 5:25 PM, James Keeline james@keeline.com wrote:
I have seen the messages since my last inquiry and I need to read them carefully. I understand now how to "get" the unique ID for the inAuthority value.
According to this ( http://core.collectionspace.org:8180/cspace-services/personauthorities ) there are several person authorities but the local person authority seems to have an ID of:
<list-item><csid>2937e6b9-8ec6-4e0f-b45a</csid><uri>/personauthorities/2937e6b9-8ec6-4e0f-b45a</uri><refName>urn:cspace:core.collectionspace.org:personauthorities:name(person)'Local Persons'</refName><updatedAt>2016-04-08T18:52:26.094Z</updatedAt><workflowState>project</workflowState><shortIdentifier>person</shortIdentifier><displayName>Local Persons</displayName></list-item>
This is what I sent to core.collectionspace.org as a test with additional fields. It says it was created but it does not show up on a search.
<?xml version="1.0" encoding="utf-8" ?><imports> <import seq="1" service="Persons" type="Person"> <document name="persons"> <ns2:persons_common xmlns:ns2="http://collectionspace.org/services/person" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <inAuthority>e5c217c5-26ad-4289-b778</inAuthority> <shortIdentifier>huangjunbi</shortIdentifier> <personTermGroupList> <personTermGroup> <termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType> <termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'</termLanguage> <termDisplayName>Huang Junbi</termDisplayName> <surName>Huang</surName> <foreName>Junbi</foreName> <termSource></termSource> <termSourceID></termSourceID> </personTermGroup> <personTermGroup> <termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType> <termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage> <termDisplayName>黃君壁</termDisplayName> <surName>黃</surName> <foreName>君壁</foreName> <termSource></termSource> <termSourceID></termSourceID> </personTermGroup> </personTermGroupList> <birthDateGroup> <dateLatestYear></dateLatestYear> </birthDateGroup> <deathDateGroup> <dateLatestYear></dateLatestYear> </deathDateGroup> </ns2:persons_common> </document> </import></imports>
Perhaps this is related to my inAuthority value being different/wrong. I tried sending to the "found" csid value but it still does not show up under search. These are the response codes for the two attempts with the old ID and the found one:
jameskesmacbook:BPOC keeline$ curl -X POST 'http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items' -i -u admin@core.collectionspace.org:Administrator -H "Content-Type: application/xml " -T testperson.xmlHTTP/1.1 100 Continue
HTTP/1.1 201 CreatedServer: Apache-Coyote/1.1Location: http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/85b329e4-0d14-48f3-9365Set-Cookie: JSESSIONID=E2A4F02670F864DDE3A5D4517B7A36A2; Path=/cspace-services/; HttpOnlyContent-Length: 0Date: Tue, 14 Jun 2016 00:05:43 GMT
jameskesmacbook:BPOC keeline$ curl -X POST 'http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items' -i -u admin@core.collectionspace.org:Administrator -H "Content-Type: application/xml " -T testperson.xmlHTTP/1.1 100 Continue
HTTP/1.1 201 CreatedServer: Apache-Coyote/1.1Location: http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/18394f8b-00c4-40d2-a256Set-Cookie: JSESSIONID=A5405E5A665EE6375E295A27E4DD53B4; Path=/cspace-services/; HttpOnlyContent-Length: 0Date: Tue, 14 Jun 2016 00:17:26 GMT
I'm using a PHP script to generate the XML so if there is a snippet to extract the correct value into a variable, I will include that. I can probably parse through it with some regex but I'll bet there's a better way if anyone knows it.
Sometimes it feels like these processes are just a bit more technical than they need to be. Perhaps it is necessary but there are a lot of details which must be just right for success. James D. Keeline
From: Aron Roberts <aron@socrates.berkeley.edu>
To: James Keeline james@keeline.com
Cc: Talk talk@lists.collectionspace.org; Chris Hoffman chris_h@berkeley.edu
Sent: Monday, June 13, 2016 5:08 PM
Subject: Re: [Talk] XML payload with multiple people
BTW, there was a typo in the sample payload in a previous note: this should have read <import service="Persons" type="Person"> (note: first attribute value is now plural) rather than: <import service="Person" type="Person">.
The (corrected) example payload:
<?xml version="1.0" encoding="utf-8"?>
<imports>
<import service="Persons" type="Person">
<schema xmlns:persons_common="http://collectionspace.org/services/person" name="persons_common">
<personTermGroupList>
<personTermGroup>
<termDisplayName>Zelda C. Dobbs</termDisplayName>
</personTermGroup>
</personTermGroupList>
<shortIdentifier>ZedaCDobbs</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(ZeldaCDobbs)'ZeldaC. Dobbs'</refName>
<inAuthority>4b5cd4b4-9776-48e1-9258</inAuthority>
</schema>
</import>
<import service="Persons" type="Person">
<!-- Another record goes here ... -->
</import>
</imports>
The section "How to find the service and type values" in the Imports Service Home document, https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Howtofindtheserviceandtypevalues, describes how to find and enter the right values for those
two attributes, in the <import service="something_here" type="something_else_here"> elements.
Aron
On Mon, Jun 13, 2016 at 4:54 PM, Aron Roberts aron@socrates.berkeley.edu wrote:
Good questions, Chris!
About an hour ago, I test-imported a couple of Person records lacking
a refName and shortidentifier. It looks like an 'ID' form of the refName was auto-created for
those records; e.g.:
urn:cspace:core.collectionspace.org:persons:id(dbbf8c78-6c4e-470b-8765-b07ba73ff9a4)
And when listing all Person records, following that import, the following services error occurred:
ERROR ... [org.collectionspace.services.common.vocabulary.RefNameServiceUtils:527]
Could not retrieve a list of documents referring to the specified authority item
java.lang.IllegalArgumentException: Malformed refName for AuthorityTerm (too few tokens)
This might yet reflect pilot error on my part, but this at least suggests a need
to supply values for one or both of those fields in the import payload.
On Mon, Jun 13, 2016 at 4:40 PM, Chris Hoffman chris_h@berkeley.edu wrote:
Thanks, Aron, for this better example!
Do you know if the refname and shortidentifier elements are still needed by the import service? I don’t see them listed in the schema needed via the Rest API
But maybe they are still needed for the import service.
ThanksChris
On Jun 13, 2016, at 4:34 PM, Aron Roberts aron@socrates.berkeley.edu wrote:
Hi James,
Sounds good. Note that these examples are for authority records,
not for the records for terms within an authority, which may be what
you're planning to add here.
(Note to self and colleagues: we really need to add the latter examples
to this doc.)
One thing you'll need to be aware of, when importing authority term records
(i.e. the items within a particular authority/vocabulary), the 'inAuthority' field
must be present in each such record and must reference an extant parent
authority. This associates the term with the relevant (parent) authority.
In the example below, when importing one or more persons terms into,
say, the "Local Persons" authority, the inAuthority field here contains the
unique ID ("CSID") of that authority in the relevant CollectionSpace system,
4b5cd4b4-9776-48e1-9258, in this instance. (You can find that CSID via a
request to http://host:port/cspace-services/personauthorities)
<?xml version="1.0" encoding="utf-8"?>
<imports>
<import service="Person" type="Person">
<schema xmlns:persons_common="http://collectionspace.org/services/person" name="persons_common">
<personTermGroupList>
<personTermGroup>
<termDisplayName>Zelda C. Dobbs</termDisplayName>
</personTermGroup>
</personTermGroupList>
<shortIdentifier>ZedaCDobbs</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(ZeldaCDobbs)'ZeldaC. Dobbs'</refName>
<inAuthority>4b5cd4b4-9776-48e1-9258</inAuthority>
</schema>
</import>
<import service="Person" type="Person">
<!-- Another record goes here ... -->
</import>
</imports>
Aron
On Mon, Jun 13, 2016 at 3:54 PM, James Keeline james@keeline.com wrote:
I think I will try to emulate the one on Aron's first link to my inquiry:
<?xml version="1.0" encoding="UTF-8"?><imports> <import seq="1" service="Personauthorities" type="Personauthority"> <schema xmlns:personauthorities_common="http://collectionspace.org/services/person" name="personauthorities_common"> <personauthorities_common:displayName>American Poets</personauthorities_common:displayName> <personauthorities_common:shortIdentifier>americanpoets</personauthorities_common:shortIdentifier> <personauthorities_common:vocabType>PersonAuthority</personauthorities_common:vocabType> <personauthorities_common:refName>urn:cspace:core.collectionspace.org:Personauthorities:name(americanpoets)'American Poets'</personauthorities_common:refName> </schema> </import> <import seq="2" service="Personauthorities" type="Personauthority" CSID="11111111-2222-3333-4444-123456789012"> <schema xmlns:personauthorities_common="http://collectionspace.org/services/person" name="personauthorities_common"> <personauthorities_common:displayName>French Poets</personauthorities_common:displayName> <personauthorities_common:shortIdentifier>frenchpoets</personauthorities_common:shortIdentifier> <personauthorities_common:vocabType>PersonAuthority</personauthorities_common:vocabType> <personauthorities_common:refName>urn:cspace:core.collectionspace.org:Personauthorities:name(frenchpoets)'French Poets'</personauthorities_common:refName> </schema> </import></imports> I'm not adding multiple person authorities so I'll have to use some of your suggestion as well. I will report back on its efficacy.
This is an example of the kind of person record I will be including in the larger document:
<?xml version="1.0" encoding="utf-8"?><document name="persons"> <ns2:persons_common xmlns:ns2="http://collectionspace.org/services/person" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <inAuthority>e5c217c5-26ad-4289-b778</inAuthority> <personTermGroupList> <personTermGroup> <termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType> <termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'</termLanguage> <termDisplayName>Chiang Kai-shek</termDisplayName> <surName>Chiang</surName> <foreName>Kai-shek</foreName> </personTermGroup> <personTermGroup> <termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType> <termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage> <termDisplayName>蔣介石</termDisplayName> <surName>蔣</surName> <foreName>介石</foreName> </personTermGroup> </personTermGroupList> </ns2:persons_common></document>
This worked against core.collectionspace.org. There are a couple fields to add to this payload.
I think though that I might wish to define the short-name so that I can use a known value for the object records.
I'm always a bit concerned about supplying the right unique IDs for something like the inAuthority field. Any thoughts? It is also not clear to me why the second block of data in the Person Authorities example at the top has a unique ID (admittedly contrived) but the first one does not._____
Thank you both for your prompt help to this and my other inquiries.
James D. Keeline
From: Chris Hoffman <chris_h@berkeley.edu>
To: Aron Roberts aron@socrates.berkeley.edu
Cc: James Keeline james@keeline.com; Talk talk@lists.collectionspace.org
Sent: Monday, June 13, 2016 3:03 PM
Subject: Re: [Talk] XML payload with multiple people
Hi James,
Your typical import document is set up to support submitting multiple records at once. If I recall correctly, the whole document is wrapped in <imports></imports>. Within that you can have any number of <import></import> blocks, each of which represents one person record that you want to create. In practice, we’ve found that we can really only submit 5K records per batch. Otherwise we’ve had timeouts and other very nasty behaviors. Here’s an example with the top level elements for creating 3 records.
<?xml version="1.0" encoding="UTF-8"?>
<imports> <import service="Persons" type="Person”> ... </import> <import service="Persons" type="Person”> ... </import> <import service="Persons" type="Person”> ... </import></imports>
I hope this helps,Chris
On Jun 13, 2016, at 12:04 PM, Aron Roberts aron@socrates.berkeley.edu wrote:
And this is also (somewhat) helpful, as you branch out from Person authority records to other record types:
https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Howtodeterminethecorrectvaluestoputintoan%22/imports/import/schema%22element:
On Mon, Jun 13, 2016 at 12:02 PM, Aron Roberts aron@socrates.berkeley.edu wrote:
One possible starting place:
https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-ExampleRequest
On Mon, Jun 13, 2016 at 11:29 AM, James Keeline james@keeline.com wrote:
I wish to import multiple people (authors, artists). I can make a single XML payload.
It seems to me that one can send multiple at once. What is the element format for this? James D. Keeline
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
For the record, here is what worked for me.
I had to get the unique ID from http://192.168.56.10:8180/cspace-services/personauthorities
<list-item><csid>004bb42f-dadc-469c-acfa</csid><uri>/personauthorities/004bb42f-dadc-469c-acfa</uri><refName>urn:cspace:core.collectionspace.org:personauthorities:name(person)'Local Persons'</refName><updatedAt>2016-06-10T17:20:02.062Z</updatedAt><workflowState>project</workflowState><shortIdentifier>person</shortIdentifier><displayName>Local Persons</displayName></list-item>
I stored this payload in a file:
<?xml version="1.0" encoding="utf-8" ?><imports> <import seq="3" service="Persons" type="Person">
<schema xmlns:persons_common="http://collectionspace.org/services/person" name="persons_common"> <inAuthority>004bb42f-dadc-469c-acfa</inAuthority> <shortIdentifier>chiangkaishek</shortIdentifier> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(chiangkaishek)'Chiang Kai-shek 蔣介石'</refName> <personTermGroupList> <personTermGroup> <termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType> <termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'</termLanguage> <termDisplayName>Chiang Kai-shek</termDisplayName> <surName>Chiang</surName> <foreName>Kai-shek</foreName> <termSource></termSource> <termSourceID></termSourceID> </personTermGroup> <personTermGroup> <termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType> <termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage> <termDisplayName>蔣介石</termDisplayName> <surName>蔣</surName> <foreName>介石</foreName> <termSource></termSource> <termSourceID></termSourceID> </personTermGroup> </personTermGroupList> <birthDateGroup> <dateDisplayDate></dateDisplayDate> <dateLatestYear></dateLatestYear> </birthDateGroup> <deathDateGroup> <dateDisplayDate></dateDisplayDate> <dateLatestYear></dateLatestYear> </deathDateGroup> </schema> </import> <import seq="4" service="Persons" type="Person"> <schema xmlns:persons_common="http://collectionspace.org/services/person" name="persons_common"> <inAuthority>004bb42f-dadc-469c-acfa</inAuthority> <shortIdentifier>huangjunbi</shortIdentifier> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang Junbi 黃君壁'</refName> <personTermGroupList> <personTermGroup> <termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType> <termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'</termLanguage> <termDisplayName>Huang Junbi</termDisplayName> <surName>Huang</surName> <foreName>Junbi</foreName> <termSource></termSource> <termSourceID></termSourceID> </personTermGroup> <personTermGroup> <termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType> <termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage> <termDisplayName>黃君壁</termDisplayName> <surName>黃</surName> <foreName>君壁</foreName> <termSource></termSource> <termSourceID></termSourceID> </personTermGroup> </personTermGroupList> <birthDateGroup> <dateDisplayDate></dateDisplayDate> <dateLatestYear></dateLatestYear> </birthDateGroup> <deathDateGroup> <dateDisplayDate></dateDisplayDate> <dateLatestYear></dateLatestYear> </deathDateGroup> </schema> </import></imports>
I used a command like this to send the file to the import service:
curl -X POST http://192.168.56.10:8180/cspace-services/imports -i -u admin@core.collectionspace.org:Administrator -H "Content-Type: application/xml" -T payload.xml
James D. Keeline
From: Susan STONE <sstone@berkeley.edu>
To: Christopher R. HOFFMAN <chris_h@berkeley.edu>
Cc: Talk <talk@lists.collectionspace.org>
Sent: Tuesday, June 14, 2016 6:38 PM
Subject: Re: [Talk] XML payload with multiple people
Right. This appears to have changed.
On Tue, Jun 14, 2016 at 6:27 PM, Christopher R. HOFFMAN <chris_h@berkeley.edu> wrote:
Hi Susan, I think we no longer need to create that schema and data manually. Lam Voong checked her scripts from our last implementation, and we did not need to populate that URI. Thanks,Chris
On Jun 14, 2016, at 12:01 AM, Susan STONE <sstone@berkeley.edu> wrote:
Aron,
Unless it has changed back again, the collectionspace_core part is needed in an import though it wasn't originally.
Susan
On Mon, Jun 13, 2016 at 11:56 PM, Aron Roberts <aron@socrates.berkeley.edu> wrote:
There's some possible confusion (which I missed seeing in your earlier email) between:
1. Importing records, via the Imports service. (This is the method generally used when bulk importing hundreds or thousands of records.)
2. Creating a record, by POSTing to the relevant person authority via the Services REST API.
These use *subtly different payloads*, an artifact resulting from the fact that the Imports service bypasses most of the Services framework and talks more or less directly to Nuxeo, which expects to encounter its own payload format.
The payload included in an earlier message, repeated below with a few trivial tweaks (uppercasing UTF-8 as per W3C doc conventions, removing the 'seq=1' attribute, removing empty repeatable groups), should likely work for you method 1, calling the Imports service, via either of the following formats:
https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Sendingtherequest
<?xml version="1.0" encoding="UTF-8" ?>
<imports>
<import service="Persons" type="Person">
<schema xmlns:persons_common="http://collectionspace.org/services/person" name="persons_common">
<inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
<shortIdentifier>huangjunbi</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang Junbi (黃君壁)'</refName>
<personTermGroupList>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'</termLanguage>
<termDisplayName>Huang Junbi</termDisplayName>
<surName>Huang</surName>
<foreName>Junbi</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
<termDisplayName>黃君壁</termDisplayName>
<surName>黃</surName>
<foreName>君壁</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
</personTermGroupList>
</schema>
</import>
</imports>
If you're going to be using method 2, POSTing an individual record via the Services REST APIs, via a call like:
$ curl -X POST 'http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items' -i -u admin@core.collectionspace.org:Administrator -H "Content-Type: application/xml " -T testperson.xml
Then your payload will start with something similar to this:
<?xml version="1.0" encoding="UTF-8"?>
<document name="persons">
<ns2:persons_common xmlns:ns2="http://collectionspace.org/services/person">
...
Rather than the Import payload's preamble:
<?xml version="1.0" encoding="UTF-8" ?>
<imports>
<import service="Persons" type="Person">
<schema xmlns:persons_common="http://collectionspace.org/services/person" name="persons_common">
...
I don't believe the CollectionSpace 'core' schema part needs to be included; that this part will get automatically created by CollectionSpace when you POST. But this is all from memory, since I'm currently away from access to my past working examples of Person authority term payloads.
Aron
On Mon, Jun 13, 2016 at 11:32 PM, Susan STONE <sstone@berkeley.edu> wrote:
James,
I think you are missing the collectionspace_core part of the import record (in addition to the persons_common part) , e.g. (these are not your values but pasted in from something I have):
<schema name="collectionspace_core" xmlns:collectionspace_core="http://collectionspace.org/collectionspace_core/">
<collectionspace_core:uri>/personauthorities/82d438d8-da87-4479-9b68/items/b6ac65f6-7f9d-4dc4-9a18-641e4de1cf65</collectionspace_core:uri>
<collectionspace_core:refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(p224)'A. Smith'</collectionspace_core:refName>
</schema>
Susan
On Mon, Jun 13, 2016 at 10:38 PM, James Keeline <james@keeline.com> wrote:
I am still not having success. That is, I get a response code that suggests that a record is created but it is not showing up in search.
I was mainly testing against core.collectionspace.org and using the reported Local Persons person authority ID. I found it with this method:
http://core.collectionspace.org/cspace-services/personauthorities
and the relevant result seems to be:
<list-item> <csid>2937e6b9-8ec6-4e0f-b45a</csid> <uri>/personauthorities/2937e6b9-8ec6-4e0f-b45a</uri> <refName> urn:cspace:core.collectionspace.org:personauthorities:name(person)'Local Persons' </refName> <updatedAt>2016-04-08T18:52:26.094Z</updatedAt> <workflowState>project</workflowState> <shortIdentifier>person</shortIdentifier> <displayName>Local Persons</displayName></list-item>
The XML I am trying to send is:
<?xml version="1.0" encoding="utf-8" ?><imports> <import seq="1" service="Persons" type="Person"> <document name="persons"> <schema xmlns:persons_common="http://collectionspace.org/services/person" name="persons_common"> <inAuthority>2937e6b9-8ec6-4e0f-b45a</inAuthority> <shortIdentifier>huangjunbi</shortIdentifier> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang Junbi 黃君壁'</refName> <personTermGroupList> <personTermGroup> <termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType> <termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'</termLanguage> <termDisplayName>Huang Junbi</termDisplayName> <surName>Huang</surName> <foreName>Junbi</foreName> <termSource></termSource> <termSourceID></termSourceID> </personTermGroup> <personTermGroup> <termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType> <termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage> <termDisplayName>黃君壁</termDisplayName> <surName>黃</surName> <foreName>君壁</foreName> <termSource></termSource> <termSourceID></termSourceID> </personTermGroup> </personTermGroupList> <birthDateGroup> <dateLatestYear></dateLatestYear> </birthDateGroup> <deathDateGroup> <dateLatestYear></dateLatestYear> </deathDateGroup> </schema> </document> </import></imports>
Note that I have modified to <schema> as suggested. When I send the XML payload to the server with this method (is it correct?) I get a response code that indicates that a record was sent. However, it is not showing up in search as I though tit would.
$ curl -X POST 'http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items' -i -u admin@core.collectionspace.org:Administrator -H "Content-Type: application/xml " -T testperson.xml
HTTP/1.1 100 Continue
HTTP/1.1 201 CreatedServer: Apache-Coyote/1.1Location: http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/bee20f53-4ffb-4751-a727Set-Cookie: JSESSIONID=4E542E1C6CAF477ABDC72AD64EA06962; Path=/cspace-services/; HttpOnlyContent-Length: 0Date: Tue, 14 Jun 2016 05:28:41 GMT
I suppose that if I can get one working, I can send larger numbers of values at once, perhaps even the 800 people at once. However, there is some little thing that is not working.
I have also tried this on my local installation, with the corresponding inAuthority number retrieved from that system. Again it claims to create it but nothing can be found in search.
The XML returned from this URL provided in the response code has essentially empty elements, none of the data I provided.
http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/bee20f53-4ffb-4751-a727
Perhaps someone reading has a suggestion of a mistake in my XML or methods.
James D. Keeline
From: Aron Roberts <aron@socrates.berkeley.edu>
To: James Keeline <james@keeline.com>
Cc: Talk <talk@lists.collectionspace.org>; Chris Hoffman <chris_h@berkeley.edu>
Sent: Monday, June 13, 2016 7:21 PM
Subject: Re: [Talk] XML payload with multiple people
Have also experienced a display oddity - in the record titlebar, in the dropdown menu below autocomplete fields, and in the Terms Used sidebar (screenshot attached) - when using the Import service to import a Person record whose refName display name contains Chinese characters (with or without parens, square brackets, etc.):
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang Junbi (黃君壁)'</refName>
If you see the same thing, we can file a bug if one doesn't already exist ... and for now, perhaps avoid adding those?
On Mon, Jun 13, 2016 at 6:03 PM, Aron Roberts <aron@socrates.berkeley.edu> wrote:
> Sometimes it feels like these processes are just a bit more technical than they need to be. Perhaps it is necessary but there are a lot of details which must be just right for success.
D'accord.
Import, in particular, is rather finicky. For sheer speed - since imports can be quite large and performance is of the essence - the import service is interacting in a fairly raw way with the Nuxeo enterprise content management system that underlies CollectionSpace, in a manner that mostly bypasses the CollectionSpace framework.
1. One thing I observed in the import payload:
<document name="persons">
<ns2:persons_common xmlns:ns2="http://collectionspace.org/services/person"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
...
</ns2:persons_common>
</document>
(These two elements appear in the payloads that are produced and consumed when interacting with CollectionSpace via most of its Services REST API ...)
Whereas for the Import service, the corresponding *single* element at this same level of the payload might instead be <schema ...> (AIUI due to the 'bypass' mentioned above):
<schema xmlns:persons_common="http://collectionspace.org/services/person" name="persons_common">
...
</schema>
2. As well, as mentioned in the brief convo between Chris and myself earlier, it appears the refName element (field) is required, when importing an authority term via the Import service.
3. If you replace the two elements above with the <schema...> element here, and add the refName, perhaps the import will succeed?
The following payload just imported successfully for me on qa.collectionspace.org (after substituting QA's "Local Persons" value in the inAuthority field for the one you're using with your own server, below).
<?xml version="1.0" encoding="utf-8" ?>
<imports>
<import seq="1" service="Persons" type="Person">
<schema xmlns:persons_common="http://collectionspace.org/services/person" name="persons_common">
<inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
<shortIdentifier>huangjunbi</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang Junbi (黃君壁)'</refName>
<personTermGroupList>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'</termLanguage>
<termDisplayName>Huang Junbi</termDisplayName>
<surName>Huang</surName>
<foreName>Junbi</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
<termDisplayName>黃君壁</termDisplayName>
<surName>黃</surName>
<foreName>君壁</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
</personTermGroupList>
<birthDateGroup>
<dateLatestYear></dateLatestYear>
</birthDateGroup>
<deathDateGroup>
<dateLatestYear></dateLatestYear>
</deathDateGroup>
</schema>
</import>
</imports>
The resulting record can be viewed at:
https://qa.collectionspace.org/collectionspace/ui/core/html/person.html?csid=7606204f-67ee-4e1f-8a2e-451683c8ff03&vocab=person
Aron
On Mon, Jun 13, 2016 at 5:25 PM, James Keeline <james@keeline.com> wrote:
I have seen the messages since my last inquiry and I need to read them carefully. I understand now how to "get" the unique ID for the inAuthority value.
According to this ( http://core.collectionspace.org:8180/cspace-services/personauthorities ) there are several person authorities but the local person authority seems to have an ID of:
<list-item><csid>2937e6b9-8ec6-4e0f-b45a</csid><uri>/personauthorities/2937e6b9-8ec6-4e0f-b45a</uri><refName>urn:cspace:core.collectionspace.org:personauthorities:name(person)'Local Persons'</refName><updatedAt>2016-04-08T18:52:26.094Z</updatedAt><workflowState>project</workflowState><shortIdentifier>person</shortIdentifier><displayName>Local Persons</displayName></list-item>
This is what I sent to core.collectionspace.org as a test with additional fields. It says it was created but it does not show up on a search.
<?xml version="1.0" encoding="utf-8" ?><imports> <import seq="1" service="Persons" type="Person"> <document name="persons"> <ns2:persons_common xmlns:ns2="http://collectionspace.org/services/person" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <inAuthority>e5c217c5-26ad-4289-b778</inAuthority> <shortIdentifier>huangjunbi</shortIdentifier> <personTermGroupList> <personTermGroup> <termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType> <termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'</termLanguage> <termDisplayName>Huang Junbi</termDisplayName> <surName>Huang</surName> <foreName>Junbi</foreName> <termSource></termSource> <termSourceID></termSourceID> </personTermGroup> <personTermGroup> <termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType> <termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage> <termDisplayName>黃君壁</termDisplayName> <surName>黃</surName> <foreName>君壁</foreName> <termSource></termSource> <termSourceID></termSourceID> </personTermGroup> </personTermGroupList> <birthDateGroup> <dateLatestYear></dateLatestYear> </birthDateGroup> <deathDateGroup> <dateLatestYear></dateLatestYear> </deathDateGroup> </ns2:persons_common> </document> </import></imports>
Perhaps this is related to my inAuthority value being different/wrong. I tried sending to the "found" csid value but it still does not show up under search. These are the response codes for the two attempts with the old ID and the found one:
jameskesmacbook:BPOC keeline$ curl -X POST 'http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items' -i -u admin@core.collectionspace.org:Administrator -H "Content-Type: application/xml " -T testperson.xmlHTTP/1.1 100 Continue
HTTP/1.1 201 CreatedServer: Apache-Coyote/1.1Location: http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/85b329e4-0d14-48f3-9365Set-Cookie: JSESSIONID=E2A4F02670F864DDE3A5D4517B7A36A2; Path=/cspace-services/; HttpOnlyContent-Length: 0Date: Tue, 14 Jun 2016 00:05:43 GMT
jameskesmacbook:BPOC keeline$ curl -X POST 'http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items' -i -u admin@core.collectionspace.org:Administrator -H "Content-Type: application/xml " -T testperson.xmlHTTP/1.1 100 Continue
HTTP/1.1 201 CreatedServer: Apache-Coyote/1.1Location: http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/18394f8b-00c4-40d2-a256Set-Cookie: JSESSIONID=A5405E5A665EE6375E295A27E4DD53B4; Path=/cspace-services/; HttpOnlyContent-Length: 0Date: Tue, 14 Jun 2016 00:17:26 GMT
I'm using a PHP script to generate the XML so if there is a snippet to extract the correct value into a variable, I will include that. I can probably parse through it with some regex but I'll bet there's a better way if anyone knows it.
Sometimes it feels like these processes are just a bit more technical than they need to be. Perhaps it is necessary but there are a lot of details which must be just right for success. James D. Keeline
From: Aron Roberts <aron@socrates.berkeley.edu>
To: James Keeline <james@keeline.com>
Cc: Talk <talk@lists.collectionspace.org>; Chris Hoffman <chris_h@berkeley.edu>
Sent: Monday, June 13, 2016 5:08 PM
Subject: Re: [Talk] XML payload with multiple people
BTW, there was a typo in the sample payload in a previous note: this should have read <import service="Persons" type="Person"> (note: first attribute value is now plural) rather than: <import service="Person" type="Person">.
The (corrected) example payload:
<?xml version="1.0" encoding="utf-8"?>
<imports>
<import service="Persons" type="Person">
<schema xmlns:persons_common="http://collectionspace.org/services/person" name="persons_common">
<personTermGroupList>
<personTermGroup>
<termDisplayName>Zelda C. Dobbs</termDisplayName>
</personTermGroup>
</personTermGroupList>
<shortIdentifier>ZedaCDobbs</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(ZeldaCDobbs)'ZeldaC. Dobbs'</refName>
<inAuthority>4b5cd4b4-9776-48e1-9258</inAuthority>
</schema>
</import>
<import service="Persons" type="Person">
<!-- Another record goes here ... -->
</import>
</imports>
The section "How to find the service and type values" in the Imports Service Home document, https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Howtofindtheserviceandtypevalues, describes how to find and enter the right values for those
two attributes, in the <import service="something_here" type="something_else_here"> elements.
Aron
On Mon, Jun 13, 2016 at 4:54 PM, Aron Roberts <aron@socrates.berkeley.edu> wrote:
Good questions, Chris!
About an hour ago, I test-imported a couple of Person records lacking
a refName and shortidentifier. It looks like an 'ID' form of the refName was auto-created for
those records; e.g.:
urn:cspace:core.collectionspace.org:persons:id(dbbf8c78-6c4e-470b-8765-b07ba73ff9a4)
And when listing all Person records, following that import, the following services error occurred:
ERROR ... [org.collectionspace.services.common.vocabulary.RefNameServiceUtils:527]
Could not retrieve a list of documents referring to the specified authority item
java.lang.IllegalArgumentException: Malformed refName for AuthorityTerm (too few tokens)
This might yet reflect pilot error on my part, but this at least suggests a need
to supply values for one or both of those fields in the import payload.
On Mon, Jun 13, 2016 at 4:40 PM, Chris Hoffman <chris_h@berkeley.edu> wrote:
Thanks, Aron, for this better example!
Do you know if the refname and shortidentifier elements are still needed by the import service? I don’t see them listed in the schema needed via the Rest API
But maybe they are still needed for the import service.
ThanksChris
On Jun 13, 2016, at 4:34 PM, Aron Roberts <aron@socrates.berkeley.edu> wrote:
Hi James,
Sounds good. Note that these examples are for *authority* records,
not for the records for terms *within* an authority, which may be what
you're planning to add here.
(Note to self and colleagues: we *really* need to add the latter examples
to this doc.)
One thing you'll need to be aware of, when importing authority term records
(i.e. the items within a particular authority/vocabulary), the 'inAuthority' field
must be present in each such record and must reference an extant parent
authority. This associates the term with the relevant (parent) authority.
In the example below, when importing one or more persons terms into,
say, the "Local Persons" authority, the inAuthority field here contains the
unique ID ("CSID") of that authority in the relevant CollectionSpace system,
4b5cd4b4-9776-48e1-9258, in this instance. (You can find that CSID via a
request to http://host:port/cspace-services/personauthorities)
<?xml version="1.0" encoding="utf-8"?>
<imports>
<import service="Person" type="Person">
<schema xmlns:persons_common="http://collectionspace.org/services/person" name="persons_common">
<personTermGroupList>
<personTermGroup>
<termDisplayName>Zelda C. Dobbs</termDisplayName>
</personTermGroup>
</personTermGroupList>
<shortIdentifier>ZedaCDobbs</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(ZeldaCDobbs)'ZeldaC. Dobbs'</refName>
<inAuthority>4b5cd4b4-9776-48e1-9258</inAuthority>
</schema>
</import>
<import service="Person" type="Person">
<!-- Another record goes here ... -->
</import>
</imports>
Aron
On Mon, Jun 13, 2016 at 3:54 PM, James Keeline <james@keeline.com> wrote:
I think I will try to emulate the one on Aron's first link to my inquiry:
<?xml version="1.0" encoding="UTF-8"?><imports> <import seq="1" service="Personauthorities" type="Personauthority"> <schema xmlns:personauthorities_common="http://collectionspace.org/services/person" name="personauthorities_common"> <personauthorities_common:displayName>American Poets</personauthorities_common:displayName> <personauthorities_common:shortIdentifier>americanpoets</personauthorities_common:shortIdentifier> <personauthorities_common:vocabType>PersonAuthority</personauthorities_common:vocabType> <personauthorities_common:refName>urn:cspace:core.collectionspace.org:Personauthorities:name(americanpoets)'American Poets'</personauthorities_common:refName> </schema> </import> <import seq="2" service="Personauthorities" type="Personauthority" CSID="11111111-2222-3333-4444-123456789012"> <schema xmlns:personauthorities_common="http://collectionspace.org/services/person" name="personauthorities_common"> <personauthorities_common:displayName>French Poets</personauthorities_common:displayName> <personauthorities_common:shortIdentifier>frenchpoets</personauthorities_common:shortIdentifier> <personauthorities_common:vocabType>PersonAuthority</personauthorities_common:vocabType> <personauthorities_common:refName>urn:cspace:core.collectionspace.org:Personauthorities:name(frenchpoets)'French Poets'</personauthorities_common:refName> </schema> </import></imports> I'm not adding multiple person authorities so I'll have to use some of your suggestion as well. I will report back on its efficacy.
This is an example of the kind of person record I will be including in the larger document:
<?xml version="1.0" encoding="utf-8"?><document name="persons"> <ns2:persons_common xmlns:ns2="http://collectionspace.org/services/person" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <inAuthority>e5c217c5-26ad-4289-b778</inAuthority> <personTermGroupList> <personTermGroup> <termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType> <termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'</termLanguage> <termDisplayName>Chiang Kai-shek</termDisplayName> <surName>Chiang</surName> <foreName>Kai-shek</foreName> </personTermGroup> <personTermGroup> <termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType> <termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage> <termDisplayName>蔣介石</termDisplayName> <surName>蔣</surName> <foreName>介石</foreName> </personTermGroup> </personTermGroupList> </ns2:persons_common></document>
This worked against core.collectionspace.org. There are a couple fields to add to this payload.
I think though that I might wish to define the short-name so that I can use a known value for the object records.
I'm always a bit concerned about supplying the right unique IDs for something like the inAuthority field. Any thoughts? It is also not clear to me why the second block of data in the Person Authorities example at the top has a unique ID (admittedly contrived) but the first one does not._____
Thank you both for your prompt help to this and my other inquiries.
James D. Keeline
From: Chris Hoffman <chris_h@berkeley.edu>
To: Aron Roberts <aron@socrates.berkeley.edu>
Cc: James Keeline <james@keeline.com>; Talk <talk@lists.collectionspace.org>
Sent: Monday, June 13, 2016 3:03 PM
Subject: Re: [Talk] XML payload with multiple people
Hi James,
Your typical import document is set up to support submitting multiple records at once. If I recall correctly, the whole document is wrapped in <imports></imports>. Within that you can have any number of <import></import> blocks, each of which represents one person record that you want to create. In practice, we’ve found that we can really only submit 5K records per batch. Otherwise we’ve had timeouts and other very nasty behaviors. Here’s an example with the top level elements for creating 3 records.
<?xml version="1.0" encoding="UTF-8"?>
<imports> <import service="Persons" type="Person”> ... </import> <import service="Persons" type="Person”> ... </import> <import service="Persons" type="Person”> ... </import></imports>
I hope this helps,Chris
On Jun 13, 2016, at 12:04 PM, Aron Roberts <aron@socrates.berkeley.edu> wrote:
And this is also (somewhat) helpful, as you branch out from Person authority records to other record types:
https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Howtodeterminethecorrectvaluestoputintoan%22/imports/import/schema%22element:
On Mon, Jun 13, 2016 at 12:02 PM, Aron Roberts <aron@socrates.berkeley.edu> wrote:
One possible starting place:
https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-ExampleRequest
On Mon, Jun 13, 2016 at 11:29 AM, James Keeline <james@keeline.com> wrote:
I wish to import multiple people (authors, artists). I can make a single XML payload.
It seems to me that one can send multiple at once. What is the element format for this? James D. Keeline
_______________________________________________
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
_______________________________________________
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
_______________________________________________
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
_______________________________________________
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
_______________________________________________
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
_______________________________________________
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
CH
Chris Hoffman
Wed, Jun 15, 2016 4:08 PM
Hi James,
I’m glad to see this worked! You did something I haven’t seen before. Your refname is not the literal combination of the “urn” string plus the short identifier in parentheses plus the first/primary termDisplayName in single quotes. You added the Chinese name to the English name in that final part. If I had created the refname for import, I would probably have entered:
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(chiangkaishek)'Chiang Kai-shek'</refName>
I don’t know if this will have any unintended consequences. I suspect though that if someone modifies some yet to be determined parts of the person record, the refname will be recalculated and that Chinese name portion might drop out. It might be worth doing some testing.
Thanks,
Chris
On Jun 14, 2016, at 10:09 PM, James Keeline james@keeline.com wrote:
For the record, here is what worked for me.
I had to get the unique ID from http://192.168.56.10:8180/cspace-services/personauthorities http://192.168.56.10:8180/cspace-services/personauthorities
<list-item>
<csid>004bb42f-dadc-469c-acfa</csid>
<uri>/personauthorities/004bb42f-dadc-469c-acfa</uri>
<refName>
urn:cspace:core.collectionspace.org:personauthorities:name(person)'Local Persons'
</refName>
<updatedAt>2016-06-10T17:20:02.062Z</updatedAt>
<workflowState>project</workflowState>
<shortIdentifier>person</shortIdentifier>
<displayName>Local Persons</displayName>
</list-item>
I stored this payload in a file:
<?xml version="1.0" encoding="utf-8" ?>
<imports>
<import seq="3" service="Persons" type="Person">
<schema xmlns:persons_common="http://collectionspace.org/services/person" name="persons_common">
<inAuthority>004bb42f-dadc-469c-acfa</inAuthority>
<shortIdentifier>chiangkaishek</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(chiangkaishek)'Chiang Kai-shek 蔣介石'</refName>
<personTermGroupList>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'</termLanguage>
<termDisplayName>Chiang Kai-shek</termDisplayName>
<surName>Chiang</surName>
<foreName>Kai-shek</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
<termDisplayName>蔣介石</termDisplayName>
<surName>蔣</surName>
<foreName>介石</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
</personTermGroupList>
<birthDateGroup>
<dateDisplayDate></dateDisplayDate>
<dateLatestYear></dateLatestYear>
</birthDateGroup>
<deathDateGroup>
<dateDisplayDate></dateDisplayDate>
<dateLatestYear></dateLatestYear>
</deathDateGroup>
</schema>
</import>
<import seq="4" service="Persons" type="Person">
<schema xmlns:persons_common="http://collectionspace.org/services/person" name="persons_common">
<inAuthority>004bb42f-dadc-469c-acfa</inAuthority>
<shortIdentifier>huangjunbi</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang Junbi 黃君壁'</refName>
<personTermGroupList>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'</termLanguage>
<termDisplayName>Huang Junbi</termDisplayName>
<surName>Huang</surName>
<foreName>Junbi</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
<termDisplayName>黃君壁</termDisplayName>
<surName>黃</surName>
<foreName>君壁</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
</personTermGroupList>
<birthDateGroup>
<dateDisplayDate></dateDisplayDate>
<dateLatestYear></dateLatestYear>
</birthDateGroup>
<deathDateGroup>
<dateDisplayDate></dateDisplayDate>
<dateLatestYear></dateLatestYear>
</deathDateGroup>
</schema>
</import>
</imports>
I used a command like this to send the file to the import service:
curl -X POST http://192.168.56.10:8180/cspace-services/imports
-i
-u admin@core.collectionspace.org:Administrator
-H "Content-Type: application/xml"
-T payload.xml
James D. Keeline
From: Susan STONE sstone@berkeley.edu
To: Christopher R. HOFFMAN chris_h@berkeley.edu
Cc: Talk talk@lists.collectionspace.org
Sent: Tuesday, June 14, 2016 6:38 PM
Subject: Re: [Talk] XML payload with multiple people
Right. This appears to have changed.
On Tue, Jun 14, 2016 at 6:27 PM, Christopher R. HOFFMAN <chris_h@berkeley.edu mailto:chris_h@berkeley.edu> wrote:
Hi Susan, I think we no longer need to create that schema and data manually. Lam Voong checked her scripts from our last implementation, and we did not need to populate that URI.
Thanks,
Chris
On Jun 14, 2016, at 12:01 AM, Susan STONE <sstone@berkeley.edu mailto:sstone@berkeley.edu> wrote:
Aron,
Unless it has changed back again, the collectionspace_core part is needed in an import though it wasn't originally.
Susan
On Mon, Jun 13, 2016 at 11:56 PM, Aron Roberts <aron@socrates.berkeley.edu mailto:aron@socrates.berkeley.edu> wrote:
There's some possible confusion (which I missed seeing in your earlier email) between:
-
Importing records, via the Imports service. (This is the method generally used when bulk importing hundreds or thousands of records.)
-
Creating a record, by POSTing to the relevant person authority via the Services REST API.
These use subtly different payloads, an artifact resulting from the fact that the Imports service bypasses most of the Services framework and talks more or less directly to Nuxeo, which expects to encounter its own payload format.
The payload included in an earlier message, repeated below with a few trivial tweaks (uppercasing UTF-8 as per W3C doc conventions, removing the 'seq=1' attribute, removing empty repeatable groups), should likely work for you method 1, calling the Imports service, via either of the following formats:
https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Sendingtherequest https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Sendingtherequest
<?xml version="1.0" encoding="UTF-8" ?>
<imports>
<import service="Persons" type="Person">
<schema xmlns:persons_common="http://collectionspace.org/services/person <http://collectionspace.org/services/person>" name="persons_common">
<inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
<shortIdentifier>huangjunbi</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang Junbi (黃君壁)'</refName>
<personTermGroupList>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'</termLanguage>
<termDisplayName>Huang Junbi</termDisplayName>
<surName>Huang</surName>
<foreName>Junbi</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
<termDisplayName>黃君壁</termDisplayName>
<surName>黃</surName>
<foreName>君壁</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
</personTermGroupList>
</schema>
</import>
</imports>
If you're going to be using method 2, POSTing an individual record via the Services REST APIs, via a call like:
$ curl -X POST 'http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items' -i -u admin@core.collectionspace.org:Administrator -H "Content-Type: application/xml " -T testperson.xml
Then your payload will start with something similar to this:
<?xml version="1.0" encoding="UTF-8"?>
<document name="persons">
<ns2:persons_common xmlns:ns2="http://collectionspace.org/services/person <http://collectionspace.org/services/person>">
...
Rather than the Import payload's preamble:
<?xml version="1.0" encoding="UTF-8" ?>
<imports>
<import service="Persons" type="Person">
<schema xmlns:persons_common="http://collectionspace.org/services/person <http://collectionspace.org/services/person>" name="persons_common">
...
I don't believe the CollectionSpace 'core' schema part needs to be included; that this part will get automatically created by CollectionSpace when you POST. But this is all from memory, since I'm currently away from access to my past working examples of Person authority term payloads.
Aron
On Mon, Jun 13, 2016 at 11:32 PM, Susan STONE <sstone@berkeley.edu mailto:sstone@berkeley.edu> wrote:
James,
I think you are missing the collectionspace_core part of the import record (in addition to the persons_common part) , e.g. (these are not your values but pasted in from something I have):
<schema name="collectionspace_core" xmlns:collectionspace_core="http://collectionspace.org/collectionspace_core/ <http://collectionspace.org/collectionspace_core/>">
<collectionspace_core:uri>/personauthorities/82d438d8-da87-4479-9b68/items/b6ac65f6-7f9d-4dc4-9a18-641e4de1cf65</collectionspace_core:uri>
<collectionspace_core:refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(p224)'A. Smith'</collectionspace_core:refName>
</schema>
Susan
On Mon, Jun 13, 2016 at 10:38 PM, James Keeline <james@keeline.com mailto:james@keeline.com> wrote:
I am still not having success. That is, I get a response code that suggests that a record is created but it is not showing up in search.
I was mainly testing against core.collectionspace.org http://core.collectionspace.org/ and using the reported Local Persons person authority ID. I found it with this method:
http://core.collectionspace.org/cspace-services/personauthorities http://core.collectionspace.org/cspace-services/personauthorities
and the relevant result seems to be:
<list-item>
<csid>2937e6b9-8ec6-4e0f-b45a</csid>
<uri>/personauthorities/2937e6b9-8ec6-4e0f-b45a</uri>
<refName>
urn:cspace:core.collectionspace.org:personauthorities:name(person)'Local Persons'
</refName>
<updatedAt>2016-04-08T18:52:26.094Z</updatedAt>
<workflowState>project</workflowState>
<shortIdentifier>person</shortIdentifier>
<displayName>Local Persons</displayName>
</list-item>
The XML I am trying to send is:
<?xml version="1.0" encoding="utf-8" ?>
<imports>
<import seq="1" service="Persons" type="Person">
<document name="persons">
<schema xmlns:persons_common="http://collectionspace.org/services/person <http://collectionspace.org/services/person>" name="persons_common">
<inAuthority>2937e6b9-8ec6-4e0f-b45a</inAuthority>
<shortIdentifier>huangjunbi</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang Junbi 黃君壁'</refName>
<personTermGroupList>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'</termLanguage>
<termDisplayName>Huang Junbi</termDisplayName>
<surName>Huang</surName>
<foreName>Junbi</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
<termDisplayName>黃君壁</termDisplayName>
<surName>黃</surName>
<foreName>君壁</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
</personTermGroupList>
<birthDateGroup>
<dateLatestYear></dateLatestYear>
</birthDateGroup>
<deathDateGroup>
<dateLatestYear></dateLatestYear>
</deathDateGroup>
</schema>
</document>
</import>
</imports>
Note that I have modified to <schema> as suggested. When I send the XML payload to the server with this method (is it correct?) I get a response code that indicates that a record was sent. However, it is not showing up in search as I though tit would.
$ curl -X POST 'http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items' -i -u admin@core.collectionspace.org:Administrator -H "Content-Type: application/xml " -T testperson.xml
HTTP/1.1 100 Continue
HTTP/1.1 201 Created
Server: Apache-Coyote/1.1
Location: http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/bee20f53-4ffb-4751-a727 http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/bee20f53-4ffb-4751-a727
Set-Cookie: JSESSIONID=4E542E1C6CAF477ABDC72AD64EA06962; Path=/cspace-services/; HttpOnly
Content-Length: 0
Date: Tue, 14 Jun 2016 05:28:41 GMT
I suppose that if I can get one working, I can send larger numbers of values at once, perhaps even the 800 people at once. However, there is some little thing that is not working.
I have also tried this on my local installation, with the corresponding inAuthority number retrieved from that system. Again it claims to create it but nothing can be found in search.
The XML returned from this URL provided in the response code has essentially empty elements, none of the data I provided.
http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/bee20f53-4ffb-4751-a727 http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/bee20f53-4ffb-4751-a727
Perhaps someone reading has a suggestion of a mistake in my XML or methods.
James D. Keeline
From: Aron Roberts <aron@socrates.berkeley.edu mailto:aron@socrates.berkeley.edu>
To: James Keeline <james@keeline.com mailto:james@keeline.com>
Cc: Talk <talk@lists.collectionspace.org mailto:talk@lists.collectionspace.org>; Chris Hoffman <chris_h@berkeley.edu mailto:chris_h@berkeley.edu>
Sent: Monday, June 13, 2016 7:21 PM
Subject: Re: [Talk] XML payload with multiple people
Have also experienced a display oddity - in the record titlebar, in the dropdown menu below autocomplete fields, and in the Terms Used sidebar (screenshot attached) - when using the Import service to import a Person record whose refName display name contains Chinese characters (with or without parens, square brackets, etc.):
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang Junbi (黃君壁)'</refName>
If you see the same thing, we can file a bug if one doesn't already exist ... and for now, perhaps avoid adding those?
On Mon, Jun 13, 2016 at 6:03 PM, Aron Roberts <aron@socrates.berkeley.edu mailto:aron@socrates.berkeley.edu> wrote:
Sometimes it feels like these processes are just a bit more technical than they need to be. Perhaps it is necessary but there are a lot of details which must be just right for success.
D'accord.
Import, in particular, is rather finicky. For sheer speed - since imports can be quite large and performance is of the essence - the import service is interacting in a fairly raw way with the Nuxeo enterprise content management system that underlies CollectionSpace, in a manner that mostly bypasses the CollectionSpace framework.
-
One thing I observed in the import payload:
<document name="persons">
<ns2:persons_common xmlns:ns2="http://collectionspace.org/services/person <http://collectionspace.org/services/person>"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance <http://www.w3.org/2001/XMLSchema-instance>">
...
</ns2:persons_common>
</document>
(These two elements appear in the payloads that are produced and consumed when interacting with CollectionSpace via most of its Services REST API ...)
Whereas for the Import service, the corresponding single element at this same level of the payload might instead be <schema ...> (AIUI due to the 'bypass' mentioned above):
<schema xmlns:persons_common="http://collectionspace.org/services/person <http://collectionspace.org/services/person>" name="persons_common">
...
</schema>
-
As well, as mentioned in the brief convo between Chris and myself earlier, it appears the refName element (field) is required, when importing an authority term via the Import service.
-
If you replace the two elements above with the <schema...> element here, and add the refName, perhaps the import will succeed?
The following payload just imported successfully for me on qa.collectionspace.org http://qa.collectionspace.org/ (after substituting QA's "Local Persons" value in the inAuthority field for the one you're using with your own server, below).
<?xml version="1.0" encoding="utf-8" ?>
<imports>
<import seq="1" service="Persons" type="Person">
<schema xmlns:persons_common="http://collectionspace.org/services/person <http://collectionspace.org/services/person>" name="persons_common">
<inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
<shortIdentifier>huangjunbi</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang Junbi (黃君壁)'</refName>
<personTermGroupList>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'</termLanguage>
<termDisplayName>Huang Junbi</termDisplayName>
<surName>Huang</surName>
<foreName>Junbi</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
<termDisplayName>黃君壁</termDisplayName>
<surName>黃</surName>
<foreName>君壁</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
</personTermGroupList>
<birthDateGroup>
<dateLatestYear></dateLatestYear>
</birthDateGroup>
<deathDateGroup>
<dateLatestYear></dateLatestYear>
</deathDateGroup>
</schema>
</import>
</imports>
The resulting record can be viewed at:
https://qa.collectionspace.org/collectionspace/ui/core/html/person.html?csid=7606204f-67ee-4e1f-8a2e-451683c8ff03&vocab=person https://qa.collectionspace.org/collectionspace/ui/core/html/person.html?csid=7606204f-67ee-4e1f-8a2e-451683c8ff03&vocab=person
Aron
On Mon, Jun 13, 2016 at 5:25 PM, James Keeline <james@keeline.com mailto:james@keeline.com> wrote:
I have seen the messages since my last inquiry and I need to read them carefully. I understand now how to "get" the unique ID for the inAuthority value.
According to this ( http://core.collectionspace.org:8180/cspace-services/personauthorities http://core.collectionspace.org:8180/cspace-services/personauthorities ) there are several person authorities but the local person authority seems to have an ID of:
<list-item>
<csid>2937e6b9-8ec6-4e0f-b45a</csid>
<uri>/personauthorities/2937e6b9-8ec6-4e0f-b45a</uri>
<refName>
urn:cspace:core.collectionspace.org:personauthorities:name(person)'Local Persons'
</refName>
<updatedAt>2016-04-08T18:52:26.094Z</updatedAt>
<workflowState>project</workflowState>
<shortIdentifier>person</shortIdentifier>
<displayName>Local Persons</displayName>
</list-item>
This is what I sent to core.collectionspace.org http://core.collectionspace.org/ as a test with additional fields. It says it was created but it does not show up on a search.
<?xml version="1.0" encoding="utf-8" ?>
<imports>
<import seq="1" service="Persons" type="Person">
<document name="persons">
<ns2:persons_common xmlns:ns2="http://collectionspace.org/services/person <http://collectionspace.org/services/person>"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance <http://www.w3.org/2001/XMLSchema-instance>">
<inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
<shortIdentifier>huangjunbi</shortIdentifier>
<personTermGroupList>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'</termLanguage>
<termDisplayName>Huang Junbi</termDisplayName>
<surName>Huang</surName>
<foreName>Junbi</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
<termDisplayName>黃君壁</termDisplayName>
<surName>黃</surName>
<foreName>君壁</foreName>
<termSource></termSource>
<termSourceID></termSourceID>
</personTermGroup>
</personTermGroupList>
<birthDateGroup>
<dateLatestYear></dateLatestYear>
</birthDateGroup>
<deathDateGroup>
<dateLatestYear></dateLatestYear>
</deathDateGroup>
</ns2:persons_common>
</document>
</import>
</imports>
Perhaps this is related to my inAuthority value being different/wrong. I tried sending to the "found" csid value but it still does not show up under search. These are the response codes for the two attempts with the old ID and the found one:
jameskesmacbook:BPOC keeline$ curl -X POST 'http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items' -i -u admin@core.collectionspace.org:Administrator -H "Content-Type: application/xml " -T testperson.xml
HTTP/1.1 100 Continue
HTTP/1.1 201 Created
Server: Apache-Coyote/1.1
Location: http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/85b329e4-0d14-48f3-9365 http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/85b329e4-0d14-48f3-9365
Set-Cookie: JSESSIONID=E2A4F02670F864DDE3A5D4517B7A36A2; Path=/cspace-services/; HttpOnly
Content-Length: 0
Date: Tue, 14 Jun 2016 00:05:43 GMT
jameskesmacbook:BPOC keeline$ curl -X POST 'http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items' -i -u admin@core.collectionspace.org:Administrator -H "Content-Type: application/xml " -T testperson.xml
HTTP/1.1 100 Continue
HTTP/1.1 201 Created
Server: Apache-Coyote/1.1
Location: http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/18394f8b-00c4-40d2-a256 http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/18394f8b-00c4-40d2-a256
Set-Cookie: JSESSIONID=A5405E5A665EE6375E295A27E4DD53B4; Path=/cspace-services/; HttpOnly
Content-Length: 0
Date: Tue, 14 Jun 2016 00:17:26 GMT
I'm using a PHP script to generate the XML so if there is a snippet to extract the correct value into a variable, I will include that. I can probably parse through it with some regex but I'll bet there's a better way if anyone knows it.
Sometimes it feels like these processes are just a bit more technical than they need to be. Perhaps it is necessary but there are a lot of details which must be just right for success.
James D. Keeline
From: Aron Roberts <aron@socrates.berkeley.edu mailto:aron@socrates.berkeley.edu>
To: James Keeline <james@keeline.com mailto:james@keeline.com>
Cc: Talk <talk@lists.collectionspace.org mailto:talk@lists.collectionspace.org>; Chris Hoffman <chris_h@berkeley.edu mailto:chris_h@berkeley.edu>
Sent: Monday, June 13, 2016 5:08 PM
Subject: Re: [Talk] XML payload with multiple people
BTW, there was a typo in the sample payload in a previous note: this should have read <import service="Persons" type="Person"> (note: first attribute value is now plural) rather than: <import service="Person" type="Person">.
The (corrected) example payload:
<?xml version="1.0" encoding="utf-8"?>
<imports>
<import service="Persons" type="Person">
<schema xmlns:persons_common="http://collectionspace.org/services/person <http://collectionspace.org/services/person>" name="persons_common">
<personTermGroupList>
<personTermGroup>
<termDisplayName>Zelda C. Dobbs</termDisplayName>
</personTermGroup>
</personTermGroupList>
<shortIdentifier>ZedaCDobbs</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(ZeldaCDobbs)'ZeldaC. Dobbs'</refName>
<inAuthority>4b5cd4b4-9776-48e1-9258</inAuthority>
</schema>
</import>
<import service="Persons" type="Person">
<!-- Another record goes here ... -->
</import>
</imports>
The section "How to find the service and type values" in the Imports Service Home document, https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Howtofindtheserviceandtypevalues https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Howtofindtheserviceandtypevalues, describes how to find and enter the right values for those
two attributes, in the <import service="something_here" type="something_else_here"> elements.
Aron
On Mon, Jun 13, 2016 at 4:54 PM, Aron Roberts <aron@socrates.berkeley.edu mailto:aron@socrates.berkeley.edu> wrote:
Good questions, Chris!
About an hour ago, I test-imported a couple of Person records lacking
a refName and shortidentifier. It looks like an 'ID' form of the refName was auto-created for
those records; e.g.:
urn:cspace:core.collectionspace.org:persons:id(dbbf8c78-6c4e-470b-8765-b07ba73ff9a4)
And when listing all Person records, following that import, the following services error occurred:
ERROR ... [org.collectionspace.services.common.vocabulary.RefNameServiceUtils:527]
Could not retrieve a list of documents referring to the specified authority item
java.lang.IllegalArgumentException: Malformed refName for AuthorityTerm (too few tokens)
This might yet reflect pilot error on my part, but this at least suggests a need
to supply values for one or both of those fields in the import payload.
On Mon, Jun 13, 2016 at 4:40 PM, Chris Hoffman <chris_h@berkeley.edu mailto:chris_h@berkeley.edu> wrote:
Thanks, Aron, for this better example!
Do you know if the refname and shortidentifier elements are still needed by the import service? I don’t see them listed in the schema needed via the Rest API https://wiki.collectionspace.org/display/DOC/Person+Service+REST+APIs#PersonServiceRESTAPIs-Personinstanceschema
But maybe they are still needed for the import service.
Thanks
Chris
On Jun 13, 2016, at 4:34 PM, Aron Roberts <aron@socrates.berkeley.edu mailto:aron@socrates.berkeley.edu> wrote:
Hi James,
Sounds good. Note that these examples are for authority records,
not for the records for terms within an authority, which may be what
you're planning to add here.
(Note to self and colleagues: we really need to add the latter examples
to this doc.)
One thing you'll need to be aware of, when importing authority term records
(i.e. the items within a particular authority/vocabulary), the 'inAuthority' field
must be present in each such record and must reference an extant parent
authority. This associates the term with the relevant (parent) authority.
In the example below, when importing one or more persons terms into,
say, the "Local Persons" authority, the inAuthority field here contains the
unique ID ("CSID") of that authority in the relevant CollectionSpace system,
4b5cd4b4-9776-48e1-9258, in this instance. (You can find that CSID via a
request to http://host:port/cspace-services/personauthorities http://host:port/cspace-services/personauthorities)
<?xml version="1.0" encoding="utf-8"?>
<imports>
<import service="Person" type="Person">
<schema xmlns:persons_common="http://collectionspace.org/services/person <http://collectionspace.org/services/person>" name="persons_common">
<personTermGroupList>
<personTermGroup>
<termDisplayName>Zelda C. Dobbs</termDisplayName>
</personTermGroup>
</personTermGroupList>
<shortIdentifier>ZedaCDobbs</shortIdentifier>
<refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(ZeldaCDobbs)'ZeldaC. Dobbs'</refName>
<inAuthority>4b5cd4b4-9776-48e1-9258</inAuthority>
</schema>
</import>
<import service="Person" type="Person">
<!-- Another record goes here ... -->
</import>
</imports>
Aron
On Mon, Jun 13, 2016 at 3:54 PM, James Keeline <james@keeline.com mailto:james@keeline.com> wrote:
I think I will try to emulate the one on Aron's first link to my inquiry:
<?xml version="1.0" encoding="UTF-8"?>
<imports>
<import seq="1" service="Personauthorities" type="Personauthority">
<schema xmlns:personauthorities_common="http://collectionspace.org/services/person" <http://collectionspace.org/services/person> name="personauthorities_common">
<personauthorities_common:displayName>American Poets</personauthorities_common:displayName>
<personauthorities_common:shortIdentifier>americanpoets</personauthorities_common:shortIdentifier>
<personauthorities_common:vocabType>PersonAuthority</personauthorities_common:vocabType>
<personauthorities_common:refName>urn:cspace:core.collectionspace.org:Personauthorities:name(americanpoets)'American Poets'</personauthorities_common:refName>
</schema>
</import>
<import seq="2" service="Personauthorities" type="Personauthority" CSID="11111111-2222-3333-4444-123456789012">
<schema xmlns:personauthorities_common="http://collectionspace.org/services/person" <http://collectionspace.org/services/person> name="personauthorities_common">
<personauthorities_common:displayName>French Poets</personauthorities_common:displayName>
<personauthorities_common:shortIdentifier>frenchpoets</personauthorities_common:shortIdentifier>
<personauthorities_common:vocabType>PersonAuthority</personauthorities_common:vocabType>
<personauthorities_common:refName>urn:cspace:core.collectionspace.org:Personauthorities:name(frenchpoets)'French Poets'</personauthorities_common:refName>
</schema>
</import>
</imports>
I'm not adding multiple person authorities so I'll have to use some of your suggestion as well. I will report back on its efficacy.
This is an example of the kind of person record I will be including in the larger document:
<?xml version="1.0" encoding="utf-8"?>
<document name="persons">
<ns2:persons_common xmlns:ns2="http://collectionspace.org/services/person <http://collectionspace.org/services/person>" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance <http://www.w3.org/2001/XMLSchema-instance>">
<inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
<personTermGroupList>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'</termLanguage>
<termDisplayName>Chiang Kai-shek</termDisplayName>
<surName>Chiang</surName>
<foreName>Kai-shek</foreName>
</personTermGroup>
<personTermGroup>
<termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
<termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
<termDisplayName>蔣介石</termDisplayName>
<surName>蔣</surName>
<foreName>介石</foreName>
</personTermGroup>
</personTermGroupList>
</ns2:persons_common>
</document>
This worked against core.collectionspace.org http://core.collectionspace.org/. There are a couple fields to add to this payload.
I think though that I might wish to define the short-name so that I can use a known value for the object records.
I'm always a bit concerned about supplying the right unique IDs for something like the inAuthority field. Any thoughts? It is also not clear to me why the second block of data in the Person Authorities example at the top has a unique ID (admittedly contrived) but the first one does not.
Thank you both for your prompt help to this and my other inquiries.
James D. Keeline
From: Chris Hoffman <chris_h@berkeley.edu mailto:chris_h@berkeley.edu>
To: Aron Roberts <aron@socrates.berkeley.edu mailto:aron@socrates.berkeley.edu>
Cc: James Keeline <james@keeline.com mailto:james@keeline.com>; Talk <talk@lists.collectionspace.org mailto:talk@lists.collectionspace.org>
Sent: Monday, June 13, 2016 3:03 PM
Subject: Re: [Talk] XML payload with multiple people
Hi James,
Your typical import document is set up to support submitting multiple records at once. If I recall correctly, the whole document is wrapped in <imports></imports>. Within that you can have any number of <import></import> blocks, each of which represents one person record that you want to create. In practice, we’ve found that we can really only submit 5K records per batch. Otherwise we’ve had timeouts and other very nasty behaviors. Here’s an example with the top level elements for creating 3 records.
<?xml version="1.0" encoding="UTF-8"?>
<imports>
<import service="Persons" type="Person”>
...
</import>
<import service="Persons" type="Person”>
...
</import>
<import service="Persons" type="Person”>
...
</import>
</imports>
On Jun 13, 2016, at 12:04 PM, Aron Roberts <aron@socrates.berkeley.edu mailto:aron@socrates.berkeley.edu> wrote:
And this is also (somewhat) helpful, as you branch out from Person authority records to other record types:
https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Howtodeterminethecorrectvaluestoputintoan%22/imports/import/schema%22element https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Howtodeterminethecorrectvaluestoputintoan%22/imports/import/schema%22element:
On Mon, Jun 13, 2016 at 12:02 PM, Aron Roberts <aron@socrates.berkeley.edu mailto:aron@socrates.berkeley.edu> wrote:
One possible starting place:
https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-ExampleRequest https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-ExampleRequest
On Mon, Jun 13, 2016 at 11:29 AM, James Keeline <james@keeline.com mailto:james@keeline.com> wrote:
I wish to import multiple people (authors, artists). I can make a single XML payload.
It seems to me that one can send multiple at once. What is the element format for this?
James D. Keeline
Talk mailing list
Talk@lists.collectionspace.org mailto:Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
Talk mailing list
Talk@lists.collectionspace.org mailto:Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
Hi James,
I’m glad to see this worked! You did something I haven’t seen before. Your refname is not the literal combination of the “urn” string plus the short identifier in parentheses plus the first/primary termDisplayName in single quotes. You added the Chinese name to the English name in that final part. If I had created the refname for import, I would probably have entered:
> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(chiangkaishek)'Chiang Kai-shek'</refName>
I don’t know if this will have any unintended consequences. I suspect though that if someone modifies some yet to be determined parts of the person record, the refname will be recalculated and that Chinese name portion might drop out. It might be worth doing some testing.
Thanks,
Chris
> On Jun 14, 2016, at 10:09 PM, James Keeline <james@keeline.com> wrote:
>
> For the record, here is what worked for me.
>
> I had to get the unique ID from http://192.168.56.10:8180/cspace-services/personauthorities <http://192.168.56.10:8180/cspace-services/personauthorities>
>
> <list-item>
> <csid>004bb42f-dadc-469c-acfa</csid>
> <uri>/personauthorities/004bb42f-dadc-469c-acfa</uri>
> <refName>
> urn:cspace:core.collectionspace.org:personauthorities:name(person)'Local Persons'
> </refName>
> <updatedAt>2016-06-10T17:20:02.062Z</updatedAt>
> <workflowState>project</workflowState>
> <shortIdentifier>person</shortIdentifier>
> <displayName>Local Persons</displayName>
> </list-item>
>
> I stored this payload in a file:
>
> <?xml version="1.0" encoding="utf-8" ?>
> <imports>
> <import seq="3" service="Persons" type="Person">
> <schema xmlns:persons_common="http://collectionspace.org/services/person" name="persons_common">
> <inAuthority>004bb42f-dadc-469c-acfa</inAuthority>
> <shortIdentifier>chiangkaishek</shortIdentifier>
> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(chiangkaishek)'Chiang Kai-shek 蔣介石'</refName>
> <personTermGroupList>
> <personTermGroup>
> <termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
> <termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'</termLanguage>
> <termDisplayName>Chiang Kai-shek</termDisplayName>
> <surName>Chiang</surName>
> <foreName>Kai-shek</foreName>
> <termSource></termSource>
> <termSourceID></termSourceID>
> </personTermGroup>
> <personTermGroup>
> <termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
> <termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
> <termDisplayName>蔣介石</termDisplayName>
> <surName>蔣</surName>
> <foreName>介石</foreName>
> <termSource></termSource>
> <termSourceID></termSourceID>
> </personTermGroup>
> </personTermGroupList>
> <birthDateGroup>
> <dateDisplayDate></dateDisplayDate>
> <dateLatestYear></dateLatestYear>
> </birthDateGroup>
> <deathDateGroup>
> <dateDisplayDate></dateDisplayDate>
> <dateLatestYear></dateLatestYear>
> </deathDateGroup>
> </schema>
> </import>
> <import seq="4" service="Persons" type="Person">
> <schema xmlns:persons_common="http://collectionspace.org/services/person" name="persons_common">
> <inAuthority>004bb42f-dadc-469c-acfa</inAuthority>
> <shortIdentifier>huangjunbi</shortIdentifier>
> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang Junbi 黃君壁'</refName>
> <personTermGroupList>
> <personTermGroup>
> <termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
> <termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'</termLanguage>
> <termDisplayName>Huang Junbi</termDisplayName>
> <surName>Huang</surName>
> <foreName>Junbi</foreName>
> <termSource></termSource>
> <termSourceID></termSourceID>
> </personTermGroup>
> <personTermGroup>
> <termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
> <termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
> <termDisplayName>黃君壁</termDisplayName>
> <surName>黃</surName>
> <foreName>君壁</foreName>
> <termSource></termSource>
> <termSourceID></termSourceID>
> </personTermGroup>
> </personTermGroupList>
> <birthDateGroup>
> <dateDisplayDate></dateDisplayDate>
> <dateLatestYear></dateLatestYear>
> </birthDateGroup>
> <deathDateGroup>
> <dateDisplayDate></dateDisplayDate>
> <dateLatestYear></dateLatestYear>
> </deathDateGroup>
> </schema>
> </import>
> </imports>
>
> I used a command like this to send the file to the import service:
>
> curl -X POST http://192.168.56.10:8180/cspace-services/imports
> -i
> -u admin@core.collectionspace.org:Administrator
> -H "Content-Type: application/xml"
> -T payload.xml
>
>
> James D. Keeline
>
> From: Susan STONE <sstone@berkeley.edu>
> To: Christopher R. HOFFMAN <chris_h@berkeley.edu>
> Cc: Talk <talk@lists.collectionspace.org>
> Sent: Tuesday, June 14, 2016 6:38 PM
> Subject: Re: [Talk] XML payload with multiple people
>
> Right. This appears to have changed.
>
> On Tue, Jun 14, 2016 at 6:27 PM, Christopher R. HOFFMAN <chris_h@berkeley.edu <mailto:chris_h@berkeley.edu>> wrote:
> Hi Susan, I think we no longer need to create that schema and data manually. Lam Voong checked her scripts from our last implementation, and we did not need to populate that URI.
> Thanks,
> Chris
>
> On Jun 14, 2016, at 12:01 AM, Susan STONE <sstone@berkeley.edu <mailto:sstone@berkeley.edu>> wrote:
>
>> Aron,
>>
>> Unless it has changed back again, the collectionspace_core part is needed in an import though it wasn't originally.
>>
>> Susan
>>
>> On Mon, Jun 13, 2016 at 11:56 PM, Aron Roberts <aron@socrates.berkeley.edu <mailto:aron@socrates.berkeley.edu>> wrote:
>> There's some possible confusion (which I missed seeing in your earlier email) between:
>>
>> 1. Importing records, via the Imports service. (This is the method generally used when bulk importing hundreds or thousands of records.)
>>
>> 2. Creating a record, by POSTing to the relevant person authority via the Services REST API.
>>
>> These use *subtly different payloads*, an artifact resulting from the fact that the Imports service bypasses most of the Services framework and talks more or less directly to Nuxeo, which expects to encounter its own payload format.
>>
>> The payload included in an earlier message, repeated below with a few trivial tweaks (uppercasing UTF-8 as per W3C doc conventions, removing the 'seq=1' attribute, removing empty repeatable groups), should likely work for you method 1, calling the Imports service, via either of the following formats:
>>
>> https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Sendingtherequest <https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Sendingtherequest>
>>
>> <?xml version="1.0" encoding="UTF-8" ?>
>> <imports>
>> <import service="Persons" type="Person">
>> <schema xmlns:persons_common="http://collectionspace.org/services/person <http://collectionspace.org/services/person>" name="persons_common">
>> <inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
>> <shortIdentifier>huangjunbi</shortIdentifier>
>> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang Junbi (黃君壁)'</refName>
>>
>> <personTermGroupList>
>> <personTermGroup>
>> <termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>> <termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'</termLanguage>
>> <termDisplayName>Huang Junbi</termDisplayName>
>> <surName>Huang</surName>
>> <foreName>Junbi</foreName>
>> <termSource></termSource>
>> <termSourceID></termSourceID>
>> </personTermGroup>
>> <personTermGroup>
>> <termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>> <termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
>> <termDisplayName>黃君壁</termDisplayName>
>> <surName>黃</surName>
>> <foreName>君壁</foreName>
>> <termSource></termSource>
>> <termSourceID></termSourceID>
>> </personTermGroup>
>> </personTermGroupList>
>> </schema>
>> </import>
>> </imports>
>>
>> If you're going to be using method 2, POSTing an individual record via the Services REST APIs, via a call like:
>>
>> $ curl -X POST 'http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items <http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items>' -i -u admin@core.collectionspace.org:Administrator -H "Content-Type: application/xml " -T testperson.xml
>>
>> Then your payload will start with something similar to this:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <document name="persons">
>> <ns2:persons_common xmlns:ns2="http://collectionspace.org/services/person <http://collectionspace.org/services/person>">
>> ...
>>
>> Rather than the Import payload's preamble:
>>
>> <?xml version="1.0" encoding="UTF-8" ?>
>> <imports>
>> <import service="Persons" type="Person">
>> <schema xmlns:persons_common="http://collectionspace.org/services/person <http://collectionspace.org/services/person>" name="persons_common">
>> ...
>>
>> I don't believe the CollectionSpace 'core' schema part needs to be included; that this part will get automatically created by CollectionSpace when you POST. But this is all from memory, since I'm currently away from access to my past working examples of Person authority term payloads.
>>
>> Aron
>>
>>
>>
>> On Mon, Jun 13, 2016 at 11:32 PM, Susan STONE <sstone@berkeley.edu <mailto:sstone@berkeley.edu>> wrote:
>> James,
>>
>> I think you are missing the collectionspace_core part of the import record (in addition to the persons_common part) , e.g. (these are not your values but pasted in from something I have):
>>
>> <schema name="collectionspace_core" xmlns:collectionspace_core="http://collectionspace.org/collectionspace_core/ <http://collectionspace.org/collectionspace_core/>">
>> <collectionspace_core:uri>/personauthorities/82d438d8-da87-4479-9b68/items/b6ac65f6-7f9d-4dc4-9a18-641e4de1cf65</collectionspace_core:uri>
>> <collectionspace_core:refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(p224)'A. Smith'</collectionspace_core:refName>
>> </schema>
>>
>>
>> Susan
>>
>>
>> On Mon, Jun 13, 2016 at 10:38 PM, James Keeline <james@keeline.com <mailto:james@keeline.com>> wrote:
>> I am still not having success. That is, I get a response code that suggests that a record is created but it is not showing up in search.
>>
>> I was mainly testing against core.collectionspace.org <http://core.collectionspace.org/> and using the reported Local Persons person authority ID. I found it with this method:
>>
>> http://core.collectionspace.org/cspace-services/personauthorities <http://core.collectionspace.org/cspace-services/personauthorities>
>>
>> and the relevant result seems to be:
>>
>> <list-item>
>> <csid>2937e6b9-8ec6-4e0f-b45a</csid>
>> <uri>/personauthorities/2937e6b9-8ec6-4e0f-b45a</uri>
>> <refName>
>> urn:cspace:core.collectionspace.org:personauthorities:name(person)'Local Persons'
>> </refName>
>> <updatedAt>2016-04-08T18:52:26.094Z</updatedAt>
>> <workflowState>project</workflowState>
>> <shortIdentifier>person</shortIdentifier>
>> <displayName>Local Persons</displayName>
>> </list-item>
>>
>> The XML I am trying to send is:
>>
>> <?xml version="1.0" encoding="utf-8" ?>
>> <imports>
>> <import seq="1" service="Persons" type="Person">
>> <document name="persons">
>> <schema xmlns:persons_common="http://collectionspace.org/services/person <http://collectionspace.org/services/person>" name="persons_common">
>> <inAuthority>2937e6b9-8ec6-4e0f-b45a</inAuthority>
>> <shortIdentifier>huangjunbi</shortIdentifier>
>> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang Junbi 黃君壁'</refName>
>> <personTermGroupList>
>> <personTermGroup>
>> <termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>> <termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'</termLanguage>
>> <termDisplayName>Huang Junbi</termDisplayName>
>> <surName>Huang</surName>
>> <foreName>Junbi</foreName>
>> <termSource></termSource>
>> <termSourceID></termSourceID>
>> </personTermGroup>
>> <personTermGroup>
>> <termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>> <termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
>> <termDisplayName>黃君壁</termDisplayName>
>> <surName>黃</surName>
>> <foreName>君壁</foreName>
>> <termSource></termSource>
>> <termSourceID></termSourceID>
>> </personTermGroup>
>> </personTermGroupList>
>> <birthDateGroup>
>> <dateLatestYear></dateLatestYear>
>> </birthDateGroup>
>> <deathDateGroup>
>> <dateLatestYear></dateLatestYear>
>> </deathDateGroup>
>> </schema>
>> </document>
>> </import>
>> </imports>
>>
>> Note that I have modified to <schema> as suggested. When I send the XML payload to the server with this method (is it correct?) I get a response code that indicates that a record was sent. However, it is not showing up in search as I though tit would.
>>
>> $ curl -X POST 'http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items <http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items>' -i -u admin@core.collectionspace.org:Administrator -H "Content-Type: application/xml " -T testperson.xml
>>
>> HTTP/1.1 100 Continue
>>
>> HTTP/1.1 201 Created
>> Server: Apache-Coyote/1.1
>> Location: http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/bee20f53-4ffb-4751-a727 <http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/bee20f53-4ffb-4751-a727>
>> Set-Cookie: JSESSIONID=4E542E1C6CAF477ABDC72AD64EA06962; Path=/cspace-services/; HttpOnly
>> Content-Length: 0
>> Date: Tue, 14 Jun 2016 05:28:41 GMT
>>
>> I suppose that if I can get one working, I can send larger numbers of values at once, perhaps even the 800 people at once. However, there is some little thing that is not working.
>>
>> I have also tried this on my local installation, with the corresponding inAuthority number retrieved from that system. Again it claims to create it but nothing can be found in search.
>>
>> The XML returned from this URL provided in the response code has essentially empty elements, none of the data I provided.
>>
>> http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/bee20f53-4ffb-4751-a727 <http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/bee20f53-4ffb-4751-a727>
>>
>> Perhaps someone reading has a suggestion of a mistake in my XML or methods.
>>
>> James D. Keeline
>>
>> From: Aron Roberts <aron@socrates.berkeley.edu <mailto:aron@socrates.berkeley.edu>>
>> To: James Keeline <james@keeline.com <mailto:james@keeline.com>>
>> Cc: Talk <talk@lists.collectionspace.org <mailto:talk@lists.collectionspace.org>>; Chris Hoffman <chris_h@berkeley.edu <mailto:chris_h@berkeley.edu>>
>> Sent: Monday, June 13, 2016 7:21 PM
>> Subject: Re: [Talk] XML payload with multiple people
>>
>> Have also experienced a display oddity - in the record titlebar, in the dropdown menu below autocomplete fields, and in the Terms Used sidebar (screenshot attached) - when using the Import service to import a Person record whose refName display name contains Chinese characters (with or without parens, square brackets, etc.):
>>
>> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang Junbi (黃君壁)'</refName>
>>
>> If you see the same thing, we can file a bug if one doesn't already exist ... and for now, perhaps avoid adding those?
>>
>> On Mon, Jun 13, 2016 at 6:03 PM, Aron Roberts <aron@socrates.berkeley.edu <mailto:aron@socrates.berkeley.edu>> wrote:
>> > Sometimes it feels like these processes are just a bit more technical than they need to be. Perhaps it is necessary but there are a lot of details which must be just right for success.
>>
>> D'accord.
>>
>> Import, in particular, is rather finicky. For sheer speed - since imports can be quite large and performance is of the essence - the import service is interacting in a fairly raw way with the Nuxeo enterprise content management system that underlies CollectionSpace, in a manner that mostly bypasses the CollectionSpace framework.
>>
>> 1. One thing I observed in the import payload:
>>
>> <document name="persons">
>> <ns2:persons_common xmlns:ns2="http://collectionspace.org/services/person <http://collectionspace.org/services/person>"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance <http://www.w3.org/2001/XMLSchema-instance>">
>> ...
>> </ns2:persons_common>
>> </document>
>>
>> (These two elements appear in the payloads that are produced and consumed when interacting with CollectionSpace via most of its Services REST API ...)
>>
>> Whereas for the Import service, the corresponding *single* element at this same level of the payload might instead be <schema ...> (AIUI due to the 'bypass' mentioned above):
>>
>> <schema xmlns:persons_common="http://collectionspace.org/services/person <http://collectionspace.org/services/person>" name="persons_common">
>> ...
>> </schema>
>>
>> 2. As well, as mentioned in the brief convo between Chris and myself earlier, it appears the refName element (field) is required, when importing an authority term via the Import service.
>>
>> 3. If you replace the two elements above with the <schema...> element here, and add the refName, perhaps the import will succeed?
>>
>> The following payload just imported successfully for me on qa.collectionspace.org <http://qa.collectionspace.org/> (after substituting QA's "Local Persons" value in the inAuthority field for the one you're using with your own server, below).
>>
>> <?xml version="1.0" encoding="utf-8" ?>
>> <imports>
>> <import seq="1" service="Persons" type="Person">
>> <schema xmlns:persons_common="http://collectionspace.org/services/person <http://collectionspace.org/services/person>" name="persons_common">
>> <inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
>> <shortIdentifier>huangjunbi</shortIdentifier>
>> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(huangjunbi)'Huang Junbi (黃君壁)'</refName>
>>
>> <personTermGroupList>
>> <personTermGroup>
>> <termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>> <termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'</termLanguage>
>> <termDisplayName>Huang Junbi</termDisplayName>
>> <surName>Huang</surName>
>> <foreName>Junbi</foreName>
>> <termSource></termSource>
>> <termSourceID></termSourceID>
>> </personTermGroup>
>> <personTermGroup>
>> <termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>> <termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
>> <termDisplayName>黃君壁</termDisplayName>
>> <surName>黃</surName>
>> <foreName>君壁</foreName>
>> <termSource></termSource>
>> <termSourceID></termSourceID>
>> </personTermGroup>
>> </personTermGroupList>
>> <birthDateGroup>
>> <dateLatestYear></dateLatestYear>
>> </birthDateGroup>
>> <deathDateGroup>
>> <dateLatestYear></dateLatestYear>
>> </deathDateGroup>
>> </schema>
>> </import>
>> </imports>
>>
>> The resulting record can be viewed at:
>>
>> https://qa.collectionspace.org/collectionspace/ui/core/html/person.html?csid=7606204f-67ee-4e1f-8a2e-451683c8ff03&vocab=person <https://qa.collectionspace.org/collectionspace/ui/core/html/person.html?csid=7606204f-67ee-4e1f-8a2e-451683c8ff03&vocab=person>
>>
>> Aron
>>
>> On Mon, Jun 13, 2016 at 5:25 PM, James Keeline <james@keeline.com <mailto:james@keeline.com>> wrote:
>> I have seen the messages since my last inquiry and I need to read them carefully. I understand now how to "get" the unique ID for the inAuthority value.
>>
>> According to this ( http://core.collectionspace.org:8180/cspace-services/personauthorities <http://core.collectionspace.org:8180/cspace-services/personauthorities> ) there are several person authorities but the local person authority seems to have an ID of:
>>
>> <list-item>
>> <csid>2937e6b9-8ec6-4e0f-b45a</csid>
>> <uri>/personauthorities/2937e6b9-8ec6-4e0f-b45a</uri>
>> <refName>
>> urn:cspace:core.collectionspace.org:personauthorities:name(person)'Local Persons'
>> </refName>
>> <updatedAt>2016-04-08T18:52:26.094Z</updatedAt>
>> <workflowState>project</workflowState>
>> <shortIdentifier>person</shortIdentifier>
>> <displayName>Local Persons</displayName>
>> </list-item>
>>
>> This is what I sent to core.collectionspace.org <http://core.collectionspace.org/> as a test with additional fields. It says it was created but it does not show up on a search.
>>
>> <?xml version="1.0" encoding="utf-8" ?>
>> <imports>
>> <import seq="1" service="Persons" type="Person">
>> <document name="persons">
>> <ns2:persons_common xmlns:ns2="http://collectionspace.org/services/person <http://collectionspace.org/services/person>"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance <http://www.w3.org/2001/XMLSchema-instance>">
>> <inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
>> <shortIdentifier>huangjunbi</shortIdentifier>
>> <personTermGroupList>
>> <personTermGroup>
>> <termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>> <termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'</termLanguage>
>> <termDisplayName>Huang Junbi</termDisplayName>
>> <surName>Huang</surName>
>> <foreName>Junbi</foreName>
>> <termSource></termSource>
>> <termSourceID></termSourceID>
>> </personTermGroup>
>> <personTermGroup>
>> <termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>> <termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
>> <termDisplayName>黃君壁</termDisplayName>
>> <surName>黃</surName>
>> <foreName>君壁</foreName>
>> <termSource></termSource>
>> <termSourceID></termSourceID>
>> </personTermGroup>
>> </personTermGroupList>
>> <birthDateGroup>
>> <dateLatestYear></dateLatestYear>
>> </birthDateGroup>
>> <deathDateGroup>
>> <dateLatestYear></dateLatestYear>
>> </deathDateGroup>
>> </ns2:persons_common>
>> </document>
>> </import>
>> </imports>
>>
>> Perhaps this is related to my inAuthority value being different/wrong. I tried sending to the "found" csid value but it still does not show up under search. These are the response codes for the two attempts with the old ID and the found one:
>>
>> jameskesmacbook:BPOC keeline$ curl -X POST 'http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items <http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items>' -i -u admin@core.collectionspace.org:Administrator -H "Content-Type: application/xml " -T testperson.xml
>> HTTP/1.1 100 Continue
>>
>> HTTP/1.1 201 Created
>> Server: Apache-Coyote/1.1
>> Location: http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/85b329e4-0d14-48f3-9365 <http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/85b329e4-0d14-48f3-9365>
>> Set-Cookie: JSESSIONID=E2A4F02670F864DDE3A5D4517B7A36A2; Path=/cspace-services/; HttpOnly
>> Content-Length: 0
>> Date: Tue, 14 Jun 2016 00:05:43 GMT
>>
>> jameskesmacbook:BPOC keeline$ curl -X POST 'http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items <http://core.collectionspace.org:8180/cspace-services/personauthorities/urn:cspace:name(person)/items>' -i -u admin@core.collectionspace.org:Administrator -H "Content-Type: application/xml " -T testperson.xml
>> HTTP/1.1 100 Continue
>>
>> HTTP/1.1 201 Created
>> Server: Apache-Coyote/1.1
>> Location: http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/18394f8b-00c4-40d2-a256 <http://core.collectionspace.org:8180/cspace-services/personauthorities/2937e6b9-8ec6-4e0f-b45a/items/18394f8b-00c4-40d2-a256>
>> Set-Cookie: JSESSIONID=A5405E5A665EE6375E295A27E4DD53B4; Path=/cspace-services/; HttpOnly
>> Content-Length: 0
>> Date: Tue, 14 Jun 2016 00:17:26 GMT
>>
>> I'm using a PHP script to generate the XML so if there is a snippet to extract the correct value into a variable, I will include that. I can probably parse through it with some regex but I'll bet there's a better way if anyone knows it.
>>
>> Sometimes it feels like these processes are just a bit more technical than they need to be. Perhaps it is necessary but there are a lot of details which must be just right for success.
>>
>> James D. Keeline
>>
>> From: Aron Roberts <aron@socrates.berkeley.edu <mailto:aron@socrates.berkeley.edu>>
>> To: James Keeline <james@keeline.com <mailto:james@keeline.com>>
>> Cc: Talk <talk@lists.collectionspace.org <mailto:talk@lists.collectionspace.org>>; Chris Hoffman <chris_h@berkeley.edu <mailto:chris_h@berkeley.edu>>
>> Sent: Monday, June 13, 2016 5:08 PM
>>
>> Subject: Re: [Talk] XML payload with multiple people
>>
>> BTW, there was a typo in the sample payload in a previous note: this should have read <import service="Persons" type="Person"> (note: first attribute value is now plural) rather than: <import service="Person" type="Person">.
>>
>> The (corrected) example payload:
>>
>> <?xml version="1.0" encoding="utf-8"?>
>> <imports>
>> <import service="Persons" type="Person">
>> <schema xmlns:persons_common="http://collectionspace.org/services/person <http://collectionspace.org/services/person>" name="persons_common">
>> <personTermGroupList>
>> <personTermGroup>
>> <termDisplayName>Zelda C. Dobbs</termDisplayName>
>> </personTermGroup>
>> </personTermGroupList>
>> <shortIdentifier>ZedaCDobbs</shortIdentifier>
>> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(ZeldaCDobbs)'ZeldaC. Dobbs'</refName>
>> <inAuthority>4b5cd4b4-9776-48e1-9258</inAuthority>
>> </schema>
>> </import>
>> <import service="Persons" type="Person">
>> <!-- Another record goes here ... -->
>> </import>
>> </imports>
>>
>> The section "How to find the service and type values" in the Imports Service Home document, https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Howtofindtheserviceandtypevalues <https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Howtofindtheserviceandtypevalues>, describes how to find and enter the right values for those
>> two attributes, in the <import service="something_here" type="something_else_here"> elements.
>>
>> Aron
>>
>>
>> On Mon, Jun 13, 2016 at 4:54 PM, Aron Roberts <aron@socrates.berkeley.edu <mailto:aron@socrates.berkeley.edu>> wrote:
>> Good questions, Chris!
>>
>> About an hour ago, I test-imported a couple of Person records lacking
>> a refName and shortidentifier. It looks like an 'ID' form of the refName was auto-created for
>> those records; e.g.:
>> urn:cspace:core.collectionspace.org:persons:id(dbbf8c78-6c4e-470b-8765-b07ba73ff9a4)
>>
>> And when listing all Person records, following that import, the following services error occurred:
>>
>> ERROR ... [org.collectionspace.services.common.vocabulary.RefNameServiceUtils:527]
>> Could not retrieve a list of documents referring to the specified authority item
>> java.lang.IllegalArgumentException: Malformed refName for AuthorityTerm (too few tokens)
>>
>> This might yet reflect pilot error on my part, but this at least suggests a need
>> to supply values for one or both of those fields in the import payload.
>>
>> On Mon, Jun 13, 2016 at 4:40 PM, Chris Hoffman <chris_h@berkeley.edu <mailto:chris_h@berkeley.edu>> wrote:
>> Thanks, Aron, for this better example!
>>
>> Do you know if the refname and shortidentifier elements are still needed by the import service? I don’t see them listed in the schema needed via the Rest API <https://wiki.collectionspace.org/display/DOC/Person+Service+REST+APIs#PersonServiceRESTAPIs-Personinstanceschema>
>>
>> But maybe they are still needed for the import service.
>>
>> Thanks
>> Chris
>>
>>
>>> On Jun 13, 2016, at 4:34 PM, Aron Roberts <aron@socrates.berkeley.edu <mailto:aron@socrates.berkeley.edu>> wrote:
>>>
>>> Hi James,
>>>
>>> Sounds good. Note that these examples are for *authority* records,
>>> not for the records for terms *within* an authority, which may be what
>>> you're planning to add here.
>>>
>>> (Note to self and colleagues: we *really* need to add the latter examples
>>> to this doc.)
>>>
>>> One thing you'll need to be aware of, when importing authority term records
>>> (i.e. the items within a particular authority/vocabulary), the 'inAuthority' field
>>> must be present in each such record and must reference an extant parent
>>> authority. This associates the term with the relevant (parent) authority.
>>>
>>> In the example below, when importing one or more persons terms into,
>>> say, the "Local Persons" authority, the inAuthority field here contains the
>>> unique ID ("CSID") of that authority in the relevant CollectionSpace system,
>>> 4b5cd4b4-9776-48e1-9258, in this instance. (You can find that CSID via a
>>> request to http://host:port/cspace-services/personauthorities <http://host:port/cspace-services/personauthorities>)
>>>
>>> <?xml version="1.0" encoding="utf-8"?>
>>> <imports>
>>> <import service="Person" type="Person">
>>> <schema xmlns:persons_common="http://collectionspace.org/services/person <http://collectionspace.org/services/person>" name="persons_common">
>>> <personTermGroupList>
>>> <personTermGroup>
>>> <termDisplayName>Zelda C. Dobbs</termDisplayName>
>>> </personTermGroup>
>>> </personTermGroupList>
>>> <shortIdentifier>ZedaCDobbs</shortIdentifier>
>>> <refName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(ZeldaCDobbs)'ZeldaC. Dobbs'</refName>
>>> <inAuthority>4b5cd4b4-9776-48e1-9258</inAuthority>
>>> </schema>
>>> </import>
>>> <import service="Person" type="Person">
>>> <!-- Another record goes here ... -->
>>> </import>
>>> </imports>
>>>
>>> Aron
>>>
>>> On Mon, Jun 13, 2016 at 3:54 PM, James Keeline <james@keeline.com <mailto:james@keeline.com>> wrote:
>>> I think I will try to emulate the one on Aron's first link to my inquiry:
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <imports>
>>> <import seq="1" service="Personauthorities" type="Personauthority">
>>> <schema xmlns:personauthorities_common="http://collectionspace.org/services/person" <http://collectionspace.org/services/person> name="personauthorities_common">
>>> <personauthorities_common:displayName>American Poets</personauthorities_common:displayName>
>>> <personauthorities_common:shortIdentifier>americanpoets</personauthorities_common:shortIdentifier>
>>> <personauthorities_common:vocabType>PersonAuthority</personauthorities_common:vocabType>
>>> <personauthorities_common:refName>urn:cspace:core.collectionspace.org:Personauthorities:name(americanpoets)'American Poets'</personauthorities_common:refName>
>>> </schema>
>>> </import>
>>> <import seq="2" service="Personauthorities" type="Personauthority" CSID="11111111-2222-3333-4444-123456789012">
>>> <schema xmlns:personauthorities_common="http://collectionspace.org/services/person" <http://collectionspace.org/services/person> name="personauthorities_common">
>>> <personauthorities_common:displayName>French Poets</personauthorities_common:displayName>
>>> <personauthorities_common:shortIdentifier>frenchpoets</personauthorities_common:shortIdentifier>
>>> <personauthorities_common:vocabType>PersonAuthority</personauthorities_common:vocabType>
>>> <personauthorities_common:refName>urn:cspace:core.collectionspace.org:Personauthorities:name(frenchpoets)'French Poets'</personauthorities_common:refName>
>>> </schema>
>>> </import>
>>> </imports>
>>>
>>> I'm not adding multiple person authorities so I'll have to use some of your suggestion as well. I will report back on its efficacy.
>>>
>>> This is an example of the kind of person record I will be including in the larger document:
>>>
>>> <?xml version="1.0" encoding="utf-8"?>
>>> <document name="persons">
>>> <ns2:persons_common xmlns:ns2="http://collectionspace.org/services/person <http://collectionspace.org/services/person>" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance <http://www.w3.org/2001/XMLSchema-instance>">
>>> <inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
>>> <personTermGroupList>
>>> <personTermGroup>
>>> <termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>>> <termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'</termLanguage>
>>> <termDisplayName>Chiang Kai-shek</termDisplayName>
>>> <surName>Chiang</surName>
>>> <foreName>Kai-shek</foreName>
>>> </personTermGroup>
>>> <personTermGroup>
>>> <termType>urn:cspace:core.collectionspace.org:vocabularies:name(persontermtype):item:name(artist)'Artist'</termType>
>>> <termLanguage>urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(zho)'Chinese'</termLanguage>
>>> <termDisplayName>蔣介石</termDisplayName>
>>> <surName>蔣</surName>
>>> <foreName>介石</foreName>
>>> </personTermGroup>
>>> </personTermGroupList>
>>> </ns2:persons_common>
>>> </document>
>>>
>>>
>>> This worked against core.collectionspace.org <http://core.collectionspace.org/>. There are a couple fields to add to this payload.
>>>
>>> I think though that I might wish to define the short-name so that I can use a known value for the object records.
>>>
>>> I'm always a bit concerned about supplying the right unique IDs for something like the inAuthority field. Any thoughts? It is also not clear to me why the second block of data in the Person Authorities example at the top has a unique ID (admittedly contrived) but the first one does not.
>>> _____
>>>
>>> Thank you both for your prompt help to this and my other inquiries.
>>>
>>> James D. Keeline
>>>
>>> From: Chris Hoffman <chris_h@berkeley.edu <mailto:chris_h@berkeley.edu>>
>>> To: Aron Roberts <aron@socrates.berkeley.edu <mailto:aron@socrates.berkeley.edu>>
>>> Cc: James Keeline <james@keeline.com <mailto:james@keeline.com>>; Talk <talk@lists.collectionspace.org <mailto:talk@lists.collectionspace.org>>
>>> Sent: Monday, June 13, 2016 3:03 PM
>>> Subject: Re: [Talk] XML payload with multiple people
>>>
>>> Hi James,
>>>
>>> Your typical import document is set up to support submitting multiple records at once. If I recall correctly, the whole document is wrapped in <imports></imports>. Within that you can have any number of <import></import> blocks, each of which represents one person record that you want to create. In practice, we’ve found that we can really only submit 5K records per batch. Otherwise we’ve had timeouts and other very nasty behaviors. Here’s an example with the top level elements for creating 3 records.
>>>
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>
>>>> <imports>
>>>> <import service="Persons" type="Person”>
>>>> ...
>>>> </import>
>>>> <import service="Persons" type="Person”>
>>>> ...
>>>> </import>
>>>> <import service="Persons" type="Person”>
>>>> ...
>>>> </import>
>>>> </imports>
>>>
>>>
>>> I hope this helps,
>>> Chris
>>>
>>>> On Jun 13, 2016, at 12:04 PM, Aron Roberts <aron@socrates.berkeley.edu <mailto:aron@socrates.berkeley.edu>> wrote:
>>>>
>>>> And this is also (somewhat) helpful, as you branch out from Person authority records to other record types:
>>>>
>>>> https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Howtodeterminethecorrectvaluestoputintoan%22/imports/import/schema%22element <https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-Howtodeterminethecorrectvaluestoputintoan%22/imports/import/schema%22element>:
>>>>
>>>> On Mon, Jun 13, 2016 at 12:02 PM, Aron Roberts <aron@socrates.berkeley.edu <mailto:aron@socrates.berkeley.edu>> wrote:
>>>> One possible starting place:
>>>>
>>>> https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-ExampleRequest <https://wiki.collectionspace.org/display/DOC/Imports+Service+Home#ImportsServiceHome-ExampleRequest>
>>>>
>>>> On Mon, Jun 13, 2016 at 11:29 AM, James Keeline <james@keeline.com <mailto:james@keeline.com>> wrote:
>>>> I wish to import multiple people (authors, artists). I can make a single XML payload.
>>>>
>>>> It seems to me that one can send multiple at once. What is the element format for this?
>>>>
>>>> James D. Keeline
>>>>
>>>>
>>>> _______________________________________________
>>>> Talk mailing list
>>>> Talk@lists.collectionspace.org <mailto:Talk@lists.collectionspace.org>
>>>> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org <http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org>
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Talk mailing list
>>>> Talk@lists.collectionspace.org <mailto:Talk@lists.collectionspace.org>
>>>> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org <http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org>
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Talk mailing list
>>> Talk@lists.collectionspace.org <mailto:Talk@lists.collectionspace.org>
>>> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org <http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> Talk mailing list
>> Talk@lists.collectionspace.org <mailto:Talk@lists.collectionspace.org>
>> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org <http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org>
>>
>>
>>
>>
>> _______________________________________________
>> Talk mailing list
>> Talk@lists.collectionspace.org <mailto:Talk@lists.collectionspace.org>
>> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org <http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org>
>
>
> _______________________________________________
> Talk mailing list
> Talk@lists.collectionspace.org <mailto:Talk@lists.collectionspace.org>
> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org <http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org>
>
>