CP
Christopher Pott
Wed, Nov 28, 2012 1:13 PM
Hi,
Does anyone have experience of importing Storage Locations including hierarchies?
I'm able to import the locations themselves, but how do I attach the locations hierarchy list to this import? I've tried appending a "relation-list-item" in the same import record, using a separate import record with a "relations-common-list" schema, and adding every useful field I can think of (I'm not sure which are required fields). I've also tried creating completely separate "relations_common" import records, but this also failed to produce the hierarchy entries.
I've attached my favourite (but equally incorrect) guess so far. It's an attempt to import a storage location with a relation to a parent location. In most cases, there'll be a number of children as well. The import responds with "success", but only imports the first item, not the relation. Any ideas?
Regards,
Chris
Hi,
Does anyone have experience of importing Storage Locations including hierarchies?
I'm able to import the locations themselves, but how do I attach the locations hierarchy list to this import? I've tried appending a "relation-list-item" in the same import record, using a separate import record with a "relations-common-list" schema, and adding every useful field I can think of (I'm not sure which are required fields). I've also tried creating completely separate "relations_common" import records, but this also failed to produce the hierarchy entries.
I've attached my favourite (but equally incorrect) guess so far. It's an attempt to import a storage location with a relation to a parent location. In most cases, there'll be a number of children as well. The import responds with "success", but only imports the first item, not the relation. Any ideas?
Regards,
Chris
CH
Chris Hoffman
Wed, Nov 28, 2012 6:47 PM
HI Chris,
Importing relations is fun! Here's a test payload I a recently loaded for the UC Botanical Garden. I don't know if you need all these fields (the subject and object CSIDs, URIs, and doc types and refNames), but they were in the payload so I just populated them. I'm working on 2.4 though so this might not be needed any longer.
<?xml version="1.0" encoding="UTF-8"?>
<imports>
<import service="Relations" type="Relation" CSID="59f25184-f242-4c59-99a1-05ad80460f61">
<schema xmlns:relations_common="http://collectionspace.org/relation" name="relations_common">
<relationshipType>hasBroader</relationshipType>
<subjectDocumentType>Locationitem</subjectDocumentType>
<subjectCsid>5d21e8d2-e893-41ed-8dc2-bb0541e0cb06</subjectCsid>
<subjectUri>/locationauthorities/dbf254e8-437d-4926-be5d/items/5d21e8d2-e893-41ed-8dc2-bb0541e0cb06</subjectUri>
<subjectRefName>urn:cspace:botgarden.cspace.berkeley.edu:locationauthorities:name(location):item:name(garden1)'NURS'</subjectRefName>
<objectDocumentType>Locationitem</objectDocumentType>
<objectCsid>b025a681-0604-42c3-9776-240d6fdf62e0</objectCsid>
<objectUri>/locationauthorities/dbf254e8-437d-4926-be5d/items/b025a681-0604-42c3-9776-240d6fdf62e0</objectUri>
<objectRefName>urn:cspace:botgarden.cspace.berkeley.edu:locationauthorities:name(location):item:name(garden0)'none'</objectRefName>
</schema>
</import>
</imports>
Chris
On Nov 28, 2012, at 5:13 AM, Christopher Pott wrote:
Hi,
Does anyone have experience of importing Storage Locations including hierarchies?
I’m able to import the locations themselves, but how do I attach the locations hierarchy list to this import? I’ve tried appending a “relation-list-item” in the same import record, using a separate import record with a “relations-common-list” schema, and adding every useful field I can think of (I’m not sure which are required fields). I’ve also tried creating completely separate “relations_common” import records, but this also failed to produce the hierarchy entries.
I’ve attached my favourite (but equally incorrect) guess so far. It’s an attempt to import a storage location with a relation to a parent location. In most cases, there’ll be a number of children as well. The import responds with “success”, but only imports the first item, not the relation. Any ideas?
Regards,
Chris
<location0.xml>_______________________________________________
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
HI Chris,
Importing relations is fun! Here's a test payload I a recently loaded for the UC Botanical Garden. I don't know if you need all these fields (the subject and object CSIDs, URIs, and doc types and refNames), but they were in the payload so I just populated them. I'm working on 2.4 though so this might not be needed any longer.
<?xml version="1.0" encoding="UTF-8"?>
<imports>
<import service="Relations" type="Relation" CSID="59f25184-f242-4c59-99a1-05ad80460f61">
<schema xmlns:relations_common="http://collectionspace.org/relation" name="relations_common">
<relationshipType>hasBroader</relationshipType>
<subjectDocumentType>Locationitem</subjectDocumentType>
<subjectCsid>5d21e8d2-e893-41ed-8dc2-bb0541e0cb06</subjectCsid>
<subjectUri>/locationauthorities/dbf254e8-437d-4926-be5d/items/5d21e8d2-e893-41ed-8dc2-bb0541e0cb06</subjectUri>
<subjectRefName>urn:cspace:botgarden.cspace.berkeley.edu:locationauthorities:name(location):item:name(garden1)'NURS'</subjectRefName>
<objectDocumentType>Locationitem</objectDocumentType>
<objectCsid>b025a681-0604-42c3-9776-240d6fdf62e0</objectCsid>
<objectUri>/locationauthorities/dbf254e8-437d-4926-be5d/items/b025a681-0604-42c3-9776-240d6fdf62e0</objectUri>
<objectRefName>urn:cspace:botgarden.cspace.berkeley.edu:locationauthorities:name(location):item:name(garden0)'none'</objectRefName>
</schema>
</import>
</imports>
Chris
On Nov 28, 2012, at 5:13 AM, Christopher Pott wrote:
> Hi,
>
> Does anyone have experience of importing Storage Locations including hierarchies?
>
> I’m able to import the locations themselves, but how do I attach the locations hierarchy list to this import? I’ve tried appending a “relation-list-item” in the same import record, using a separate import record with a “relations-common-list” schema, and adding every useful field I can think of (I’m not sure which are required fields). I’ve also tried creating completely separate “relations_common” import records, but this also failed to produce the hierarchy entries.
>
> I’ve attached my favourite (but equally incorrect) guess so far. It’s an attempt to import a storage location with a relation to a parent location. In most cases, there’ll be a number of children as well. The import responds with “success”, but only imports the first item, not the relation. Any ideas?
>
> Regards,
> Chris
> <location0.xml>_______________________________________________
> Talk mailing list
> Talk@lists.collectionspace.org
> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
JB
John B. LOWE
Wed, Nov 28, 2012 6:53 PM
Chris,
Hi! Yes, Importing relations is a lot of fun!
Here's the template for the REST payload used to POST BT relations
(one at a time) for the PAHMA location authority (also v2.4). I notice
some "dialect differences" between Chris H.'s and mine...not sure how
to account for them.
Good hunting!
John
<?xml version="1.0" encoding="UTF-8"?>
<document name="relations">
<ns2:relations_common
xmlns:ns2="http://collectionspace.org/services/relation"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<relationshipType>hasBroader</relationshipType>
<objectCsid>#objectCsid#</objectCsid>
<subjectCsid>#subjectCsid#</subjectCsid>
<objectDocumentType>LocationitemTenant15</objectDocumentType>
<subjectDocumentType>LocationitemTenant15</subjectDocumentType>
<objectRefName>#objectRefName#</objectRefName>
<subjectRefName>#subjectRefName#</subjectRefName>
</ns2:relations_common>
</document>
On Wed, Nov 28, 2012 at 10:47 AM, Chris Hoffman chris_h@berkeley.edu wrote:
HI Chris,
Importing relations is fun! Here's a test payload I a recently loaded for
the UC Botanical Garden. I don't know if you need all these fields (the
subject and object CSIDs, URIs, and doc types and refNames), but they were
in the payload so I just populated them. I'm working on 2.4 though so this
might not be needed any longer.
<?xml version="1.0" encoding="UTF-8"?>
<imports>
<import service="Relations" type="Relation"
CSID="59f25184-f242-4c59-99a1-05ad80460f61">
<schema xmlns:relations_common="http://collectionspace.org/relation"
name="relations_common">
<relationshipType>hasBroader</relationshipType>
<subjectDocumentType>Locationitem</subjectDocumentType>
<subjectCsid>5d21e8d2-e893-41ed-8dc2-bb0541e0cb06</subjectCsid>
<subjectUri>/locationauthorities/dbf254e8-437d-4926-be5d/items/5d21e8d2-e893-41ed-8dc2-bb0541e0cb06</subjectUri>
<subjectRefName>urn:cspace:botgarden.cspace.berkeley.edu:locationauthorities:name(location):item:name(garden1)'NURS'</subjectRefName>
<objectDocumentType>Locationitem</objectDocumentType>
<objectCsid>b025a681-0604-42c3-9776-240d6fdf62e0</objectCsid>
<objectUri>/locationauthorities/dbf254e8-437d-4926-be5d/items/b025a681-0604-42c3-9776-240d6fdf62e0</objectUri>
<objectRefName>urn:cspace:botgarden.cspace.berkeley.edu:locationauthorities:name(location):item:name(garden0)'none'</objectRefName>
</schema>
</import>
</imports>
Chris
On Nov 28, 2012, at 5:13 AM, Christopher Pott wrote:
Hi,
Does anyone have experience of importing Storage Locations including
hierarchies?
I’m able to import the locations themselves, but how do I attach the
locations hierarchy list to this import? I’ve tried appending a
“relation-list-item” in the same import record, using a separate import
record with a “relations-common-list” schema, and adding every useful field
I can think of (I’m not sure which are required fields). I’ve also tried
creating completely separate “relations_common” import records, but this
also failed to produce the hierarchy entries.
I’ve attached my favourite (but equally incorrect) guess so far. It’s an
attempt to import a storage location with a relation to a parent location.
In most cases, there’ll be a number of children as well. The import responds
with “success”, but only imports the first item, not the relation. Any
ideas?
Regards,
Chris
<location0.xml>_______________________________________________
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
Chris,
Hi! Yes, Importing relations is a lot of fun!
Here's the template for the REST payload used to POST BT relations
(one at a time) for the PAHMA location authority (also v2.4). I notice
some "dialect differences" between Chris H.'s and mine...not sure how
to account for them.
Good hunting!
John
<?xml version="1.0" encoding="UTF-8"?>
<document name="relations">
<ns2:relations_common
xmlns:ns2="http://collectionspace.org/services/relation"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<relationshipType>hasBroader</relationshipType>
<objectCsid>#objectCsid#</objectCsid>
<subjectCsid>#subjectCsid#</subjectCsid>
<objectDocumentType>LocationitemTenant15</objectDocumentType>
<subjectDocumentType>LocationitemTenant15</subjectDocumentType>
<objectRefName>#objectRefName#</objectRefName>
<subjectRefName>#subjectRefName#</subjectRefName>
</ns2:relations_common>
</document>
On Wed, Nov 28, 2012 at 10:47 AM, Chris Hoffman <chris_h@berkeley.edu> wrote:
> HI Chris,
>
> Importing relations is fun! Here's a test payload I a recently loaded for
> the UC Botanical Garden. I don't know if you need all these fields (the
> subject and object CSIDs, URIs, and doc types and refNames), but they were
> in the payload so I just populated them. I'm working on 2.4 though so this
> might not be needed any longer.
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <imports>
> <import service="Relations" type="Relation"
> CSID="59f25184-f242-4c59-99a1-05ad80460f61">
> <schema xmlns:relations_common="http://collectionspace.org/relation"
> name="relations_common">
> <relationshipType>hasBroader</relationshipType>
> <subjectDocumentType>Locationitem</subjectDocumentType>
> <subjectCsid>5d21e8d2-e893-41ed-8dc2-bb0541e0cb06</subjectCsid>
>
> <subjectUri>/locationauthorities/dbf254e8-437d-4926-be5d/items/5d21e8d2-e893-41ed-8dc2-bb0541e0cb06</subjectUri>
>
> <subjectRefName>urn:cspace:botgarden.cspace.berkeley.edu:locationauthorities:name(location):item:name(garden1)'NURS'</subjectRefName>
> <objectDocumentType>Locationitem</objectDocumentType>
> <objectCsid>b025a681-0604-42c3-9776-240d6fdf62e0</objectCsid>
>
> <objectUri>/locationauthorities/dbf254e8-437d-4926-be5d/items/b025a681-0604-42c3-9776-240d6fdf62e0</objectUri>
>
> <objectRefName>urn:cspace:botgarden.cspace.berkeley.edu:locationauthorities:name(location):item:name(garden0)'none'</objectRefName>
> </schema>
> </import>
> </imports>
>
> Chris
>
>
>
> On Nov 28, 2012, at 5:13 AM, Christopher Pott wrote:
>
> Hi,
>
> Does anyone have experience of importing Storage Locations including
> hierarchies?
>
> I’m able to import the locations themselves, but how do I attach the
> locations hierarchy list to this import? I’ve tried appending a
> “relation-list-item” in the same import record, using a separate import
> record with a “relations-common-list” schema, and adding every useful field
> I can think of (I’m not sure which are required fields). I’ve also tried
> creating completely separate “relations_common” import records, but this
> also failed to produce the hierarchy entries.
>
> I’ve attached my favourite (but equally incorrect) guess so far. It’s an
> attempt to import a storage location with a relation to a parent location.
> In most cases, there’ll be a number of children as well. The import responds
> with “success”, but only imports the first item, not the relation. Any
> ideas?
>
> Regards,
> Chris
> <location0.xml>_______________________________________________
> 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
Wed, Nov 28, 2012 7:56 PM
Thanks much, Chris and John, for these examples!
Chris (Pott) and all: you can find several more examples of hierarchical
relation record payloads in datafiles used in automated tests of
CollectionSpace's Services layer. These datafiles can be found in various
sub-directories of this test directory:
https://github.com/collectionspace/services/tree/master/services/IntegrationTests/src/test/resources/test-data/xmlreplay
In this particular directory, you can find some prototypical examples of
payloads you might send via the Services REST API - for hierarchical
cataloging records, introduced in v2.7 - such as these (payloads 2 through
7). These demonstrate sending a list of relations (a
relations-common-list) as a separate part, alongside a part containing the
record to be created or updated, in a single request payload:
https://github.com/collectionspace/services/tree/master/services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/hierarchy
In summary, you can either:
- Send an appropriate payload (such as for a Storage Location record),
along with a relations-common-list, to the appropriate service (e.g. the
Storage Location service), to create or update a record and its relations
in a single request; or
- As in John's example, send relation record payloads by themselves, to the
Relation service, to create/update relations on their own, separate from
the records to which they pertain; or
- As in Chris Hoffman's example, use the Imports service to import object,
procedural or authority/vocabulary records, and/or relation records that
pertain to those records.
Also, to clarify in John's example, the document type
'LocationitemTenant15' is an extended document type for the Storage
Location record, which includes a custom schema part for a tenant (most
likely PAHMA) with tenant ID 15; hence the "Tenant15" suffix. If you
haven't extended Storage Location records, the document type would likely
be just 'Locationitem'.
On Wed, Nov 28, 2012 at 10:53 AM, John B. LOWE jblowe@berkeley.edu wrote:
Chris,
Hi! Yes, Importing relations is a lot of fun!
Here's the template for the REST payload used to POST BT relations
(one at a time) for the PAHMA location authority (also v2.4). I notice
some "dialect differences" between Chris H.'s and mine...not sure how
to account for them.
Good hunting!
John
<?xml version="1.0" encoding="UTF-8"?>
<document name="relations">
<ns2:relations_common
xmlns:ns2="http://collectionspace.org/services/relation"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<relationshipType>hasBroader</relationshipType>
<objectCsid>#objectCsid#</objectCsid>
<subjectCsid>#subjectCsid#</subjectCsid>
<objectDocumentType>LocationitemTenant15</objectDocumentType>
<subjectDocumentType>LocationitemTenant15</subjectDocumentType>
<objectRefName>#objectRefName#</objectRefName>
<subjectRefName>#subjectRefName#</subjectRefName>
</ns2:relations_common>
</document>
On Wed, Nov 28, 2012 at 10:47 AM, Chris Hoffman chris_h@berkeley.edu
wrote:
HI Chris,
Importing relations is fun! Here's a test payload I a recently loaded
the UC Botanical Garden. I don't know if you need all these fields (the
subject and object CSIDs, URIs, and doc types and refNames), but they
in the payload so I just populated them. I'm working on 2.4 though so
might not be needed any longer.
<?xml version="1.0" encoding="UTF-8"?>
<imports>
<import service="Relations" type="Relation"
CSID="59f25184-f242-4c59-99a1-05ad80460f61">
<schema xmlns:relations_common="http://collectionspace.org/relation"
name="relations_common">
<relationshipType>hasBroader</relationshipType>
<subjectDocumentType>Locationitem</subjectDocumentType>
<subjectCsid>5d21e8d2-e893-41ed-8dc2-bb0541e0cb06</subjectCsid>
<subjectUri>/locationauthorities/dbf254e8-437d-4926-be5d/items/5d21e8d2-e893-41ed-8dc2-bb0541e0cb06</subjectUri>
<subjectRefName>urn:cspace:botgarden.cspace.berkeley.edu:
locationauthorities:name(location):item:name(garden1)'NURS'</subjectRefName>
<objectDocumentType>Locationitem</objectDocumentType>
<objectCsid>b025a681-0604-42c3-9776-240d6fdf62e0</objectCsid>
<objectUri>/locationauthorities/dbf254e8-437d-4926-be5d/items/b025a681-0604-42c3-9776-240d6fdf62e0</objectUri>
<objectRefName>urn:cspace:botgarden.cspace.berkeley.edu:
locationauthorities:name(location):item:name(garden0)'none'</objectRefName>
</schema>
</import>
</imports>
Chris
On Nov 28, 2012, at 5:13 AM, Christopher Pott wrote:
Hi,
Does anyone have experience of importing Storage Locations including
hierarchies?
I’m able to import the locations themselves, but how do I attach the
locations hierarchy list to this import? I’ve tried appending a
“relation-list-item” in the same import record, using a separate import
record with a “relations-common-list” schema, and adding every useful
I can think of (I’m not sure which are required fields). I’ve also tried
creating completely separate “relations_common” import records, but this
also failed to produce the hierarchy entries.
I’ve attached my favourite (but equally incorrect) guess so far. It’s an
attempt to import a storage location with a relation to a parent
In most cases, there’ll be a number of children as well. The import
with “success”, but only imports the first item, not the relation. Any
ideas?
Regards,
Chris
<location0.xml>_______________________________________________
Talk mailing list
Talk@lists.collectionspace.org
Thanks much, Chris and John, for these examples!
Chris (Pott) and all: you can find several more examples of hierarchical
relation record payloads in datafiles used in automated tests of
CollectionSpace's Services layer. These datafiles can be found in various
sub-directories of this test directory:
https://github.com/collectionspace/services/tree/master/services/IntegrationTests/src/test/resources/test-data/xmlreplay
In this particular directory, you can find some prototypical examples of
payloads you might send via the Services REST API - for hierarchical
cataloging records, introduced in v2.7 - such as these (payloads 2 through
7). These demonstrate sending a list of relations (a
relations-common-list) as a separate part, alongside a part containing the
record to be created or updated, in a single request payload:
https://github.com/collectionspace/services/tree/master/services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/hierarchy
In summary, you can either:
* Send an appropriate payload (such as for a Storage Location record),
along with a relations-common-list, to the appropriate service (e.g. the
Storage Location service), to create or update a record *and* its relations
in a single request; or
* As in John's example, send relation record payloads by themselves, to the
Relation service, to create/update relations on their own, separate from
the records to which they pertain; or
* As in Chris Hoffman's example, use the Imports service to import object,
procedural or authority/vocabulary records, and/or relation records that
pertain to those records.
Also, to clarify in John's example, the document type
'LocationitemTenant15' is an extended document type for the Storage
Location record, which includes a custom schema part for a tenant (most
likely PAHMA) with tenant ID 15; hence the "Tenant15" suffix. If you
haven't extended Storage Location records, the document type would likely
be just 'Locationitem'.
On Wed, Nov 28, 2012 at 10:53 AM, John B. LOWE <jblowe@berkeley.edu> wrote:
> Chris,
>
> Hi! Yes, Importing relations is a lot of fun!
>
> Here's the template for the REST payload used to POST BT relations
> (one at a time) for the PAHMA location authority (also v2.4). I notice
> some "dialect differences" between Chris H.'s and mine...not sure how
> to account for them.
>
> Good hunting!
>
> John
>
> <?xml version="1.0" encoding="UTF-8"?>
> <document name="relations">
> <ns2:relations_common
> xmlns:ns2="http://collectionspace.org/services/relation"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <relationshipType>hasBroader</relationshipType>
> <objectCsid>#objectCsid#</objectCsid>
> <subjectCsid>#subjectCsid#</subjectCsid>
> <objectDocumentType>LocationitemTenant15</objectDocumentType>
> <subjectDocumentType>LocationitemTenant15</subjectDocumentType>
> <objectRefName>#objectRefName#</objectRefName>
> <subjectRefName>#subjectRefName#</subjectRefName>
> </ns2:relations_common>
> </document>
>
>
> On Wed, Nov 28, 2012 at 10:47 AM, Chris Hoffman <chris_h@berkeley.edu>
> wrote:
> > HI Chris,
> >
> > Importing relations is fun! Here's a test payload I a recently loaded
> for
> > the UC Botanical Garden. I don't know if you need all these fields (the
> > subject and object CSIDs, URIs, and doc types and refNames), but they
> were
> > in the payload so I just populated them. I'm working on 2.4 though so
> this
> > might not be needed any longer.
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> >
> > <imports>
> > <import service="Relations" type="Relation"
> > CSID="59f25184-f242-4c59-99a1-05ad80460f61">
> > <schema xmlns:relations_common="http://collectionspace.org/relation"
> > name="relations_common">
> > <relationshipType>hasBroader</relationshipType>
> > <subjectDocumentType>Locationitem</subjectDocumentType>
> > <subjectCsid>5d21e8d2-e893-41ed-8dc2-bb0541e0cb06</subjectCsid>
> >
> >
> <subjectUri>/locationauthorities/dbf254e8-437d-4926-be5d/items/5d21e8d2-e893-41ed-8dc2-bb0541e0cb06</subjectUri>
> >
> > <subjectRefName>urn:cspace:botgarden.cspace.berkeley.edu:
> locationauthorities:name(location):item:name(garden1)'NURS'</subjectRefName>
> > <objectDocumentType>Locationitem</objectDocumentType>
> > <objectCsid>b025a681-0604-42c3-9776-240d6fdf62e0</objectCsid>
> >
> >
> <objectUri>/locationauthorities/dbf254e8-437d-4926-be5d/items/b025a681-0604-42c3-9776-240d6fdf62e0</objectUri>
> >
> > <objectRefName>urn:cspace:botgarden.cspace.berkeley.edu:
> locationauthorities:name(location):item:name(garden0)'none'</objectRefName>
> > </schema>
> > </import>
> > </imports>
> >
> > Chris
> >
> >
> >
> > On Nov 28, 2012, at 5:13 AM, Christopher Pott wrote:
> >
> > Hi,
> >
> > Does anyone have experience of importing Storage Locations including
> > hierarchies?
> >
> > I’m able to import the locations themselves, but how do I attach the
> > locations hierarchy list to this import? I’ve tried appending a
> > “relation-list-item” in the same import record, using a separate import
> > record with a “relations-common-list” schema, and adding every useful
> field
> > I can think of (I’m not sure which are required fields). I’ve also tried
> > creating completely separate “relations_common” import records, but this
> > also failed to produce the hierarchy entries.
> >
> > I’ve attached my favourite (but equally incorrect) guess so far. It’s an
> > attempt to import a storage location with a relation to a parent
> location.
> > In most cases, there’ll be a number of children as well. The import
> responds
> > with “success”, but only imports the first item, not the relation. Any
> > ideas?
> >
> > Regards,
> > Chris
> > <location0.xml>_______________________________________________
> > 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
>
S
sstone@socrates.berkeley.edu
Wed, Nov 28, 2012 8:52 PM
I think we stopped needing the tenant after a certain cspace version in
the 2's even if the schema is extended.
Susan
Also, to clarify in John's example, the document type
'LocationitemTenant15' is an extended document type for the Storage
Location record, which includes a custom schema part for a tenant (most
PAHMA) with tenant ID 15; hence the "Tenant15" suffix. If you haven't
extended Storage Location records, the document type would likely be
just
I think we stopped needing the tenant after a certain cspace version in
the 2's even if the schema is extended.
Susan
> Also, to clarify in John's example, the document type
> 'LocationitemTenant15' is an extended document type for the Storage
> Location record, which includes a custom schema part for a tenant (most
likely
> PAHMA) with tenant ID 15; hence the "Tenant15" suffix. If you haven't
extended Storage Location records, the document type would likely be
just
> 'Locationitem'.
AR
Aron Roberts
Wed, Nov 28, 2012 9:58 PM
I think we stopped needing the tenant after a certain cspace version in
the 2's even if the schema is extended.
Good point, Susan.
Related to this: in a POST to the Relations service, I was also able to
omit the <subjectDocumentType> and <objectDocumentType> values entirely;
those values were automatically filled in by the Relations service (see
below). In a minimal POST payload to create a hierarchical relationship,
only these three fields/values were needed (plus the relevant enclosing
tags, not shown here):
<subjectCsid>65c02de2-dc79-4f46-90c4</subjectCsid>
<relationshipType>hasBroader</relationshipType>
<objectCsid>87104c86-7585-4d52-8e95</objectCsid>
However, when importing records via the Imports service, that service
bypasses (for speed) most services code that would otherwise be invoked
when you using other parts of the Services REST APIs, including the crunchy
goodness that automatically fills in the document type values in relation
records. So when using the Imports service, it's likely that you'd need to
provide at least the standard (not tenant qualified, per Susan) document
type values in <subjectDocumentType> and <objectDocumentType> in your
import payload.
Aron
--
Curl command to create a hierarchical relation record between two
Cataloging objects (CollectionObjects) (see below for the payload file
sent):
curl -i -u admin@core.collectionspace.org:Administrator -X POST -H
"Content-Type: application/xml"
http://localhost:8180/cspace-services/relations -T rel1.xml
Curl command to retrieve the relation record that was created via the
above command, with its response payload (XML pretty-printed for
readability):
curl -i -u admin@core.collectionspace.org:Administrator
http://localhost:8180/cspace-services/relations/737bcb88-88b1-407e-8e25
<?xml version="1.0" encoding="utf-8"?>
<document name="relations">
<ns2:relations_common xmlns:ns2="
http://collectionspace.org/services/relation"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<objectRefName>
urn:cspace:core.collectionspace.org:
collectionobjects:id(87104c86-7585-4d52-8e95)'objectNumber-1352948654719'</objectRefName>
<subjectDocumentType>CollectionObject</subjectDocumentType>
<relationshipType>hasBroader</relationshipType>
<subjectRefName>
urn:cspace:core.collectionspace.org:
collectionobjects:id(65c02de2-dc79-4f46-90c4)'objectNumber-1352948659532'</subjectRefName>
<objectCsid>87104c86-7585-4d52-8e95</objectCsid>
<subjectCsid>65c02de2-dc79-4f46-90c4</subjectCsid>
<objectUri>
/collectionobjects/87104c86-7585-4d52-8e95</objectUri>
<subjectUri>
/collectionobjects/65c02de2-dc79-4f46-90c4</subjectUri>
<objectDocumentType>CollectionObject</objectDocumentType>
</ns2:relations_common>
<ns2:collectionspace_core xmlns:ns2="
http://collectionspace.org/collectionspace_core/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<tenantId>1</tenantId>
<updatedAt>2012-11-28T21:43:03Z</updatedAt>
<workflowState>project</workflowState>
<createdBy>admin@core.collectionspace.org</createdBy>
<createdAt>2012-11-28T21:43:03Z</createdAt>
<refName>
urn:cspace:core.collectionspace.org:
relations:id(737bcb88-88b1-407e-8e25)</refName>
<uri>/relations/737bcb88-88b1-407e-8e25</uri>
<updatedBy>admin@core.collectionspace.org</updatedBy>
</ns2:collectionspace_core>
<ns2:account_permission xmlns:ns2="
http://collectionspace.org/services/authorization">
<account>
<accountId>67a43798-f4a0-4f3c-9770-fa5f785dde7c</accountId>
<screenName>Administrator</screenName>
<userId>admin@core.collectionspace.org</userId>
<tenantId>1</tenantId>
</account>
</ns2:account_permission>
</document>
Contents of rel1.xml, the file containing the payload sent in the first,
'create' command:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<document name="relations">
<ns2:relations_common xmlns:ns2="
http://collectionspace.org/services/relation">
<subjectCsid>65c02de2-dc79-4f46-90c4</subjectCsid>
<relationshipType>hasBroader</relationshipType>
<objectCsid>87104c86-7585-4d52-8e95</objectCsid>
</ns2:relations_common>
</document>
--
Also, to clarify in John's example, the document type
'LocationitemTenant15' is an extended document type for the Storage
Location record, which includes a custom schema part for a tenant (most
PAHMA) with tenant ID 15; hence the "Tenant15" suffix. If you haven't
extended Storage Location records, the document type would likely be
just
On Wed, Nov 28, 2012 at 12:52 PM, <sstone@socrates.berkeley.edu> wrote:
> I think we stopped needing the tenant after a certain cspace version in
> the 2's even if the schema is extended.
Good point, Susan.
Related to this: in a POST to the Relations service, I was also able to
omit the <subjectDocumentType> and <objectDocumentType> values entirely;
those values were automatically filled in by the Relations service (see
below). In a minimal POST payload to create a hierarchical relationship,
only these three fields/values were needed (plus the relevant enclosing
tags, not shown here):
<subjectCsid>65c02de2-dc79-4f46-90c4</subjectCsid>
<relationshipType>hasBroader</relationshipType>
<objectCsid>87104c86-7585-4d52-8e95</objectCsid>
However, when importing records via the Imports service, that service
bypasses (for speed) most services code that would otherwise be invoked
when you using other parts of the Services REST APIs, including the crunchy
goodness that automatically fills in the document type values in relation
records. So when using the Imports service, it's likely that you'd need to
provide at least the standard (not tenant qualified, per Susan) document
type values in <subjectDocumentType> and <objectDocumentType> in your
import payload.
Aron
--
Curl command to create a hierarchical relation record between two
Cataloging objects (CollectionObjects) (see below for the payload file
sent):
curl -i -u admin@core.collectionspace.org:Administrator -X POST -H
"Content-Type: application/xml"
http://localhost:8180/cspace-services/relations -T rel1.xml
Curl command to retrieve the relation record that was created via the
above command, with its response payload (XML pretty-printed for
readability):
curl -i -u admin@core.collectionspace.org:Administrator
http://localhost:8180/cspace-services/relations/737bcb88-88b1-407e-8e25
<?xml version="1.0" encoding="utf-8"?>
<document name="relations">
<ns2:relations_common xmlns:ns2="
http://collectionspace.org/services/relation"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<objectRefName>
urn:cspace:core.collectionspace.org:
collectionobjects:id(87104c86-7585-4d52-8e95)'objectNumber-1352948654719'</objectRefName>
<subjectDocumentType>CollectionObject</subjectDocumentType>
<relationshipType>hasBroader</relationshipType>
<subjectRefName>
urn:cspace:core.collectionspace.org:
collectionobjects:id(65c02de2-dc79-4f46-90c4)'objectNumber-1352948659532'</subjectRefName>
<objectCsid>87104c86-7585-4d52-8e95</objectCsid>
<subjectCsid>65c02de2-dc79-4f46-90c4</subjectCsid>
<objectUri>
/collectionobjects/87104c86-7585-4d52-8e95</objectUri>
<subjectUri>
/collectionobjects/65c02de2-dc79-4f46-90c4</subjectUri>
<objectDocumentType>CollectionObject</objectDocumentType>
</ns2:relations_common>
<ns2:collectionspace_core xmlns:ns2="
http://collectionspace.org/collectionspace_core/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<tenantId>1</tenantId>
<updatedAt>2012-11-28T21:43:03Z</updatedAt>
<workflowState>project</workflowState>
<createdBy>admin@core.collectionspace.org</createdBy>
<createdAt>2012-11-28T21:43:03Z</createdAt>
<refName>
urn:cspace:core.collectionspace.org:
relations:id(737bcb88-88b1-407e-8e25)</refName>
<uri>/relations/737bcb88-88b1-407e-8e25</uri>
<updatedBy>admin@core.collectionspace.org</updatedBy>
</ns2:collectionspace_core>
<ns2:account_permission xmlns:ns2="
http://collectionspace.org/services/authorization">
<account>
<accountId>67a43798-f4a0-4f3c-9770-fa5f785dde7c</accountId>
<screenName>Administrator</screenName>
<userId>admin@core.collectionspace.org</userId>
<tenantId>1</tenantId>
</account>
</ns2:account_permission>
</document>
Contents of rel1.xml, the file containing the payload sent in the first,
'create' command:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<document name="relations">
<ns2:relations_common xmlns:ns2="
http://collectionspace.org/services/relation">
<subjectCsid>65c02de2-dc79-4f46-90c4</subjectCsid>
<relationshipType>hasBroader</relationshipType>
<objectCsid>87104c86-7585-4d52-8e95</objectCsid>
</ns2:relations_common>
</document>
--
> > Also, to clarify in John's example, the document type
> > 'LocationitemTenant15' is an extended document type for the Storage
> > Location record, which includes a custom schema part for a tenant (most
> likely
> > PAHMA) with tenant ID 15; hence the "Tenant15" suffix. If you haven't
> extended Storage Location records, the document type would likely be
> just
> > 'Locationitem'.
>
>
>
CP
Christopher Pott
Thu, Nov 29, 2012 1:16 PM
Thanks to all who answered this with examples, they really help.
Aron, if I understand your summary correctly, then the confusing issue for me was that the "relations-common-list" can be used in the Services REST API but is not accepted by the import service. Plus, I must have made an error in my schema when I attempted importing the relation via a "relations_common" import schema - as this should have worked. I'll try again!
/Chris
Fra: Aron Roberts [mailto:aronroberts@gmail.com]
Sendt: 28. november 2012 20:56
Til: Christopher Pott; John B. LOWE; Chris Hoffman
Cc: CollectionSpace Talk List
Emne: Re: [Talk] importing Storage Locations
Thanks much, Chris and John, for these examples!
Chris (Pott) and all: you can find several more examples of hierarchical relation record payloads in datafiles used in automated tests of CollectionSpace's Services layer. These datafiles can be found in various sub-directories of this test directory:
https://github.com/collectionspace/services/tree/master/services/IntegrationTests/src/test/resources/test-data/xmlreplay
In this particular directory, you can find some prototypical examples of payloads you might send via the Services REST API - for hierarchical cataloging records, introduced in v2.7 - such as these (payloads 2 through 7). These demonstrate sending a list of relations (a relations-common-list) as a separate part, alongside a part containing the record to be created or updated, in a single request payload:
https://github.com/collectionspace/services/tree/master/services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/hierarchy
In summary, you can either:
- Send an appropriate payload (such as for a Storage Location record), along with a relations-common-list, to the appropriate service (e.g. the Storage Location service), to create or update a record and its relations in a single request; or
- As in John's example, send relation record payloads by themselves, to the Relation service, to create/update relations on their own, separate from the records to which they pertain; or
- As in Chris Hoffman's example, use the Imports service to import object, procedural or authority/vocabulary records, and/or relation records that pertain to those records.
Also, to clarify in John's example, the document type 'LocationitemTenant15' is an extended document type for the Storage Location record, which includes a custom schema part for a tenant (most likely PAHMA) with tenant ID 15; hence the "Tenant15" suffix. If you haven't extended Storage Location records, the document type would likely be just 'Locationitem'.
On Wed, Nov 28, 2012 at 10:53 AM, John B. LOWE <jblowe@berkeley.edumailto:jblowe@berkeley.edu> wrote:
Chris,
Hi! Yes, Importing relations is a lot of fun!
Here's the template for the REST payload used to POST BT relations
(one at a time) for the PAHMA location authority (also v2.4). I notice
some "dialect differences" between Chris H.'s and mine...not sure how
to account for them.
Good hunting!
John
<?xml version="1.0" encoding="UTF-8"?>
<document name="relations">
<ns2:relations_common
xmlns:ns2="http://collectionspace.org/services/relation"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<relationshipType>hasBroader</relationshipType>
<objectCsid>#objectCsid#</objectCsid>
<subjectCsid>#subjectCsid#</subjectCsid>
<objectDocumentType>LocationitemTenant15</objectDocumentType>
<subjectDocumentType>LocationitemTenant15</subjectDocumentType>
<objectRefName>#objectRefName#</objectRefName>
<subjectRefName>#subjectRefName#</subjectRefName>
</ns2:relations_common>
</document>
On Wed, Nov 28, 2012 at 10:47 AM, Chris Hoffman <chris_h@berkeley.edumailto:chris_h@berkeley.edu> wrote:
HI Chris,
Importing relations is fun! Here's a test payload I a recently loaded for
the UC Botanical Garden. I don't know if you need all these fields (the
subject and object CSIDs, URIs, and doc types and refNames), but they were
in the payload so I just populated them. I'm working on 2.4 though so this
might not be needed any longer.
<?xml version="1.0" encoding="UTF-8"?>
<imports>
<import service="Relations" type="Relation"
CSID="59f25184-f242-4c59-99a1-05ad80460f61">
<schema xmlns:relations_common="http://collectionspace.org/relation"
name="relations_common">
<relationshipType>hasBroader</relationshipType>
<subjectDocumentType>Locationitem</subjectDocumentType>
<subjectCsid>5d21e8d2-e893-41ed-8dc2-bb0541e0cb06</subjectCsid>
<subjectUri>/locationauthorities/dbf254e8-437d-4926-be5d/items/5d21e8d2-e893-41ed-8dc2-bb0541e0cb06</subjectUri>
<subjectRefName>urn:cspace:botgarden.cspace.berkeley.edu:locationauthorities:name(location):item:name(garden1)'NURS'</subjectRefName>
<objectDocumentType>Locationitem</objectDocumentType>
<objectCsid>b025a681-0604-42c3-9776-240d6fdf62e0</objectCsid>
<objectUri>/locationauthorities/dbf254e8-437d-4926-be5d/items/b025a681-0604-42c3-9776-240d6fdf62e0</objectUri>
<objectRefName>urn:cspace:botgarden.cspace.berkeley.edu:locationauthorities:name(location):item:name(garden0)'none'</objectRefName>
</schema>
</import>
</imports>
Chris
On Nov 28, 2012, at 5:13 AM, Christopher Pott wrote:
Hi,
Does anyone have experience of importing Storage Locations including
hierarchies?
I'm able to import the locations themselves, but how do I attach the
locations hierarchy list to this import? I've tried appending a
"relation-list-item" in the same import record, using a separate import
record with a "relations-common-list" schema, and adding every useful field
I can think of (I'm not sure which are required fields). I've also tried
creating completely separate "relations_common" import records, but this
also failed to produce the hierarchy entries.
I've attached my favourite (but equally incorrect) guess so far. It's an
attempt to import a storage location with a relation to a parent location.
In most cases, there'll be a number of children as well. The import responds
with "success", but only imports the first item, not the relation. Any
ideas?
Regards,
Chris
<location0.xml>_______________________________________________
Talk mailing list
Talk@lists.collectionspace.orgmailto:Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
Talk mailing list
Talk@lists.collectionspace.orgmailto:Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
Thanks to all who answered this with examples, they really help.
Aron, if I understand your summary correctly, then the confusing issue for me was that the "relations-common-list" can be used in the Services REST API but is not accepted by the import service. Plus, I must have made an error in my schema when I attempted importing the relation via a "relations_common" import schema - as this should have worked. I'll try again!
/Chris
________________________________
Fra: Aron Roberts [mailto:aronroberts@gmail.com]
Sendt: 28. november 2012 20:56
Til: Christopher Pott; John B. LOWE; Chris Hoffman
Cc: CollectionSpace Talk List
Emne: Re: [Talk] importing Storage Locations
Thanks much, Chris and John, for these examples!
Chris (Pott) and all: you can find several more examples of hierarchical relation record payloads in datafiles used in automated tests of CollectionSpace's Services layer. These datafiles can be found in various sub-directories of this test directory:
https://github.com/collectionspace/services/tree/master/services/IntegrationTests/src/test/resources/test-data/xmlreplay
In this particular directory, you can find some prototypical examples of payloads you might send via the Services REST API - for hierarchical cataloging records, introduced in v2.7 - such as these (payloads 2 through 7). These demonstrate sending a list of relations (a relations-common-list) as a separate part, alongside a part containing the record to be created or updated, in a single request payload:
https://github.com/collectionspace/services/tree/master/services/IntegrationTests/src/test/resources/test-data/xmlreplay/collectionobject/hierarchy
In summary, you can either:
* Send an appropriate payload (such as for a Storage Location record), along with a relations-common-list, to the appropriate service (e.g. the Storage Location service), to create or update a record *and* its relations in a single request; or
* As in John's example, send relation record payloads by themselves, to the Relation service, to create/update relations on their own, separate from the records to which they pertain; or
* As in Chris Hoffman's example, use the Imports service to import object, procedural or authority/vocabulary records, and/or relation records that pertain to those records.
Also, to clarify in John's example, the document type 'LocationitemTenant15' is an extended document type for the Storage Location record, which includes a custom schema part for a tenant (most likely PAHMA) with tenant ID 15; hence the "Tenant15" suffix. If you haven't extended Storage Location records, the document type would likely be just 'Locationitem'.
On Wed, Nov 28, 2012 at 10:53 AM, John B. LOWE <jblowe@berkeley.edu<mailto:jblowe@berkeley.edu>> wrote:
Chris,
Hi! Yes, Importing relations is a lot of fun!
Here's the template for the REST payload used to POST BT relations
(one at a time) for the PAHMA location authority (also v2.4). I notice
some "dialect differences" between Chris H.'s and mine...not sure how
to account for them.
Good hunting!
John
<?xml version="1.0" encoding="UTF-8"?>
<document name="relations">
<ns2:relations_common
xmlns:ns2="http://collectionspace.org/services/relation"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<relationshipType>hasBroader</relationshipType>
<objectCsid>#objectCsid#</objectCsid>
<subjectCsid>#subjectCsid#</subjectCsid>
<objectDocumentType>LocationitemTenant15</objectDocumentType>
<subjectDocumentType>LocationitemTenant15</subjectDocumentType>
<objectRefName>#objectRefName#</objectRefName>
<subjectRefName>#subjectRefName#</subjectRefName>
</ns2:relations_common>
</document>
On Wed, Nov 28, 2012 at 10:47 AM, Chris Hoffman <chris_h@berkeley.edu<mailto:chris_h@berkeley.edu>> wrote:
> HI Chris,
>
> Importing relations is fun! Here's a test payload I a recently loaded for
> the UC Botanical Garden. I don't know if you need all these fields (the
> subject and object CSIDs, URIs, and doc types and refNames), but they were
> in the payload so I just populated them. I'm working on 2.4 though so this
> might not be needed any longer.
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <imports>
> <import service="Relations" type="Relation"
> CSID="59f25184-f242-4c59-99a1-05ad80460f61">
> <schema xmlns:relations_common="http://collectionspace.org/relation"
> name="relations_common">
> <relationshipType>hasBroader</relationshipType>
> <subjectDocumentType>Locationitem</subjectDocumentType>
> <subjectCsid>5d21e8d2-e893-41ed-8dc2-bb0541e0cb06</subjectCsid>
>
> <subjectUri>/locationauthorities/dbf254e8-437d-4926-be5d/items/5d21e8d2-e893-41ed-8dc2-bb0541e0cb06</subjectUri>
>
> <subjectRefName>urn:cspace:botgarden.cspace.berkeley.edu:locationauthorities:name(location):item:name(garden1)'NURS'</subjectRefName>
> <objectDocumentType>Locationitem</objectDocumentType>
> <objectCsid>b025a681-0604-42c3-9776-240d6fdf62e0</objectCsid>
>
> <objectUri>/locationauthorities/dbf254e8-437d-4926-be5d/items/b025a681-0604-42c3-9776-240d6fdf62e0</objectUri>
>
> <objectRefName>urn:cspace:botgarden.cspace.berkeley.edu:locationauthorities:name(location):item:name(garden0)'none'</objectRefName>
> </schema>
> </import>
> </imports>
>
> Chris
>
>
>
> On Nov 28, 2012, at 5:13 AM, Christopher Pott wrote:
>
> Hi,
>
> Does anyone have experience of importing Storage Locations including
> hierarchies?
>
> I'm able to import the locations themselves, but how do I attach the
> locations hierarchy list to this import? I've tried appending a
> "relation-list-item" in the same import record, using a separate import
> record with a "relations-common-list" schema, and adding every useful field
> I can think of (I'm not sure which are required fields). I've also tried
> creating completely separate "relations_common" import records, but this
> also failed to produce the hierarchy entries.
>
> I've attached my favourite (but equally incorrect) guess so far. It's an
> attempt to import a storage location with a relation to a parent location.
> In most cases, there'll be a number of children as well. The import responds
> with "success", but only imports the first item, not the relation. Any
> ideas?
>
> Regards,
> Chris
> <location0.xml>_______________________________________________
> Talk mailing list
> Talk@lists.collectionspace.org<mailto: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
>
_______________________________________________
Talk mailing list
Talk@lists.collectionspace.org<mailto:Talk@lists.collectionspace.org>
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
AR
Aron Roberts
Thu, Nov 29, 2012 4:45 PM
Aron, if I understand your summary correctly, then the confusing issue for
me was that the “relations-common-list” can be used in the Services REST API
but is not accepted by the import service.
Nice summary - yes, I believe that's correct, Chris.
On Thu, Nov 29, 2012 at 5:16 AM, Christopher Pott
<Christopher.Pott@smk.dk> wrote:
> Aron, if I understand your summary correctly, then the confusing issue for
> me was that the “relations-common-list” can be used in the Services REST API
> but is not accepted by the import service.
Nice summary - yes, I believe that's correct, Chris.