OAI-ORE Data Package Examples

  1. Create a simple data package with one data document and one metadata document.

This example creates an OAI-ORE resource map document that describes the situation with a single metadata document ("id-scimeta-1") that describes a single data object ("id-data-1"). The generated OIA-ORE document has identifier "id-package-1".


In [8]:
from d1_common.types import dataoneTypes
from d1_client import data_package

metadata_pid = 'id-scimeta-1'
data_pid = 'id-data-1'
package_pid = 'id-package-1'

ore_generator = data_package.ResourceMapGenerator()

ore_document = ore_generator.simple_generate_resource_map(package_pid, 
                                                          metadata_pid,
                                                          [data_pid,])
print ore_document


<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
   xmlns:cito="http://purl.org/spar/cito/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:dcterms="http://purl.org/dc/terms/"
   xmlns:foaf="http://xmlns.com/foaf/0.1/"
   xmlns:ore="http://www.openarchives.org/ore/terms/"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:rdfs1="http://www.w3.org/2001/01/rdf-schema#"
>
  <rdf:Description rdf:about="https://cn.dataone.org/cn/v1/resolve/id-package-1">
    <dcterms:modified>2016-01-19T10:22:22Z</dcterms:modified>
    <dcterms:identifier>id-package-1</dcterms:identifier>
    <dc:format>application/rdf+xml</dc:format>
    <dcterms:created>2016-01-19T10:22:22Z</dcterms:created>
    <ore:describes rdf:resource="https://cn.dataone.org/cn/v1/resolve/id-package-1#aggregation"/>
    <rdf:type rdf:resource="http://www.openarchives.org/ore/terms/ResourceMap"/>
    <dcterms:creator rdf:resource="http://foresite-toolkit.googlecode.com/#pythonAgent"/>
  </rdf:Description>
  <rdf:Description rdf:about="https://cn.dataone.org/cn/v1/resolve/id-scimeta-1">
    <dcterms:identifier>id-scimeta-1</dcterms:identifier>
    <cito:documents rdf:resource="https://cn.dataone.org/cn/v1/resolve/id-data-1"/>
  </rdf:Description>
  <rdf:Description rdf:about="https://cn.dataone.org/cn/v1/resolve/id-data-1">
    <dcterms:identifier>id-data-1</dcterms:identifier>
    <cito:isDocumentedBy rdf:resource="https://cn.dataone.org/cn/v1/resolve/id-scimeta-1"/>
  </rdf:Description>
  <rdf:Description rdf:about="http://www.openarchives.org/ore/terms/Aggregation">
    <rdfs1:isDefinedBy>http://www.openarchives.org/ore/terms/</rdfs1:isDefinedBy>
    <rdfs1:label>Aggregation</rdfs1:label>
  </rdf:Description>
  <rdf:Description rdf:about="http://www.openarchives.org/ore/terms/ResourceMap">
    <rdfs1:isDefinedBy>http://www.openarchives.org/ore/terms/</rdfs1:isDefinedBy>
    <rdfs1:label>ResourceMap</rdfs1:label>
  </rdf:Description>
  <rdf:Description rdf:about="https://cn.dataone.org/cn/v1/resolve/id-package-1#aggregation">
    <rdf:type rdf:resource="http://www.openarchives.org/ore/terms/Aggregation"/>
    <ore:aggregates rdf:resource="https://cn.dataone.org/cn/v1/resolve/id-data-1"/>
    <ore:aggregates rdf:resource="https://cn.dataone.org/cn/v1/resolve/id-scimeta-1"/>
  </rdf:Description>
  <rdf:Description rdf:about="http://foresite-toolkit.googlecode.com/#pythonAgent">
    <foaf:name>Foresite Toolkit (Python)</foaf:name>
    <foaf:mbox>foresite@googlegroups.com</foaf:mbox>
  </rdf:Description>
</rdf:RDF>


In [ ]:


In [ ]: