WE HAVE SUNSET THIS LISTSERV - Join us at collectionspace@lyrasislists.org
View all threadsI 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
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
And this is also (somewhat) helpful, as you branch out from Person
authority records to other record types:
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
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.
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 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
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
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.
<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:
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
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)
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:refNameurn: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:
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.
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:
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
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)
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:
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.
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
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)
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:refNameurn: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:
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.
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:
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
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)
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:refNameurn: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:
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.
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:
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
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.
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)
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.
<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:
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