diff --git a/docs/conf.py b/docs/conf.py index dab41171..5a0b8f31 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,10 +1,8 @@ import os import django os.environ.setdefault("DJANGO_SETTINGS_MODULE", "swh.deposit.settings.development") django.setup() from swh.docs.sphinx.conf import * # NoQA - -extensions = ["sphinx.ext.autosectionlabel"] diff --git a/docs/endpoints/collection.rst b/docs/endpoints/collection.rst index 53219258..10326d76 100644 --- a/docs/endpoints/collection.rst +++ b/docs/endpoints/collection.rst @@ -1,73 +1,74 @@ +.. _API-create-deposit: Create deposit ^^^^^^^^^^^^^^^ .. http:post:: /1// Create deposit in a collection. The client sends a deposit request to a specific collection with: * an archive holding the software source code (binary upload) * an envelop with metadata describing information regarding a deposit (atom entry deposit) Also known as: COL-IRI :param text : the client's credentials :param text Content-Type: accepted mimetype :param int Content-Length: tarball size :param text Content-MD5: md5 checksum hex encoded of the tarball :param text Content-Disposition: attachment; filename=[filename]; the filename parameter must be text (ascii) :param text Content-Disposition: for the metadata file set name parameter to 'atom'. :param bool In-progress: true if not final; false when final request. :statuscode 201: success for deposit on POST :statuscode 401: Unauthorized :statuscode 404: access to an unknown collection :statuscode 415: unsupported media type Sample request ~~~~~~~~~~~~~~~ .. code:: shell curl -i -u hal: \ -F "file=@../deposit.json;type=application/zip;filename=payload" \ -F "atom=@../atom-entry.xml;type=application/atom+xml;charset=UTF-8" \ -H 'In-Progress: false' \ -H 'Slug: some-external-id' \ -XPOST https://deposit.softwareheritage.org/1/hal/ Sample response ~~~~~~~~~~~~~~~ .. code:: shell HTTP/1.0 201 Created Date: Tue, 26 Sep 2017 10:32:35 GMT Server: WSGIServer/0.2 CPython/3.5.3 Vary: Accept, Cookie Allow: GET, POST, PUT, DELETE, HEAD, OPTIONS Location: /1/hal/10/metadata/ X-Frame-Options: SAMEORIGIN Content-Type: application/xml 10 Sept. 26, 2017, 10:32 a.m. None deposited http://purl.org/net/sword/package/SimpleZip diff --git a/docs/metadata.rst b/docs/metadata.rst index f8e1cda2..7b07f724 100644 --- a/docs/metadata.rst +++ b/docs/metadata.rst @@ -1,185 +1,187 @@ .. _deposit-metadata: Deposit metadata ================ When making a software deposit into the SWH archive, one can add information describing the software artifact and the software project. +.. _metadata-requirements: + Metadata requirements --------------------- - **the schema/vocabulary** used *MUST* be specified with a persistent url (DublinCore, DOAP, CodeMeta, etc.) .. code:: xml or or - **the name** of the software deposit *MUST* be provided [atom:title, codemeta:name, dcterms:title] - **the authors** of the software deposit *MUST* be provided - **the url** representing the location of the source *MAY* be provided under the url tag. The url will be used for creating an origin object in the archive. .. code:: xml www.url-example.com - **the external\_identifier** *MAY* be provided as an identifier - **the external\_identifier** *SHOULD* match the Slug external-identifier in the header - **the description** of the software deposit *SHOULD* be provided [codemeta:description]: short or long description of the software - **the license/s** of the software deposit *SHOULD* be provided [codemeta:license] - other metadata *MAY* be added with terms defined by the schema in use. Examples -------- Using only Atom ~~~~~~~~~~~~~~~ .. code:: xml Awesome Compiler urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a 1785io25c695 2017-10-07T15:17:08Z some awesome author Using Atom with CodeMeta ~~~~~~~~~~~~~~~~~~~~~~~~ .. code:: xml Awesome Compiler urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a 1785io25c695 1785io25c695 origin url other identifier, DOI, ARK Domain description key-word 1 key-word 2 creation date publication date comment article name article id Collaboration/Projet project name id see also Sponsor A Sponsor B Platform/OS dependencies Version active license url spdx .Net Framework 3.0 Python2.3 author1 Inria UPMC author2 Inria UPMC http://code.com language 1 language 2 http://issuetracker.com Using Atom with DublinCore and CodeMeta (multi-schema entry) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. code:: xml Awesome Compiler hal urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a %s hal-01587361 doi:10.5281/zenodo.438684 The assignment problem AffectationRO author [INFO] Computer Science [cs] [INFO.INFO-RO] Computer Science [cs]/Operations Research [cs.RO] SOFTWARE Project in OR: The assignment problemA java implementation for the assignment problem first release description fr 2015-06-01 2017-10-19 en origin url 1.0.0 key word Comment Rfrence interne link Sponsor Platform/OS dependencies Ended license url spdx http://code.com language 1 language 2 Note ---- We aim on harmonizing the metadata from different origins and thus metadata will be translated to the `CodeMeta v.2 `__ vocabulary if possible. diff --git a/docs/specs/spec-meta-deposit.rst b/docs/specs/spec-meta-deposit.rst index c3c2c01e..80e4fe66 100644 --- a/docs/specs/spec-meta-deposit.rst +++ b/docs/specs/spec-meta-deposit.rst @@ -1,140 +1,141 @@ The metadata-deposit ==================== Goal ---- -A client wishes to deposit only metadata about an origin or object in the -Software Heritage archive. + +A client wishes to deposit only metadata about an origin or object already +present in the Software Heritage archive. The metadata-deposit is a special deposit where no content is provided and the data transferred to Software Heritage is only the metadata about an object in the archive. Requirements ------------ -1. :ref:`Create a metadata-only deposit through a POST request` +1. Create a metadata-only deposit through a :ref:`POST request` 2. It is composed of ONLY one xml metadata file -3. It MUST comply with :ref:`the metadata requirements` +3. It MUST comply with :ref:`the metadata requirements` 4. It MUST reference an **object** or an **origin** in a deposit tag 5. The reference SHOULD exist in the SWH archive 6. The **object** reference MUST be a SWHID on one of the following artifact types: - - origin - - snapshot - - release - - revision - - directory - - content + - origin + - snapshot + - release + - revision + - directory + - content 7. The SWHID MAY be a `core identifier`_ with or without `qualifiers`_ 8. The SWHID MUST NOT reference a fragment of code with the classifier `lines` .. _core identifier: https://docs.softwareheritage.org/devel/swh-model/persistent-identifiers.html#core-identifiers .. _qualifiers: https://docs.softwareheritage.org/devel/swh-model/persistent-identifiers.html#qualifiers A complete metadata example --------------------------- The reference element is included in the metadata xml atomEntry under the swh namespace: .. code:: xml HAL hal@ccsd.cnrs.fr hal hal-01243573 The assignment problem https://hal.archives-ouvertes.fr/hal-01243573 other identifier, DOI, ARK Domain description author1 Inria UPMC author2 Inria UPMC References ^^^^^^^^^^ The metadata reference can be either on: - an origin - a graph object (core SWHID with or without qualifiers) Origins ======= The metadata may be on an origin, identified by the origin's URL: .. code:: xml Graph objects ============= It may also reference an object in the `SWH graph `: contents, directories, revisions, releases, and snapshots: .. code:: xml .. code:: xml The value of the ``swhid`` attribute must be a `SWHID `, with any context qualifiers in this list: * ``origin`` * ``visit`` * ``anchor`` * ``path`` and they should be provided whenever relevant, especially ``origin``. Other qualifiers are not allowed (for example, ``line`` isn't because SWH cannot store metadata at a finer level than entire contents). Loading procedure ------------------ In this case, the metadata-deposit will be injected as a metadata entry of the relevant object, with the information about the contributor of the deposit. Contrary to the complete and sparse deposit, there will be no object creation.