Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add models for per-entry & per-property metadata #2168

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
70 changes: 65 additions & 5 deletions openapi/index_openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"info": {
"title": "OPTIMADE API - Index meta-database",
"description": "The [Open Databases Integration for Materials Design (OPTIMADE) consortium](https://www.optimade.org/) aims to make materials databases interoperational by developing a common REST API.\nThis is the \"special\" index meta-database.\n\nThis specification is generated using [`optimade-python-tools`](https://github.com/Materials-Consortia/optimade-python-tools/tree/v1.1.11) v1.1.11.",
"version": "1.1.0"
"version": "1.2.0"
},
"paths": {
"/info": {
Expand Down Expand Up @@ -477,6 +477,19 @@
"title": "BaseRelationshipResource",
"description": "Minimum requirements to represent a relationship resource"
},
"EntryMetadata": {
"properties": {
"property_metadata": {
"type": "object",
"title": "Property Metadata",
"description": "An object containing per-entry and per-property metadata. The keys are the names of the fields in attributes for which metadata is available. The values belonging to these keys are dictionaries containing the relevant metadata fields. See also [Metadata properties](https://github.com/Materials-Consortia/OPTIMADE/blob/develop/optimade.rst#metadata-properties)"
}
},
"additionalProperties": true,
"type": "object",
"title": "EntryMetadata",
"description": "Contains the metadata for the attributes of an entry"
},
"EntryRelationships": {
"properties": {
"references": {
Expand Down Expand Up @@ -536,13 +549,13 @@
"meta": {
"anyOf": [
{
"$ref": "#/components/schemas/Meta"
"$ref": "#/components/schemas/EntryMetadata"
},
{
"type": "null"
}
],
"description": "a meta object containing non-standard meta-information about a resource that can not be represented as an attribute or relationship."
"description": "A [JSON API meta object](https://jsonapi.org/format/1.1/#document-meta) that is used to communicate metadata."
},
"attributes": {
"$ref": "#/components/schemas/EntryResourceAttributes",
Expand Down Expand Up @@ -1010,6 +1023,53 @@
"title": "Is Index",
"description": "This must be `true` since this is an index meta-database (see section Index Meta-Database).",
"default": true
},
"license": {
"anyOf": [
{
"$ref": "#/components/schemas/Link"
},
{
"type": "string",
"minLength": 1,
"format": "uri"
},
{
"type": "null"
}
],
"title": "License",
"description": "A [JSON API links object](http://jsonapi.org/format/1.0/#document-links) giving a URL to a web page containing a human-readable text describing the license (or licensing options if there are multiple) covering all the data and metadata provided by this database.\nClients are advised not to try automated parsing of this link or its content, but rather rely on the field `available_licenses` instead."
},
"available_licenses": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"title": "Available Licenses",
"description": "List of [SPDX license identifiers](https://spdx.org/licenses/) specifying a set of alternative licenses available to the client for licensing the complete database, i.e., all the entries, metadata, and the content and structure of the database itself.\n\nIf more than one license is available to the client, the identifier of each one SHOULD be included in the list.\nInclusion of a license identifier in the list is a commitment of the database that the rights are in place to grant clients access to all the individual entries, all metadata, and the content and structure of the database itself according to the terms of any of these licenses (at the choice of the client).\nIf the licensing information provided via the field license omits licensing options specified in `available_licenses`, or if it otherwise contradicts them, a client MUST still be allowed to interpret the inclusion of a license in `available_licenses` as a full commitment from the database without exceptions, under the respective licenses.\nIf the database cannot make that commitment, e.g., if only part of the database is available under a license, the corresponding license identifier MUST NOT appear in `available_licenses` (but, rather, the field license is to be used to clarify the licensing situation.)\nAn empty list indicates that none of the SPDX licenses apply and that the licensing situation is clarified in human readable form in the field `license`.\nAn unknown value means that the database makes no commitment."
},
"available_licenses_for_entries": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"title": "Available Licenses For Entries",
"description": "List of [SPDX license identifiers](https://spdx.org/licenses/) specifying a set of additional alternative licenses available to the client for licensing individual, and non-substantial sets of, database entries, metadata, and extracts from the database that do not constitute substantial parts of the database.\n\nNote that the definition of the field `available_licenses` implies that licenses specified in that field are available also for the licensing specified by this field, even if they are not explicitly included in the field `available_licenses_for_entries` or if it is `null` (however, the opposite relationship does not hold).\nIf `available_licenses` is unknown, only the licenses in `available_licenses_for_entries` apply."
}
},
"type": "object",
Expand Down Expand Up @@ -1277,13 +1337,13 @@
"meta": {
"anyOf": [
{
"$ref": "#/components/schemas/Meta"
"$ref": "#/components/schemas/EntryMetadata"
},
{
"type": "null"
}
],
"description": "a meta object containing non-standard meta-information about a resource that can not be represented as an attribute or relationship."
"description": "A [JSON API meta object](https://jsonapi.org/format/1.1/#document-meta) that is used to communicate metadata."
},
"attributes": {
"$ref": "#/components/schemas/LinksResourceAttributes",
Expand Down
78 changes: 69 additions & 9 deletions openapi/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"info": {
"title": "OPTIMADE API",
"description": "The [Open Databases Integration for Materials Design (OPTIMADE) consortium](https://www.optimade.org/) aims to make materials databases interoperational by developing a common REST API.\n\nThis specification is generated using [`optimade-python-tools`](https://github.com/Materials-Consortia/optimade-python-tools/tree/v1.1.11) v1.1.11.",
"version": "1.1.0"
"version": "1.2.0"
},
"paths": {
"/info": {
Expand Down Expand Up @@ -1488,6 +1488,53 @@
"title": "Is Index",
"description": "If true, this is an index meta-database base URL (see section Index Meta-Database). If this member is not provided, the client MUST assume this is not an index meta-database base URL (i.e., the default is for `is_index` to be `false`).",
"default": false
},
"license": {
"anyOf": [
{
"$ref": "#/components/schemas/Link"
},
{
"type": "string",
"minLength": 1,
"format": "uri"
},
{
"type": "null"
}
],
"title": "License",
"description": "A [JSON API links object](http://jsonapi.org/format/1.0/#document-links) giving a URL to a web page containing a human-readable text describing the license (or licensing options if there are multiple) covering all the data and metadata provided by this database.\nClients are advised not to try automated parsing of this link or its content, but rather rely on the field `available_licenses` instead."
},
"available_licenses": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"title": "Available Licenses",
"description": "List of [SPDX license identifiers](https://spdx.org/licenses/) specifying a set of alternative licenses available to the client for licensing the complete database, i.e., all the entries, metadata, and the content and structure of the database itself.\n\nIf more than one license is available to the client, the identifier of each one SHOULD be included in the list.\nInclusion of a license identifier in the list is a commitment of the database that the rights are in place to grant clients access to all the individual entries, all metadata, and the content and structure of the database itself according to the terms of any of these licenses (at the choice of the client).\nIf the licensing information provided via the field license omits licensing options specified in `available_licenses`, or if it otherwise contradicts them, a client MUST still be allowed to interpret the inclusion of a license in `available_licenses` as a full commitment from the database without exceptions, under the respective licenses.\nIf the database cannot make that commitment, e.g., if only part of the database is available under a license, the corresponding license identifier MUST NOT appear in `available_licenses` (but, rather, the field license is to be used to clarify the licensing situation.)\nAn empty list indicates that none of the SPDX licenses apply and that the licensing situation is clarified in human readable form in the field `license`.\nAn unknown value means that the database makes no commitment."
},
"available_licenses_for_entries": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"title": "Available Licenses For Entries",
"description": "List of [SPDX license identifiers](https://spdx.org/licenses/) specifying a set of additional alternative licenses available to the client for licensing individual, and non-substantial sets of, database entries, metadata, and extracts from the database that do not constitute substantial parts of the database.\n\nNote that the definition of the field `available_licenses` implies that licenses specified in that field are available also for the licensing specified by this field, even if they are not explicitly included in the field `available_licenses_for_entries` or if it is `null` (however, the opposite relationship does not hold).\nIf `available_licenses` is unknown, only the licenses in `available_licenses_for_entries` apply."
}
},
"type": "object",
Expand Down Expand Up @@ -1791,6 +1838,19 @@
],
"title": "EntryInfoResponse"
},
"EntryMetadata": {
"properties": {
"property_metadata": {
"type": "object",
"title": "Property Metadata",
"description": "An object containing per-entry and per-property metadata. The keys are the names of the fields in attributes for which metadata is available. The values belonging to these keys are dictionaries containing the relevant metadata fields. See also [Metadata properties](https://github.com/Materials-Consortia/OPTIMADE/blob/develop/optimade.rst#metadata-properties)"
}
},
"additionalProperties": true,
"type": "object",
"title": "EntryMetadata",
"description": "Contains the metadata for the attributes of an entry"
},
"EntryRelationships": {
"properties": {
"references": {
Expand Down Expand Up @@ -1850,13 +1910,13 @@
"meta": {
"anyOf": [
{
"$ref": "#/components/schemas/Meta"
"$ref": "#/components/schemas/EntryMetadata"
},
{
"type": "null"
}
],
"description": "a meta object containing non-standard meta-information about a resource that can not be represented as an attribute or relationship."
"description": "A [JSON API meta object](https://jsonapi.org/format/1.1/#document-meta) that is used to communicate metadata."
},
"attributes": {
"$ref": "#/components/schemas/EntryResourceAttributes",
Expand Down Expand Up @@ -2434,13 +2494,13 @@
"meta": {
"anyOf": [
{
"$ref": "#/components/schemas/Meta"
"$ref": "#/components/schemas/EntryMetadata"
},
{
"type": "null"
}
],
"description": "a meta object containing non-standard meta-information about a resource that can not be represented as an attribute or relationship."
"description": "A [JSON API meta object](https://jsonapi.org/format/1.1/#document-meta) that is used to communicate metadata."
},
"attributes": {
"$ref": "#/components/schemas/LinksResourceAttributes",
Expand Down Expand Up @@ -2931,13 +2991,13 @@
"meta": {
"anyOf": [
{
"$ref": "#/components/schemas/Meta"
"$ref": "#/components/schemas/EntryMetadata"
},
{
"type": "null"
}
],
"description": "a meta object containing non-standard meta-information about a resource that can not be represented as an attribute or relationship."
"description": "A [JSON API meta object](https://jsonapi.org/format/1.1/#document-meta) that is used to communicate metadata."
},
"attributes": {
"$ref": "#/components/schemas/ReferenceResourceAttributes"
Expand Down Expand Up @@ -4055,13 +4115,13 @@
"meta": {
"anyOf": [
{
"$ref": "#/components/schemas/Meta"
"$ref": "#/components/schemas/EntryMetadata"
},
{
"type": "null"
}
],
"description": "a meta object containing non-standard meta-information about a resource that can not be represented as an attribute or relationship."
"description": "A [JSON API meta object](https://jsonapi.org/format/1.1/#document-meta) that is used to communicate metadata."
},
"attributes": {
"$ref": "#/components/schemas/StructureResourceAttributes"
Expand Down
2 changes: 1 addition & 1 deletion optimade-version.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"schemaVersion": 1,
"label": "OPTIMADE",
"message": "v1.1.0",
"message": "v1.2.0",
"color": "yellowgreen",
"logoSvg": "<svg version='1' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 55 55'><line x1='27' y1='14.5' x2='38.0' y2='7.94744111674' stroke='#9ed700' stroke-width='1.15' /><line x1='37.8253175473' y1='33.25' x2='38.0' y2='46.0525588833' stroke='#00acd9' stroke-width='1.15' /><line x1='16.1746824527' y1='33.25' x2='5' y2='27' stroke='#7a2dd0' stroke-width='1.15' /><line x1='49' y1='27' x2='38.0' y2='46.0525588833' stroke='#00acd9' stroke-width='1.15' /><line x1='38.0' y1='46.0525588833' x2='16.0' y2='46.0525588833' stroke='#e8e8e8' stroke-width='2' /><line x1='16.0' y1='46.0525588833' x2='5' y2='27' stroke='#7a2dd0' stroke-width='1.15' /><line x1='5' y1='27' x2='16.0' y2='7.94744111674' stroke='#e8e8e8' stroke-width='2' /><line x1='16.0' y1='7.94744111674' x2='38.0' y2='7.94744111674' stroke='#9ed700' stroke-width='1.15' /><line x1='38.0' y1='7.94744111674' x2='49' y2='27' stroke='#e8e8e8' stroke-width='2' /><circle cx='49' cy='27' r='3.5' fill='#00acd9' /><circle cx='38.0' cy='46.0525588833' r='3.5' fill='#00acd9' /><circle cx='16.0' cy='46.0525588833' r='3.5' fill='#7a2dd0' /><circle cx='5' cy='27' r='3.5' fill='#7a2dd0' /><circle cx='16.0' cy='7.94744111674' r='3.5' fill='#9ed700' /><circle cx='38.0' cy='7.94744111674' r='3.5' fill='#9ed700' /><line x1='27' y1='39.5' x2='16.1746824527' y2='33.25' stroke='#ff414d' stroke-width='1' /><line x1='16.1746824527' y1='33.25' x2='16.1746824527' y2='20.75' stroke='#ff414d' stroke-width='1' /><line x1='16.1746824527' y1='20.75' x2='27' y2='14.5' stroke='#ff414d' stroke-width='1' /><line x1='27' y1='14.5' x2='37.8253175473' y2='20.75' stroke='#ff414d' stroke-width='1' /><line x1='37.8253175473' y1='20.75' x2='37.8253175473' y2='33.25' stroke='#ff414d' stroke-width='1' /><line x1='37.8253175473' y1='33.25' x2='27' y2='39.5' stroke='#ff414d' stroke-width='1' /><circle cx='27' cy='39.5' r='2.5' fill='#ff414d' /><circle cx='16.1746824527' cy='33.25' r='2.5' fill='#ff414d' /><circle cx='16.1746824527' cy='20.75' r='2.5' fill='#ff414d' /><circle cx='27' cy='14.5' r='2.5' fill='#ff414d' /><circle cx='37.8253175473' cy='20.75' r='2.5' fill='#ff414d' /><circle cx='37.8253175473' cy='33.25' r='2.5' fill='#ff414d' /></svg>"
}
2 changes: 1 addition & 1 deletion optimade/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = "1.1.11"
__api_version__ = "1.1.0"
__api_version__ = "1.2.0"
Loading
Loading