OARepo的Invenio数据模型
oarepo-invenio-model的Python项目详细描述
OARepo Invenio数据模型
英维尼奥基本记录模型。在
安装
pip install oarepo-invenio-model
使用
该库提供可扩展的Invenio基本记录模型。在
JSON架构
将这个包添加到依赖项中,并通过json中的$ref使用它 架构。在
用法示例
^{pr2}$弹性搜索映射
使用oarepo-mapping-includes
库扩展invenio基本记录模型映射。在
用法示例
{"mappings":{"dynamic":"strict","oarepo:extends":"invenio-v1.0.0.json#/InvenioRecord","properties":{"title":{"type":"text"}}}}
棉花糖
通过从InvenioRecordMetadataSchemaV1Mixin
继承,可以用Invenio基本模型模式扩展模式。在
用法示例
classSampleSchemaV1(InvenioRecordMetadataSchemaV1Mixin):title=fields.String(validate=validate.Length(min=5),required=True)
模式继承
JSON模式提供allOf
构造来连接多个模式。电流
python模式验证器的实现无法在顶层处理allOf
元素。在
要以顶层“includes”的形式组合模式,请执行以下操作:
{"$schema":"http://json-schema.org/draft-07/schema#","allOf":[{"$ref":"/schemas/dcterms-v2.0.0.json#/definitions/DCObject"},{"$ref":"/schemas/invenio-v1.0.0.json#/definitions/InvenioRecord"},{"properties":{"category":{"type":"string","enum":["kovy","sklo","keramika","textil"]}}}]}
从InheritedSchemaRecordMixin
继承记录类:
fromoarepo_invenio_modelimportInheritedSchemaRecordMixinfrominvenio_records.apiimportRecordclassMyRecord(InheritedSchemaRecordMixin,Record):pass
变更
[版本2.0.0]
- Update schemas, mappings and marshmallow to latest records rest schemas
- Switch record id type from string to PersistentIdentifier
[版本1.1.0]
- Export Invenio ES mappings
英维尼奥基本记录模型。在
- 项目
标签: