Skip to main content

OARepo Invenio data model

image image image image

Invenio base record model.

Instalation

    pip install oarepo-invenio-model

Usage

The library provides extensible Invenio base record model.

JSON Schema

Add this package to your dependencies and use it via $ref in json schema.

Usage example

{
  "type": "object",
  "allOf": [
    {
      "properties": {
        "title": {
          "type": "string"
        }
      }
    },
    {
      "$ref": "/schemas/invenio-v3.0.0.json#/definitions/InvenioRecord"
    }
  ],
  "additionalProperties": "false"
}

Elastic Search Mapping

Use oarepo-mapping-includes library for extanding invenio base record model mapping.

Usage example

{
  "mappings": {
    "dynamic": "strict",
    "oarepo:extends": "invenio-v3.0.0.json#/InvenioRecord",
    "properties": {
         "title": {
        "type": "text"
      }
    }
  }
}

Marshmallow

You can extense your schema with Invenio base model schema by inheriting from InvenioRecordMetadataSchemaV1Mixin.

Usage example

class SampleSchemaV1(InvenioRecordMetadataSchemaV1Mixin):
    title = fields.String(validate=validate.Length(min=5), required=True)

Schema inheritance

JSON Schema provides allOf construct to join multiple schemas. The current implementation of python's schema validator can not handle allOf in top-level element.

To enable composition of schemas in the form of top-level "includes":

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "allOf": [
    {
      "$ref": "/schemas/dcterms-v2.0.0.json#/definitions/DCObject"
    },
    {
      "$ref": "/schemas/invenio-v3.0.0.json#/definitions/InvenioRecord"
    },
    {
      "properties": {
        "category": {
          "type": "string",
          "enum": ["kovy", "sklo", "keramika", "textil"]
        }
      }
    }
  ]
}

inherit your record class from InheritedSchemaRecordMixin:

from oarepo_invenio_model import InheritedSchemaRecordMixin
from invenio_records.api import Record

class MyRecord(InheritedSchemaRecordMixin, Record):
    pass

Changes

[Version 2.0.0]

  • Update schemas, mappings and marshmallow to latest records rest schemas
  • Switch record id type from string to PersistentIdentifier

[Version 1.1.0]

  • Export Invenio ES mappings

Invenio base record model.

Metadata

Release files for oarepo-invenio-model 3.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for oarepo-invenio-model 3.0.2
File Size Uploaded
oarepo_invenio_model-3.0.2.tar.gz 12.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for oarepo-invenio-model 3.0.2
File Interpreter ABI Platform
oarepo_invenio_model-3.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 21.9 kB

Release files / oarepo_invenio_model-3.0.2.tar.gz

Download URL oarepo_invenio_model-3.0.2.tar.gz
Size 12.7 kB
Tags Source
SHA-256 checksum
How to use checksums
e3e1a5193d2acd36cc2f1b8ad312c1a617899f2ade22ee3b54ec89e6a2f654aa
BLAKE2b-256 checksum
How to use checksums
3849ad5b8e6e44e65e477fcfeb49883ef17b4557c2ac475f03f4849529490058
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

Release files / oarepo_invenio_model-3.0.2-py3-none-any.whl

Download URL oarepo_invenio_model-3.0.2-py3-none-any.whl
Size 9.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aac79bba5047eb9b708cf45cb4c8a9c496279a62462e75838224b63f13ce896b
BLAKE2b-256 checksum
How to use checksums
76c04fec33840ef7030d5b2398abd9d6c4ee0d5b5e10300267ffb3e70f9b8208
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

Release history Release notifications | RSS feed

This release

3.0.2 This release

2 release files

3.0.1

2 release files

3.0.0

2 release files

2.2.2

2 release files

2.2.1

2 release files

2.2.0

2 release files

2.1.3

2 release files

2.1.2

2 release files

2.1.0

2 release files

2.0.2

2 release files

2.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page