Skip to main content

DCTerms support for OARepo (just selected props)

Project description

OARepo DC data model

image image image image

DC Terms data model for oarepo.

Instalation

    pip install oarepo-dc

Usage

The library provides Dublin Core object for json schema with marshmallow validation and deserialization and elastic search mapping.

JSON Schema

Add this package to your dependencies and use it via $ref in json schema as "[server]/schemas/dcterms-v2.0.0.json#/definitions/DCObject". Elastic Search mapping is handled automatically via Eleastic Search templates.

Usage example

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "these": {
            "$ref": "https://localhost:5000/schemas/dcterms-v2.0.0.json#/definitions/DCObject"
      }
  }
}
{
  "type": "object",
  "properties": {
    "these": {
        "abstract" : {"cs": "neco", "en": "something"}, 
        "contributor" : "Alzbeta Pokorna", 
        "modified":"2012-04-23T18:25:43.511Z"
            }
        }
}

Marshmallow

For data validation and deserialization.

If marshmallow validation is performed within application context, languages in multilingual string data fields are validated against SUPPORTED_LANGUAGES config. If the validation is performed outside app context, the keys are not checked against a list of languages but a generic validation is performed - keys must be in ISO 639-1 or language-region format from RFC 5646.

Usage example

class MD(DCObjectSchemaV2Mixin, marshmallow.Schema):
    pass

data = {"title": {"cs": "neco"},
                 "alternative": {"en-us": "something", "cs": "neco"},
                 "abstract": {},
                 "creator": "Alzbeta Pokorna",
                 "contributor": "Miroslav Simek",
                 "dateSubmitted": "1970-10-12",
                 "available": "1970-03-18",
                 "created": "1970-09-29",
                 "modified": "1970-12-31",
                 "description": {"en-us": "something", "cs": "neco"},
                 "identifier": "id"}


    MD().load(data)

Supported languages validation

You can specified supported languages in your application configuration in SUPPORTED_LANGUAGES . Then only these languages are allowed as multilingual string. You must specified your languages in format "en" or "en-us".

Usage example

app.config.update(SUPPORTED_LANGUAGES = ["cs", "en"])

Changes

Version 2.0.0 (released 2020-08-25)

  • Initial public release.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

oarepo_dc-2.2.0.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

oarepo_dc-2.2.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file oarepo_dc-2.2.0.tar.gz.

File metadata

  • Download URL: oarepo_dc-2.2.0.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for oarepo_dc-2.2.0.tar.gz
Algorithm Hash digest
SHA256 73980df0f6d774d2951cef6744f97cd34519b0dd2b6e89c3ab6b5f0aff8b64f0
MD5 46408e7c80c4a56272a4fac630934a40
BLAKE2b-256 ea2f522a129aa709c04add906e3af0d4af74d4a036766b9e18549b64c426391b

See more details on using hashes here.

File details

Details for the file oarepo_dc-2.2.0-py3-none-any.whl.

File metadata

  • Download URL: oarepo_dc-2.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for oarepo_dc-2.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 75bfb07c97b546fd62b52590968d1884fddcaaecd571e0ddaa4b108e48245d81
MD5 98176f9378ec8a67ab85f32d5b228d70
BLAKE2b-256 4b63004926975731d60c0dbfb5ba8dd86931837c0909b1772f87ee4d70a0c361

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page