__init__.py 4.56 KB
Newer Older
Markus Scheidgen's avatar
Markus Scheidgen committed
1
2
3
4
#
# Copyright The NOMAD Authors.
#
# This file is part of NOMAD. See https://nomad-lab.eu for further info.
5
6
7
8
9
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
Markus Scheidgen's avatar
Markus Scheidgen committed
10
#     http://www.apache.org/licenses/LICENSE-2.0
11
12
#
# Unless required by applicable law or agreed to in writing, software
Markus Scheidgen's avatar
Markus Scheidgen committed
13
# distributed under the License is distributed on an "AS IS" BASIS,
14
15
16
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
Markus Scheidgen's avatar
Markus Scheidgen committed
17
#
18

19
'''
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Introduction
------------

This is about the *datamodel* that is used to represent NOMAD entries in our databases and
search engines. The respective data, also known as (repository) metadata is also part of
the NOMAD Archive and the datamodel is also defined based on the NOMAD Metainfo
(section *metadata*). It covers all information that users can search for and that can
be easily rendered on the GUI. The information is readily available through the
**repo** API.

.. image:: assets/data.png

See also the `datamodel section in the introduction <introduction.html#data-model>`_.

34
This module contains classes that allow to represent the core
35
nomad data entities (entries/calculations, users, datasets) on a high level of abstraction
36
independent from their representation in the different modules
37
:py:mod:`nomad.processing`, :py:mod:`nomad.parsing`, :py:mod:`nomad.search`, :py:mod:`nomad.app`.
38

39
40
41
42
43
44
Datamodel entities
------------------

The entities in the datamodel are defined as NOMAD Metainfo sections. They are treated
similarily to all Archive data. The entry/calculation datamodel data is created during
processing. It is not about representing every detail, but those parts that are directly involved in
45
api, processing, mirroring, or other 'infrastructure' operations.
46
47
48
49
50

The class :class:`User` is used to represent users and their attributes.

.. autoclass:: nomad.datamodel.User
    :members:
51
52
53
54
55

The class :class:`Dataset` is used to represent datasets and their attributes.

.. autoclass:: nomad.datamodel.Dataset
    :members:
56

57
The class :class:`MongoMetadata` is used to tag metadata stored in mongodb.
58

59
.. autoclass:: nomad.datamodel.MongoMetadata
60
61
62
    :members:

The class :class:`EntryMetadata` is used to represent all metadata about an entry.
63

64
65
.. autoclass:: nomad.datamodel.EntryMetadata
    :members:
66

67
68
69
70
71
72
Domains
------------------

The datamodel supports different *domains*. This means that most domain metadata of an
entry/calculation is stored in domain-specific sub sections of the :class:`EntryMetadata`
section. We currently have the following domain specific metadata classes/sections:
73
74
75
76

.. autoclass:: nomad.datamodel.dft.DFTMetadata
    :members:

77
.. autoclass:: nomad.datamodel.ems.EMSMetadata
78
79
80
81
    :members:

.. autoclass:: nomad.datamodel.OptimadeEntry
    :members:
82
83
84

.. automodule:: nomad.datamodel.encyclopedia
    :members:
85
'''
86
87
88
import sys

from nomad.metainfo import Environment
89
90
91

from .dft import DFTMetadata
from .ems import EMSMetadata
92
93
from .qcms import QCMSMetadata
from .datamodel import (
94
    Dataset, User, Author, EditableUserMetadata, UserProvidableMetadata, OasisMetadata,
Markus Scheidgen's avatar
Markus Scheidgen committed
95
    MongoMetadata, EntryMetadata, EntryArchive, user_reference, author_reference)
96
from .optimade import OptimadeEntry, Species
97
98
99
100
101
from .metainfo import m_env

m_env.m_add_sub_section(Environment.packages, sys.modules['nomad.datamodel.datamodel'].m_package)  # type: ignore
m_env.m_add_sub_section(Environment.packages, sys.modules['nomad.datamodel.dft'].m_package)  # type: ignore
m_env.m_add_sub_section(Environment.packages, sys.modules['nomad.datamodel.ems'].m_package)  # type: ignore
102
m_env.m_add_sub_section(Environment.packages, sys.modules['nomad.datamodel.qcms'].m_package)  # type: ignore
103
104
m_env.m_add_sub_section(Environment.packages, sys.modules['nomad.datamodel.encyclopedia'].m_package)  # type: ignore
m_env.m_add_sub_section(Environment.packages, sys.modules['nomad.datamodel.optimade'].m_package)  # type: ignore
105
106
107
108

domains = {
    'dft': {
        'metadata': DFTMetadata,
109
        'metainfo_all_package': 'common',
110
111
112
113
        'root_section': 'section_run'
    },
    'ems': {
        'metadata': EMSMetadata,
114
        'metainfo_all_package': 'common_experimental',
115
        'root_section': 'section_experiment'
116
117
118
119
120
    },
    'qcms': {
        'metadata': QCMSMetadata,
        'metainfo_all_package': 'general_qcms',
        'root_section': 'section_quantum_cms'
121
122
123
    }
}

124
root_sections = [domain['root_section'] for domain in domains.values()] + ['section_entry_info', 'OptimadeEntry', 'Workflow']