diff --git a/README.md b/README.md index fe4eb3c..f809044 100644 --- a/README.md +++ b/README.md @@ -178,6 +178,20 @@ The rendered figures are exposed via `view.figures` so a host app can add its own annotations; `view.export_series()` returns the plotted series as tidy records. +Export covers every checked channel, numeric and text-log alike, while the plot +HTML is numeric-only. Column names must stay unique: composite sub-fields share +their parent channel label, and a duplicate name makes `df[label]` return a +DataFrame instead of a Series, which breaks the per-column `dequantify()`. +Composite series are therefore labelled `/`, with a dedupe +safety net in `_series_to_dataframe`. + +HTML export builds a fresh set of figures rather than reusing the live ones: +`bokeh.embed.file_html` raises `RuntimeError: Models must be owned by only a +single document` for a figure already rendered in a `pn.pane.Bokeh`, and +`copy.deepcopy` on a figure fails too. Both views therefore split figure +construction into a pure `_make_figures()`, used for the live panes and reused +by `_export_figures()`. + ### Configuration and URL sync The config is the complete, JSON-serializable state of a view, composed to @@ -203,6 +217,55 @@ aggregate model. *Two views composed under one aggregate config, URL-synced in PLAIN_KEYS mode (readable `?app.reactor...` params in the address bar).* +### Implementation notes + +Behaviour of the Panel/Bokeh stack that the view code depends on. Read this +before touching figure building, zoom/reset or layout CSS in +`src/opensemantic/base/view/`. + +**Linked x-axes need one shared range at creation.** Create a single +`DataRange1d` and pass it to every figure while building it: + +```python +shared_x = DataRange1d() +fig = bk_figure(x_range=shared_x, ...) # every figure +``` + +Reassigning `f.x_range` afterwards races the render and leaves some plots +unlinked, so panning moves only part of them. The y-ranges stay per figure, one +scale per characteristic. + +**Reset events do not reach the server.** `figure.on_event(Reset, cb)` never +fires under `pn.pane.Bokeh`: Bokeh *events* are not forwarded, while model +*property* changes sync reliably. Bridge it through a property: + +```python +self._reset_bridge = ColumnDataSource(data={"n": [0]}) +self._reset_bridge.on_change("data", self._on_reset_bridge) +fig.js_on_event(Reset, CustomJS(args={"bridge": self._reset_bridge}, + code="bridge.data = {n: [(bridge.data.n[0] || 0) + 1]};")) +``` + +`m.reset.emit()` does fire `js_on_event`, but client-side only, so it is useful +in tests and not a substitute for the bridge. + +**Shadow-DOM CSS.** Page-level `pn.config.raw_css` does not reliably reach +elements inside a component's shadow root. For a Panel `AnyWidgetComponent` such +as Wunderbaum, pass `stylesheets=[css]`, which injects into the component's own +shadow root. That is how the tree grid's hardcoded inline `width: 800px` is +overridden. + +**Content scrolling is owned by panelini.** `.content` lacked the `overflow-y: +auto` that `.sidebar` has, so tall stacked plots spilled past the wallpaper; +fixed upstream in +[panelini#37](https://github.com/OpenSemanticWorld/panelini/pull/37). With that +in place, leave `_plot_col` uncapped, otherwise a `max_height` plus `scroll=True` +adds a second, nested scrollbar. + +**Stale Bokeh models.** After a pane rebuild, old figures and ranges linger in +`doc._all_models`. When inspecting through JS, filter to the live ones or you +will read a phantom range. + ## Server-side downsampling Large time series are downsampled on the server so the plot only transports the @@ -413,3 +476,21 @@ PostgREST integration tests require a running [pgstack](https://github.com/opens 1. Start pgstack: `docker compose -f docker-compose.yml -f docker-compose.example-tsdb.override.yml up -d` 2. Copy `tests/.env.example` to `tests/.env` and fill in `TEST_PGRST_URL` and `TEST_PGRST_JWT_SECRET` 3. Run tests - PostgREST tests are skipped unless both env vars are set + +### Browser tests + +`tests/test_export_browser.py` drives `panel serve` with Playwright. Four things +it has to get right: + +- `examples/datatool_dashboard.py` pins its SQLite database next to the script, + so the test serves a **copy in a temp directory** rather than contending with + a running demo on the shared file. +- Bokeh 3 renders widgets in a shadow root, so find buttons with + `get_by_role("button", name=...)`, which pierces it, not a light-DOM + `querySelectorAll`. +- Readiness is a raw TCP connect, not an HTTP GET: a corporate proxy may divert + localhost GETs. +- Port cleanup parses `netstat` by column, not by the state word, which is + localized (German Windows prints `ABHOEREN`, not `LISTENING`). +- `FileDownload` generates its payload lazily on click, so wrap the click in + `expect_download`. diff --git a/examples/dataset_from_remote_csv.py b/examples/dataset_from_remote_csv.py new file mode 100644 index 0000000..d76049a --- /dev/null +++ b/examples/dataset_from_remote_csv.py @@ -0,0 +1,97 @@ +"""Wrap a CSV that lives on the web in a Dataset. + +A ``Dataset`` carries its rows either inline in ``data`` or by reference, +through a ``Distribution`` that names the file holding them. This builds the +second form over a CSV nobody here controls, then reads the rows back into the +typed model with one call. + +``AddressRow`` gives the columns their types. That is what makes the dataset +more than a file: ``materialize_data()`` knows what each column means, so the +rows come back as models rather than strings in a frame. + +Run from the package root:: + + python examples/dataset_from_remote_csv.py +""" + +from pathlib import Path +from typing import List, Optional + +from pydantic import BaseModel + +from opensemantic.base import Dataset, Distribution +from opensemantic.core import Label, LocalFile, RemoteFile + +CSV_URL = ( + "https://raw.githubusercontent.com/w3c/csvw/refs/heads/gh-pages/" + "examples/dm-example-1/addresses.csv" +) + + +class AddressRow(BaseModel): + """One line of the CSV. Field names match the column headers.""" + + ID: Optional[int] = None + city: Optional[str] = None + state: Optional[str] = None + + +class AddressDataset(Dataset): + """A dataset whose rows are addresses. + + ``Dataset`` is the controller that implements the model, so this subclass + carries the conversions - ``to_df``, ``materialize_data`` - without naming + them. + """ + + data: Optional[List[AddressRow]] = None + + +def main() -> None: + # 1. The dataset refers to the file instead of holding its content. The + # file entity is a RemoteFile, so reading it needs no local copy. + dataset = AddressDataset( + label=[Label(text="W3C CSVW example addresses")], + distributions=[ + Distribution( + file=RemoteFile( + label=[Label(text="addresses.csv")], download_url=CSV_URL + ), + media_type="text/csv", + ) + ], + ) + print(f"{len(dataset.distributions)} distribution, data: {dataset.data}") + + # 2. Read the file and build the typed rows from it. + rows = dataset.materialize_data() + for row in rows: + print( + f" {type(row).__name__}(ID={row.ID!r}, city={row.city!r}, " + f"state={row.state!r})" + ) + + # 3. The rows are now inline, and the frame form carries the same columns. + print(f"\n{dataset.to_df()}") + + # 4. Back to CSV. The second row names each column's unit and is empty + # where a column has none, so a table of plain values writes and reads + # like any other CSV. + print(f"\n{dataset.serialize_data('csv').decode('utf-8')}") + + # 5. The whole loop: write the rows to a local file, let a Distribution + # describe it, drop the inline copy, and read them back. + target = Path(__file__).parent / "addresses.roundtrip.csv" + dataset.externalize_data( + LocalFile(label=[Label(text=target.name)], local_path=str(target)), + fmt="csv", + ) + print(f"data after externalize: {dataset.data}") + + restored = dataset.materialize_data(dataset.distributions[-1]) + print(f"read back from {target.name}: {restored}") + target.unlink() + + +if __name__ == "__main__": + main() diff --git a/setup.cfg b/setup.cfg index 7ad953b..afa8745 100644 --- a/setup.cfg +++ b/setup.cfg @@ -49,7 +49,10 @@ python_requires = >=3.10 # For more information, check out https://semver.org/. install_requires = opensemantic>=0.2.4 - opensemantic.core>=0.53.2 + # TEMPORARY: the file controllers the dataset controller needs are merged + # but not released. Replace with opensemantic.core>=0.59.0 once a version + # tag is cut. + opensemantic.core @ git+https://github.com/OpenSemanticWorld-Packages/opensemantic.core-python@main pydantic[email] [options.packages.find] diff --git a/src/opensemantic/base/__init__.py b/src/opensemantic/base/__init__.py index 0479d73..60f0b60 100644 --- a/src/opensemantic/base/__init__.py +++ b/src/opensemantic/base/__init__.py @@ -12,6 +12,26 @@ from opensemantic.base._model import * # noqa try: + from opensemantic.base import _controller # noqa: F401 from opensemantic.base._controller import * # noqa -except ImportError: +except ImportError as _error: # pragma: no cover - an optional dependency is missing + # Without this the controllers are simply absent and every lookup returns + # the pure model, which reads as "no controller registered" rather than as + # a broken install. + import logging as _logging + + # info, not warning: the controllers are an optional extra, so a + # model-only install is a supported configuration - but a missing + # dependency must still be nameable, instead of the controllers simply + # not being there + _logging.getLogger(__name__).info( + "opensemantic.base controllers are unavailable: %s", _error + ) + +# Assignments, not imports: isort sorts an import above the star import, which +# would put the pure models back. These names resolve to the controllers that +# implement them. +try: + Dataset = _controller.DatasetController +except NameError: # pragma: no cover - controllers unavailable, see above pass diff --git a/src/opensemantic/base/_controller.py b/src/opensemantic/base/_controller.py index 44b6855..c6ae1f5 100644 --- a/src/opensemantic/base/_controller.py +++ b/src/opensemantic/base/_controller.py @@ -14,7 +14,11 @@ DownsampleParams, TSDCMixin, ) +from opensemantic.base._dataset_controller_mixin import ( # noqa: F401 (re-export) + DatasetControllerMixin, +) from opensemantic.base._model import Database as _Database +from opensemantic.base._model import Dataset as _Dataset from opensemantic.base._model import DataTool as _DataTool @@ -175,3 +179,19 @@ async def start_offline_sync(self): DeleteToolParams = TSDCMixin.DeleteToolParams WriteToolChannelRawParams = TSDCMixin.WriteToolChannelRawParams ReadToolChannelRawParams = TSDCMixin.ReadToolChannelRawParams + + +class DatasetController(DatasetControllerMixin, _Dataset): + """Dataset controller (v2).""" + + +# A controller stands in for the model it implements, so a Dataset a caller +# builds can convert and materialize itself; it needs nothing beyond what the +# model requires and its __init__ does nothing but construct. +# +# DataToolController and the database controllers keep their own names. The +# first indexes channels, warns about unloaded characteristics and may open an +# archive database on construction, which is not what building a data model +# should do. Of the latter there are three for one Database, and the local one +# needs a db_path, so which applies is the caller's choice, not a default. +Dataset = DatasetController diff --git a/src/opensemantic/base/_controller_mixin.py b/src/opensemantic/base/_controller_mixin.py index 905c416..d6068c2 100644 --- a/src/opensemantic/base/_controller_mixin.py +++ b/src/opensemantic/base/_controller_mixin.py @@ -80,9 +80,13 @@ def __init__(self, *args, **data): # Auto-init archive database from storage_locations _archive_db = getattr(self, "archive_database", None) _needs_init = _archive_db is None or isinstance(_archive_db, dict) - _storage = getattr(self, "storage_locations", None) - if self.auto_archive and _needs_init and _storage: - self.archive_database = self._init_archive_database(_storage[0]) + if self.auto_archive and _needs_init: + # read last: storage_locations is a link field, so reading it + # resolves its IRIs and needs a registered resolver. Constructing + # a tool that does not archive must not require one. + _storage = getattr(self, "storage_locations", None) + if _storage: + self.archive_database = self._init_archive_database(_storage[0]) # __setattr__ for private attrs inherited from BaseController # get_osw_id() and get_iri() are inherited from OswBaseModel diff --git a/src/opensemantic/base/_dataset_controller_mixin.py b/src/opensemantic/base/_dataset_controller_mixin.py new file mode 100644 index 0000000..f32a030 --- /dev/null +++ b/src/opensemantic/base/_dataset_controller_mixin.py @@ -0,0 +1,475 @@ +"""Controller for datasets that carry their rows inline or in a distribution. + +A ``Dataset`` holds its rows in ``data`` and/or points at them through a +``Distribution``. This controller owns the conversions between those forms and +a pandas DataFrame: + +* :meth:`to_df` / :meth:`from_df` - inline rows to and from a pint-pandas frame, + one column per row field, each carrying the field's declared unit. +* :meth:`materialize_data` - fill ``data`` from a distribution's file. +* :meth:`externalize_data` - write ``data`` to a file, describe it as a + distribution and drop the inline copy. + +File access goes through the ``opensemantic.core`` file controllers, so a +distribution backed by a local file, an HTTP URL or a wiki page is read the same +way and this module needs no knowledge of the storage behind it. + +The row values are typed characteristics; their unit handling is used through +duck typing (``to_pint``, ``get_pint_ureg_compatible_str``) so this module does +not depend on the characteristics package. +""" + +import io +import json +import logging +import typing +from collections import abc +from typing import Any, List, Optional + +from opensemantic.base import _pint_csv +from opensemantic.core import get_file_controller + +_logger = logging.getLogger(__name__) + +JSON_MEDIA_TYPE = "application/json" +CSV_MEDIA_TYPE = "text/csv" + + +def _fields_of(model_cls) -> dict: + """Field map of a model, for either pydantic version.""" + return getattr(model_cls, "model_fields", None) or model_cls.__fields__ + + +def _unwrap(annotation): + """Strip Optional/List wrappers down to the contained model class. + + A mapping unwraps to its *value* type, and a union of more than one real + member is left as it is: there is no single class behind it, and taking the + first argument turned ``Optional[Dict[str, X]]`` into ``str``. + """ + while True: + origin = typing.get_origin(annotation) + args = [ + a for a in typing.get_args(annotation) if a is not type(None) + ] # noqa: E721 + if not args: + return annotation + if origin is typing.Annotated: + # what follows the type is metadata, not an alternative to it + annotation = args[0] + continue + if isinstance(origin, type) and issubclass(origin, abc.Mapping): + annotation = args[-1] + continue + if len(args) > 1: + return annotation + annotation = args[0] + + +def _field_type(model_cls, name): + """The model class behind a field, for either pydantic version.""" + field = _fields_of(model_cls)[name] + annotation = getattr(field, "annotation", None) + if annotation is None: + return getattr(field, "type_", None) + return _unwrap(annotation) + + +def _is_model_cls(obj) -> bool: + """Whether ``obj`` is a model class of either pydantic version.""" + return isinstance(obj, type) and ( + hasattr(obj, "model_fields") or hasattr(obj, "__fields__") + ) + + +def row_class_of(dataset_cls): + """The row model behind a dataset's ``data`` field, or ``None``. + + ``data`` is a list of typed rows on a concrete dataset; on the generic + ``Dataset`` it carries no row model, in which case there is nothing to + convert. + """ + fields = _fields_of(dataset_cls) + if "data" not in fields: + return None + row_cls = _field_type(dataset_cls, "data") + return row_cls if _is_model_cls(row_cls) else None + + +def _value_fields(row_cls) -> List[str]: + """Data-column fields of a row model (all but the category marker).""" + return [name for name in _fields_of(row_cls) if name != "type"] + + +def _declared_unit(row_cls, field: str) -> Optional[str]: + """Pint-compatible unit string declared as the field's default, if any. + + A field that is not a model - ``timestamp: Optional[datetime]``, a plain + string - carries no unit, which is what makes the unit-less column path + reachable. + """ + value_cls = _field_type(row_cls, field) + if not _is_model_cls(value_cls): + return None + unit_field = _fields_of(value_cls).get("unit") + default = getattr(unit_field, "default", None) if unit_field else None + name = getattr(default, "name", None) + if name is None: + return None + to_pint_str = getattr(value_cls, "get_pint_ureg_compatible_str", None) + return to_pint_str(name) if callable(to_pint_str) else name + + +def _column_unit(row_cls, field: str, values: List[Any]) -> Optional[str]: + """Unit for a column: the declared default, else the first value's own.""" + declared = _declared_unit(row_cls, field) + if declared: + return declared + for value in values: + if value is not None and hasattr(value, "to_pint"): + return str(value.to_pint().units) + return None + + +def _remote_file_cls(dataset): + """``RemoteFile`` of the dataset's own pydantic layer. + + The v1 and v2 models are not interchangeable: handing v1 labels to the v2 + class fails validation, so the layer the dataset belongs to decides. + """ + from pydantic.v1 import BaseModel as BaseModelV1 + + if isinstance(dataset, BaseModelV1): + from opensemantic.core.v1 import RemoteFile + else: + from opensemantic.core import RemoteFile + return RemoteFile + + +def _is_missing(value) -> bool: + """Whether a frame cell carries no value. + + ``pd.isna`` answers element-wise for a sequence, and the array it returns + cannot be used as a condition; a cell holding a list is a value, not a gap. + """ + import pandas as pd + + if value is None: + return True + if isinstance(value, (str, bytes)) or isinstance(value, abc.Sequence): + return False + result = pd.isna(value) + return bool(result) if isinstance(result, bool) else False + + +def _row_value(dataset_cls, field: str, value_cls, magnitude, declared, unit): + """One cell of a frame as the value a row field takes. + + With a declared unit the column was converted to it, so the magnitude alone + is unambiguous. Without one the column's own unit has to travel with the + value, or the dataset reads back in the model's default unit instead. + + A field that is not a model - a timestamp, a label, a flag - takes the cell + as it stands; there is nothing to build and no unit to carry. + """ + if not _is_model_cls(value_cls): + return magnitude + if isinstance(magnitude, value_cls): + return magnitude + try: + number = float(magnitude) + except (TypeError, ValueError) as error: + raise TypeError( + f"{dataset_cls.__name__}.{field}: cannot build a row value from " + f"{magnitude!r} - the column holds neither a number nor a typed value" + ) from error + if declared is not None or unit is None: + return {"value": number} + from_pint = getattr(value_cls, "from_pint", None) + if not callable(from_pint): + raise TypeError( + f"{dataset_cls.__name__}.{field}: the column carries {unit}, but " + f"{getattr(value_cls, '__name__', value_cls)} declares no unit and " + "cannot be built from a pint quantity" + ) + import pint + + return from_pint( + pint.get_application_registry().Quantity(number, unit), + quantity_type=value_cls, + ) + + +class _NamedBytesIO(io.BytesIO): + """A buffer that carries a file name. + + A controller may derive metadata from the stream it is handed - the wiki one + takes the uploaded page's title from ``file.name`` - and a plain BytesIO has + none. + """ + + def __init__(self, data: bytes, name: str): + super().__init__(data) + self.name = name + + +def _distribution_name(distribution) -> str: + """Something short that identifies a distribution in a log line. + + The model's repr carries the whole file controller, which drowns the + message it is part of. + """ + for attribute in ("download_url", "access_url"): + value = getattr(distribution, attribute, None) + if isinstance(value, str) and value: + return value + media_type = getattr(distribution, "media_type", None) + return f"<{type(distribution).__name__} {media_type or 'unknown type'}>" + + +def _file_url(controller) -> Optional[str]: + """The URL a file controller publishes, if it has one. + + A remote file carries its own address; a local one does not, and reading its + ``url`` may need a live connection. A connection failure is reported and + then treated as "no URL", so the distribution still describes the file. + """ + for attribute in ("download_url", "url", "access_url"): + try: + value = getattr(controller, attribute, None) + except Exception as error: # noqa: BLE001 - a property may do anything + # This runs after the upload, so letting the failure out would + # leave the file written with no distribution attached, and a + # retry would upload it twice. Reporting it keeps a real failure + # distinguishable from "this file has no address". + _logger.warning( + "%s.%s is not readable: %s", + type(controller).__name__, + attribute, + error, + ) + continue + if isinstance(value, str) and value: + return value + return None + + +class DatasetControllerMixin: + """Conversions between a dataset's inline rows, a DataFrame and files.""" + + # -- DataFrame -------------------------------------------------------- + + def to_df(self): + """The dataset's rows as a pint-pandas DataFrame. + + One column per row field, converted to that field's declared unit; + missing optional values become NA. + """ + import pandas as pd + + row_cls = row_class_of(type(self)) + rows = self.data or [] + if row_cls is None: + raise TypeError( + f"{type(self).__name__}.data carries no row model to convert" + ) + + columns = {} + for field in _value_fields(row_cls): + values = [getattr(row, field, None) for row in rows] + unit = _column_unit(row_cls, field, values) + if unit is None: + columns[field] = pd.Series(values, name=field, dtype="object") + continue + magnitudes = [ + value.to_pint().to(unit).magnitude if value is not None else None + for value in values + ] + columns[field] = pd.Series(magnitudes, dtype=f"pint[{unit}]", name=field) + return pd.DataFrame(columns) + + @classmethod + def from_df(cls, df, **kwargs): + """Build a dataset from a pint-pandas frame. + + Columns matching a row field are stored in that field's declared unit. + A field without a declared unit keeps the column's own unit, so a + ``to_df`` / ``from_df`` round trip does not reinterpret magnitudes. + Unknown columns are ignored; remaining ``kwargs`` are passed to the + dataset (``label`` is required by the model). + """ + row_cls = row_class_of(cls) + if row_cls is None: + raise TypeError(f"{cls.__name__}.data carries no row model to build") + + known = set(_value_fields(row_cls)) + columns = [name for name in df.columns if name in known] + + prepared = {} + for field in columns: + series = df[field] + declared = _declared_unit(row_cls, field) + is_pint = hasattr(series, "pint") + if declared is not None and is_pint: + series = series.pint.to(declared) + unit = str(series.pint.units) if is_pint else None + prepared[field] = ( + series.pint.magnitude if is_pint else series, + _field_type(row_cls, field), + declared, + unit, + ) + + rows = [] + for i in range(len(df)): + values = {} + for field in columns: + magnitudes, value_cls, declared, unit = prepared[field] + magnitude = magnitudes.iloc[i] + if _is_missing(magnitude): + continue + values[field] = _row_value( + cls, field, value_cls, magnitude, declared, unit + ) + rows.append(row_cls(**values)) + return cls(data=rows, **kwargs) + + # -- Distributions ---------------------------------------------------- + + def _distribution_controller(self, distribution, **controller_kwargs): + """File controller for a distribution's file, or ``None``. + + ``controller_kwargs`` reach the controller, which is how a caller hands + it what it needs to read the file - a wiki session, for instance. A + controller that does not declare them ignores them. + """ + file = getattr(distribution, "file", None) + if file is not None: + return get_file_controller(file, **controller_kwargs) + url = getattr(distribution, "download_url", None) or getattr( + distribution, "access_url", None + ) + if not url: + return None + remote_cls = _remote_file_cls(self) + return get_file_controller( + remote_cls(label=self.label, download_url=url), **controller_kwargs + ) + + def materialize_data(self, distribution=None, **controller_kwargs): + """Fill ``data`` from a distribution's file and return the rows. + + Without an explicit distribution the first one that yields rows is + used: a distribution whose file cannot be read or parsed is reported + and the next one is tried. The file is parsed by its ``media_type`` + (JSON or CSV). + + ``controller_kwargs`` are handed to the file controller, which is how + a caller passes the session or credentials the file needs. + """ + distributions = ( + [distribution] + if distribution is not None + else list(getattr(self, "distributions", None) or []) + ) + row_cls = row_class_of(type(self)) + if row_cls is None: + raise TypeError(f"{type(self).__name__}.data carries no row model to fill") + last_error: Optional[Exception] = None + for dist in distributions: + try: + # resolving the controller can fail too - an unreachable file + # entity, a reference that no longer resolves - and that is a + # reason to try the next distribution, not to give up + controller = self._distribution_controller(dist, **controller_kwargs) + if controller is None: + continue + with controller.get() as handle: + payload = handle.read() + if isinstance(payload, str): + payload = payload.encode("utf-8") + + media_type = getattr(dist, "media_type", None) or JSON_MEDIA_TYPE + if media_type == CSV_MEDIA_TYPE: + self.data = ( + type(self) + .from_df(_pint_csv.read_csv(payload), label=self.label) + .data + ) + else: + entries = json.loads(payload.decode("utf-8")) + if isinstance(entries, dict): + entries = entries.get("data", []) + self.data = [ + entry if isinstance(entry, row_cls) else row_cls(**entry) + for entry in entries + ] + except Exception as error: # noqa: BLE001 - the next one may work + last_error = error + _logger.warning( + "%s: distribution %s could not be read: %s", + type(self).__name__, + _distribution_name(dist), + error, + ) + continue + return self.data + # chained: without the cause, a column that cannot be parsed reads as + # "there is no file", and the error naming the field is lost + raise ValueError( + f"{type(self).__name__} has no distribution with a readable file" + ) from last_error + + def externalize_data(self, file, fmt: str = "json", keep_data: bool = False): + """Write ``data`` to ``file``, attach a distribution and clear ``data``. + + ``file`` is a file entity or file controller that accepts the bytes; the + distribution records its media type and size, and the file's URL when it + has one, so the rows stay reachable once the dataset is reloaded and the + file is only a reference. Set ``keep_data`` to leave the inline rows in + place. + """ + payload = self.serialize_data(fmt) + controller = get_file_controller(file) + if controller is None: + raise ValueError(f"No file controller for {type(file).__name__}") + name = getattr(controller, "name", None) or f"data.{fmt}" + if not str(name).endswith(f".{fmt}"): + name = f"{name}.{fmt}" + controller.put(_NamedBytesIO(payload, str(name))) + + distribution_cls = _field_type(type(self), "distributions") + distribution = distribution_cls( + file=controller, + media_type=CSV_MEDIA_TYPE if fmt == "csv" else JSON_MEDIA_TYPE, + byte_size=len(payload), + download_url=_file_url(controller), + ) + self.distributions = list(self.distributions or []) + [distribution] + if not keep_data: + self.data = None + return distribution + + def serialize_data(self, fmt: str = "json") -> bytes: + """The inline rows as JSON or CSV bytes. + + JSON keeps the typed values, so it round-trips without loss. CSV carries + a two-row ``(field, unit)`` header written by pint-pandas. + """ + if fmt == "csv": + return _pint_csv.to_csv(self.to_df()) + if fmt != "json": + raise ValueError(f"Unsupported format: {fmt}") + rows = self.data or [] + # v2 models carry both .model_dump() and a deprecated .dict(), so the + # v2 form is tested first; its json mode is what keeps bytes, Decimal + # and datetime lossless rather than leaving them to json's default=str + dump = [ + ( + row.model_dump(exclude_none=True, mode="json") + if hasattr(row, "model_dump") + else row.dict(exclude_none=True) + ) + for row in rows + ] + return json.dumps(dump, default=str).encode("utf-8") diff --git a/src/opensemantic/base/_model.py b/src/opensemantic/base/_model.py index 3c049c7..054cbdf 100644 --- a/src/opensemantic/base/_model.py +++ b/src/opensemantic/base/_model.py @@ -14,6 +14,7 @@ Description, Entity, Enumeration, + File, IntangibleItem, Item, Label, @@ -1006,167 +1007,44 @@ class Recipe(HowTo): # filename: OSWfe72974590fd4e8ba94cd4e8366375e8.json -class Distribution(OswBaseModel): - model_config = ConfigDict( - json_schema_extra={"title": "Distribution"}, - ) - download_url: str = Field(..., title="Download URL") - - -class DatasetSchema(Item): - model_config = ConfigDict( - json_schema_extra={ - "@context": [{"schema_definition": "Property:HasSchemaDefinition"}], - "title": "DatasetSchema", - "defaultProperties": ["schema_definition", "label", "uuid"], - }, - ) - schema_definition: str | None = Field(None, title="Dataset schema") - """ - Defintion of a JSON based Schema for a dataset. - """ - type: list[str] | None = ["Category:OSW0d6584b3e2b64e9595733c4c3963c486"] - - -class Dataset(Data): - model_config = ConfigDict( - json_schema_extra={ - "@context": [ - "/wiki/Category:OSW2ac4493f8635481eaf1db961b63c8325?action=raw&slot=jsonschema", - { - "url": "dcat:landingPage", - "url*": "Property:HasUrl", - "themes": {"@type": "@id", "@id": "dcat:theme"}, - "themes*": {"@type": "@id", "@id": "Property:IsRelatedTo"}, - "distributions": {"@type": "@id", "@id": "dcat:distribution"}, - "distributions*": { - "@type": "@id", - "@id": "Property:HasDistribution", - }, - "download_url": "dcat:downloadURL", - "download_url*": "Property:HasUrl", - "data_format": "Property:HasDataFormat", - "dataset_schema": "Property:HasDatasetSchema", - }, - ], - "title": "Dataset", - "defaultProperties": ["url", "themes"], - "uuid": "fe729745-90fd-4e8b-a94c-d4e8366375e8", - "title*": {"en": "Dataset"}, - "description": "", - "description*": {}, - }, - ) - type: list[str] | None = ["Category:OSWfe72974590fd4e8ba94cd4e8366375e8"] - url: list[str] | None = Field(None, title="URL / Websites") - """ - Landing page(s) that documents the dataset - """ - themes: list[Entity] | None = Field( - None, json_schema_extra={"range": "Category:Entity"}, title="Themes / Topics" +class Status(str, Enum): + Item_OSWaa8d29404288446a9f3ec7afa4e2a512 = ( + "Item:OSWaa8d29404288446a9f3ec7afa4e2a512" ) """ - Terms to categorizes this dataset + To do """ - distributions: list[Distribution] | None = Field( - None, title="Distributions / Downloads" + Item_OSWa2b4567ad4874ea1b9adfed19a3d06d1 = ( + "Item:OSWa2b4567ad4874ea1b9adfed19a3d06d1" ) """ - Actual download options for this dataset + In work """ - data_format: list[DataFormat] | None = Field( - None, - json_schema_extra={"range": "Category:OSWccac243b31f94574847861e5d9685b82"}, - min_length=1, - title="Data format", + Item_OSWf474ec34b7df451ea8356134241aef8a = ( + "Item:OSWf474ec34b7df451ea8356134241aef8a" ) """ - Gives a structure to define specific formats of data. + Done """ - dataset_schema: list[DatasetSchema] | None = Field( - None, - json_schema_extra={"range": "Category:OSW0d6584b3e2b64e9595733c4c3963c486"}, - min_length=1, - title="Dataset schema", - ) - - -class DataTerm(DefinedTerm): - model_config = ConfigDict( - json_schema_extra={ - "@context": [ - "/wiki/Category:OSWa5812d3b5119416c8da1606cbe7054eb?action=raw&slot=jsonschema" - ], - "title": "DataTerm", - }, - ) - type: list[str] | None = ["Category:OSW34f9d66c7e1241c8b9543231526f126d"] -class DataFormat(DataTerm): +class DisplayName(OswBaseModel): model_config = ConfigDict( - json_schema_extra={ - "defaultProperties": [ - "specification", - "description", - "label", - "short_name", - ], - "title": "DataFormat", - }, + json_schema_extra={"title": "Display name", "title*": {"de": "Anzeigenamen"}}, ) - specification: str | None = Field( + text: Any | None = Field( None, json_schema_extra={ - "title*": {"de": "Spezifikation"}, - "description*": {"de": "Entweder Text oder Link"}, - }, - title="Specification", - ) - """ - Either text or link - """ - type: list[str] | None = ["Category:OSWccac243b31f94574847861e5d9685b82"] - - -# generated by datamodel-codegen: -# filename: OSW0d6584b3e2b64e9595733c4c3963c486.json - - -# generated by datamodel-codegen: -# filename: OSWafcac83979f4472298b6acdc01981728.json - - -class DigitalDocument(CreativeWork): - """ - An electronic file or document. - """ - - model_config = ConfigDict( - json_schema_extra={ - "@context": [ - "/wiki/Category:OSW712583f2479944deb2546b77cf860dda?action=raw&slot=jsonschema" - ], - "uuid": "afcac839-79f4-4722-98b6-acdc01981728", - "title": "DigitalDocument", - "title*": {"en": "Digital document"}, - "description": "An electronic file or document.", - "description*": {"en": "An electronic file or document."}, + "watch": { + "first_name": "root.first_name", + "middle_name": "root.middle_name", + "surname": "root.surname", + }, + "readonly": True, + "dynamic_template": "{{first_name}}{{#each middle_name}} {{.}}{{/each}}{{#if surname}} {{{surname}}}{{/if}}", }, ) - type: list[str] | None = ["Category:OSWafcac83979f4472298b6acdc01981728"] - - -# generated by datamodel-codegen: -# filename: OSW34f9d66c7e1241c8b9543231526f126d.json - - -# generated by datamodel-codegen: -# filename: OSWccac243b31f94574847861e5d9685b82.json - - -# generated by datamodel-codegen: -# filename: OSW3d238d05316e45a4ac95a11d7b24e36b.json + lang: str | None = "en" class GPSCoordinates(OswBaseModel): @@ -1212,384 +1090,369 @@ class GPSCoordinates(OswBaseModel): """ -class PostalAddress(OswBaseModel): +class ProjectTypeDeprecated(str, Enum): + """ + Replaced with Project / Funding Type + """ + + house_project = "house_project" + """ + House project + """ + internal = "internal" + """ + Internal + """ + public = "public" + """ + Public + """ + industry = "industry" + """ + Industry + """ + + +class WeightedSum(OswBaseModel): model_config = ConfigDict( json_schema_extra={ - "@context": { - "address_supplement": { - "@id": "Property:HasAddressSupplement", - "@type": "xsd:string", - }, - "city": {"@id": "Property:HasCity", "@type": "@id"}, - "city*": {"@id": "schema:containedInPlace", "@type": "@id"}, - "city**": {"@id": "Property:IsLocatedIn", "@type": "@id"}, - "country": {"@id": "schema:addressCountry", "@type": "@id"}, - "country*": {"@id": "Property:HasCountry", "@type": "@id"}, - "house_no": {"@id": "Property:HasHouseNo", "@type": "xsd:string"}, - "postal_code": {"@id": "schema:postalCode", "@type": "xsd:string"}, - "postal_code*": { - "@id": "Property:HasPostalCode", - "@type": "xsd:string", - }, - "post_office_box_no": { - "@id": "schema:postOfficeBoxNumer", - "@type": "xsd:string", - }, - "post_office_box_no*": { - "@id": "Property:HasPoBoxNo", - "@type": "xsd:string", - }, - "region": {"@id": "schema:addressRegion", "@type": "@id"}, - "region*": {"@id": "Property:HasRegion", "@type": "@id"}, - "state": {"@id": "schema:addressCountry", "@type": "@id"}, - "state*": {"@id": "Property:HasState", "@type": "@id"}, - "street_name": {"@id": "Property:HasStreet", "@type": "xsd:string"}, - }, - "title": "Postal address", - "title*": {"en": "Postal address", "de": "Postalische Adresse"}, - "description": "", - "eval_template": { - "type": "wikitext", - "mode": "render", - "value": "{{#if: {{{addressee|}}}|{{{addressee|}}}
|}}{{{street_name|}}} {{{house_no|}}}
{{#if: {{{address_supplement|}}}|{{{address_supplement|}}}
|}}{{{postal_code|}}} {{#if: {{{city|}}} |[[{{{city|}}}]]|{{{city_name|}}} }}, {{#if: {{{region|}}}|[[{{{region|}}}]], |}}{{#if: {{{state|}}}|[[{{{state|}}}]], |}}{{#if: {{{country|}}} |[[{{{country|}}}]]|{{{country_name|}}} }}{{#if: {{{post_office_box_no|}}}|
{{#switch:{{USERLANGUAGECODE}}|#default=PO Box No|de=Postfach-Nr.}} {{{post_office_box_no|}}}|}}", + "title": "weighted sum", + "title*": {"de": "Gewichtete Summe"}, + "_description": "weighted with probability of successful funding", + "_description*": {"de": "gewichtet mit Erfolgswahrscheinlichkeit"}, + "options": { + "disable_collapse": True, + "disable_properties": True, + "compact": True, }, - "defaultProperties": [ - "uuid", - "street_name", - "house_no", - "postal_code", - "city", - "city_name", - "country", - "country_name", - "address_supplement", - "state", - "region", - "post_office_box_no", - ], }, ) uuid: UUID = Field( - default_factory=uuid4, json_schema_extra={"options": {"hidden": True}} - ) - country: Country | None = Field( - None, - json_schema_extra={ - "title*": {"en": "Country", "de": "Land"}, - "range": "Category:OSW0551abcd6f734047825e3ded4c8a0ffe", - }, - title="Country", + ..., json_schema_extra={"options": {"hidden": True}}, title="UUID" ) - country_name: str | None = Field( - None, - json_schema_extra={"title*": {"de": "Land (Text)"}}, - title="Country (text)", + quantity: str | None = Field( + "Property:HasWeightedBudget", json_schema_extra={"options": {"hidden": True}} ) - state: State | None = Field( - None, + numerical_value: str = Field( + ..., json_schema_extra={ - "title*": {"en": "State", "de": "Bundesland"}, - "range": "Category:OSWab60f9a227954ee0be92344ff6272420", + "_format": "template", + "options": { + "grid_columns": 12, + "hidden": True, + "dynamic_template": {"override": "always"}, + }, + "watch": { + "probability_of_successful_funding": "probability_of_successful_funding.numerical_value", + "yearly_budget_sum_value": "yearly_budget.yearly_budget_sum.numerical_value", + }, + "dynamic_template": "{{#calc 0.01 '*'}}{{#calc probability_of_successful_funding '*'}}{{yearly_budget_sum_value}}{{/calc}}{{/calc}}", }, - title="State", ) - region: Region | None = Field( - None, + value: str = Field( + ..., json_schema_extra={ - "title*": {"en": "Region", "de": "Region"}, - "range": "Category:OSW95efaf34e2c7439e8e7967233910e44b", + "_format": "template", + "options": {"grid_columns": 12, "hidden": False}, + "_watch": { + "probability_of_successful_funding": "probability_of_successful_funding.numerical_value", + "yearly_budget_sum_value": "yearly_budget.yearly_budget_sum.numerical_value", + "yearly_budget_sum_unit_symbol": "yearly_budget.yearly_budget_sum.unit_symbol", + }, + "watch": { + "numerical_value": "statement.numerical_value", + "unit_symbol": "statement.unit_symbol", + }, + "template": "{{{numerical_value}}} {{{unit_symbol}}}", }, - title="Region", - ) - post_office_box_no: str | None = Field( - None, - json_schema_extra={"title*": {"en": "PO box number", "de": "Postfach nummer"}}, - title="PO box number", - ) - postal_code: str | None = Field( - None, - json_schema_extra={"title*": {"en": "Postal code", "de": "Postleitzahl"}}, - title="Postal code", + title="Wert", ) - city: City | None = Field( - None, + unit: str = Field( + ..., json_schema_extra={ - "title*": {"en": "City", "de": "Stadt"}, - "range": "Category:OSW807f1da5b42e42f296b213ab06ca873b", + "title*": {"de": "Währung"}, + "_format": "template", + "propertyOrder": 1001, + "options": {"grid_columns": 6, "hidden": True}, + "watch": {"yearly_budget_sum_unit": "yearly_budget.yearly_budget_sum.unit"}, + "template": "{{yearly_budget_sum_unit}}", }, - title="City", + title="Currency", ) - city_name: str | None = Field( - None, json_schema_extra={"title*": {"de": "Stadt (Text)"}}, title="City (text)" + unit_symbol: str = Field( + ..., + json_schema_extra={ + "watch": { + "yearly_budget_sum_unit_symbol": "yearly_budget.yearly_budget_sum.unit_symbol" + }, + "template": "{{yearly_budget_sum_unit_symbol}}", + "options": {"grid_columns": 6, "hidden": True}, + }, ) - street_name: str | None = Field( - None, - json_schema_extra={"title*": {"en": "Street", "de": "Straße"}}, - title="Street", + + +class Quantity(OswBaseModel): + model_config = ConfigDict( + json_schema_extra={ + "@context": { + "Property": "https://wiki-dev.open-semantic-lab.org/id/Property-3A", + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "quantity*": "Property:HasProperty", + "quantity": "rdf:predicate", + "value*": "Property:HasObject", + "value": "rdf:object", + "unit": "Property:HasUnit", + }, + "$comment": "A reduced version of JsonSchema:Statement", + "title": "Quantity", + "title*": {"de": "Menge"}, + "_headerTemplate": "{{self.value}}", + }, ) - house_no: str | None = Field( - None, - json_schema_extra={"title*": {"en": "House number", "de": "Hausnummer"}}, - title="House number", + uuid: UUID = Field( + ..., json_schema_extra={"options": {"hidden": True}}, title="UUID" ) - address_supplement: str | None = Field( - None, + quantity: str = Field( + ..., json_schema_extra={ - "title*": {"en": "Address supplement", "de": "Adresszusatz"} + "title*": {"de": "Attribut"}, + "propertyOrder": 10, + "options": { + "grid_columns": 8, + "autocomplete": {"category": "Category:QuantityProperty"}, + }, }, - title="Address supplement", + title="Property", ) - addressee: str | None = Field( - None, + numerical_value: str = Field( + ..., json_schema_extra={ - "title*": {"de": "Adressat"}, - "description*": { - "de": "Titelzeile der Adresse falls abweichend vom Organisationsname" - }, + "title*": {"de": "Wert"}, + "propertyOrder": 20, + "options": {"grid_columns": 2}, }, - title="Addressee", + title="Value", ) - """ - Title line of the address in case different from organization name - """ - - -class Location(Item): - """ - A location. Entities that have a somewhat fixed, physical extension. - """ - - model_config = ConfigDict( + unit: str = Field( + ..., json_schema_extra={ - "@context": [ - { - "gps_coordinates": {"@id": "schema:geo", "@type": "xsd:string"}, - "gps_coordinates*": { - "@id": "Property:HasGpsCoordinates", - "@type": "xsd:string", - }, - "latitude": {"@id": "schema:latitude", "@type": "xsd:float"}, - "located_in": {"@id": "schema:containedInPlace", "@type": "@id"}, - "located_in*": {"@id": "Property:IsLocatedIn", "@type": "@id"}, - "longitude": {"@id": "schema:longitude", "@type": "xsd:float"}, - "longitude*": { - "@id": "Property:HasLongitude", - "@type": "xsd:float", - }, - "postal_address": { - "@id": "Property:HasPostalAddress", - "@type": "@id", - "@context": ["/wiki/JsonSchema:PostalAddress?action=raw"], + "title*": {"de": "Einheit"}, + "propertyOrder": 30, + "watch": { + "quantity": "statement.quantity", + "unit_symbol": "statement.unit_symbol", + }, + "options": { + "grid_columns": 2, + "autocomplete": { + "query": "[[-HasInputUnit::{{$(quantity)}}]][[Display_title_of::like:*{{_user_input}}*]]|?Display_title_of=label", + "render_template": { + "type": ["handlebars"], + "value": "{{result.printouts.label.[0]}}", }, + "field_maps": [ + { + "source_path": "$", + "template": "{{{result.printouts.label.[0]}}}", + "target_path": "$(unit_symbol)", + } + ], }, - "/wiki/Category:Item?action=raw&slot=jsonschema", - ], - "title": "Location", - "uuid": "3d238d05-316e-45a4-ac95-a11d7b24e36b", - "title*": {"en": "Location", "de": "Örtlichkeit"}, - "description": "A location. Entities that have a somewhat fixed, physical extension.", - "description*": { - "de": "Eine Örtlichkeit. Entitaeten, die eine mehr oder weniger feste, physische Ausdehnung haben." }, - "defaultProperties": ["label", "gps_coordinates", "postal_address"], }, + title="Unit", ) - type: list[str] | None = ["Category:OSW3d238d05316e45a4ac95a11d7b24e36b"] - postal_address: PostalAddress | None = None - gps_coordinates: GPSCoordinates | None = Field( - None, + unit_symbol: str = Field(..., json_schema_extra={"options": {"hidden": True}}) + value: str = Field( + ..., json_schema_extra={ - "title*": {"en": "GPS coordinates", "de": "GPS Koordinaten"}, - "eval_template": { - "type": "wikitext", - "value": "{{{latitude|}}}, {{{longitude|}}}", + "title*": {"de": "Wert"}, + "watch": { + "numerical_value": "statement.numerical_value", + "unit_symbol": "statement.unit_symbol", }, - "defaultProperties": ["uuid", "latitude", "longitude"], + "template": "{{{numerical_value}}} {{{unit_symbol}}}", + "options": {"hidden": True}, }, - title="GPS coordinates", + title="Value", ) -class Place(Item): +class ProbabilityOfSuccessfulFundingInPercent(Quantity): """ - Entities that have a somewhat fixed, physical extension. + Indicates the likelihood that the funding will be approved, determines the weighted budget """ model_config = ConfigDict( json_schema_extra={ - "@context": ["/wiki/Category:Item?action=raw&slot=jsonschema"], - "uuid": "28f71f2c-20ad-48c3-8c4e-4d190a95c0b8", - "title": "Place", - "title*": {"en": "Place", "de": "Ort"}, - "description": "Entities that have a somewhat fixed, physical extension.", + "title": "Probability of Successful Funding in percent", + "title*": { + "de": "Wahrscheinlichkeit einer erfolgreichen Förderung in Prozent" + }, + "description": "Indicates the likelihood that the funding will be approved, determines the weighted budget", "description*": { - "en": "Entities that have a somewhat fixed, physical extension.", - "de": "Entitäten, die eine gewisse feste, physische Ausdehnung haben.", + "de": "Gibt die Wahrscheinlichkeit an, dass die Förderung genehmigt wird, bestimmt das gewichtete Budget" }, }, ) - type: list[str] | None = ["Category:OSW28f71f2c20ad48c38c4e4d190a95c0b8"] + quantity: str | None = Field( + "Property:HasProbabilityOfSuccessfulFunding", + json_schema_extra={"options": {"hidden": True}}, + ) + unit: str | None = Field( + "Property:HasDimensionlessRatio#OSW8b3dc9b793074afc8ab8b03041f97f16", + json_schema_extra={"readOnly": True}, + ) -class AdministrativeArea(Place): - """ - A geographical region, typically under the jurisdiction of a particular government. - """ +class TotalBudget(Quantity): + model_config = ConfigDict( + json_schema_extra={"title": "Total Budget", "title*": {"de": "Budgetsumme"}}, + ) + quantity: str | None = Field( + "Property:HasBudget", json_schema_extra={"options": {"hidden": True}} + ) + unit: str | None = Field( + None, json_schema_extra={"title*": {"de": "Währung"}}, title="Currency" + ) + +class YearlyBudgetSum(Quantity): model_config = ConfigDict( json_schema_extra={ - "@context": [ - "/wiki/Category:OSW28f71f2c20ad48c38c4e4d190a95c0b8?action=raw&slot=jsonschema" - ], - "uuid": "137e7443-b2b9-4692-bd59-a0e0a6778b70", - "title": "AdministrativeArea", - "title*": {"en": "Administrative Area", "de": "Verwaltungsbereich"}, - "description": "A geographical region, typically under the jurisdiction of a particular government.", - "description*": { - "en": "A geographical region, typically under the jurisdiction of a particular government.", - "de": "Eine geografische Region, die in der Regel unter die Zuständigkeit einer bestimmten Regierung fällt.", + "title": "Yearly Budget Sum", + "title*": {"de": "Summe Jahresbudget"}, + "options": { + "disable_collapse": True, + "disable_properties": True, + "compact": True, }, }, ) - type: list[str] | None = ["Category:OSW137e7443b2b94692bd59a0e0a6778b70"] - + quantity: str | None = Field( + "Property:HasBudget", json_schema_extra={"options": {"hidden": True}} + ) + numerical_value: str | None = Field( + None, json_schema_extra={"options": {"grid_columns": 6}} + ) + unit: str | None = Field( + None, + json_schema_extra={ + "title*": {"de": "Währung"}, + "propertyOrder": 1001, + "options": {"grid_columns": 6}, + }, + title="Currency", + ) -class Country(AdministrativeArea): - """ - A distinct part of the world, such as a state, nation, or other political entity - """ +class Distribution(OswBaseModel): model_config = ConfigDict( json_schema_extra={ - "@context": [ - "/wiki/Category:OSW137e7443b2b94692bd59a0e0a6778b70?action=raw&slot=jsonschema" - ], - "uuid": "0551abcd-6f73-4047-825e-3ded4c8a0ffe", - "title": "Country", - "title*": {"en": "Country", "de": "Land"}, - "description": "A distinct part of the world, such as a state, nation, or other political entity", - "description*": { - "en": "A distinct part of the world, such as a state, nation, or other political entity", - "de": "Ein bestimmter Teil der Welt, z. B. ein Staat, eine Nation oder eine andere politische Einheit", - }, + "title": "Distribution", + "title*": {"de": "Distribution"}, + "defaultProperties": ["file", "media_type", "conforms_to"], }, ) - type: list[str] | None = ["Category:OSW0551abcd6f734047825e3ded4c8a0ffe"] - - -class State(AdministrativeArea): + file: File | None = Field( + None, + json_schema_extra={ + "title*": {"de": "Datei"}, + "description*": {"de": "Die Dateientität, die die Bytes enthält"}, + "range": "Category:OSWff333fd349af4f65a69100405a9e60c7", + }, + title="File", + ) """ - A state or province of a country. + The file entity holding the bytes """ - - model_config = ConfigDict( + media_type: str | None = Field( + None, json_schema_extra={ - "@context": [ - "/wiki/Category:OSW137e7443b2b94692bd59a0e0a6778b70?action=raw&slot=jsonschema" - ], - "uuid": "ab60f9a2-2795-4ee0-be92-344ff6272420", - "title": "State", - "title*": {"en": "State", "de": "Staat"}, - "description": "A state or province of a country.", + "title*": {"de": "Medientyp"}, "description*": { - "en": "A state or province of a country.", - "de": "Ein Staat oder eine Provinz eines Landes.", + "de": "IANA-Medientyp dieser Repräsentation, z. B. text/csv" }, }, + title="Media type", ) - type: list[str] | None = ["Category:OSWab60f9a227954ee0be92344ff6272420"] - - -class Region(AdministrativeArea): - model_config = ConfigDict( + """ + IANA media type of this representation, e. g. text/csv + """ + byte_size: conint(ge=0) | None = Field( + None, json_schema_extra={"title*": {"de": "Größe in Byte"}}, title="Byte size" + ) + package_format: str | None = Field( + None, json_schema_extra={ - "@context": [ - "/wiki/Category:OSW137e7443b2b94692bd59a0e0a6778b70?action=raw&slot=jsonschema" - ], - "uuid": "95efaf34-e2c7-439e-8e79-67233910e44b", - "title": "Region", - "title*": {"en": "Region", "de": "Region"}, - "description": "", - "description*": {}, + "title*": {"de": "Paketformat"}, + "description*": { + "de": "Container, in dem die Bytes verpackt sind, z. B. zip" + }, }, + title="Package format", ) - type: list[str] | None = ["Category:OSW95efaf34e2c7439e8e7967233910e44b"] - - -class City(AdministrativeArea): """ - A city or town. + Container the bytes are packaged in, e. g. zip """ - - model_config = ConfigDict( + compression_format: str | None = Field( + None, + json_schema_extra={"title*": {"de": "Kompressionsformat"}}, + title="Compression format", + ) + conforms_to: str | None = Field( + None, json_schema_extra={ - "@context": [ - "/wiki/Category:OSW137e7443b2b94692bd59a0e0a6778b70?action=raw&slot=jsonschema" - ], - "uuid": "807f1da5-b42e-42f2-96b2-13ab06ca873b", - "title": "City", - "title*": {"en": "Stadt"}, - "description": "A city or town.", - "description*": { - "en": "A city or town.", - "de": "Eine Stadt oder ein Ort, im Sinne einer Gemeinde", + "title*": {"de": "Entspricht"}, + "description*": {"de": "Das Datensatzschema, das diese Bytes verkörpern"}, + "options": { + "autocomplete": { + "$comment": "Any Category", + "query": "[[:Category:%2B]]", + } }, }, + title="Conforms to", ) - type: list[str] | None = ["Category:OSW807f1da5b42e42f296b213ab06ca873b"] - - -# generated by datamodel-codegen: -# filename: OSW28f71f2c20ad48c38c4e4d190a95c0b8.json - - -# generated by datamodel-codegen: -# filename: OSW473d7a1ed48544d1be83b258b5810948.json - - -class Site(Location): """ - A site is a location or place where a particular event, activity, or object exists or is situated. + The dataset schema these bytes embody """ - - model_config = ConfigDict( + table_schema: str | None = Field( + None, json_schema_extra={ - "@context": [ - "/wiki/Category:OSW3d238d05316e45a4ac95a11d7b24e36b?action=raw&slot=jsonschema" - ], - "title": "Site", - "title*": {"en": "Site", "de": "Standort"}, - "uuid": "473d7a1e-d485-44d1-be83-b258b5810948", - "description": "A site is a location or place where a particular event, activity, or object exists or is situated.", + "title*": {"de": "Tabellenschema"}, "description*": { - "de": "Ein Standort ist ein Ort oder ein Platz, an dem ein bestimmtes Ereignis, eine Aktivität oder ein Objekt existiert oder sich befindet." + "de": "Das Zeilenschema, wenn die Serialisierung tabellarisch ist" + }, + "options": { + "autocomplete": { + "$comment": "Any Category", + "query": "[[:Category:%2B]]", + } }, }, + title="Table schema", ) - type: list[str] | None = ["Category:OSW473d7a1ed48544d1be83b258b5810948"] - - -# generated by datamodel-codegen: -# filename: OSW4bcd4a99a73f482ea40ac4210dfab836.json - - -class DisplayName(OswBaseModel): - model_config = ConfigDict( - json_schema_extra={"title": "Display name", "title*": {"de": "Anzeigenamen"}}, - ) - text: Any | None = Field( + """ + The row schema, where the serialization is tabular + """ + download_url: str | None = Field( None, json_schema_extra={ - "watch": { - "first_name": "root.first_name", - "middle_name": "root.middle_name", - "surname": "root.surname", + "title*": {"de": "Download-URL"}, + "description*": { + "de": "Direkte URL, wenn keine Dateientität verwendet wird" }, - "readonly": True, - "dynamic_template": "{{first_name}}{{#each middle_name}} {{.}}{{/each}}{{#if surname}} {{{surname}}}{{/if}}", }, + title="Download URL", + ) + """ + Direct URL, where no file entity is used + """ + access_url: str | None = Field( + None, json_schema_extra={"title*": {"de": "Zugriffs-URL"}}, title="Access URL" ) - lang: str | None = "en" class TaxIdAndCountry(OswBaseModel): @@ -1632,253 +1495,923 @@ class VatIdAndCountry(OswBaseModel): ) -class BuildingFunction(Item): - model_config = ConfigDict( - json_schema_extra={"title": "BuildingFunction"}, - ) - type: list[str] | None = ["Category:OSW07a0faef5be94b788514a2dd5dca20bf"] - - -class Person(Item): - """ - Category for a person in general. Subcategories are e.g. 'User', i.e. persons who have a user ID. - """ - +class PostalAddress(OswBaseModel): model_config = ConfigDict( json_schema_extra={ - "@context": [ - { - "competence": {"@id": "schema:knowsAbout", "@type": "@id"}, - "competence*": {"@id": "Property:HasCompetence", "@type": "@id"}, - "email": {"@id": "schema:email", "@type": "xsd:string"}, - "email*": {"@id": "Property:HasEmail", "@type": "xsd:string"}, - "fax_number": {"@id": "schema:faxNumber", "@type": "xsd:string"}, - "fax_number*": { - "@id": "Property:HasFaxNumber", - "@type": "xsd:string", - }, - "first_name": {"@id": "schema:givenName", "@type": "xsd:string"}, - "first_name*": { - "@id": "Property:HasFirstName", - "@type": "xsd:string", - }, - "located_in": {"@id": "schema:workLocation", "@type": "@id"}, - "located_in*": {"@id": "Property:IsLocatedIn", "@type": "@id"}, - "middle_name": { - "@id": "schema:additionalName", - "@type": "xsd:string", - }, - "middle_name*": { - "@id": "Property:HasMiddleName", - "@type": "xsd:string", - }, - "orcid": {"@id": "schema:identifier", "@type": "xsd:string"}, - "orcid*": {"@id": "Property:HasOrcidId", "@type": "xsd:string"}, - "organization": {"@id": "schema:worksFor", "@type": "@id"}, - "organization*": { - "@id": "Property:HasOrganization", - "@type": "@id", - }, - "organization**": {"@id": "Property:HasOu", "@type": "@id"}, - "organizational_unit": {"@id": "schema:memberOf", "@type": "@id"}, - "organizational_unit*": {"@id": "Property:HasOu", "@type": "@id"}, - "phone_number": {"@id": "schema:telephone", "@type": "xsd:string"}, - "phone_number*": { - "@id": "Property:HasPhoneNumber", - "@type": "xsd:string", - }, - "role": {"@id": "schema:jobTitle", "@type": "@id"}, - "role*": {"@id": "Property:HasRole", "@type": "@id"}, - "surname": {"@id": "schema:familyName", "@type": "xsd:string"}, - "surname*": {"@id": "Property:HasSurname", "@type": "xsd:string"}, - "topic": {"@id": "schema:knowsAbout", "@type": "@id"}, - "topic*": {"@id": "Property:HasTopic", "@type": "@id"}, - "website": {"@id": "schema:subjectOf", "@type": "xsd:string"}, - "website*": {"@id": "Property:HasWebsite", "@type": "xsd:string"}, + "@context": { + "address_supplement": { + "@id": "Property:HasAddressSupplement", + "@type": "xsd:string", }, - "/wiki/Category:Item?action=raw&slot=jsonschema", - ], - "title": "Person", - "title*": {"de": "Person", "en": "Person"}, - "uuid": "44deaa5b-806d-41a2-a885-94f562b110e9", - "description": "Category for a person in general. Subcategories are e.g. 'User', i.e. persons who have a user ID.", - "description*": { - "en": "Category for a person in general. Subcategories are e.g. 'User', i.e. persons who have a user ID.", - "de": "Kategorie für eine Person im Allgemeinen. Unterkategorien sind bsp. 'User', also Personen die über eine Nutzerkennung verfügen.", - }, - "data_source_maps": [ - { - "id": "pub.orcid.org", - "source": "https://pub.orcid.org/v3.0/{{#split '/' -1}}{{orcid}}{{/split}}", - "format": "jsonld", - "label": "ORCID", - "required": ["orcid"], - "object_map": { - "first_name": "$.givenName", - "surname": "$.familyName", - }, - } - ], - "defaultProperties": [ - "first_name", - "surname", - "organization", - "email", - "phone_number", + "city": {"@id": "Property:HasCity", "@type": "@id"}, + "city*": {"@id": "schema:containedInPlace", "@type": "@id"}, + "city**": {"@id": "Property:IsLocatedIn", "@type": "@id"}, + "country": {"@id": "schema:addressCountry", "@type": "@id"}, + "country*": {"@id": "Property:HasCountry", "@type": "@id"}, + "house_no": {"@id": "Property:HasHouseNo", "@type": "xsd:string"}, + "postal_code": {"@id": "schema:postalCode", "@type": "xsd:string"}, + "postal_code*": { + "@id": "Property:HasPostalCode", + "@type": "xsd:string", + }, + "post_office_box_no": { + "@id": "schema:postOfficeBoxNumer", + "@type": "xsd:string", + }, + "post_office_box_no*": { + "@id": "Property:HasPoBoxNo", + "@type": "xsd:string", + }, + "region": {"@id": "schema:addressRegion", "@type": "@id"}, + "region*": {"@id": "Property:HasRegion", "@type": "@id"}, + "state": {"@id": "schema:addressCountry", "@type": "@id"}, + "state*": {"@id": "Property:HasState", "@type": "@id"}, + "street_name": {"@id": "Property:HasStreet", "@type": "xsd:string"}, + }, + "title": "Postal address", + "title*": {"en": "Postal address", "de": "Postalische Adresse"}, + "description": "", + "eval_template": { + "type": "wikitext", + "mode": "render", + "value": "{{#if: {{{addressee|}}}|{{{addressee|}}}
|}}{{{street_name|}}} {{{house_no|}}}
{{#if: {{{address_supplement|}}}|{{{address_supplement|}}}
|}}{{{postal_code|}}} {{#if: {{{city|}}} |[[{{{city|}}}]]|{{{city_name|}}} }}, {{#if: {{{region|}}}|[[{{{region|}}}]], |}}{{#if: {{{state|}}}|[[{{{state|}}}]], |}}{{#if: {{{country|}}} |[[{{{country|}}}]]|{{{country_name|}}} }}{{#if: {{{post_office_box_no|}}}|
{{#switch:{{USERLANGUAGECODE}}|#default=PO Box No|de=Postfach-Nr.}} {{{post_office_box_no|}}}|}}", + }, + "defaultProperties": [ + "uuid", + "street_name", + "house_no", + "postal_code", + "city", + "city_name", + "country", + "country_name", + "address_supplement", + "state", + "region", + "post_office_box_no", ], }, ) - type: list[str] | None = ["Category:OSW44deaa5b806d41a2a88594f562b110e9"] - first_name: str = Field( - ..., - json_schema_extra={"title*": {"de": "Vorname"}, "propertyOrder": -3}, - title="First name / Given name / Forename", + uuid: UUID = Field( + default_factory=uuid4, json_schema_extra={"options": {"hidden": True}} ) - middle_name: set[str] | None = Field( + country: Country | None = Field( None, json_schema_extra={ - "title*": {"de": "Zweite(r) Vorname(n)"}, - "propertyOrder": -2, + "title*": {"en": "Country", "de": "Land"}, + "range": "Category:OSW0551abcd6f734047825e3ded4c8a0ffe", }, - title="Middle name(s)", + title="Country", ) - surname: str = Field( - ..., - json_schema_extra={"title*": {"de": "Nachname"}, "propertyOrder": -1}, - title="Last name / Family name / Surname", + country_name: str | None = Field( + None, + json_schema_extra={"title*": {"de": "Land (Text)"}}, + title="Country (text)", ) - label: list[DisplayName] | None = Field( - None, json_schema_extra={"options": {"hidden": True}} + state: State | None = Field( + None, + json_schema_extra={ + "title*": {"en": "State", "de": "Bundesland"}, + "range": "Category:OSWab60f9a227954ee0be92344ff6272420", + }, + title="State", ) - organization: set[OrganizationalUnit] | None = Field( + region: Region | None = Field( None, json_schema_extra={ - "title*": {"de": "Organisation"}, - "description*": { - "de": "Organisation(en), derer die Person Mitglied ist. Z.B. Universität, Forschungsinstitut, Unternehmen, etc." - }, - "range": "Category:OSW3cb8cef2225e403092f098f99bc4c472", + "title*": {"en": "Region", "de": "Region"}, + "range": "Category:OSW95efaf34e2c7439e8e7967233910e44b", }, - title="Organization", + title="Region", ) - """ - Organization(s) the person is affiliated with. E.g., university, research institute, company, etc. - """ - organizational_unit: set[OrganizationalSubUnit] | None = Field( + post_office_box_no: str | None = Field( + None, + json_schema_extra={"title*": {"en": "PO box number", "de": "Postfach nummer"}}, + title="PO box number", + ) + postal_code: str | None = Field( + None, + json_schema_extra={"title*": {"en": "Postal code", "de": "Postleitzahl"}}, + title="Postal code", + ) + city: City | None = Field( None, json_schema_extra={ - "title*": {"de": "Organisations(unter)einheit"}, + "title*": {"en": "City", "de": "Stadt"}, + "range": "Category:OSW807f1da5b42e42f296b213ab06ca873b", + }, + title="City", + ) + city_name: str | None = Field( + None, json_schema_extra={"title*": {"de": "Stadt (Text)"}}, title="City (text)" + ) + street_name: str | None = Field( + None, + json_schema_extra={"title*": {"en": "Street", "de": "Straße"}}, + title="Street", + ) + house_no: str | None = Field( + None, + json_schema_extra={"title*": {"en": "House number", "de": "Hausnummer"}}, + title="House number", + ) + address_supplement: str | None = Field( + None, + json_schema_extra={ + "title*": {"en": "Address supplement", "de": "Adresszusatz"} + }, + title="Address supplement", + ) + addressee: str | None = Field( + None, + json_schema_extra={ + "title*": {"de": "Adressat"}, "description*": { - "de": "Organisations(unter)einheit(en), derer die Person Mitglied ist. Z.B. Fakultät, Institut, Abteilung oder Forschungsgruppe, etc." + "de": "Titelzeile der Adresse falls abweichend vom Organisationsname" }, - "range": "Category:OSWfe3e842b804445c7bb0dd8ee61da2d70", }, - title="Organizational (sub)unit", + title="Addressee", ) """ - Organizational (sub)unit(s) the person is member of. E.g., faculty, institute, department or research group, etc. + Title line of the address in case different from organization name """ - email: set[EmailStr] | None = Field( - None, + + +class Component(OswBaseModel): + model_config = ConfigDict( json_schema_extra={ - "title*": {"de": "E-Mail Adresse"}, - "eval_template": { - "type": "mustache-wikitext", - "mode": "render", - "value": "{{#email}}[mailto:{{.}} {{.}}]
{{/email}}", - }, + "title": "Component", + "title*": {"de": "Komponente"}, + "headerTemplate": "{{ i1 }} - {{ self.component_id }}", + "defaultProperties": [], }, - title="Email address", ) - website: set[AnyUrl] | None = Field( - None, + uuid: UUID = Field( + ..., json_schema_extra={ - "title*": {"de": "Webseite"}, - "eval_template": { - "type": "mustache-wikitext", - "mode": "render", - "value": "{{#website}}{{{.}}}
{{/website}}", - }, + "title*": {"de": "UUID"}, + "$comment": "format uuid field are copied, if not set in copy_ignore", + "_template": "dynamic_template", + "dynamic_template": "{{_uuid_}}", + "options": {"hidden": True, "dynamic_template": {"override": "empty"}}, }, - title="Website", + title="UUID", ) - orcid: AnyUrl | None = Field( - None, + component_id: str = Field( + ..., json_schema_extra={ - "title*": {"de": "ORCID iD"}, - "description*": { - "de": "Die ORCID iD ist eine https URI mit einer 16-stelligen Nummer, z. B. https://orcid.org/0000-0001-2345-6789." + "$comment": "Will be used as a visual reference for the user", + "title*": {"de": "ID"}, + "description*": {"de": "Wird automatisch generiert"}, + "dynamic_template": "Component{{patternformat '00' _array_index_}}", + "readOnly": True, + "options": { + "hidden": True, + "dynamic_template": {"override": "always"}, + "grid_columns": 6, }, + "propertyOrder": 10, }, - title="ORCID iD", + title="ID", ) """ - The ORCID iD is an https URI with a 16-digit number, e.g., https://orcid.org/0000-0001-2345-6789. + Automatically generated """ - phone_number: ( - set[ - constr( - pattern=r"(?:(?:(?:\+|00|011)[\.\/\-\ \t]*([17]|2(?:[07]|[1-689]\d)|3(?:[0-4679]|[578]\d)|4(?:[013-9]|2\d)|5(?:[1-8]|[09]\d)|6(?:[0-6]|[789]\d)|8(?:[1246]|[035789]\d)|9(?:[0-58]|[679]\d))[\.\/\-\ \t]*|([17])[\.\/\-\ ])?(?:\((\d{1,6})\)[\.\/\-\ \t]*)?(?:(\d{1,6})[\.\/\-\ ])?(?:(\d{1,6})[\.\/\-\ ])?(?:(\d{1,6})[\.\/\-\ ])?(?:(\d{1,6})[\.\/\-\ ])?(\d{0,10}?)(\d{1,})(?:[\.\/\-;\ \t]*e?xt?[\.\/\-=\ \t]*(\d{1,14}))?)?" - ) - ] - | None - ) = Field( + label: list[Label] | None = Field( None, json_schema_extra={ - "title*": {"de": "Telefonnummer"}, + "title*": {"de": "Bezeichnung"}, "description*": { - "de": "Telefonnummer mit Landesvorwahl und Bindestrichen formatiert, z.B.. +49-931-4100-172. Entsprechend https://www.wikidata.org/wiki/Property:P1329" + "de": "Bezeichnung der Funktion oder Rolle der Komponente in diesem spezifischen Kontext." }, "eval_template": { "type": "mustache-wikitext", "mode": "render", - "value": "{{#phone_number}}[tel:{{.}} {{.}}]
{{/phone_number}}", + "value": "{{=<% %>=}} {{#switch:{{USERLANGUAGECODE}} <%={{ }}=%> {{#label}} |{{lang}}={{text}} {{/label}} {{=<% %>=}} }}", }, + "options": {"grid_columns": 12}, + "propertyOrder": 20, }, - title="Phone number", + title="Label", ) """ - Phone number formatted with country code and hyphens, e.g.. +49-931-4100-172. According to https://www.wikidata.org/wiki/Property:P1329 + Designation of the function or role of the component in this specific context. """ - fax_number: ( - set[ - constr( - pattern=r"(?:(?:(?:\+|00|011)[\.\/\-\ \t]*([17]|2(?:[07]|[1-689]\d)|3(?:[0-4679]|[578]\d)|4(?:[013-9]|2\d)|5(?:[1-8]|[09]\d)|6(?:[0-6]|[789]\d)|8(?:[1246]|[035789]\d)|9(?:[0-58]|[679]\d))[\.\/\-\ \t]*|([17])[\.\/\-\ ])?(?:\((\d{1,6})\)[\.\/\-\ \t]*)?(?:(\d{1,6})[\.\/\-\ ])?(?:(\d{1,6})[\.\/\-\ ])?(?:(\d{1,6})[\.\/\-\ ])?(?:(\d{1,6})[\.\/\-\ ])?(\d{0,10}?)(\d{1,})(?:[\.\/\-;\ \t]*e?xt?[\.\/\-=\ \t]*(\d{1,14}))?)?" - ) - ] - | None - ) = Field( + description: list[Description] | None = Field( None, json_schema_extra={ - "title*": {"de": "Faxnummer"}, + "title*": {"de": "Beschreibung"}, "description*": { - "de": "Faxnummer mit Landesvorwahl und Bindestrichen formatiert, z.B.. +49-931-4100-172. Entsprechend https://www.wikidata.org/wiki/Property:P1329" + "de": "Optional, zusätzliche Angaben zur Rolle oder Funktion der Komponente in diesem spezifischen Kontext." }, "eval_template": { "type": "mustache-wikitext", "mode": "render", - "value": "{{#fax_number}}[tel:{{.}} {{.}}]
{{/fax_number}}", + "value": "{{=<% %>=}} {{#switch:{{USERLANGUAGECODE}} <%={{ }}=%> {{#description}} |{{lang}}={{text}} {{/description}} {{=<% %>=}} }}", }, + "options": {"grid_columns": 12}, + "propertyOrder": 30, }, - title="Fax number", + title="Description", ) """ - Fax number formatted with country code and hyphens, e.g.. +49-931-4100-172. According to https://www.wikidata.org/wiki/Property:P1329 + Optional, additional details on the role or function of the component in this specific context. """ - located_in: set[Site] | None = Field( - None, - json_schema_extra={ - "title*": {"de": "Tätig an (Standort)"}, - "range": "Category:OSW473d7a1ed48544d1be83b258b5810948", - }, - title="Located at ", - ) - role: set[PersonRole] | None = Field( - None, + component_type: Category | None = Field( + default_factory=lambda: Category.model_validate( + "Category:OSWe427aafafbac4262955b9f690a83405d" + ), json_schema_extra={ - "title*": {"de": "Rollen"}, - "range": "Category:OSW5efde23b1d8c4e1c864ef039cb0616ed", - }, + "title*": {"de": "Typ der Komponente"}, + "range": "Category:Category", + "options": { + "autocomplete": { + "$comment": "Tool", + "query": "[[:Category:OSWe427aafafbac4262955b9f690a83405d]]OR[[SubClassOf::Category:OSWe427aafafbac4262955b9f690a83405d]]OR[[SubClassOf.SubClassOf::Category:OSWe427aafafbac4262955b9f690a83405d]]OR[[SubClassOf.SubClassOf.SubClassOf::Category:OSWe427aafafbac4262955b9f690a83405d]]OR[[SubClassOf.SubClassOf.SubClassOf.SubClassOf::Category:OSWe427aafafbac4262955b9f690a83405d]]OR[[SubClassOf.SubClassOf.SubClassOf.SubClassOf.SubClassOf::Category:OSWe427aafafbac4262955b9f690a83405d]]", + }, + "grid_columns": 12, + }, + "propertyOrder": 40, + "x-oold-required-iri": True, + }, + title="Component type", + ) + component_instance_property: str | None = Field( + "Property:HasPart", json_schema_extra={"options": {"hidden": True}} + ) + component_instance: Tool | None = Field( + None, + json_schema_extra={ + "title*": {"de": "Instanz"}, + "range": "Category:OSWe427aafafbac4262955b9f690a83405d", + "watch": {"component_type_": "component.component_type"}, + "options": { + "autocomplete": { + "query": "[[HasType::$(component_type_)]]|?Display_title_of=label|?HasImage=image|?HasDescription=description" + }, + "grid_columns": 12, + }, + "propertyOrder": 50, + "x-oold-required-iri": True, + }, + title="Instance", + ) + + +class InitialOccupantOfTheSlot(OswBaseModel): + """ + Tool or component installed in the slot. + """ + + model_config = ConfigDict( + json_schema_extra={ + "title": "Initial occupant of the slot", + "title*": {"de": "Initiale Belegung des Slots"}, + "description": "Tool or component installed in the slot.", + "description*": {"de": "Im Slot installiertes Werkzeug oder Komponente."}, + "defaultProperties": ["slot_occupant_type"], + "options": {"grid_columns": 12}, + "propertyOrder": 60, + }, + ) + slot_occupant_type: Category | None = Field( + None, + json_schema_extra={ + "title*": {"de": "Typ"}, + "range": "Category:Category", + "watch": {"slot_type": "slot.slot_type_restriction"}, + "options": { + "autocomplete": { + "$comment": "Tool", + "query": "[[:$(slot_type)]]OR[[SubClassOf::$(slot_type)]]OR[[SubClassOf.SubClassOf::$(slot_type)]]OR[[SubClassOf.SubClassOf.SubClassOf::$(slot_type)]]OR[[SubClassOf.SubClassOf.SubClassOf.SubClassOf::$(slot_type)]]OR[[SubClassOf.SubClassOf.SubClassOf.SubClassOf.SubClassOf::$(slot_type)]]", + } + }, + "propertyOrder": 11, + }, + title="Type", + ) + slot_occupant_instance_property: str | None = Field( + "Property:HasOccupant", json_schema_extra={"options": {"hidden": True}} + ) + slot_occupant_instance: Tool | None = Field( + None, + json_schema_extra={ + "title*": {"de": "Instanz"}, + "range": "Category:OSWe427aafafbac4262955b9f690a83405d", + "watch": {"slot_occupant_type_": "slot_occupant.slot_occupant_type"}, + "options": { + "autocomplete": { + "query": "[[HasType::$(slot_occupant_type_)]]|?Display_title_of=label|?HasImage=image|?HasDescription=description" + } + }, + "propertyOrder": 21, + "x-oold-required-iri": True, + }, + title="Instance", + ) + + +class Slot(OswBaseModel): + model_config = ConfigDict( + json_schema_extra={ + "title": "Slot", + "title*": {"de": "Slot"}, + "headerTemplate": "{{ i1 }} - {{ self.slot_id }}", + "defaultProperties": ["name", "description", "slot_occupant"], + }, + ) + uuid: str = Field( + ..., + json_schema_extra={ + "title*": {"de": "UUID"}, + "$comment": "format uuid field are copied, if not set in copy_ignore", + "_format": "uuid", + "_template": "dynamic_template", + "dynamic_template": "{{_uuid_}}", + "options": {"hidden": True, "dynamic_template": {"override": "empty"}}, + }, + title="UUID", + ) + slot_osw_id: str = Field( + ..., + json_schema_extra={ + "$comment": "Will be used an unique reference for slot exchange events.", + "title*": {"de": "OSW-ID"}, + "watch": {"_own_uuid": "slot.uuid"}, + "_format": "dynamic_template", + "dynamic_template": "{{_current_subject_}}#OSW{{#replace '-' ''}}{{_own_uuid}}{{/replace}}", + "readOnly": True, + "options": {"hidden": True, "dynamic_template": {"override": "empty"}}, + }, + title="OSW-ID", + ) + slot_id: str = Field( + ..., + json_schema_extra={ + "$comment": "Will be used as a visual reference for the user", + "title*": {"de": "ID"}, + "description*": {"de": "Wird automatisch generiert"}, + "dynamic_template": "Slot{{patternformat '00' _array_index_}}", + "readOnly": True, + "options": { + "hidden": True, + "dynamic_template": {"override": "always"}, + "grid_columns": 6, + }, + "propertyOrder": 10, + }, + title="ID", + ) + """ + Automatically generated + """ + name: str | None = Field( + None, + json_schema_extra={ + "title*": {"de": "Name"}, + "options": {"grid_columns": 6}, + "propertyOrder": 20, + }, + title="Name", + ) + description: list[Description] | None = Field( + None, + json_schema_extra={ + "title*": {"de": "Beschreibung"}, + "eval_template": { + "type": "mustache-wikitext", + "mode": "render", + "value": "{{=<% %>=}} {{#switch:{{USERLANGUAGECODE}} <%={{ }}=%> {{#description}} |{{lang}}={{text}} {{/description}} {{=<% %>=}} }}", + }, + "options": {"grid_columns": 12}, + "propertyOrder": 30, + }, + title="Description", + ) + slot_init_date_time: AwareDatetime = Field( + ..., + json_schema_extra={ + "title*": {"de": "Datum der Slot-Initialisierung"}, + "dynamic_template": "{{_now_}}", + "options": {"dynamic_template": {"override": "empty"}, "grid_columns": 4}, + "propertyOrder": 21, + }, + title="Date of slot initialization", + ) + slot_type_restriction: Category | None = Field( + default_factory=lambda: Category.model_validate( + "Category:OSWe427aafafbac4262955b9f690a83405d" + ), + json_schema_extra={ + "title*": {"de": "Typeinschränkung des Slots"}, + "range": "Category:Category", + "options": { + "autocomplete": { + "$comment": "Tool", + "query": "[[:Category:OSWe427aafafbac4262955b9f690a83405d]]OR[[SubClassOf::Category:OSWe427aafafbac4262955b9f690a83405d]]OR[[SubClassOf.SubClassOf::Category:OSWe427aafafbac4262955b9f690a83405d]]OR[[SubClassOf.SubClassOf.SubClassOf::Category:OSWe427aafafbac4262955b9f690a83405d]]OR[[SubClassOf.SubClassOf.SubClassOf.SubClassOf::Category:OSWe427aafafbac4262955b9f690a83405d]]OR[[SubClassOf.SubClassOf.SubClassOf.SubClassOf.SubClassOf::Category:OSWe427aafafbac4262955b9f690a83405d]]", + } + }, + "propertyOrder": 50, + "x-oold-required-iri": True, + }, + title="Type restriction of the slot", + ) + slot_occupant: InitialOccupantOfTheSlot | None = Field( + None, + json_schema_extra={ + "title*": {"de": "Initiale Belegung des Slots"}, + "description*": {"de": "Im Slot installiertes Werkzeug oder Komponente."}, + "defaultProperties": ["slot_occupant_type"], + "options": {"grid_columns": 12}, + "propertyOrder": 60, + }, + title="Initial occupant of the slot", + ) + """ + Tool or component installed in the slot. + """ + + +class YearlyBudget(OswBaseModel): + model_config = ConfigDict( + json_schema_extra={ + "title": "Yearly budget", + "title*": {"de": "Jahresbudget"}, + "defaultProperties": [ + "budget_year", + "yearly_budget_sum", + "budget_type", + "budget_ou", + ], + }, + ) + uuid: UUID = Field( + ..., json_schema_extra={"options": {"hidden": True}}, title="UUID" + ) + budget_year: str | None = Field( + None, json_schema_extra={"title*": {"de": "Jahr"}}, title="Year" + ) + yearly_budget_sum: YearlyBudgetSum | None = Field( + None, + json_schema_extra={ + "title*": {"de": "Summe Jahresbudget"}, + "options": { + "disable_collapse": True, + "disable_properties": True, + "compact": True, + }, + }, + title="Yearly Budget Sum", + ) + yearly_budget_sum_weighted: WeightedSum | None = Field( + None, + json_schema_extra={ + "title*": {"de": "Gewichtete Summe"}, + "_description": "weighted with probability of successful funding", + "_description*": {"de": "gewichtet mit Erfolgswahrscheinlichkeit"}, + "options": { + "disable_collapse": True, + "disable_properties": True, + "compact": True, + }, + }, + title="weighted sum", + ) + budget_start: date | None = Field( + None, json_schema_extra={"title*": {"de": "Beginn"}}, title="Start" + ) + budget_end: date | None = Field( + None, json_schema_extra={"title*": {"de": "Ende"}}, title="End" + ) + budget_ou: OrganizationalUnit | None = Field( + None, + json_schema_extra={ + "title*": {"en": "OU", "de": "OE"}, + "range": "Category:OSW3cb8cef2225e403092f098f99bc4c472", + }, + title="OU", + ) + budget_type: BudgetType | None = Field( + None, + json_schema_extra={ + "title*": {"de": "Typ"}, + "range": "Category:OSW595b282aedf048788f3ee326454792ce", + }, + title="Type", + ) + + +class DatasetSchema(Item): + model_config = ConfigDict( + json_schema_extra={ + "@context": [{"schema_definition": "Property:HasSchemaDefinition"}], + "title": "DatasetSchema", + "defaultProperties": ["schema_definition", "label", "uuid"], + }, + ) + schema_definition: str | None = Field(None, title="Dataset schema") + """ + Defintion of a JSON based Schema for a dataset. + """ + type: list[str] | None = ["Category:OSW0d6584b3e2b64e9595733c4c3963c486"] + + +class Process(Item): + """ + Members of the Process Category describe the act of changing the state or properties of something + """ + + model_config = ConfigDict( + json_schema_extra={ + "@context": [ + "/wiki/Category:Item?action=raw&slot=jsonschema", + { + "type": {"@id": "Property:HasType", "@type": "@id"}, + "type*": {"@id": "Property:HasSchema", "@type": "@id"}, + "tool": {"@id": "Property:HasTool", "@type": "@id"}, + "input": {"@id": "Property:HasInput", "@type": "@id"}, + "location": {"@id": "Property:HasLocation", "@type": "@id"}, + "location_name": {"@id": "Property:HasLocation", "@type": "@id"}, + "output": {"@id": "Property:HasOutput", "@type": "@id"}, + "creator": {"@id": "Property:HasCreator", "@type": "@id"}, + "actionees": {"@id": "Property:HasActionee", "@type": "@id"}, + "projects": {"@id": "Property:HasProject", "@type": "@id"}, + "status": {"@id": "Property:HasStatus", "@type": "@id"}, + "start_date_time": { + "@id": "Property:HasStartDateAndTime", + "@type": "xsd:dateTime", + }, + "duration": {"@id": "Property:HasDuration"}, + "end_date_time": { + "@id": "Property:HasEndDateAndTime", + "@type": "xsd:dateTime", + }, + "subprocesses": {"@id": "Property:HasPart", "@type": "@id"}, + }, + ], + "title": "Process", + "title*": {"en": "Process", "de": "Prozess"}, + "uuid": "5a07d666-c55b-4ffa-89d4-9633c708029d", + "description": "Members of the Process Category describe the act of changing the state or properties of something", + "description*": { + "en": "Members of the Process Category describe the act of changing the state or properties of something", + "de": "Prozesse beschreiben den Akt des Änderns eines Zustandes oder der Eigenschaften von etwas.", + }, + "defaultProperties": [ + "actionees", + "start_date_time", + "tool", + "input", + "output", + ], + }, + ) + type: list[str] | None = ["Category:OSWe5aa96bffb1c4d95be7fbd46142ad203"] + creator: Person | None = Field( + None, + json_schema_extra={ + "title*": {"de": "Ersteller"}, + "range": "Category:OSW44deaa5b806d41a2a88594f562b110e9", + }, + title="Creator", + ) + actionees: list[Person] | None = Field( + None, + json_schema_extra={ + "title*": {"de": "Akteure"}, + "range": "Category:OSW44deaa5b806d41a2a88594f562b110e9", + }, + title="Actionees", + ) + start_date_time: AwareDatetime | None = Field( + None, + json_schema_extra={ + "title*": {"de": "Startzeitpunkt"}, + "$comment": 'Note: To hide the time, you can set {"options": {"flatpickr": {"dateFormat": "Z", "altInput": true, "altFormat": "Y-m-d"}}}', + }, + title="Start time", + ) + duration: timedelta | None = Field( + None, json_schema_extra={"title*": {"de": "Dauer"}}, title="Duration" + ) + end_date_time: AwareDatetime | None = Field( + None, json_schema_extra={"title*": {"de": "Endzeitpunkt"}}, title="End time" + ) + location: Location | None = Field( + None, + json_schema_extra={ + "title*": {"de": "Ort"}, + "range": "Category:OSW3d238d05316e45a4ac95a11d7b24e36b", + }, + title="Location", + ) + location_name: str | None = Field( + None, + json_schema_extra={ + "title*": {"de": "Ort (Text)"}, + "description*": { + "de": "Vorzugsweise sollte ein Ort aus dem Autocomplete-Feld 'Ort' ausgewählt oder erstellt werden." + }, + }, + title="Location (text)", + ) + """ + Its prefered to select or create a location from or in the autocomplete field 'Location'. + """ + status: Status | None = Field( + None, + json_schema_extra={ + "_format": "autocomplete", + "options": { + "_autocomplete": { + "category": "Category:OSW9725d7a91bab4f1aa68f423e4e9bfcf4" + }, + "enum_titles": ["To do", "In work", "Done"], + "enum_titles*": {"de": ["Zu tun", "In Arbeit", "Erledigt"]}, + "grid_columns": 6, + }, + }, + title="Status", + ) + tool: list[Tool] | None = Field( + None, + json_schema_extra={ + "title*": {"de": "Werkzeuge"}, + "options": {"conditional_visible": {"modes": ["query", "default"]}}, + "range": "Category:OSWe427aafafbac4262955b9f690a83405d", + }, + title="Tools", + ) + input: list[Item] | None = Field( + None, + json_schema_extra={ + "title*": {"de": "Eingangsressource (Input)"}, + "options": {"conditional_visible": {"modes": ["query", "default"]}}, + "range": "Category:Item", + }, + title="Inputs", + ) + output: list[Item] | None = Field( + None, + json_schema_extra={ + "title*": {"de": "Ausgangsressource (Output)"}, + "options": {"conditional_visible": {"modes": ["query", "default"]}}, + "range": "Category:Item", + }, + title="Outputs", + ) + projects: list[Project] | None = Field( + None, + json_schema_extra={ + "title*": {"de": "Projekt(e)"}, + "options": {"conditional_visible": {"modes": ["query", "default"]}}, + "range": "Category:OSWb2d7e6a2eff94c82b7f1f2699d5b0ee3", + }, + title="Project(s)", + ) + parameters: dict[str, Any] | None = Field(None, title="Parameters") + + +class Person(Item): + """ + Category for a person in general. Subcategories are e.g. 'User', i.e. persons who have a user ID. + """ + + model_config = ConfigDict( + json_schema_extra={ + "@context": [ + { + "competence": {"@id": "schema:knowsAbout", "@type": "@id"}, + "competence*": {"@id": "Property:HasCompetence", "@type": "@id"}, + "email": {"@id": "schema:email", "@type": "xsd:string"}, + "email*": {"@id": "Property:HasEmail", "@type": "xsd:string"}, + "fax_number": {"@id": "schema:faxNumber", "@type": "xsd:string"}, + "fax_number*": { + "@id": "Property:HasFaxNumber", + "@type": "xsd:string", + }, + "first_name": {"@id": "schema:givenName", "@type": "xsd:string"}, + "first_name*": { + "@id": "Property:HasFirstName", + "@type": "xsd:string", + }, + "located_in": {"@id": "schema:workLocation", "@type": "@id"}, + "located_in*": {"@id": "Property:IsLocatedIn", "@type": "@id"}, + "middle_name": { + "@id": "schema:additionalName", + "@type": "xsd:string", + }, + "middle_name*": { + "@id": "Property:HasMiddleName", + "@type": "xsd:string", + }, + "orcid": {"@id": "schema:identifier", "@type": "xsd:string"}, + "orcid*": {"@id": "Property:HasOrcidId", "@type": "xsd:string"}, + "organization": {"@id": "schema:worksFor", "@type": "@id"}, + "organization*": { + "@id": "Property:HasOrganization", + "@type": "@id", + }, + "organization**": {"@id": "Property:HasOu", "@type": "@id"}, + "organizational_unit": {"@id": "schema:memberOf", "@type": "@id"}, + "organizational_unit*": {"@id": "Property:HasOu", "@type": "@id"}, + "phone_number": {"@id": "schema:telephone", "@type": "xsd:string"}, + "phone_number*": { + "@id": "Property:HasPhoneNumber", + "@type": "xsd:string", + }, + "role": {"@id": "schema:jobTitle", "@type": "@id"}, + "role*": {"@id": "Property:HasRole", "@type": "@id"}, + "surname": {"@id": "schema:familyName", "@type": "xsd:string"}, + "surname*": {"@id": "Property:HasSurname", "@type": "xsd:string"}, + "topic": {"@id": "schema:knowsAbout", "@type": "@id"}, + "topic*": {"@id": "Property:HasTopic", "@type": "@id"}, + "website": {"@id": "schema:subjectOf", "@type": "xsd:string"}, + "website*": {"@id": "Property:HasWebsite", "@type": "xsd:string"}, + }, + "/wiki/Category:Item?action=raw&slot=jsonschema", + ], + "title": "Person", + "title*": {"de": "Person", "en": "Person"}, + "uuid": "44deaa5b-806d-41a2-a885-94f562b110e9", + "description": "Category for a person in general. Subcategories are e.g. 'User', i.e. persons who have a user ID.", + "description*": { + "en": "Category for a person in general. Subcategories are e.g. 'User', i.e. persons who have a user ID.", + "de": "Kategorie für eine Person im Allgemeinen. Unterkategorien sind bsp. 'User', also Personen die über eine Nutzerkennung verfügen.", + }, + "data_source_maps": [ + { + "id": "pub.orcid.org", + "source": "https://pub.orcid.org/v3.0/{{#split '/' -1}}{{orcid}}{{/split}}", + "format": "jsonld", + "label": "ORCID", + "required": ["orcid"], + "object_map": { + "first_name": "$.givenName", + "surname": "$.familyName", + }, + } + ], + "defaultProperties": [ + "first_name", + "surname", + "organization", + "email", + "phone_number", + ], + }, + ) + type: list[str] | None = ["Category:OSW44deaa5b806d41a2a88594f562b110e9"] + first_name: str = Field( + ..., + json_schema_extra={"title*": {"de": "Vorname"}, "propertyOrder": -3}, + title="First name / Given name / Forename", + ) + middle_name: set[str] | None = Field( + None, + json_schema_extra={ + "title*": {"de": "Zweite(r) Vorname(n)"}, + "propertyOrder": -2, + }, + title="Middle name(s)", + ) + surname: str = Field( + ..., + json_schema_extra={"title*": {"de": "Nachname"}, "propertyOrder": -1}, + title="Last name / Family name / Surname", + ) + label: list[DisplayName] | None = Field( + None, json_schema_extra={"options": {"hidden": True}} + ) + organization: set[OrganizationalUnit] | None = Field( + None, + json_schema_extra={ + "title*": {"de": "Organisation"}, + "description*": { + "de": "Organisation(en), derer die Person Mitglied ist. Z.B. Universität, Forschungsinstitut, Unternehmen, etc." + }, + "range": "Category:OSW3cb8cef2225e403092f098f99bc4c472", + }, + title="Organization", + ) + """ + Organization(s) the person is affiliated with. E.g., university, research institute, company, etc. + """ + organizational_unit: set[OrganizationalSubUnit] | None = Field( + None, + json_schema_extra={ + "title*": {"de": "Organisations(unter)einheit"}, + "description*": { + "de": "Organisations(unter)einheit(en), derer die Person Mitglied ist. Z.B. Fakultät, Institut, Abteilung oder Forschungsgruppe, etc." + }, + "range": "Category:OSWfe3e842b804445c7bb0dd8ee61da2d70", + }, + title="Organizational (sub)unit", + ) + """ + Organizational (sub)unit(s) the person is member of. E.g., faculty, institute, department or research group, etc. + """ + email: set[EmailStr] | None = Field( + None, + json_schema_extra={ + "title*": {"de": "E-Mail Adresse"}, + "eval_template": { + "type": "mustache-wikitext", + "mode": "render", + "value": "{{#email}}[mailto:{{.}} {{.}}]
{{/email}}", + }, + }, + title="Email address", + ) + website: set[AnyUrl] | None = Field( + None, + json_schema_extra={ + "title*": {"de": "Webseite"}, + "eval_template": { + "type": "mustache-wikitext", + "mode": "render", + "value": "{{#website}}{{{.}}}
{{/website}}", + }, + }, + title="Website", + ) + orcid: AnyUrl | None = Field( + None, + json_schema_extra={ + "title*": {"de": "ORCID iD"}, + "description*": { + "de": "Die ORCID iD ist eine https URI mit einer 16-stelligen Nummer, z. B. https://orcid.org/0000-0001-2345-6789." + }, + }, + title="ORCID iD", + ) + """ + The ORCID iD is an https URI with a 16-digit number, e.g., https://orcid.org/0000-0001-2345-6789. + """ + phone_number: ( + set[ + constr( + pattern=r"(?:(?:(?:\+|00|011)[\.\/\-\ \t]*([17]|2(?:[07]|[1-689]\d)|3(?:[0-4679]|[578]\d)|4(?:[013-9]|2\d)|5(?:[1-8]|[09]\d)|6(?:[0-6]|[789]\d)|8(?:[1246]|[035789]\d)|9(?:[0-58]|[679]\d))[\.\/\-\ \t]*|([17])[\.\/\-\ ])?(?:\((\d{1,6})\)[\.\/\-\ \t]*)?(?:(\d{1,6})[\.\/\-\ ])?(?:(\d{1,6})[\.\/\-\ ])?(?:(\d{1,6})[\.\/\-\ ])?(?:(\d{1,6})[\.\/\-\ ])?(\d{0,10}?)(\d{1,})(?:[\.\/\-;\ \t]*e?xt?[\.\/\-=\ \t]*(\d{1,14}))?)?" + ) + ] + | None + ) = Field( + None, + json_schema_extra={ + "title*": {"de": "Telefonnummer"}, + "description*": { + "de": "Telefonnummer mit Landesvorwahl und Bindestrichen formatiert, z.B.. +49-931-4100-172. Entsprechend https://www.wikidata.org/wiki/Property:P1329" + }, + "eval_template": { + "type": "mustache-wikitext", + "mode": "render", + "value": "{{#phone_number}}[tel:{{.}} {{.}}]
{{/phone_number}}", + }, + }, + title="Phone number", + ) + """ + Phone number formatted with country code and hyphens, e.g.. +49-931-4100-172. According to https://www.wikidata.org/wiki/Property:P1329 + """ + fax_number: ( + set[ + constr( + pattern=r"(?:(?:(?:\+|00|011)[\.\/\-\ \t]*([17]|2(?:[07]|[1-689]\d)|3(?:[0-4679]|[578]\d)|4(?:[013-9]|2\d)|5(?:[1-8]|[09]\d)|6(?:[0-6]|[789]\d)|8(?:[1246]|[035789]\d)|9(?:[0-58]|[679]\d))[\.\/\-\ \t]*|([17])[\.\/\-\ ])?(?:\((\d{1,6})\)[\.\/\-\ \t]*)?(?:(\d{1,6})[\.\/\-\ ])?(?:(\d{1,6})[\.\/\-\ ])?(?:(\d{1,6})[\.\/\-\ ])?(?:(\d{1,6})[\.\/\-\ ])?(\d{0,10}?)(\d{1,})(?:[\.\/\-;\ \t]*e?xt?[\.\/\-=\ \t]*(\d{1,14}))?)?" + ) + ] + | None + ) = Field( + None, + json_schema_extra={ + "title*": {"de": "Faxnummer"}, + "description*": { + "de": "Faxnummer mit Landesvorwahl und Bindestrichen formatiert, z.B.. +49-931-4100-172. Entsprechend https://www.wikidata.org/wiki/Property:P1329" + }, + "eval_template": { + "type": "mustache-wikitext", + "mode": "render", + "value": "{{#fax_number}}[tel:{{.}} {{.}}]
{{/fax_number}}", + }, + }, + title="Fax number", + ) + """ + Fax number formatted with country code and hyphens, e.g.. +49-931-4100-172. According to https://www.wikidata.org/wiki/Property:P1329 + """ + located_in: set[Site] | None = Field( + None, + json_schema_extra={ + "title*": {"de": "Tätig an (Standort)"}, + "range": "Category:OSW473d7a1ed48544d1be83b258b5810948", + }, + title="Located at ", + ) + role: set[PersonRole] | None = Field( + None, + json_schema_extra={ + "title*": {"de": "Rollen"}, + "range": "Category:OSW5efde23b1d8c4e1c864ef039cb0616ed", + }, title="Roles", ) competence: set[Competence] | None = Field( @@ -2307,1767 +2840,1706 @@ class OrganizationalUnit(Item): """ Fax number formatted with country code and hyphens, e.g.. +49-931-4100-172. According to https://www.wikidata.org/wiki/Property:P1329 """ - associated_acl_roles: list[str] | None = Field( - None, - json_schema_extra={"title*": {"de": "Rollen für die Zugriffskontrolle"}}, - title="Access control roles", - ) - - -class PersonRole(Item): - model_config = ConfigDict( - json_schema_extra={ - "title": "Person role", - "@context": [ - { - "ad_label": "Property:HasAdLabel", - "miri_label": "Property:HasMiriLabel", - "miri_id": "Property:HasMiriId", - } - ], - }, - ) - ad_label: list[str] | None = Field( - None, - json_schema_extra={ - "title*": {"de": "AD-Label"}, - "description*": {"de": "Label des Rolle im Active Directory"}, - }, - title="AD label", - ) - """ - Label of the role in the Active Directory - """ - miri_label: list[str] | None = Field( - None, - json_schema_extra={ - "title*": {"de": "MIRI-Label"}, - "description*": {"de": "Label der Rolle in MIRI und eDirectory"}, - }, - title="MIRI label", - ) - """ - Label of the role in MIRI and eDirectory - """ - miri_id: list[str] | None = Field( - None, - json_schema_extra={ - "title*": {"de": "MIRI-ID"}, - "description*": {"de": "ID der Rolle in MIRI"}, - }, - title="MIRI id", - ) - """ - ID of the role in MIRI - """ - miri_label_orig: list[str] | None = Field( - None, - json_schema_extra={ - "title*": {"de": "Ursprüngliches MIRI-Label"}, - "description*": {"de": "Ursprüngliches Label der Rolle in MIRI"}, - }, - title="Original MIRI label", - ) - """ - Original label of the role in MIRI - """ - type: list[str] | None = ["Category:OSW5efde23b1d8c4e1c864ef039cb0616ed"] - - -class AreaUsageType(Item): - model_config = ConfigDict( - json_schema_extra={ - "title": "AreaUsageType", - "@context": [{"din277_label": "Property:HasDin277Label"}], - }, - ) - din277_label: list[str] | None = Field( - None, - json_schema_extra={ - "title*": {"de": "DIN 277 Bezeichnung"}, - "desciption": "Label according to DIN 277", - "description*": {"de": "Bezeichnung nach DIN 277"}, - }, - title="DIN 277 label", - ) - type: list[str] | None = ["Category:OSWae92be81cdb34d22844d4791ef790d93"] - - -class RoomUsage(Item): - model_config = ConfigDict( - json_schema_extra={ - "title": "RoomUsage", - "@context": [{"din277_label": "Property:HasDin277Label"}], - }, - ) - din277_label: list[str] | None = Field( - None, - json_schema_extra={ - "title*": {"de": "DIN 277 Bezeichnung"}, - "desciption": "Label according to DIN 277", - "description*": {"de": "Bezeichnung nach DIN 277"}, - }, - title="DIN 277 label", - ) - type: list[str] | None = ["Category:OSWac9f0e49d8024804bd7d77058322a3fe"] - - -class Building(Location): - model_config = ConfigDict( - json_schema_extra={ - "@context": [ - { - "area": {"@id": "schema:floorSize", "@type": "@id"}, - "area*": {"@id": "Property:HasArea", "@type": "xsd:float"}, - "construction_year": { - "@id": "schema:yearBuilt", - "@type": "xsd:integer", - }, - "construction_year*": { - "@id": "Property:HasConstructionYear", - "@type": "xsd:integer", - }, - "footprint": {"@id": "Property:HasFootprint", "@type": "xsd:float"}, - "function": {"@id": "Property:HasBuildingFunction", "@type": "@id"}, - "height": {"@id": "schema:height", "@type": "xsd:float"}, - "height*": {"@id": "Property:HasHeight", "@type": "xsd:float"}, - "length": {"@id": "Property:HasLength", "@type": "xsd:float"}, - "located_in": {"@id": "schema:containedInPlace", "@type": "@id"}, - "located_in*": {"@id": "Property:IsLocatedIn", "@type": "@id"}, - "responsible_person": { - "@id": "Property:HasResponsiblePerson", - "@type": "@id", - }, - "width": {"@id": "schema:width", "@type": "xsd:float"}, - "width*": {"@id": "Property:HasWidth", "@type": "xsd:float"}, - }, - "/wiki/Category:OSW3d238d05316e45a4ac95a11d7b24e36b?action=raw&slot=jsonschema", - ], - "title": "Building", - "title*": {"en": "Building", "de": "Gebäude"}, - }, - ) - type: list[str] | None = ["Category:OSW4bcd4a99a73f482ea40ac4210dfab836"] - located_in: set[Site] | None = Field( - None, - json_schema_extra={ - "title*": {"en": "Site", "de": "Standort"}, - "range": "Category:OSW473d7a1ed48544d1be83b258b5810948", - }, - title="Site", - ) - construction_year: float | None = Field( - None, - json_schema_extra={ - "title*": {"de": "Baujahr", "en": "Construction year"}, - "description*": { - "de": "Das Jahr, in dem der Bau abgeschlossen wurde.", - "en": "The year in which the construction was completed.", - }, - }, - title="Construction year", - ) - """ - The year in which the construction was completed. - """ - length: float | None = Field( - None, - json_schema_extra={"title*": {"de": "Länge", "en": "Length"}}, - title="Length", - ) - width: float | None = Field( - None, - json_schema_extra={"title*": {"de": "Breite", "en": "Width"}}, - title="Width", - ) - height: float | None = Field( - None, - json_schema_extra={"title*": {"de": "Höhe", "en": "Height"}}, - title="Height", - ) - footprint: float | None = Field( - None, - json_schema_extra={"title*": {"de": "Grundfläche", "en": "Area at base level"}}, - title="Area at base level", - ) - area: float | None = Field( - None, - json_schema_extra={"title*": {"de": "Gesamtfläche", "en": "Total floor area"}}, - title="Total floor area", - ) - function: set[BuildingFunction] | None = Field( - None, - json_schema_extra={ - "title*": {"en": "Building function", "de": "Gebäudefunktion"}, - "range": "Category:OSW07a0faef5be94b788514a2dd5dca20bf", - }, - title="Building function", - ) - responsible_person: set[User] | None = Field( + associated_acl_roles: list[str] | None = Field( None, + json_schema_extra={"title*": {"de": "Rollen für die Zugriffskontrolle"}}, + title="Access control roles", + ) + + +class Place(Item): + """ + Entities that have a somewhat fixed, physical extension. + """ + + model_config = ConfigDict( json_schema_extra={ - "title*": {"de": "Verantwortliche Person", "en": "Responsible person"}, - "range": "Category:OSWd9aa0bca9b0040d8af6f5c091bf9eec7", + "@context": ["/wiki/Category:Item?action=raw&slot=jsonschema"], + "uuid": "28f71f2c-20ad-48c3-8c4e-4d190a95c0b8", + "title": "Place", + "title*": {"en": "Place", "de": "Ort"}, + "description": "Entities that have a somewhat fixed, physical extension.", + "description*": { + "en": "Entities that have a somewhat fixed, physical extension.", + "de": "Entitäten, die eine gewisse feste, physische Ausdehnung haben.", + }, }, - title="Responsible person", ) + type: list[str] | None = ["Category:OSW28f71f2c20ad48c38c4e4d190a95c0b8"] -class Room(Location): +class Location(Item): + """ + A location. Entities that have a somewhat fixed, physical extension. + """ + model_config = ConfigDict( json_schema_extra={ "@context": [ { - "area": {"@id": "schema:floorSize", "@type": "xsd:float"}, - "area*": {"@id": "Property:HasArea", "@type": "xsd:float"}, - "construction_year": { - "@id": "schema:yearBuilt", - "@type": "xsd:integer", - }, - "construction_year*": { - "@id": "Property:HasConstructionYear", - "@type": "xsd:integer", - }, - "door_height": { - "@id": "Property:HasDoorHeight", - "@type": "xsd:float", - }, - "door_width": { - "@id": "Property:HasDoorWidth", - "@type": "xsd:float", + "gps_coordinates": {"@id": "schema:geo", "@type": "xsd:string"}, + "gps_coordinates*": { + "@id": "Property:HasGpsCoordinates", + "@type": "xsd:string", }, - "height": {"@id": "schema:height", "@type": "xsd:float"}, - "height*": {"@id": "Property:HasHeight", "@type": "xsd:float"}, - "length": {"@id": "Property:HasLength", "@type": "xsd:float"}, + "latitude": {"@id": "schema:latitude", "@type": "xsd:float"}, "located_in": {"@id": "schema:containedInPlace", "@type": "@id"}, "located_in*": {"@id": "Property:IsLocatedIn", "@type": "@id"}, - "number": {"@id": "Property:HasRoomNumber", "@type": "xsd:string"}, - "responsible_person": { - "@id": "Property:HasResponsiblePerson", + "longitude": {"@id": "schema:longitude", "@type": "xsd:float"}, + "longitude*": { + "@id": "Property:HasLongitude", + "@type": "xsd:float", + }, + "postal_address": { + "@id": "Property:HasPostalAddress", "@type": "@id", + "@context": ["/wiki/JsonSchema:PostalAddress?action=raw"], }, - "usage": {"@id": "Property:HasRoomUsage", "@type": "@id"}, - "usage_type": {"@id": "Property:HasRoomUsageType", "@type": "@id"}, - "width": {"@id": "schema:width", "@type": "xsd:float"}, - "width*": {"@id": "Property:HasWidth", "@type": "xsd:float"}, }, - "/wiki/Category:OSW3d238d05316e45a4ac95a11d7b24e36b?action=raw&slot=jsonschema", + "/wiki/Category:Item?action=raw&slot=jsonschema", ], - "title": "Room", - "uuid": "c5ed0ed1-e33c-4b31-887c-67af25a610c1", - "title*": {"en": "Room", "de": "Raum"}, - "description": "", - "description*": {}, + "title": "Location", + "uuid": "3d238d05-316e-45a4-ac95-a11d7b24e36b", + "title*": {"en": "Location", "de": "Örtlichkeit"}, + "description": "A location. Entities that have a somewhat fixed, physical extension.", + "description*": { + "de": "Eine Örtlichkeit. Entitaeten, die eine mehr oder weniger feste, physische Ausdehnung haben." + }, + "defaultProperties": ["label", "gps_coordinates", "postal_address"], }, ) - type: list[str] | None = ["Category:OSWc5ed0ed1e33c4b31887c67af25a610c1"] - located_in: set[Floor] | None = Field( + type: list[str] | None = ["Category:OSW3d238d05316e45a4ac95a11d7b24e36b"] + postal_address: PostalAddress | None = None + gps_coordinates: GPSCoordinates | None = Field( None, json_schema_extra={ - "title*": {"de": "Stockwerk", "en": "Floor"}, - "range": "Category:OSW6c4212f1a39342be963d2b9efd19c5c2", + "title*": {"en": "GPS coordinates", "de": "GPS Koordinaten"}, + "eval_template": { + "type": "wikitext", + "value": "{{{latitude|}}}, {{{longitude|}}}", + }, + "defaultProperties": ["uuid", "latitude", "longitude"], }, - title="Floor", + title="GPS coordinates", ) - usage_type: set[AreaUsageType] | None = Field( - None, + + +class PersonRole(Item): + model_config = ConfigDict( json_schema_extra={ - "title*": {"en": "Room usage type", "de": "Raumnutzungsart"}, - "range": "Category:OSWae92be81cdb34d22844d4791ef790d93", + "title": "Person role", + "@context": [ + { + "ad_label": "Property:HasAdLabel", + "miri_label": "Property:HasMiriLabel", + "miri_id": "Property:HasMiriId", + } + ], }, - title="Room usage type", - ) - length: float | None = Field( - None, - json_schema_extra={"title*": {"de": "Länge", "en": "Length"}}, - title="Length", - ) - width: float | None = Field( - None, - json_schema_extra={"title*": {"de": "Breite", "en": "Width"}}, - title="Width", ) - height: float | None = Field( - None, - json_schema_extra={"title*": {"de": "Höhe", "en": "Height"}}, - title="Height", - ) - area: float | None = Field( - None, json_schema_extra={"title*": {"de": "Fläche", "en": "Area"}}, title="Area" - ) - door_width: float | None = Field( - None, - json_schema_extra={"title*": {"de": "Türbreite", "en": "Door width"}}, - title="Door width", - ) - door_height: float | None = Field( + ad_label: list[str] | None = Field( None, - json_schema_extra={"title*": {"de": "Türhöhe", "en": "Door height"}}, - title="Door height", + json_schema_extra={ + "title*": {"de": "AD-Label"}, + "description*": {"de": "Label des Rolle im Active Directory"}, + }, + title="AD label", ) - number: str | None = Field( + """ + Label of the role in the Active Directory + """ + miri_label: list[str] | None = Field( None, - json_schema_extra={"title*": {"en": "Number", "de": "Nummer"}}, - title="Number", + json_schema_extra={ + "title*": {"de": "MIRI-Label"}, + "description*": {"de": "Label der Rolle in MIRI und eDirectory"}, + }, + title="MIRI label", ) - usage: set[RoomUsage] | None = Field( + """ + Label of the role in MIRI and eDirectory + """ + miri_id: list[str] | None = Field( None, json_schema_extra={ - "title*": {"en": "Room usage", "de": "Raumnutzung"}, - "range": "Category:OSWac9f0e49d8024804bd7d77058322a3fe", + "title*": {"de": "MIRI-ID"}, + "description*": {"de": "ID der Rolle in MIRI"}, }, - title="Room usage", + title="MIRI id", ) - responsible_person: set[User] | None = Field( + """ + ID of the role in MIRI + """ + miri_label_orig: list[str] | None = Field( None, json_schema_extra={ - "title*": {"de": "Verantwortliche Person", "en": "Responsible person"}, - "range": "Category:OSWd9aa0bca9b0040d8af6f5c091bf9eec7", + "title*": {"de": "Ursprüngliches MIRI-Label"}, + "description*": {"de": "Ursprüngliches Label der Rolle in MIRI"}, }, - title="Responsible person", + title="Original MIRI label", ) + """ + Original label of the role in MIRI + """ + type: list[str] | None = ["Category:OSW5efde23b1d8c4e1c864ef039cb0616ed"] -class Floor(Location): +class Tool(Item): + """ + Item that participates as a utility (almost) unchanged in a process + """ + model_config = ConfigDict( json_schema_extra={ "@context": [ + "/wiki/Category:Item?action=raw&slot=jsonschema", { - "located_in": {"@id": "schema:containedInPlace", "@type": "@id"}, - "located_in*": {"@id": "Property:IsLocatedIn", "@type": "@id"}, + "components": { + "@id": "Property:HasStatement", + "@type": "@id", + "@context": { + "component_instance_property": { + "@id": "Property:HasProperty", + "@type": "@id", + }, + "component_instance": { + "@id": "Property:HasObject", + "@type": "@id", + }, + }, + }, + "events": {"@id": "Property:HasEvent", "@type": "@id"}, + "purposes": {"@id": "Property:HasPurpose", "@type": "xsd:string"}, + "slots": { + "@id": "Property:HasSlot", + "@type": "@id", + "@context": { + "slot_osw_id": { + "@id": "Property:HasOswId", + "@type": "xsd:string", + }, + "slot_id": {"@id": "Property:HasId", "@type": "xsd:string"}, + "name": {"@id": "Property:HasName", "@type": "xsd:string"}, + "description": { + "@id": "Property:HasDescription", + "@type": "@id", + }, + "slot_init_date_time": { + "@id": "Property:HasInitDate", + "@type": "xsd:dateTime", + }, + "slot_occupant": { + "@id": "Property:HasStatement", + "@type": "@id", + "@context": { + "slot_occupant_instance_property": "Property:HasProperty", + "slot_occupant_instance": "Property:HasObject", + }, + }, + "slot_type_restriction": { + "@id": "Property:HasTypeRestriction", + "@type": "@id", + }, + }, + }, + "typical_process": { + "@id": "Property:HasTypicalProcess", + "@type": "@id", + }, }, - "/wiki/Category:OSW3d238d05316e45a4ac95a11d7b24e36b?action=raw&slot=jsonschema", ], - "title": "Floor", + "uuid": "e427aafa-fbac-4262-955b-9f690a83405d", + "title": "Tool", + "title*": {"en": "Tool", "de": "Werkzeug"}, + "description": "Item that participates as a utility (almost) unchanged in a process", + "description*": { + "en": "Item that participates as a utility (almost) unchanged in a process", + "de": "Gegenstand der als Hilfsmittel (nahezu) unverändert in einem Prozess teilnimmt", + }, + "defaultProperties": [], }, ) - type: list[str] | None = ["Category:OSW6c4212f1a39342be963d2b9efd19c5c2"] - located_in: set[Building] | None = Field( + type: list[str] | None = ["Category:OSWe427aafafbac4262955b9f690a83405d"] + purposes: list[str] | None = Field( None, json_schema_extra={ - "title*": {"en": "Building", "de": "Gebäude"}, - "range": "Category:OSW4bcd4a99a73f482ea40ac4210dfab836", + "title*": {"de": "Zweck(e)"}, + "eval_template": [ + { + "type": "mustache-wikitext", + "mode": "render", + "value": "{{=<% %>=}} ", + } + ], }, - title="Building", + title="Purpose(s)", ) - - -class User(Person, UserAccount): - """ - A person who has a user ID. - """ - - model_config = ConfigDict( + typical_process: list[Category] | None = Field( + None, json_schema_extra={ - "@context": [ - "/wiki/Category:OSW44deaa5b806d41a2a88594f562b110e9?action=raw&slot=jsonschema", - "/wiki/Category:OSW8b3e627eb76b46d68fce3a12ff220c8e?action=raw&slot=jsonschema", + "title*": {"de": "Typische(r) Prozess(e)"}, + "eval_template": [ { - "employment_contract_status": { - "@id": "Property:HasEmploymentContractStatus", - "@type": "@id", - }, - "room": {"@id": "Property:HasRoom", "@type": "@id"}, - "superior": {"@id": "Property:HasSuperior", "@type": "@id"}, - }, + "type": "mustache-wikitext", + "mode": "render", + "value": "{{=<% %>=}} ", + } ], - "title": "User", - "title*": {"de": "Nutzer"}, - "uuid": "d9aa0bca-9b00-40d8-af6f-5c091bf9eec7", - "description": "A person who has a user ID.", - "description*": {"de": "Eine Person mit Nutzerkennung"}, + "range": "Category:Category", }, + title="Typical Process(es)", ) - room: set[Room] | None = Field( + components: list[Component] | None = Field( None, json_schema_extra={ - "title*": {"de": "Raum"}, - "description*": {"de": "Büro"}, - "range": "Category:OSWc5ed0ed1e33c4b31887c67af25a610c1", + "title*": {"de": "Komponenten"}, + "description*": { + "de": "Komponenten sind dauerhafte Teile eines Werkzeugs (im Gegensatz zu Slots für austauschbare Teile)." + }, + "options": { + "enable_array_copy": True, + "array_copy_ignore": ["uuid", "component_id", "attachments"], + }, + "eval_template": [ + { + "type": "mustache-wikitext", + "mode": "render", + "value": "{{=<% %>=}} ", + } + ], }, - title="Room(s)", + title="Components", ) """ - Office + Component are permanent parts of a tool (vs. Slots for exchangeable parts). """ - superior: set[User] | None = Field( + slots: list[Slot] | None = Field( None, json_schema_extra={ - "title*": {"de": "Führungsperson(en)"}, - "description*": {"de": "Direkte Führungsperson(en)"}, - "range": "Category:OSWd9aa0bca9b0040d8af6f5c091bf9eec7", + "title*": {"de": "Slot-Konfiguration"}, + "description*": { + "de": "Slots stellen Plätze für austauschbare Teile oder Komponenten eines Werkzeugs dar (im Gegensatz zu Komponenten, die permanente Teile sind). Slot-Austauschereignisse können verwendet werden, um Änderungen an Slots zu dokumentieren. Dies ist die anfängliche Slot-Konfiguration!" + }, + "options": { + "enable_array_copy": True, + "array_copy_ignore": ["uuid", "slot_osw_id", "slot_id", "attachments"], + }, + "eval_template": [ + { + "type": "mustache-wikitext", + "mode": "render", + "value": "{{=<% %>=}} ", + } + ], }, - title="Superior(s)", + title="Slot configuration", ) """ - Direct superior(s) + Slots represent spaces for exchangable parts or components of a tool (vs. Components, which are permanent parts). Slot exchange events can be used to document changes on slots. This is the initial slot configuration! """ - employment_contract_status: EmploymentStatus | None = Field( - default_factory=lambda: EmploymentStatus.model_validate( - "Item:OSW62770459451644f3841c502df8a5cb1d" - ), + events: list[Event] | None = Field( + None, json_schema_extra={ - "title*": {"de": "Status des Arbeitsvertrages"}, - "description*": { - "de": "Gibt an, ob ein Nutzer einen aktiven Arbeitsvertrag hat (noch beschäftigt ist) oder nicht" - }, - "range": "Category:OSW781ad17c7eef4161ade5a7b690aca6b5", + "title*": {"de": "Ereignis(se)"}, + "range": "Category:OSWb97757b46edb430591758662c18d354d", }, - title="Status of the employment contract", + title="Event(s)", ) - """ - Whether a user has an active employment contract (stil employed) or not - """ - type: list[str] | None = ["Category:OSWd9aa0bca9b0040d8af6f5c091bf9eec7"] -class OrganizationalSubUnit(OrganizationalUnit): +class Project(Item): """ - An organizational unit that explicitly is part of a larger organizational unit. + An enterprise (potentially individual but typically collaborative), planned to achieve a particular aim. """ model_config = ConfigDict( json_schema_extra={ "@context": [ - "/wiki/Category:OSW3cb8cef2225e403092f098f99bc4c472?action=raw&slot=jsonschema" + "/wiki/Category:Item?action=raw&slot=jsonschema", + { + "abstract": {"@id": "Property:HasAbstract"}, + "budget_end": {"@id": "Property:HasBudgetEndDate"}, + "budget_ou": {"@id": "Property:HasBusinessUnit", "@type": "@id"}, + "budget_start": {"@id": "Property:HasBudgetStartDate"}, + "budget_type": {"@id": "Property:HasType", "@type": "@id"}, + "budget_year": {"@id": "Property:HasBudgetYear"}, + "end_date": {"@id": "Property:HasEndDate", "@type": "xsd:date"}, + "funding_type": {"@id": "Property:HasFundingType", "@type": "@id"}, + "funding_call": {"@id": "Property:HasFundingCall", "@type": "@id"}, + "funding": {"@id": "schema:funding", "@type": "@id"}, + "funding*": {"@id": "Property:HasFunding", "@type": "@id"}, + "funder": {"@id": "schema:funder", "@type": "@id"}, + "funder*": {"@id": "Property:HasFunder", "@type": "@id"}, + "member": {"@id": "schema:member", "@type": "@id"}, + "member*": {"@id": "Property:HasMember", "@type": "@id"}, + "member_of": {"@id": "schema:memberOf", "@type": "@id"}, + "member_of*": {"@id": "Property:IsMemberOf", "@type": "@id"}, + "other_documents": { + "@id": "Property:HasAdditionalDocument", + "@type": "@id", + }, + "ou": {"@id": "Property:HasBusinessUnit", "@type": "@id"}, + "project_manager": {"@id": "Property:HasManager", "@type": "@id"}, + "project_status": {"@id": "Property:HasStatus", "@type": "@id"}, + "project_type": {"@id": "Property:HasType", "@type": "@id"}, + "proposal": {"@id": "Property:HasProposal", "@type": "@id"}, + "report": {"@id": "Property:HasReport", "@type": "@id"}, + "start_date": {"@id": "Property:HasStartDate", "@type": "xsd:date"}, + "subjects": {"@id": "Property:HasTopic", "@type": "@id"}, + "total_budget": {"@id": "Property:HasStatement"}, + "year": {"@id": "Property:HasYear"}, + "yearly_budget": {"@id": "Property:HasBudgetPart", "@type": "@id"}, + "yearly_budget_sum": {"@id": "Property:HasStatement"}, + "yearly_budget_sum_weighted": {"@id": "Property:HasStatement"}, + "probability_of_successful_funding": { + "@id": "Property:HasStatement" + }, + }, ], - "title": "OrganizationalSubUnit", - "title*": {"de": "Organisationsuntereinheit"}, - "description": "An organizational unit that explicitly is part of a larger organizational unit.", + "uuid": "b2d7e6a2-eff9-4c82-b7f1-f2699d5b0ee3", + "title": "Project", + "title*": {"en": "Project", "de": "Projekt"}, + "description": "An enterprise (potentially individual but typically collaborative), planned to achieve a particular aim.", "description*": { - "de": "Eine Organisationseinheit, die ausdrücklich Teil einer größeren Organisationseinheit ist." + "de": "Ein (möglicherweise individuelles, in der Regel aber gemeinschaftliches) Unternehmen oder Unternehmung, das auf ein bestimmtes Ziel ausgerichtet ist." }, - "defaultProperties": ["superordinate_ou"], - }, - ) - type: list[str] | None = ["Category:OSWfe3e842b804445c7bb0dd8ee61da2d70"] - - -class Competence(DefinedTerm): - model_config = ConfigDict( - json_schema_extra={ - "@context": [ - "/wiki/Category:OSWa5812d3b5119416c8da1606cbe7054eb?action=raw&slot=jsonschema" + "defaultProperties": [ + "subjects", + "project_status", + "funding_type", + "funding_call", + "funder", + "funding", + "funding_name", + "ou", + "project_manager", + "member", + "member_of", + "start_date", + "end_date", + "total_budget", + "proposal", + "abstract", ], - "uuid": "5eb9c52b-8045-44dc-870d-fd54ff434428", - "title": "Competence", - "title*": {"de": "Kompetenz"}, }, ) - type: list[str] | None = ["Category:OSW5eb9c52b804544dc870dfd54ff434428"] - - -class Topic(DefinedTerm): - model_config = ConfigDict( - json_schema_extra={ - "@context": [ - "/wiki/Category:OSWa5812d3b5119416c8da1606cbe7054eb?action=raw&slot=jsonschema" - ], - "title": "Topic", - }, + type: list[str] | None = ["Category:OSWb2d7e6a2eff94c82b7f1f2699d5b0ee3"] + subjects: list[str] | None = Field( + None, json_schema_extra={"title*": {"de": "Themen"}}, title="Subjects" ) - type: list[str] | None = ["Category:OSW5a13eeda5ed5405ea7ef62ea6feeceec"] - - -class StatusEnumeration(Enumeration): - """ - Lists or enumerations dealing with status types. - """ - - model_config = ConfigDict( + project_type: ProjectTypeDeprecated | None = Field( + "", json_schema_extra={ - "@context": [ - "/wiki/Category:OSWd02741381aaa4709ae0753a0edc341ce?action=raw&slot=jsonschema" - ], - "uuid": "2c32802b-e590-4024-8c85-eda3479d484c", - "title": "StatusEnumeration", - "title*": { - "en": "Zustandsaufzählungen", - "de": "Aufzählung von Zustandsbeschreibungen", - }, - "description": "Lists or enumerations dealing with status types.", - "description*": { - "en": "Lists or enumerations dealing with status types.", - "de": "Listen oder Aufzählungen, die sich mit Statusarten (Zustandsarten) befassen.", + "deprecated": True, + "title*": {"de": "Projekttyp (veraltet)"}, + "description*": {"de": "Ersetzt mit Projekt- bzw. Förderart"}, + "options": { + "enum_titles": ["House project", "Internal", "Public", "Industry"], + "enum_titles*": { + "de": ["Hausprojekt", "Intern", "Öffentlich", "Industrie"] + }, }, }, + title="Project type (deprecated)", ) - type: list[str] | None = ["Category:OSW2c32802be59040248c85eda3479d484c"] - - -class EmploymentStatus(StatusEnumeration): """ - Describes the status of an employment (contract) + Replaced with Project / Funding Type """ - - model_config = ConfigDict( + funding_type: ProjectType | None = Field( + None, json_schema_extra={ - "@context": [ - "/wiki/Category:OSW2c32802be59040248c85eda3479d484c?action=raw&slot=jsonschema" - ], - "uuid": "781ad17c-7eef-4161-ade5-a7b690aca6b5", - "title": "EmploymentStatus", - "title*": { - "en": "Employment status", - "de": "Status des Beschäftigungsverhältnisses", - }, - "description": "Describes the status of an employment (contract)", - "description*": { - "en": "Describes the status of an employment (contract)", - "de": "Beschreibt den Status eines Arbeitsverhältnisses(vertrages)", - }, + "title*": {"de": "Projekt- bzw. Förderart"}, + "range": "Category:OSW67f2ef61ba284c919fefa00d0e95a7a0", }, + title="Project / Funding Type", ) - type: list[str] | None = ["Category:OSW781ad17c7eef4161ade5a7b690aca6b5"] - - -# generated by datamodel-codegen: -# filename: OSW6c4212f1a39342be963d2b9efd19c5c2.json - - -# generated by datamodel-codegen: -# filename: OSWc5ed0ed1e33c4b31887c67af25a610c1.json - - -# generated by datamodel-codegen: -# filename: OSW137e7443b2b94692bd59a0e0a6778b70.json - - -# generated by datamodel-codegen: -# filename: OSW0551abcd6f734047825e3ded4c8a0ffe.json - - -# generated by datamodel-codegen: -# filename: OSWab60f9a227954ee0be92344ff6272420.json - - -# generated by datamodel-codegen: -# filename: OSW807f1da5b42e42f296b213ab06ca873b.json - - -# generated by datamodel-codegen: -# filename: OSW95efaf34e2c7439e8e7967233910e44b.json - - -# generated by datamodel-codegen: -# filename: OSWd845b96813a344458f140e48c4d063fd.json - - -class Supply(OswBaseModel): - model_config = ConfigDict( - json_schema_extra={"title": "Supply", "title*": {"de": "Bezugsmöglichkeit"}}, + project_status: ProjectStatus | None = Field( + default_factory=lambda: ProjectStatus.model_validate( + "Item:OSW55a9a9bda7b248759e48ae2e3ed6df1d" + ), + json_schema_extra={ + "title*": {"de": "Projektstatus"}, + "range": "Category:OSW490e38f9764f4408a244869a0ea98e7c", + }, + title="Project status", ) - supplier: str | None = Field( + funding_call: str | None = Field( None, json_schema_extra={ - "title*": {"de": "Lieferant"}, + "title*": {"de": "Förderaufruf"}, "options": { "autocomplete": { - "category": "Category:OSW3cb8cef2225e403092f098f99bc4c472" + "category": "Category:OSWd22af0aa3b00462a9da9b509538e8926" } }, }, - title="Supplier", + title="Funding call", ) - article_no: str | None = Field( + funder: str | None = Field( None, json_schema_extra={ - "title*": {"de": "Artikelnummer"}, - "description*": {"de": "Artikelnummer im Katalog des Lieferanten"}, + "title*": {"de": "Förder- bzw. Auftragsgeber"}, + "category": "Category:OSW3cb8cef2225e403092f098f99bc4c472", }, - title="Article no.", + title="Funder", ) - """ - Article number in the catalogue of the supplier - """ - comment: str | None = Field( + funding: str | None = Field( None, json_schema_extra={ - "title*": {"de": "Kommentar"}, - "description*": { - "de": "Kommentar bezüglich der Bezugsmöglichkeit des Materials" + "title*": {"de": "Förderung"}, + "description*": {"de": "Förderung oder Vertrag"}, + "options": { + "autocomplete": { + "category": "Category:OSWbe80b28aefd64921ba2e8e2d6225416e" + } }, }, - title="Comment", + title="Funding", ) """ - Comment on the supply of the material + Grant or contract """ - link: AnyUrl | None = Field( + funding_name: str | None = Field( None, json_schema_extra={ - "title*": {"de": "Link"}, + "title*": {"de": "Förderung (Name)"}, "description*": { - "de": "Link zum Artikel im Online-Katalog des Lieferanten" + "de": "Förderung oder Vertrag. Verwenden Sie diese Eigenschaft, um einen Text einzugeben, wenn Sie keine neue Instanz von Grant erstellen möchten." }, }, - title="Link", + title="Funding (name)", ) """ - Link to the article in the online catalogue of the supplier + Grant or contract. Use this property to enter a text if you don't want to create a new instance of grant. """ - - -class Quantity(OswBaseModel): - model_config = ConfigDict( + probability_of_successful_funding: ( + ProbabilityOfSuccessfulFundingInPercent | None + ) = Field( + None, json_schema_extra={ - "@context": { - "Property": "https://wiki-dev.open-semantic-lab.org/id/Property-3A", - "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", - "rdfs": "http://www.w3.org/2000/01/rdf-schema#", - "quantity*": "Property:HasProperty", - "quantity": "rdf:predicate", - "value*": "Property:HasObject", - "value": "rdf:object", - "unit": "Property:HasUnit", + "title*": { + "de": "Wahrscheinlichkeit einer erfolgreichen Förderung in Prozent" + }, + "description*": { + "de": "Gibt die Wahrscheinlichkeit an, dass die Förderung genehmigt wird, bestimmt das gewichtete Budget" }, - "$comment": "A reduced version of JsonSchema:Statement", - "title": "Quantity", - "title*": {"de": "Menge"}, - "_headerTemplate": "{{self.value}}", }, + title="Probability of Successful Funding in percent", ) - uuid: UUID = Field( - ..., json_schema_extra={"options": {"hidden": True}}, title="UUID" - ) - quantity: str = Field( - ..., + """ + Indicates the likelihood that the funding will be approved, determines the weighted budget + """ + ou: list[str] | None = Field( + None, json_schema_extra={ - "title*": {"de": "Attribut"}, - "propertyOrder": 10, - "options": { - "grid_columns": 8, - "autocomplete": {"category": "Category:QuantityProperty"}, + "title*": {"en": "OU", "de": "OE"}, + "description*": { + "de": "Organisationseinheit (OE), die das Projekt durchführt" }, }, - title="Property", + title="OU", ) - numerical_value: str = Field( - ..., + """ + Organizational Unit (OU), which carries out the project + """ + project_manager: list[str] | None = Field( + None, json_schema_extra={ - "title*": {"de": "Wert"}, - "propertyOrder": 20, - "options": {"grid_columns": 2}, + "title*": {"en": "Project Manager", "de": "Projektleiter*in"} }, - title="Value", + title="Project Manager", ) - unit: str = Field( - ..., - json_schema_extra={ - "title*": {"de": "Einheit"}, - "propertyOrder": 30, - "watch": { - "quantity": "statement.quantity", - "unit_symbol": "statement.unit_symbol", - }, - "options": { - "grid_columns": 2, - "autocomplete": { - "query": "[[-HasInputUnit::{{$(quantity)}}]][[Display_title_of::like:*{{_user_input}}*]]|?Display_title_of=label", - "render_template": { - "type": ["handlebars"], - "value": "{{result.printouts.label.[0]}}", - }, - "field_maps": [ - { - "source_path": "$", - "template": "{{{result.printouts.label.[0]}}}", - "target_path": "$(unit_symbol)", - } - ], - }, - }, - }, - title="Unit", + member: list[str] | None = Field( + None, + json_schema_extra={"title*": {"en": "Member", "de": "Mitglieder*innen"}}, + title="Member", ) - unit_symbol: str = Field(..., json_schema_extra={"options": {"hidden": True}}) - value: str = Field( - ..., + member_of: list[str] | None = Field( + None, json_schema_extra={ - "title*": {"de": "Wert"}, - "watch": { - "numerical_value": "statement.numerical_value", - "unit_symbol": "statement.unit_symbol", + "title*": {"en": "Member of ", "de": "Mitglied von"}, + "description*": { + "de": "Organisationseinheit(en), zu der das Projekt gehört, z. B. ein Projektcluster" }, - "template": "{{{numerical_value}}} {{{unit_symbol}}}", - "options": {"hidden": True}, - }, - title="Value", - ) - - -class Attribute(OswBaseModel): - model_config = ConfigDict( - json_schema_extra={ - "title": "Attribute", - "title*": {"de": "Attribut"}, - "headerTemplate": "{{i1}} - {{self.name}}", }, + title="Member of", ) - attribute_name: list[Label] = Field(..., min_length=1, title="Name") - quantity_prop: Quantity - - -class Constituent(OswBaseModel): - model_config = ConfigDict( - json_schema_extra={ - "title": "Constituent", - "title*": {"de": "Bestandteil"}, - "headerTemplate": "{{i1}} - {{self.name}}", - }, + """ + Organizational unit(s), the project is a member of, e.g. a project cluster + """ + start_date: date | None = Field( + None, + json_schema_extra={"title*": {"de": "Beginn"}, "options": {"flatpicker": {}}}, + title="Start", ) - uuid: UUID = Field( - ..., json_schema_extra={"options": {"hidden": True}}, title="UUID" + end_date: date | None = Field( + None, + json_schema_extra={"title*": {"de": "Ende"}, "options": {"flatpicker": {}}}, + title="End", ) - property: str | None = Field( - "Property:HasPart", json_schema_extra={"options": {"hidden": True}} + total_budget: TotalBudget | None = Field( + None, json_schema_extra={"title*": {"de": "Budgetsumme"}}, title="Total Budget" ) - is_array: bool | None = Field(None, title="Is array") - name: str = Field(..., title="Name") - type: Material | None = Field( + yearly_budget: list[YearlyBudget] | None = Field( None, json_schema_extra={ - "$comment": "Material", - "range": "Category:OSW31ca9a739cb24079b36824045c0832aa", - "options": { - "autocomplete": { - "$comment": "todo: we need an any-subcategory-of shortcut", - "query": "[[SubClassOf::Category:OSW31ca9a739cb24079b36824045c0832aa]]OR[[SubClassOf.SubClassOf::Category:OSW31ca9a739cb24079b36824045c0832aa]]OR[[SubClassOf.SubClassOf.SubClassOf::Category:OSW31ca9a739cb24079b36824045c0832aa]]OR[[SubClassOf.SubClassOf.SubClassOf.SubClassOf::Category:OSW31ca9a739cb24079b36824045c0832aa]]OR[[SubClassOf.SubClassOf.SubClassOf.SubClassOf.SubClassOf::Category:OSW31ca9a739cb24079b36824045c0832aa]]", - } - }, - "x-oold-required-iri": True, + "title*": {"de": "Jahresbudget"}, + "options": {"disable_array_reorder": False, "enable_array_copy": True}, }, - title="Type", + title="Yearly budget", ) - default: str | None = Field(None, title="Default value") - - -class OtherPhysicalItem(OswBaseModel): - model_config = ConfigDict( + proposal: str | None = Field( + None, json_schema_extra={ - "title": "Other physical Item", - "title*": {"de": "Anderer physischer Gegenstand"}, - "headerTemplate": "{{ i1 }}", - "defaultProperties": [], + "title*": {"de": "Antrag"}, + "options": {"upload": {}}, + "links": [ + { + "href": "{{#if self}}/w/index.php?title=Special:Redirect/file/{{self}}&width=200&height=200{{/if}}", + "mediaType": "image", + }, + { + "href": "{{#if self}}/w/index.php?title=Special:Redirect/file/{{self}}{{/if}}", + "rel": "{{#if self}}download{{/if}}", + "download": True, + }, + ], }, + title="Proposal", ) - uuid: str = Field( - ..., + report: str | None = Field( + None, json_schema_extra={ - "dynamic_template": "{{_uuid_}}", - "options": {"hidden": True, "dynamic_template": {"override": "empty"}}, + "title*": {"de": "Bericht"}, + "options": {"upload": {}}, + "links": [ + { + "href": "{{#if self}}/w/index.php?title=Special:Redirect/file/{{self}}&width=200&height=200{{/if}}", + "mediaType": "image", + }, + { + "href": "{{#if self}}/w/index.php?title=Special:Redirect/file/{{self}}{{/if}}", + "rel": "{{#if self}}download{{/if}}", + "download": True, + }, + ], }, + title="Report", ) - origin_item_type: Category | None = Field( - default_factory=lambda: Category.model_validate( - "Category:OSW37a57741ae2e4dd4b29b1172b6848be8" - ), + other_documents: list[str] | None = Field( + None, json_schema_extra={ - "title*": {"de": "Typ"}, - "range": "Category:Category", - "options": { - "autocomplete": { - "$comment": "Tool", - "query": "[[:Category:OSW37a57741ae2e4dd4b29b1172b6848be8]]OR[[SubClassOf::Category:OSW37a57741ae2e4dd4b29b1172b6848be8]]OR[[SubClassOf.SubClassOf::Category:OSW37a57741ae2e4dd4b29b1172b6848be8]]OR[[SubClassOf.SubClassOf.SubClassOf::Category:OSW37a57741ae2e4dd4b29b1172b6848be8]]OR[[SubClassOf.SubClassOf.SubClassOf.SubClassOf::Category:OSW37a57741ae2e4dd4b29b1172b6848be8]]OR[[SubClassOf.SubClassOf.SubClassOf.SubClassOf.SubClassOf::Category:OSW37a57741ae2e4dd4b29b1172b6848be8]]", - }, - "grid_columns": 12, - }, - "propertyOrder": 40, - "x-oold-required-iri": True, + "title*": {"en": "Additional documents", "de": "Sonstige Dokumente"} }, - title="Type", - ) - origin_item_instance_property: str | None = Field( - "Property:HasOrigin", json_schema_extra={"options": {"hidden": True}} + title="Additional documents", ) - origin_item_instance: PhysicalItem | None = Field( + abstract: list[Description] | None = Field( None, json_schema_extra={ - "title*": {"de": "Instanz"}, - "range": "Category:OSW37a57741ae2e4dd4b29b1172b6848be8", - "watch": {"origin_item_type_": "origin_item.origin_item_type"}, - "options": { - "autocomplete": { - "query": "[[HasType::$(origin_item_type_)]]|?Display_title_of=label|?HasImage=image|?HasDescription=description" - }, - "grid_columns": 12, + "title*": {"de": "Kurzbeschreibung"}, + "eval_template": { + "type": "mustache-wikitext", + "mode": "render", + "$comment": "Displays value according to user language with eng as fallback option. Note: {{=<% %>=}} changes mustache expression from {{..}} to <% %> for mixing with wikitext templates", + "value": "{{=<% %>=}} {{#switch:{{USERLANGUAGECODE}} <%#abstract%> | {{#ifeq: <%lang%>|en|#default|<%lang%>}} = <%text%> <%/abstract%> }}", }, - "propertyOrder": 50, - "x-oold-required-iri": True, }, - title="Instance", + title="Abstract", ) -class PhysicalItem(Item): - """ - Physical item as opposed to intangible item. It can posses properties such as position, geometry, weight, volume , etc. - """ - +class Dataset(Data): model_config = ConfigDict( json_schema_extra={ "@context": [ - "/wiki/Category:Item?action=raw&slot=jsonschema", + "/wiki/Category:OSW2ac4493f8635481eaf1db961b63c8325?action=raw&slot=jsonschema", { - "data_sheet": {"@id": "Property:HasDataSheet", "@type": "@id"}, - "instructions": {"@id": "Property:HasInstructions", "@type": "@id"}, - "manual": {"@id": "Property:HasManual", "@type": "@id"}, - "manufacturer": {"@id": "Property:HasManufacturer", "@type": "@id"}, - "origin": { - "@id": "Property:HasStatement", + "url": "dcat:landingPage", + "url*": "Property:HasUrl", + "themes": {"@type": "@id", "@id": "dcat:theme"}, + "themes*": {"@type": "@id", "@id": "Property:IsRelatedTo"}, + "distributions": { "@type": "@id", + "@id": "dcat:distribution", "@context": { - "origin_item_instance_property": "Property:HasProperty", - "origin_item_instance": "Property:HasObject", + "file": {"@id": "dcat:accessURL", "@type": "@id"}, + "file*": { + "@id": "Property:HasFileAttachment", + "@type": "@id", + }, + "download_url": "dcat:downloadURL", + "access_url": "dcat:accessURL", + "media_type": "dcat:mediaType", + "byte_size": "dcat:byteSize", + "package_format": "dcat:packageFormat", + "compression_format": "dcat:compressionFormat", + "conforms_to": { + "@id": "dcterms:conformsTo", + "@type": "@id", + }, + "table_schema": {"@id": "csvw:tableSchema", "@type": "@id"}, }, }, - "quantity_statements": { - "@id": "Property:HasStatement", - "@type": "@id", - }, - "safety_data_sheet": { - "@id": "Property:HasSafetyDataSheet", + "distributions*": { "@type": "@id", + "@id": "Property:HasDistribution", }, - "serial_number": "Property:HasSerialNumber", - "type_no": "Property:HasTypeNumber", + "data_format": "Property:HasDataFormat", + "dataset_schema": "Property:HasDatasetSchema", + "dcterms": "http://purl.org/dc/terms/", + "prov": "http://www.w3.org/ns/prov#", + "csvw": "http://www.w3.org/ns/csvw#", + "parts": {"@id": "dcterms:hasPart", "@type": "@id"}, + "parts*": {"@id": "Property:HasPart", "@type": "@id"}, + "about": {"@id": "schema:about", "@type": "@id"}, + "generated_by": {"@id": "prov:wasGeneratedBy", "@type": "@id"}, }, ], - "uuid": "37a57741-ae2e-4dd4-b29b-1172b6848be8", - "title": "PhysicalItem", - "title*": {"en": "Physical Item", "de": "Physischer Gegenstand"}, - "description": "Physical item as opposed to intangible item. It can posses properties such as position, geometry, weight, volume , etc. ", - "description*": { - "en": "Physical item as opposed to intangible item. It can posses properties such as position, geometry, weight, volume , etc. ", - "de": "Physischer Gegenstand im Gegensatz zu immateriellen Gegenständen. Er kann Eigenschaften wie Position, Geometrie, Gewicht, Volumen usw. besitzen. ", - }, - }, - ) - type: list[str] | None = ["Category:OSW37a57741ae2e4dd4b29b1172b6848be8"] - quantity_statements: list[Quantity] | None = Field( - None, - json_schema_extra={ - "title*": {"de": "Quantitative Aussage(n)"}, - "eval_template": { - "type": "mustache-wikitext", - "mode": "render", - "value": "{{#quantity_statements}}.. {{#quantity}}[[{{quantity}}]]{{/quantity}} {{#value}}{{value}}{{/value}}
{{/quantity_statements}}", - }, + "title": "Dataset", + "defaultProperties": ["distributions", "themes", "about"], + "uuid": "fe729745-90fd-4e8b-a94c-d4e8366375e8", + "title*": {"en": "Dataset"}, + "description": "", + "description*": {}, }, - title="Quantitative statement(s)", ) - origin: list[OtherPhysicalItem] | None = Field( - None, - json_schema_extra={ - "title*": {"de": "Ursprung"}, - "description*": { - "de": "Andere(r) physische(r) Gegenstand/Gegenstände aus der dieser physische Gegenstand hergestellt wurde." - }, - "options": { - "enable_array_copy": True, - "array_copy_ignore": ["uuid", "attachments"], - }, - "eval_template": [ - { - "type": "mustache-wikitext", - "mode": "render", - "value": "{{=<% %>=}} ", - } - ], - }, - title="Origin", + type: list[str] | None = ["Category:OSWfe72974590fd4e8ba94cd4e8366375e8"] + url: list[str] | None = Field(None, title="URL / Websites") + """ + Landing page(s) that documents the dataset + """ + themes: list[Entity] | None = Field( + None, json_schema_extra={"range": "Category:Entity"}, title="Themes / Topics" ) """ - Other physical item(s) that this physical item was derived from. + Terms to categorizes this dataset """ - type_no: str | None = Field( + distributions: list[Distribution] | None = Field( None, json_schema_extra={ - "title*": {"de": "Typennummer"}, + "title*": {"de": "Distributionen"}, "description*": { - "de": "Typen- oder Modellnummer wie vom Hersteller angegeben" + "de": "Serialisierungen dieses Datensatzes. Jeder Eintrag beschreibt eine Datei als Repräsentation dieses Datensatzes, sodass dieselbe Datei mehrere Datensätze mit unterschiedlichen Schemata bedienen kann." }, }, - title="Type number", + title="Distributions", ) """ - Type or model number as specified by the manufacturer + Serializations of this dataset. Each entry describes one file as a representation of this dataset, so the same file can serve several datasets with different schemas. """ - manufacturer: str | None = Field( + data_format: list[DataFormat] | None = Field( None, - json_schema_extra={ - "title*": {"de": "Hersteller"}, - "description*": { - "de": "Der Hersteller dieses Gegendstandes - eine Organisation(seinheit)" - }, - "range": "Category:OSW3cb8cef2225e403092f098f99bc4c472", - }, - title="Manufacturer", + json_schema_extra={"range": "Category:OSWccac243b31f94574847861e5d9685b82"}, + min_length=1, + title="Data format", ) """ - The manufacturer of this item - an organization(al unit). + Gives a structure to define specific formats of data. """ - data_sheet: set[str] | None = Field( + dataset_schema: list[DatasetSchema] | None = Field( None, json_schema_extra={ - "title*": {"de": "Datenblatt"}, - "eval_template": { - "type": "mustache-wikitext", - "mode": "render", - "value": "{{=<% %>=}} <%={{ }}=%> {{#data_sheet}}[[:{{{.}}}]];{{/data_sheet}} {{=<% %>=}} <%={{ }}=%>", - }, + "options": {"hidden": True}, + "deprecated": True, + "description*": {"de": "Veraltet: Der Typ des Feldes data ist sein Schema"}, + "range": "Category:OSW0d6584b3e2b64e9595733c4c3963c486", }, - title="Data sheet", + title="Dataset schema", ) - safety_data_sheet: set[str] | None = Field( + """ + Deprecated: the type of the data field is its schema + """ + data: str | None = Field( None, json_schema_extra={ - "title*": {"de": "Sicherheitsdatenblatt"}, - "eval_template": { - "type": "mustache-wikitext", - "mode": "render", - "value": "{{=<% %>=}} <%={{ }}=%> {{#safety_data_sheet}}[[:{{{.}}}]];{{/safety_data_sheet}} {{=<% %>=}} <%={{ }}=%>", + "title*": {"de": "Daten"}, + "description*": { + "de": "Die Nutzdaten dieses Datensatzes. Ihr Typ ist ihr Schema, ein Unterschema schränkt sie also ein." }, }, - title="Safety data sheet", + title="Data", ) - manual: set[str] | None = Field( + """ + The payload of this dataset. Its type is its schema, so a subschema restricts it. + """ + parts: list[Dataset] | None = Field( None, - json_schema_extra={ - "title*": {"de": "Handbuch"}, - "eval_template": { - "type": "mustache-wikitext", - "mode": "render", - "value": "{{=<% %>=}} <%={{ }}=%> {{#manual}}[[:{{{.}}}]];{{/manual}} {{=<% %>=}} <%={{ }}=%>", - }, - "description*": { - "de": "Handbuch, Gerauchsanweisung, Betriebs- oder Bedienungsanleitung mit Einzelheiten zur Verwendung dieses Gegenstands." - }, + json_schema_extra={ + "title*": {"de": "Teile"}, + "description*": {"de": "Teildatensätze dieses Datensatzes"}, + "range": "Category:OSWfe72974590fd4e8ba94cd4e8366375e8", }, - title="Manual", + title="Parts", ) """ - Comprehensive guide that details how to use this item. + Sub-datasets of this dataset """ - instructions: set[str] | None = Field( + about: Entity | None = Field( None, json_schema_extra={ - "title*": {"de": "Anleitung"}, - "eval_template": { - "type": "mustache-wikitext", - "mode": "render", - "value": "{{=<% %>=}} <%={{ }}=%> {{#instructions}}[[:{{{.}}}]];{{/instructions}} {{=<% %>=}} <%={{ }}=%>", - }, + "title*": {"de": "Handelt von"}, "description*": { - "de": "Eine Liste auszuführenden Schritte, z. B. die Einrichtungsanweisungen." + "de": "Worum es in den Daten geht, z. B. die Probe oder das Gerät, von dem sie stammen" + }, + "range": "Category:Entity", + "options": { + "autocomplete": { + "$comment": "Any Item or Category", + "query": "[[Item:%2B]]OR[[:Category:%2B]]", + } }, }, - title="Instructions", + title="About", ) """ - A list of steps to be performed, e.g., the setup instructions. + What the data is about, e. g. the sample or device it was taken from + """ + generated_by: Process | None = Field( + None, + json_schema_extra={ + "title*": {"de": "Erzeugt durch"}, + "description*": {"de": "Der Prozess, der diesen Datensatz erzeugt hat"}, + "range": "Category:OSWe5aa96bffb1c4d95be7fbd46142ad203", + }, + title="Generated by", + ) + """ + The process that produced this dataset """ -class PhysicalItemType(Category): +class OrganizationalSubUnit(OrganizationalUnit): """ - Helps to create subcategories of PhysicalItem + An organizational unit that explicitly is part of a larger organizational unit. """ model_config = ConfigDict( json_schema_extra={ "@context": [ - "/wiki/Category:Category?action=raw&slot=jsonschema", - { - "constituents": { - "@type": "@id", - "@id": "Property:HasStatement", - "@context": { - "property": "Property:HasProperty", - "type": "Property:HasValue", - }, - }, - "data_sheet": {"@id": "Property:HasDataSheet", "@type": "@id"}, - "instructions": {"@id": "Property:HasInstructions", "@type": "@id"}, - "manual": {"@id": "Property:HasManual", "@type": "@id"}, - "manufacturer": {"@id": "Property:HasManufacturer", "@type": "@id"}, - "safety_data_sheet": { - "@id": "Property:HasSafetyDataSheet", - "@type": "@id", - }, - "type_no": "Property:HasTypeNumber", - }, - ], - "uuid": "ca99a9bb-9ad2-4386-b222-d18a73c2af5e", - "title": "PhysicalItemType", - "title*": {"en": "Physical Item Type"}, - "description": "Helps to create subcategories of PhysicalItem", - "description*": {"en": "Helps to create subcategories of PhysicalItem"}, - "defaultPropertis": [ - "type_no", - "manufacturer", - "data_sheet", - "safety_data_sheet", - "supply", - "specifications", + "/wiki/Category:OSW3cb8cef2225e403092f098f99bc4c472?action=raw&slot=jsonschema" ], - }, - ) - type: list[str] | None = ["Category:OSWca99a9bb9ad24386b222d18a73c2af5e"] - type_no: str | None = Field( - None, - json_schema_extra={ - "title*": {"de": "Typennummer"}, + "title": "OrganizationalSubUnit", + "title*": {"de": "Organisationsuntereinheit"}, + "description": "An organizational unit that explicitly is part of a larger organizational unit.", "description*": { - "de": "Typen- oder Modellnummer wie vom Hersteller angegeben" + "de": "Eine Organisationseinheit, die ausdrücklich Teil einer größeren Organisationseinheit ist." }, + "defaultProperties": ["superordinate_ou"], }, - title="Type number", ) + type: list[str] | None = ["Category:OSWfe3e842b804445c7bb0dd8ee61da2d70"] + + +class AdministrativeArea(Place): """ - Type or model number as specified by the manufacturer + A geographical region, typically under the jurisdiction of a particular government. """ - manufacturer: str | None = Field( - None, + + model_config = ConfigDict( json_schema_extra={ - "title*": {"de": "Hersteller"}, + "@context": [ + "/wiki/Category:OSW28f71f2c20ad48c38c4e4d190a95c0b8?action=raw&slot=jsonschema" + ], + "uuid": "137e7443-b2b9-4692-bd59-a0e0a6778b70", + "title": "AdministrativeArea", + "title*": {"en": "Administrative Area", "de": "Verwaltungsbereich"}, + "description": "A geographical region, typically under the jurisdiction of a particular government.", "description*": { - "de": "Der Hersteller dieses Gegendstandes - eine Organisation(seinheit)" + "en": "A geographical region, typically under the jurisdiction of a particular government.", + "de": "Eine geografische Region, die in der Regel unter die Zuständigkeit einer bestimmten Regierung fällt.", }, - "range": "Category:OSW3cb8cef2225e403092f098f99bc4c472", }, - title="Manufacturer", ) + type: list[str] | None = ["Category:OSW137e7443b2b94692bd59a0e0a6778b70"] + + +class Site(Location): """ - The manufacturer of this item - an organization(al unit). + A site is a location or place where a particular event, activity, or object exists or is situated. """ - data_sheet: set[str] | None = Field( - None, + + model_config = ConfigDict( json_schema_extra={ - "title*": {"de": "Datenblatt"}, - "eval_template": { - "type": "mustache-wikitext", - "mode": "render", - "value": "{{=<% %>=}} <%={{ }}=%> {{#data_sheet}}[[:{{{.}}}]];{{/data_sheet}} {{=<% %>=}} <%={{ }}=%>", + "@context": [ + "/wiki/Category:OSW3d238d05316e45a4ac95a11d7b24e36b?action=raw&slot=jsonschema" + ], + "title": "Site", + "title*": {"en": "Site", "de": "Standort"}, + "uuid": "473d7a1e-d485-44d1-be83-b258b5810948", + "description": "A site is a location or place where a particular event, activity, or object exists or is situated.", + "description*": { + "de": "Ein Standort ist ein Ort oder ein Platz, an dem ein bestimmtes Ereignis, eine Aktivität oder ein Objekt existiert oder sich befindet." }, }, - title="Data sheet", ) - safety_data_sheet: set[str] | None = Field( - None, + type: list[str] | None = ["Category:OSW473d7a1ed48544d1be83b258b5810948"] + + +class DataTerm(DefinedTerm): + model_config = ConfigDict( json_schema_extra={ - "title*": {"de": "Sicherheitsdatenblatt"}, - "eval_template": { - "type": "mustache-wikitext", - "mode": "render", - "value": "{{=<% %>=}} <%={{ }}=%> {{#safety_data_sheet}}[[:{{{.}}}]];{{/safety_data_sheet}} {{=<% %>=}} <%={{ }}=%>", - }, + "@context": [ + "/wiki/Category:OSWa5812d3b5119416c8da1606cbe7054eb?action=raw&slot=jsonschema" + ], + "title": "DataTerm", }, - title="Safety data sheet", ) - instructions: set[str] | None = Field( - None, + type: list[str] | None = ["Category:OSW34f9d66c7e1241c8b9543231526f126d"] + + +class Competence(DefinedTerm): + model_config = ConfigDict( json_schema_extra={ - "title*": {"de": "Anleitung"}, - "eval_template": { - "type": "mustache-wikitext", - "mode": "render", - "value": "{{=<% %>=}} <%={{ }}=%> {{#instructions}}[[:{{{.}}}]];{{/instructions}} {{=<% %>=}} <%={{ }}=%>", + "@context": [ + "/wiki/Category:OSWa5812d3b5119416c8da1606cbe7054eb?action=raw&slot=jsonschema" + ], + "uuid": "5eb9c52b-8045-44dc-870d-fd54ff434428", + "title": "Competence", + "title*": {"de": "Kompetenz"}, + }, + ) + type: list[str] | None = ["Category:OSW5eb9c52b804544dc870dfd54ff434428"] + + +class Topic(DefinedTerm): + model_config = ConfigDict( + json_schema_extra={ + "@context": [ + "/wiki/Category:OSWa5812d3b5119416c8da1606cbe7054eb?action=raw&slot=jsonschema" + ], + "title": "Topic", + }, + ) + type: list[str] | None = ["Category:OSW5a13eeda5ed5405ea7ef62ea6feeceec"] + + +class ProjectType(Enumeration): + model_config = ConfigDict( + json_schema_extra={ + "@context": [ + "/wiki/Category:OSWd02741381aaa4709ae0753a0edc341ce?action=raw&slot=jsonschema" + ], + "uuid": "67f2ef61-ba28-4c91-9fef-a00d0e95a7a0", + "title": "ProjectType", + "title*": {"en": "Project Type", "de": "Projekttyp"}, + "description": "", + "description*": {}, + }, + ) + type: list[str] | None = ["Category:OSW67f2ef61ba284c919fefa00d0e95a7a0"] + + +class StatusEnumeration(Enumeration): + """ + Lists or enumerations dealing with status types. + """ + + model_config = ConfigDict( + json_schema_extra={ + "@context": [ + "/wiki/Category:OSWd02741381aaa4709ae0753a0edc341ce?action=raw&slot=jsonschema" + ], + "uuid": "2c32802b-e590-4024-8c85-eda3479d484c", + "title": "StatusEnumeration", + "title*": { + "en": "Zustandsaufzählungen", + "de": "Aufzählung von Zustandsbeschreibungen", }, + "description": "Lists or enumerations dealing with status types.", "description*": { - "de": "Eine Liste auszuführenden Schritte, z. B. die Einrichtungsanweisungen." + "en": "Lists or enumerations dealing with status types.", + "de": "Listen oder Aufzählungen, die sich mit Statusarten (Zustandsarten) befassen.", }, }, - title="Instructions", ) + type: list[str] | None = ["Category:OSW2c32802be59040248c85eda3479d484c"] + + +class BudgetType(Enumeration): """ - A list of steps to be performed, e.g., the setup instructions. + Type of usage of a certain budget """ - manual: set[str] | None = Field( - None, + + model_config = ConfigDict( json_schema_extra={ - "title*": {"de": "Handbuch"}, - "eval_template": { - "type": "mustache-wikitext", - "mode": "render", - "value": "{{=<% %>=}} <%={{ }}=%> {{#manual}}[[:{{{.}}}]];{{/manual}} {{=<% %>=}} <%={{ }}=%>", - }, + "@context": [ + "/wiki/Category:OSWd02741381aaa4709ae0753a0edc341ce?action=raw&slot=jsonschema" + ], + "uuid": "595b282a-edf0-4878-8f3e-e326454792ce", + "title": "BudgetType", + "title*": {"en": "Budget Type", "de": "Budget-Typ"}, + "description": "Type of usage of a certain budget", "description*": { - "de": "Handbuch, Gerauchsanweisung, Betriebs- oder Bedienungsanleitung mit Einzelheiten zur Verwendung dieses Gegenstands." + "en": "Type of usage of a certain budget", + "de": "Art der Verwendung eines bestimmten Budgets", }, }, - title="Manual", ) + type: list[str] | None = ["Category:OSW595b282aedf048788f3ee326454792ce"] + + +class Country(AdministrativeArea): """ - Comprehensive guide that details how to use this item. + A distinct part of the world, such as a state, nation, or other political entity """ - supply: list[Supply] | None = Field( - None, + + model_config = ConfigDict( json_schema_extra={ - "title*": {"de": "Bezugsmöglichkeit"}, + "@context": [ + "/wiki/Category:OSW137e7443b2b94692bd59a0e0a6778b70?action=raw&slot=jsonschema" + ], + "uuid": "0551abcd-6f73-4047-825e-3ded4c8a0ffe", + "title": "Country", + "title*": {"en": "Country", "de": "Land"}, + "description": "A distinct part of the world, such as a state, nation, or other political entity", "description*": { - "de": "Bezugsmöglichkeit des Materials mit Lieferant, Artikelnummer und Link" + "en": "A distinct part of the world, such as a state, nation, or other political entity", + "de": "Ein bestimmter Teil der Welt, z. B. ein Staat, eine Nation oder eine andere politische Einheit", }, }, - title="Supply", - ) - """ - Supply of the material with supplier, article no. and link - """ - specifications: list[Attribute] | None = Field( - None, - json_schema_extra={"title*": {"de": "Spezifikation technischer Eigenschaften"}}, - title="Specification of technical properties", - ) - constituents: list[Constituent] | None = Field( - None, json_schema_extra={"title*": {"de": "Bestandteile"}}, title="Constituents" ) - """ - Components or parts - """ + type: list[str] | None = ["Category:OSW0551abcd6f734047825e3ded4c8a0ffe"] -class Material(PhysicalItem): +class State(AdministrativeArea): """ - Contains chemical substances and engineered matterials / parts + A state or province of a country. """ model_config = ConfigDict( json_schema_extra={ "@context": [ - "/wiki/Category:OSW37a57741ae2e4dd4b29b1172b6848be8?action=raw&slot=jsonschema" + "/wiki/Category:OSW137e7443b2b94692bd59a0e0a6778b70?action=raw&slot=jsonschema" ], - "uuid": "31ca9a73-9cb2-4079-b368-24045c0832aa", - "title": "Material", - "title*": {"en": "Material", "de": "Material"}, - "description": "Contains chemical substances and engineered matterials / parts", + "uuid": "ab60f9a2-2795-4ee0-be92-344ff6272420", + "title": "State", + "title*": {"en": "State", "de": "Staat"}, + "description": "A state or province of a country.", "description*": { - "en": "Contains chemical substances and engineered matterials / parts", - "de": "Enthält chemische Stoffe, Materialien und Bauteile", + "en": "A state or province of a country.", + "de": "Ein Staat oder eine Provinz eines Landes.", }, }, ) - type: list[str] | None = ["Category:OSW31ca9a739cb24079b36824045c0832aa"] + type: list[str] | None = ["Category:OSWab60f9a227954ee0be92344ff6272420"] -class DeviceType(PhysicalItemType): +class Region(AdministrativeArea): + model_config = ConfigDict( + json_schema_extra={ + "@context": [ + "/wiki/Category:OSW137e7443b2b94692bd59a0e0a6778b70?action=raw&slot=jsonschema" + ], + "uuid": "95efaf34-e2c7-439e-8e79-67233910e44b", + "title": "Region", + "title*": {"en": "Region", "de": "Region"}, + "description": "", + "description*": {}, + }, + ) + type: list[str] | None = ["Category:OSW95efaf34e2c7439e8e7967233910e44b"] + + +class City(AdministrativeArea): """ - Helps Creating DeviceCategories + A city or town. """ model_config = ConfigDict( json_schema_extra={ "@context": [ - "/wiki/Category:OSWca99a9bb9ad24386b222d18a73c2af5e?action=raw&slot=jsonschema", - { - "purpose": {"@id": "Property:HasPurpose", "@type": "@id"}, - "typical_processes": { - "@id": "Property:HasTypicalProcess", - "@type": "@id", - }, - }, + "/wiki/Category:OSW137e7443b2b94692bd59a0e0a6778b70?action=raw&slot=jsonschema" ], - "uuid": "d845b968-13a3-4445-8f14-0e48c4d063fd", - "title": "DeviceType", - "title*": {"en": "Device Type"}, - "description": "Helps Creating DeviceCategories", - "description*": {"en": "Helps Creating DeviceCategories"}, - "defaultProperties": ["manufacturer", "typical_processes", "manual"], + "uuid": "807f1da5-b42e-42f2-96b2-13ab06ca873b", + "title": "City", + "title*": {"en": "Stadt"}, + "description": "A city or town.", + "description*": { + "en": "A city or town.", + "de": "Eine Stadt oder ein Ort, im Sinne einer Gemeinde", + }, }, ) - type: list[str] | None = ["Category:OSWd845b96813a344458f140e48c4d063fd"] - typical_processes: list[str] | None = Field( - None, - json_schema_extra={"title*": {"de": "Typische Prozesse"}}, - title="Typical Processes", + type: list[str] | None = ["Category:OSW807f1da5b42e42f296b213ab06ca873b"] + + +class DataFormat(DataTerm): + model_config = ConfigDict( + json_schema_extra={ + "defaultProperties": [ + "specification", + "description", + "label", + "short_name", + ], + "title": "DataFormat", + }, ) - manufacturer_type_id: str | None = Field( + specification: str | None = Field( None, json_schema_extra={ - "title*": {"de": "Hersteller Typen-ID"}, - "description*": {"de": "Produkt-ID des Herstellers."}, + "title*": {"de": "Spezifikation"}, + "description*": {"de": "Entweder Text oder Link"}, }, - title="Manufacturer Type ID", + title="Specification", ) """ - Product ID provided by the manufacturer + Either text or link """ - manufacturer_type_name: str | None = Field( - None, + type: list[str] | None = ["Category:OSWccac243b31f94574847861e5d9685b82"] + + +class ProjectStatus(StatusEnumeration): + """ + Status for projects and project applications + """ + + model_config = ConfigDict( json_schema_extra={ - "title*": {"de": "Hersteller Typenbezeichnung"}, + "@context": [ + "/wiki/Category:OSW2c32802be59040248c85eda3479d484c?action=raw&slot=jsonschema" + ], + "uuid": "490e38f9-764f-4408-a244-869a0ea98e7c", + "title": "ProjectStatus", + "title*": { + "en": "Project (Application) Status", + "de": "Projekt(antrags)status", + }, + "description": "Status for projects and project applications", "description*": { - "de": "Produktname des Herstellers. Oftmals ein einfacherer Alias neben der Typen-ID" + "en": "Status for projects and project applications", + "de": "Status für Projekte und Projektanträge", }, }, - title="Manufacturer Type Name", ) - """ - Product name provided by the manufacturer. Often more human friendly than the type id. - """ + type: list[str] | None = ["Category:OSW490e38f9764f4408a244869a0ea98e7c"] # generated by datamodel-codegen: -# filename: OSWf0fe562f422d49c6877490b3dfee2f3f.json +# filename: OSW0d6584b3e2b64e9595733c4c3963c486.json -class Status(str, Enum): - Item_OSWaa8d29404288446a9f3ec7afa4e2a512 = ( - "Item:OSWaa8d29404288446a9f3ec7afa4e2a512" - ) - """ - To do - """ - Item_OSWa2b4567ad4874ea1b9adfed19a3d06d1 = ( - "Item:OSWa2b4567ad4874ea1b9adfed19a3d06d1" - ) +# generated by datamodel-codegen: +# filename: OSWafcac83979f4472298b6acdc01981728.json + + +class DigitalDocument(CreativeWork): """ - In work + An electronic file or document. """ - Item_OSWf474ec34b7df451ea8356134241aef8a = ( - "Item:OSWf474ec34b7df451ea8356134241aef8a" + + model_config = ConfigDict( + json_schema_extra={ + "@context": [ + "/wiki/Category:OSW712583f2479944deb2546b77cf860dda?action=raw&slot=jsonschema" + ], + "uuid": "afcac839-79f4-4722-98b6-acdc01981728", + "title": "DigitalDocument", + "title*": {"en": "Digital document"}, + "description": "An electronic file or document.", + "description*": {"en": "An electronic file or document."}, + }, ) - """ - Done - """ + type: list[str] | None = ["Category:OSWafcac83979f4472298b6acdc01981728"] -class ProjectTypeDeprecated(str, Enum): - """ - Replaced with Project / Funding Type - """ +# generated by datamodel-codegen: +# filename: OSW34f9d66c7e1241c8b9543231526f126d.json - house_project = "house_project" - """ - House project - """ - internal = "internal" - """ - Internal - """ - public = "public" - """ - Public - """ - industry = "industry" - """ - Industry - """ +# generated by datamodel-codegen: +# filename: OSWccac243b31f94574847861e5d9685b82.json + + +# generated by datamodel-codegen: +# filename: OSW3d238d05316e45a4ac95a11d7b24e36b.json + + +# generated by datamodel-codegen: +# filename: OSW28f71f2c20ad48c38c4e4d190a95c0b8.json + + +# generated by datamodel-codegen: +# filename: OSW473d7a1ed48544d1be83b258b5810948.json + + +# generated by datamodel-codegen: +# filename: OSW4bcd4a99a73f482ea40ac4210dfab836.json -class ProbabilityOfSuccessfulFundingInPercent(Quantity): - """ - Indicates the likelihood that the funding will be approved, determines the weighted budget - """ +class BuildingFunction(Item): + model_config = ConfigDict( + json_schema_extra={"title": "BuildingFunction"}, + ) + type: list[str] | None = ["Category:OSW07a0faef5be94b788514a2dd5dca20bf"] + + +class AreaUsageType(Item): model_config = ConfigDict( json_schema_extra={ - "title": "Probability of Successful Funding in percent", - "title*": { - "de": "Wahrscheinlichkeit einer erfolgreichen Förderung in Prozent" - }, - "description": "Indicates the likelihood that the funding will be approved, determines the weighted budget", - "description*": { - "de": "Gibt die Wahrscheinlichkeit an, dass die Förderung genehmigt wird, bestimmt das gewichtete Budget" - }, + "title": "AreaUsageType", + "@context": [{"din277_label": "Property:HasDin277Label"}], }, ) - quantity: str | None = Field( - "Property:HasProbabilityOfSuccessfulFunding", - json_schema_extra={"options": {"hidden": True}}, - ) - unit: str | None = Field( - "Property:HasDimensionlessRatio#OSW8b3dc9b793074afc8ab8b03041f97f16", - json_schema_extra={"readOnly": True}, + din277_label: list[str] | None = Field( + None, + json_schema_extra={ + "title*": {"de": "DIN 277 Bezeichnung"}, + "desciption": "Label according to DIN 277", + "description*": {"de": "Bezeichnung nach DIN 277"}, + }, + title="DIN 277 label", ) + type: list[str] | None = ["Category:OSWae92be81cdb34d22844d4791ef790d93"] -class TotalBudget(Quantity): +class RoomUsage(Item): model_config = ConfigDict( - json_schema_extra={"title": "Total Budget", "title*": {"de": "Budgetsumme"}}, - ) - quantity: str | None = Field( - "Property:HasBudget", json_schema_extra={"options": {"hidden": True}} + json_schema_extra={ + "title": "RoomUsage", + "@context": [{"din277_label": "Property:HasDin277Label"}], + }, ) - unit: str | None = Field( - None, json_schema_extra={"title*": {"de": "Währung"}}, title="Currency" + din277_label: list[str] | None = Field( + None, + json_schema_extra={ + "title*": {"de": "DIN 277 Bezeichnung"}, + "desciption": "Label according to DIN 277", + "description*": {"de": "Bezeichnung nach DIN 277"}, + }, + title="DIN 277 label", ) + type: list[str] | None = ["Category:OSWac9f0e49d8024804bd7d77058322a3fe"] -class YearlyBudgetSum(Quantity): +class Building(Location): model_config = ConfigDict( json_schema_extra={ - "title": "Yearly Budget Sum", - "title*": {"de": "Summe Jahresbudget"}, - "options": { - "disable_collapse": True, - "disable_properties": True, - "compact": True, + "@context": [ + { + "area": {"@id": "schema:floorSize", "@type": "@id"}, + "area*": {"@id": "Property:HasArea", "@type": "xsd:float"}, + "construction_year": { + "@id": "schema:yearBuilt", + "@type": "xsd:integer", + }, + "construction_year*": { + "@id": "Property:HasConstructionYear", + "@type": "xsd:integer", + }, + "footprint": {"@id": "Property:HasFootprint", "@type": "xsd:float"}, + "function": {"@id": "Property:HasBuildingFunction", "@type": "@id"}, + "height": {"@id": "schema:height", "@type": "xsd:float"}, + "height*": {"@id": "Property:HasHeight", "@type": "xsd:float"}, + "length": {"@id": "Property:HasLength", "@type": "xsd:float"}, + "located_in": {"@id": "schema:containedInPlace", "@type": "@id"}, + "located_in*": {"@id": "Property:IsLocatedIn", "@type": "@id"}, + "responsible_person": { + "@id": "Property:HasResponsiblePerson", + "@type": "@id", + }, + "width": {"@id": "schema:width", "@type": "xsd:float"}, + "width*": {"@id": "Property:HasWidth", "@type": "xsd:float"}, + }, + "/wiki/Category:OSW3d238d05316e45a4ac95a11d7b24e36b?action=raw&slot=jsonschema", + ], + "title": "Building", + "title*": {"en": "Building", "de": "Gebäude"}, + }, + ) + type: list[str] | None = ["Category:OSW4bcd4a99a73f482ea40ac4210dfab836"] + located_in: set[Site] | None = Field( + None, + json_schema_extra={ + "title*": {"en": "Site", "de": "Standort"}, + "range": "Category:OSW473d7a1ed48544d1be83b258b5810948", + }, + title="Site", + ) + construction_year: float | None = Field( + None, + json_schema_extra={ + "title*": {"de": "Baujahr", "en": "Construction year"}, + "description*": { + "de": "Das Jahr, in dem der Bau abgeschlossen wurde.", + "en": "The year in which the construction was completed.", }, }, + title="Construction year", ) - quantity: str | None = Field( - "Property:HasBudget", json_schema_extra={"options": {"hidden": True}} + """ + The year in which the construction was completed. + """ + length: float | None = Field( + None, + json_schema_extra={"title*": {"de": "Länge", "en": "Length"}}, + title="Length", ) - numerical_value: str | None = Field( - None, json_schema_extra={"options": {"grid_columns": 6}} + width: float | None = Field( + None, + json_schema_extra={"title*": {"de": "Breite", "en": "Width"}}, + title="Width", ) - unit: str | None = Field( + height: float | None = Field( + None, + json_schema_extra={"title*": {"de": "Höhe", "en": "Height"}}, + title="Height", + ) + footprint: float | None = Field( + None, + json_schema_extra={"title*": {"de": "Grundfläche", "en": "Area at base level"}}, + title="Area at base level", + ) + area: float | None = Field( + None, + json_schema_extra={"title*": {"de": "Gesamtfläche", "en": "Total floor area"}}, + title="Total floor area", + ) + function: set[BuildingFunction] | None = Field( None, json_schema_extra={ - "title*": {"de": "Währung"}, - "propertyOrder": 1001, - "options": {"grid_columns": 6}, + "title*": {"en": "Building function", "de": "Gebäudefunktion"}, + "range": "Category:OSW07a0faef5be94b788514a2dd5dca20bf", }, - title="Currency", + title="Building function", + ) + responsible_person: set[User] | None = Field( + None, + json_schema_extra={ + "title*": {"de": "Verantwortliche Person", "en": "Responsible person"}, + "range": "Category:OSWd9aa0bca9b0040d8af6f5c091bf9eec7", + }, + title="Responsible person", ) -class WeightedSum(OswBaseModel): +class Room(Location): model_config = ConfigDict( json_schema_extra={ - "title": "weighted sum", - "title*": {"de": "Gewichtete Summe"}, - "_description": "weighted with probability of successful funding", - "_description*": {"de": "gewichtet mit Erfolgswahrscheinlichkeit"}, - "options": { - "disable_collapse": True, - "disable_properties": True, - "compact": True, - }, + "@context": [ + { + "area": {"@id": "schema:floorSize", "@type": "xsd:float"}, + "area*": {"@id": "Property:HasArea", "@type": "xsd:float"}, + "construction_year": { + "@id": "schema:yearBuilt", + "@type": "xsd:integer", + }, + "construction_year*": { + "@id": "Property:HasConstructionYear", + "@type": "xsd:integer", + }, + "door_height": { + "@id": "Property:HasDoorHeight", + "@type": "xsd:float", + }, + "door_width": { + "@id": "Property:HasDoorWidth", + "@type": "xsd:float", + }, + "height": {"@id": "schema:height", "@type": "xsd:float"}, + "height*": {"@id": "Property:HasHeight", "@type": "xsd:float"}, + "length": {"@id": "Property:HasLength", "@type": "xsd:float"}, + "located_in": {"@id": "schema:containedInPlace", "@type": "@id"}, + "located_in*": {"@id": "Property:IsLocatedIn", "@type": "@id"}, + "number": {"@id": "Property:HasRoomNumber", "@type": "xsd:string"}, + "responsible_person": { + "@id": "Property:HasResponsiblePerson", + "@type": "@id", + }, + "usage": {"@id": "Property:HasRoomUsage", "@type": "@id"}, + "usage_type": {"@id": "Property:HasRoomUsageType", "@type": "@id"}, + "width": {"@id": "schema:width", "@type": "xsd:float"}, + "width*": {"@id": "Property:HasWidth", "@type": "xsd:float"}, + }, + "/wiki/Category:OSW3d238d05316e45a4ac95a11d7b24e36b?action=raw&slot=jsonschema", + ], + "title": "Room", + "uuid": "c5ed0ed1-e33c-4b31-887c-67af25a610c1", + "title*": {"en": "Room", "de": "Raum"}, + "description": "", + "description*": {}, }, ) - uuid: UUID = Field( - ..., json_schema_extra={"options": {"hidden": True}}, title="UUID" - ) - quantity: str | None = Field( - "Property:HasWeightedBudget", json_schema_extra={"options": {"hidden": True}} - ) - numerical_value: str = Field( - ..., + type: list[str] | None = ["Category:OSWc5ed0ed1e33c4b31887c67af25a610c1"] + located_in: set[Floor] | None = Field( + None, json_schema_extra={ - "_format": "template", - "options": { - "grid_columns": 12, - "hidden": True, - "dynamic_template": {"override": "always"}, - }, - "watch": { - "probability_of_successful_funding": "probability_of_successful_funding.numerical_value", - "yearly_budget_sum_value": "yearly_budget.yearly_budget_sum.numerical_value", - }, - "dynamic_template": "{{#calc 0.01 '*'}}{{#calc probability_of_successful_funding '*'}}{{yearly_budget_sum_value}}{{/calc}}{{/calc}}", + "title*": {"de": "Stockwerk", "en": "Floor"}, + "range": "Category:OSW6c4212f1a39342be963d2b9efd19c5c2", }, + title="Floor", ) - value: str = Field( - ..., + usage_type: set[AreaUsageType] | None = Field( + None, json_schema_extra={ - "_format": "template", - "options": {"grid_columns": 12, "hidden": False}, - "_watch": { - "probability_of_successful_funding": "probability_of_successful_funding.numerical_value", - "yearly_budget_sum_value": "yearly_budget.yearly_budget_sum.numerical_value", - "yearly_budget_sum_unit_symbol": "yearly_budget.yearly_budget_sum.unit_symbol", - }, - "watch": { - "numerical_value": "statement.numerical_value", - "unit_symbol": "statement.unit_symbol", - }, - "template": "{{{numerical_value}}} {{{unit_symbol}}}", + "title*": {"en": "Room usage type", "de": "Raumnutzungsart"}, + "range": "Category:OSWae92be81cdb34d22844d4791ef790d93", }, - title="Wert", + title="Room usage type", + ) + length: float | None = Field( + None, + json_schema_extra={"title*": {"de": "Länge", "en": "Length"}}, + title="Length", + ) + width: float | None = Field( + None, + json_schema_extra={"title*": {"de": "Breite", "en": "Width"}}, + title="Width", + ) + height: float | None = Field( + None, + json_schema_extra={"title*": {"de": "Höhe", "en": "Height"}}, + title="Height", + ) + area: float | None = Field( + None, json_schema_extra={"title*": {"de": "Fläche", "en": "Area"}}, title="Area" + ) + door_width: float | None = Field( + None, + json_schema_extra={"title*": {"de": "Türbreite", "en": "Door width"}}, + title="Door width", + ) + door_height: float | None = Field( + None, + json_schema_extra={"title*": {"de": "Türhöhe", "en": "Door height"}}, + title="Door height", + ) + number: str | None = Field( + None, + json_schema_extra={"title*": {"en": "Number", "de": "Nummer"}}, + title="Number", ) - unit: str = Field( - ..., + usage: set[RoomUsage] | None = Field( + None, json_schema_extra={ - "title*": {"de": "Währung"}, - "_format": "template", - "propertyOrder": 1001, - "options": {"grid_columns": 6, "hidden": True}, - "watch": {"yearly_budget_sum_unit": "yearly_budget.yearly_budget_sum.unit"}, - "template": "{{yearly_budget_sum_unit}}", + "title*": {"en": "Room usage", "de": "Raumnutzung"}, + "range": "Category:OSWac9f0e49d8024804bd7d77058322a3fe", }, - title="Currency", + title="Room usage", ) - unit_symbol: str = Field( - ..., + responsible_person: set[User] | None = Field( + None, json_schema_extra={ - "watch": { - "yearly_budget_sum_unit_symbol": "yearly_budget.yearly_budget_sum.unit_symbol" - }, - "template": "{{yearly_budget_sum_unit_symbol}}", - "options": {"grid_columns": 6, "hidden": True}, + "title*": {"de": "Verantwortliche Person", "en": "Responsible person"}, + "range": "Category:OSWd9aa0bca9b0040d8af6f5c091bf9eec7", }, + title="Responsible person", ) -class Component(OswBaseModel): +class Floor(Location): model_config = ConfigDict( json_schema_extra={ - "title": "Component", - "title*": {"de": "Komponente"}, - "headerTemplate": "{{ i1 }} - {{ self.component_id }}", - "defaultProperties": [], + "@context": [ + { + "located_in": {"@id": "schema:containedInPlace", "@type": "@id"}, + "located_in*": {"@id": "Property:IsLocatedIn", "@type": "@id"}, + }, + "/wiki/Category:OSW3d238d05316e45a4ac95a11d7b24e36b?action=raw&slot=jsonschema", + ], + "title": "Floor", }, ) - uuid: UUID = Field( - ..., + type: list[str] | None = ["Category:OSW6c4212f1a39342be963d2b9efd19c5c2"] + located_in: set[Building] | None = Field( + None, json_schema_extra={ - "title*": {"de": "UUID"}, - "$comment": "format uuid field are copied, if not set in copy_ignore", - "_template": "dynamic_template", - "dynamic_template": "{{_uuid_}}", - "options": {"hidden": True, "dynamic_template": {"override": "empty"}}, + "title*": {"en": "Building", "de": "Gebäude"}, + "range": "Category:OSW4bcd4a99a73f482ea40ac4210dfab836", }, - title="UUID", + title="Building", ) - component_id: str = Field( - ..., + + +class User(Person, UserAccount): + """ + A person who has a user ID. + """ + + model_config = ConfigDict( json_schema_extra={ - "$comment": "Will be used as a visual reference for the user", - "title*": {"de": "ID"}, - "description*": {"de": "Wird automatisch generiert"}, - "dynamic_template": "Component{{patternformat '00' _array_index_}}", - "readOnly": True, - "options": { - "hidden": True, - "dynamic_template": {"override": "always"}, - "grid_columns": 6, - }, - "propertyOrder": 10, + "@context": [ + "/wiki/Category:OSW44deaa5b806d41a2a88594f562b110e9?action=raw&slot=jsonschema", + "/wiki/Category:OSW8b3e627eb76b46d68fce3a12ff220c8e?action=raw&slot=jsonschema", + { + "employment_contract_status": { + "@id": "Property:HasEmploymentContractStatus", + "@type": "@id", + }, + "room": {"@id": "Property:HasRoom", "@type": "@id"}, + "superior": {"@id": "Property:HasSuperior", "@type": "@id"}, + }, + ], + "title": "User", + "title*": {"de": "Nutzer"}, + "uuid": "d9aa0bca-9b00-40d8-af6f-5c091bf9eec7", + "description": "A person who has a user ID.", + "description*": {"de": "Eine Person mit Nutzerkennung"}, }, - title="ID", ) - """ - Automatically generated - """ - label: list[Label] | None = Field( + room: set[Room] | None = Field( None, json_schema_extra={ - "title*": {"de": "Bezeichnung"}, - "description*": { - "de": "Bezeichnung der Funktion oder Rolle der Komponente in diesem spezifischen Kontext." - }, - "eval_template": { - "type": "mustache-wikitext", - "mode": "render", - "value": "{{=<% %>=}} {{#switch:{{USERLANGUAGECODE}} <%={{ }}=%> {{#label}} |{{lang}}={{text}} {{/label}} {{=<% %>=}} }}", - }, - "options": {"grid_columns": 12}, - "propertyOrder": 20, + "title*": {"de": "Raum"}, + "description*": {"de": "Büro"}, + "range": "Category:OSWc5ed0ed1e33c4b31887c67af25a610c1", }, - title="Label", + title="Room(s)", ) """ - Designation of the function or role of the component in this specific context. + Office """ - description: list[Description] | None = Field( + superior: set[User] | None = Field( None, json_schema_extra={ - "title*": {"de": "Beschreibung"}, - "description*": { - "de": "Optional, zusätzliche Angaben zur Rolle oder Funktion der Komponente in diesem spezifischen Kontext." - }, - "eval_template": { - "type": "mustache-wikitext", - "mode": "render", - "value": "{{=<% %>=}} {{#switch:{{USERLANGUAGECODE}} <%={{ }}=%> {{#description}} |{{lang}}={{text}} {{/description}} {{=<% %>=}} }}", - }, - "options": {"grid_columns": 12}, - "propertyOrder": 30, + "title*": {"de": "Führungsperson(en)"}, + "description*": {"de": "Direkte Führungsperson(en)"}, + "range": "Category:OSWd9aa0bca9b0040d8af6f5c091bf9eec7", }, - title="Description", + title="Superior(s)", ) """ - Optional, additional details on the role or function of the component in this specific context. + Direct superior(s) """ - component_type: Category | None = Field( - default_factory=lambda: Category.model_validate( - "Category:OSWe427aafafbac4262955b9f690a83405d" + employment_contract_status: EmploymentStatus | None = Field( + default_factory=lambda: EmploymentStatus.model_validate( + "Item:OSW62770459451644f3841c502df8a5cb1d" ), json_schema_extra={ - "title*": {"de": "Typ der Komponente"}, - "range": "Category:Category", - "options": { - "autocomplete": { - "$comment": "Tool", - "query": "[[:Category:OSWe427aafafbac4262955b9f690a83405d]]OR[[SubClassOf::Category:OSWe427aafafbac4262955b9f690a83405d]]OR[[SubClassOf.SubClassOf::Category:OSWe427aafafbac4262955b9f690a83405d]]OR[[SubClassOf.SubClassOf.SubClassOf::Category:OSWe427aafafbac4262955b9f690a83405d]]OR[[SubClassOf.SubClassOf.SubClassOf.SubClassOf::Category:OSWe427aafafbac4262955b9f690a83405d]]OR[[SubClassOf.SubClassOf.SubClassOf.SubClassOf.SubClassOf::Category:OSWe427aafafbac4262955b9f690a83405d]]", - }, - "grid_columns": 12, - }, - "propertyOrder": 40, - "x-oold-required-iri": True, - }, - title="Component type", - ) - component_instance_property: str | None = Field( - "Property:HasPart", json_schema_extra={"options": {"hidden": True}} - ) - component_instance: Tool | None = Field( - None, - json_schema_extra={ - "title*": {"de": "Instanz"}, - "range": "Category:OSWe427aafafbac4262955b9f690a83405d", - "watch": {"component_type_": "component.component_type"}, - "options": { - "autocomplete": { - "query": "[[HasType::$(component_type_)]]|?Display_title_of=label|?HasImage=image|?HasDescription=description" - }, - "grid_columns": 12, + "title*": {"de": "Status des Arbeitsvertrages"}, + "description*": { + "de": "Gibt an, ob ein Nutzer einen aktiven Arbeitsvertrag hat (noch beschäftigt ist) oder nicht" }, - "propertyOrder": 50, - "x-oold-required-iri": True, + "range": "Category:OSW781ad17c7eef4161ade5a7b690aca6b5", }, - title="Instance", + title="Status of the employment contract", ) + """ + Whether a user has an active employment contract (stil employed) or not + """ + type: list[str] | None = ["Category:OSWd9aa0bca9b0040d8af6f5c091bf9eec7"] -class InitialOccupantOfTheSlot(OswBaseModel): +class EmploymentStatus(StatusEnumeration): """ - Tool or component installed in the slot. + Describes the status of an employment (contract) """ model_config = ConfigDict( json_schema_extra={ - "title": "Initial occupant of the slot", - "title*": {"de": "Initiale Belegung des Slots"}, - "description": "Tool or component installed in the slot.", - "description*": {"de": "Im Slot installiertes Werkzeug oder Komponente."}, - "defaultProperties": ["slot_occupant_type"], - "options": {"grid_columns": 12}, - "propertyOrder": 60, - }, - ) - slot_occupant_type: Category | None = Field( - None, - json_schema_extra={ - "title*": {"de": "Typ"}, - "range": "Category:Category", - "watch": {"slot_type": "slot.slot_type_restriction"}, - "options": { - "autocomplete": { - "$comment": "Tool", - "query": "[[:$(slot_type)]]OR[[SubClassOf::$(slot_type)]]OR[[SubClassOf.SubClassOf::$(slot_type)]]OR[[SubClassOf.SubClassOf.SubClassOf::$(slot_type)]]OR[[SubClassOf.SubClassOf.SubClassOf.SubClassOf::$(slot_type)]]OR[[SubClassOf.SubClassOf.SubClassOf.SubClassOf.SubClassOf::$(slot_type)]]", - } + "@context": [ + "/wiki/Category:OSW2c32802be59040248c85eda3479d484c?action=raw&slot=jsonschema" + ], + "uuid": "781ad17c-7eef-4161-ade5-a7b690aca6b5", + "title": "EmploymentStatus", + "title*": { + "en": "Employment status", + "de": "Status des Beschäftigungsverhältnisses", + }, + "description": "Describes the status of an employment (contract)", + "description*": { + "en": "Describes the status of an employment (contract)", + "de": "Beschreibt den Status eines Arbeitsverhältnisses(vertrages)", }, - "propertyOrder": 11, }, - title="Type", ) - slot_occupant_instance_property: str | None = Field( - "Property:HasOccupant", json_schema_extra={"options": {"hidden": True}} + type: list[str] | None = ["Category:OSW781ad17c7eef4161ade5a7b690aca6b5"] + + +# generated by datamodel-codegen: +# filename: OSW6c4212f1a39342be963d2b9efd19c5c2.json + + +# generated by datamodel-codegen: +# filename: OSWc5ed0ed1e33c4b31887c67af25a610c1.json + + +# generated by datamodel-codegen: +# filename: OSW137e7443b2b94692bd59a0e0a6778b70.json + + +# generated by datamodel-codegen: +# filename: OSW0551abcd6f734047825e3ded4c8a0ffe.json + + +# generated by datamodel-codegen: +# filename: OSWab60f9a227954ee0be92344ff6272420.json + + +# generated by datamodel-codegen: +# filename: OSW807f1da5b42e42f296b213ab06ca873b.json + + +# generated by datamodel-codegen: +# filename: OSW95efaf34e2c7439e8e7967233910e44b.json + + +# generated by datamodel-codegen: +# filename: OSWd845b96813a344458f140e48c4d063fd.json + + +class Supply(OswBaseModel): + model_config = ConfigDict( + json_schema_extra={"title": "Supply", "title*": {"de": "Bezugsmöglichkeit"}}, ) - slot_occupant_instance: Tool | None = Field( + supplier: str | None = Field( None, json_schema_extra={ - "title*": {"de": "Instanz"}, - "range": "Category:OSWe427aafafbac4262955b9f690a83405d", - "watch": {"slot_occupant_type_": "slot_occupant.slot_occupant_type"}, + "title*": {"de": "Lieferant"}, "options": { "autocomplete": { - "query": "[[HasType::$(slot_occupant_type_)]]|?Display_title_of=label|?HasImage=image|?HasDescription=description" + "category": "Category:OSW3cb8cef2225e403092f098f99bc4c472" } }, - "propertyOrder": 21, - "x-oold-required-iri": True, - }, - title="Instance", - ) - - -class Slot(OswBaseModel): - model_config = ConfigDict( - json_schema_extra={ - "title": "Slot", - "title*": {"de": "Slot"}, - "headerTemplate": "{{ i1 }} - {{ self.slot_id }}", - "defaultProperties": ["name", "description", "slot_occupant"], - }, - ) - uuid: str = Field( - ..., - json_schema_extra={ - "title*": {"de": "UUID"}, - "$comment": "format uuid field are copied, if not set in copy_ignore", - "_format": "uuid", - "_template": "dynamic_template", - "dynamic_template": "{{_uuid_}}", - "options": {"hidden": True, "dynamic_template": {"override": "empty"}}, }, - title="UUID", + title="Supplier", ) - slot_osw_id: str = Field( - ..., + article_no: str | None = Field( + None, json_schema_extra={ - "$comment": "Will be used an unique reference for slot exchange events.", - "title*": {"de": "OSW-ID"}, - "watch": {"_own_uuid": "slot.uuid"}, - "_format": "dynamic_template", - "dynamic_template": "{{_current_subject_}}#OSW{{#replace '-' ''}}{{_own_uuid}}{{/replace}}", - "readOnly": True, - "options": {"hidden": True, "dynamic_template": {"override": "empty"}}, + "title*": {"de": "Artikelnummer"}, + "description*": {"de": "Artikelnummer im Katalog des Lieferanten"}, }, - title="OSW-ID", + title="Article no.", ) - slot_id: str = Field( - ..., + """ + Article number in the catalogue of the supplier + """ + comment: str | None = Field( + None, json_schema_extra={ - "$comment": "Will be used as a visual reference for the user", - "title*": {"de": "ID"}, - "description*": {"de": "Wird automatisch generiert"}, - "dynamic_template": "Slot{{patternformat '00' _array_index_}}", - "readOnly": True, - "options": { - "hidden": True, - "dynamic_template": {"override": "always"}, - "grid_columns": 6, + "title*": {"de": "Kommentar"}, + "description*": { + "de": "Kommentar bezüglich der Bezugsmöglichkeit des Materials" }, - "propertyOrder": 10, }, - title="ID", + title="Comment", ) """ - Automatically generated + Comment on the supply of the material """ - name: str | None = Field( + link: AnyUrl | None = Field( None, json_schema_extra={ - "title*": {"de": "Name"}, - "options": {"grid_columns": 6}, - "propertyOrder": 20, + "title*": {"de": "Link"}, + "description*": { + "de": "Link zum Artikel im Online-Katalog des Lieferanten" + }, }, - title="Name", + title="Link", ) - description: list[Description] | None = Field( - None, + """ + Link to the article in the online catalogue of the supplier + """ + + +class Attribute(OswBaseModel): + model_config = ConfigDict( json_schema_extra={ - "title*": {"de": "Beschreibung"}, - "eval_template": { - "type": "mustache-wikitext", - "mode": "render", - "value": "{{=<% %>=}} {{#switch:{{USERLANGUAGECODE}} <%={{ }}=%> {{#description}} |{{lang}}={{text}} {{/description}} {{=<% %>=}} }}", - }, - "options": {"grid_columns": 12}, - "propertyOrder": 30, + "title": "Attribute", + "title*": {"de": "Attribut"}, + "headerTemplate": "{{i1}} - {{self.name}}", }, - title="Description", ) - slot_init_date_time: AwareDatetime = Field( - ..., + attribute_name: list[Label] = Field(..., min_length=1, title="Name") + quantity_prop: Quantity + + +class Constituent(OswBaseModel): + model_config = ConfigDict( json_schema_extra={ - "title*": {"de": "Datum der Slot-Initialisierung"}, - "dynamic_template": "{{_now_}}", - "options": {"dynamic_template": {"override": "empty"}, "grid_columns": 4}, - "propertyOrder": 21, + "title": "Constituent", + "title*": {"de": "Bestandteil"}, + "headerTemplate": "{{i1}} - {{self.name}}", }, - title="Date of slot initialization", ) - slot_type_restriction: Category | None = Field( - default_factory=lambda: Category.model_validate( - "Category:OSWe427aafafbac4262955b9f690a83405d" - ), + uuid: UUID = Field( + ..., json_schema_extra={"options": {"hidden": True}}, title="UUID" + ) + property: str | None = Field( + "Property:HasPart", json_schema_extra={"options": {"hidden": True}} + ) + is_array: bool | None = Field(None, title="Is array") + name: str = Field(..., title="Name") + type: Material | None = Field( + None, json_schema_extra={ - "title*": {"de": "Typeinschränkung des Slots"}, - "range": "Category:Category", + "$comment": "Material", + "range": "Category:OSW31ca9a739cb24079b36824045c0832aa", "options": { "autocomplete": { - "$comment": "Tool", - "query": "[[:Category:OSWe427aafafbac4262955b9f690a83405d]]OR[[SubClassOf::Category:OSWe427aafafbac4262955b9f690a83405d]]OR[[SubClassOf.SubClassOf::Category:OSWe427aafafbac4262955b9f690a83405d]]OR[[SubClassOf.SubClassOf.SubClassOf::Category:OSWe427aafafbac4262955b9f690a83405d]]OR[[SubClassOf.SubClassOf.SubClassOf.SubClassOf::Category:OSWe427aafafbac4262955b9f690a83405d]]OR[[SubClassOf.SubClassOf.SubClassOf.SubClassOf.SubClassOf::Category:OSWe427aafafbac4262955b9f690a83405d]]", + "$comment": "todo: we need an any-subcategory-of shortcut", + "query": "[[SubClassOf::Category:OSW31ca9a739cb24079b36824045c0832aa]]OR[[SubClassOf.SubClassOf::Category:OSW31ca9a739cb24079b36824045c0832aa]]OR[[SubClassOf.SubClassOf.SubClassOf::Category:OSW31ca9a739cb24079b36824045c0832aa]]OR[[SubClassOf.SubClassOf.SubClassOf.SubClassOf::Category:OSW31ca9a739cb24079b36824045c0832aa]]OR[[SubClassOf.SubClassOf.SubClassOf.SubClassOf.SubClassOf::Category:OSW31ca9a739cb24079b36824045c0832aa]]", } }, - "propertyOrder": 50, "x-oold-required-iri": True, }, - title="Type restriction of the slot", - ) - slot_occupant: InitialOccupantOfTheSlot | None = Field( - None, - json_schema_extra={ - "title*": {"de": "Initiale Belegung des Slots"}, - "description*": {"de": "Im Slot installiertes Werkzeug oder Komponente."}, - "defaultProperties": ["slot_occupant_type"], - "options": {"grid_columns": 12}, - "propertyOrder": 60, - }, - title="Initial occupant of the slot", + title="Type", ) - """ - Tool or component installed in the slot. - """ + default: str | None = Field(None, title="Default value") -class YearlyBudget(OswBaseModel): +class OtherPhysicalItem(OswBaseModel): model_config = ConfigDict( json_schema_extra={ - "title": "Yearly budget", - "title*": {"de": "Jahresbudget"}, - "defaultProperties": [ - "budget_year", - "yearly_budget_sum", - "budget_type", - "budget_ou", - ], + "title": "Other physical Item", + "title*": {"de": "Anderer physischer Gegenstand"}, + "headerTemplate": "{{ i1 }}", + "defaultProperties": [], }, ) - uuid: UUID = Field( - ..., json_schema_extra={"options": {"hidden": True}}, title="UUID" - ) - budget_year: str | None = Field( - None, json_schema_extra={"title*": {"de": "Jahr"}}, title="Year" - ) - yearly_budget_sum: YearlyBudgetSum | None = Field( - None, + uuid: str = Field( + ..., json_schema_extra={ - "title*": {"de": "Summe Jahresbudget"}, - "options": { - "disable_collapse": True, - "disable_properties": True, - "compact": True, - }, + "dynamic_template": "{{_uuid_}}", + "options": {"hidden": True, "dynamic_template": {"override": "empty"}}, }, - title="Yearly Budget Sum", ) - yearly_budget_sum_weighted: WeightedSum | None = Field( - None, + origin_item_type: Category | None = Field( + default_factory=lambda: Category.model_validate( + "Category:OSW37a57741ae2e4dd4b29b1172b6848be8" + ), json_schema_extra={ - "title*": {"de": "Gewichtete Summe"}, - "_description": "weighted with probability of successful funding", - "_description*": {"de": "gewichtet mit Erfolgswahrscheinlichkeit"}, + "title*": {"de": "Typ"}, + "range": "Category:Category", "options": { - "disable_collapse": True, - "disable_properties": True, - "compact": True, + "autocomplete": { + "$comment": "Tool", + "query": "[[:Category:OSW37a57741ae2e4dd4b29b1172b6848be8]]OR[[SubClassOf::Category:OSW37a57741ae2e4dd4b29b1172b6848be8]]OR[[SubClassOf.SubClassOf::Category:OSW37a57741ae2e4dd4b29b1172b6848be8]]OR[[SubClassOf.SubClassOf.SubClassOf::Category:OSW37a57741ae2e4dd4b29b1172b6848be8]]OR[[SubClassOf.SubClassOf.SubClassOf.SubClassOf::Category:OSW37a57741ae2e4dd4b29b1172b6848be8]]OR[[SubClassOf.SubClassOf.SubClassOf.SubClassOf.SubClassOf::Category:OSW37a57741ae2e4dd4b29b1172b6848be8]]", + }, + "grid_columns": 12, }, + "propertyOrder": 40, + "x-oold-required-iri": True, }, - title="weighted sum", - ) - budget_start: date | None = Field( - None, json_schema_extra={"title*": {"de": "Beginn"}}, title="Start" - ) - budget_end: date | None = Field( - None, json_schema_extra={"title*": {"de": "Ende"}}, title="End" + title="Type", ) - budget_ou: OrganizationalUnit | None = Field( - None, - json_schema_extra={ - "title*": {"en": "OU", "de": "OE"}, - "range": "Category:OSW3cb8cef2225e403092f098f99bc4c472", - }, - title="OU", + origin_item_instance_property: str | None = Field( + "Property:HasOrigin", json_schema_extra={"options": {"hidden": True}} ) - budget_type: BudgetType | None = Field( + origin_item_instance: PhysicalItem | None = Field( None, json_schema_extra={ - "title*": {"de": "Typ"}, - "range": "Category:OSW595b282aedf048788f3ee326454792ce", + "title*": {"de": "Instanz"}, + "range": "Category:OSW37a57741ae2e4dd4b29b1172b6848be8", + "watch": {"origin_item_type_": "origin_item.origin_item_type"}, + "options": { + "autocomplete": { + "query": "[[HasType::$(origin_item_type_)]]|?Display_title_of=label|?HasImage=image|?HasDescription=description" + }, + "grid_columns": 12, + }, + "propertyOrder": 50, + "x-oold-required-iri": True, }, - title="Type", + title="Instance", ) -class Tool(Item): +class PhysicalItem(Item): """ - Item that participates as a utility (almost) unchanged in a process + Physical item as opposed to intangible item. It can posses properties such as position, geometry, weight, volume , etc. """ model_config = ConfigDict( @@ -4075,614 +4547,406 @@ class Tool(Item): "@context": [ "/wiki/Category:Item?action=raw&slot=jsonschema", { - "components": { + "data_sheet": {"@id": "Property:HasDataSheet", "@type": "@id"}, + "instructions": {"@id": "Property:HasInstructions", "@type": "@id"}, + "manual": {"@id": "Property:HasManual", "@type": "@id"}, + "manufacturer": {"@id": "Property:HasManufacturer", "@type": "@id"}, + "origin": { "@id": "Property:HasStatement", "@type": "@id", "@context": { - "component_instance_property": { - "@id": "Property:HasProperty", - "@type": "@id", - }, - "component_instance": { - "@id": "Property:HasObject", - "@type": "@id", - }, + "origin_item_instance_property": "Property:HasProperty", + "origin_item_instance": "Property:HasObject", }, }, - "events": {"@id": "Property:HasEvent", "@type": "@id"}, - "purposes": {"@id": "Property:HasPurpose", "@type": "xsd:string"}, - "slots": { - "@id": "Property:HasSlot", + "quantity_statements": { + "@id": "Property:HasStatement", "@type": "@id", - "@context": { - "slot_osw_id": { - "@id": "Property:HasOswId", - "@type": "xsd:string", - }, - "slot_id": {"@id": "Property:HasId", "@type": "xsd:string"}, - "name": {"@id": "Property:HasName", "@type": "xsd:string"}, - "description": { - "@id": "Property:HasDescription", - "@type": "@id", - }, - "slot_init_date_time": { - "@id": "Property:HasInitDate", - "@type": "xsd:dateTime", - }, - "slot_occupant": { - "@id": "Property:HasStatement", - "@type": "@id", - "@context": { - "slot_occupant_instance_property": "Property:HasProperty", - "slot_occupant_instance": "Property:HasObject", - }, - }, - "slot_type_restriction": { - "@id": "Property:HasTypeRestriction", - "@type": "@id", - }, - }, }, - "typical_process": { - "@id": "Property:HasTypicalProcess", + "safety_data_sheet": { + "@id": "Property:HasSafetyDataSheet", "@type": "@id", }, + "serial_number": "Property:HasSerialNumber", + "type_no": "Property:HasTypeNumber", }, ], - "uuid": "e427aafa-fbac-4262-955b-9f690a83405d", - "title": "Tool", - "title*": {"en": "Tool", "de": "Werkzeug"}, - "description": "Item that participates as a utility (almost) unchanged in a process", + "uuid": "37a57741-ae2e-4dd4-b29b-1172b6848be8", + "title": "PhysicalItem", + "title*": {"en": "Physical Item", "de": "Physischer Gegenstand"}, + "description": "Physical item as opposed to intangible item. It can posses properties such as position, geometry, weight, volume , etc. ", "description*": { - "en": "Item that participates as a utility (almost) unchanged in a process", - "de": "Gegenstand der als Hilfsmittel (nahezu) unverändert in einem Prozess teilnimmt", + "en": "Physical item as opposed to intangible item. It can posses properties such as position, geometry, weight, volume , etc. ", + "de": "Physischer Gegenstand im Gegensatz zu immateriellen Gegenständen. Er kann Eigenschaften wie Position, Geometrie, Gewicht, Volumen usw. besitzen. ", }, - "defaultProperties": [], - }, - ) - type: list[str] | None = ["Category:OSWe427aafafbac4262955b9f690a83405d"] - purposes: list[str] | None = Field( - None, - json_schema_extra={ - "title*": {"de": "Zweck(e)"}, - "eval_template": [ - { - "type": "mustache-wikitext", - "mode": "render", - "value": "{{=<% %>=}} ", - } - ], - }, - title="Purpose(s)", - ) - typical_process: list[Category] | None = Field( - None, - json_schema_extra={ - "title*": {"de": "Typische(r) Prozess(e)"}, - "eval_template": [ - { - "type": "mustache-wikitext", - "mode": "render", - "value": "{{=<% %>=}} ", - } - ], - "range": "Category:Category", }, - title="Typical Process(es)", ) - components: list[Component] | None = Field( + type: list[str] | None = ["Category:OSW37a57741ae2e4dd4b29b1172b6848be8"] + quantity_statements: list[Quantity] | None = Field( None, json_schema_extra={ - "title*": {"de": "Komponenten"}, - "description*": { - "de": "Komponenten sind dauerhafte Teile eines Werkzeugs (im Gegensatz zu Slots für austauschbare Teile)." - }, - "options": { - "enable_array_copy": True, - "array_copy_ignore": ["uuid", "component_id", "attachments"], + "title*": {"de": "Quantitative Aussage(n)"}, + "eval_template": { + "type": "mustache-wikitext", + "mode": "render", + "value": "{{#quantity_statements}}.. {{#quantity}}[[{{quantity}}]]{{/quantity}} {{#value}}{{value}}{{/value}}
{{/quantity_statements}}", }, - "eval_template": [ - { - "type": "mustache-wikitext", - "mode": "render", - "value": "{{=<% %>=}} ", - } - ], }, - title="Components", + title="Quantitative statement(s)", ) - """ - Component are permanent parts of a tool (vs. Slots for exchangeable parts). - """ - slots: list[Slot] | None = Field( + origin: list[OtherPhysicalItem] | None = Field( None, json_schema_extra={ - "title*": {"de": "Slot-Konfiguration"}, + "title*": {"de": "Ursprung"}, "description*": { - "de": "Slots stellen Plätze für austauschbare Teile oder Komponenten eines Werkzeugs dar (im Gegensatz zu Komponenten, die permanente Teile sind). Slot-Austauschereignisse können verwendet werden, um Änderungen an Slots zu dokumentieren. Dies ist die anfängliche Slot-Konfiguration!" + "de": "Andere(r) physische(r) Gegenstand/Gegenstände aus der dieser physische Gegenstand hergestellt wurde." }, "options": { "enable_array_copy": True, - "array_copy_ignore": ["uuid", "slot_osw_id", "slot_id", "attachments"], + "array_copy_ignore": ["uuid", "attachments"], }, "eval_template": [ { "type": "mustache-wikitext", "mode": "render", - "value": "{{=<% %>=}} ", + "value": "{{=<% %>=}} ", } ], }, - title="Slot configuration", - ) - """ - Slots represent spaces for exchangable parts or components of a tool (vs. Components, which are permanent parts). Slot exchange events can be used to document changes on slots. This is the initial slot configuration! - """ - events: list[Event] | None = Field( - None, - json_schema_extra={ - "title*": {"de": "Ereignis(se)"}, - "range": "Category:OSWb97757b46edb430591758662c18d354d", - }, - title="Event(s)", + title="Origin", ) - - -class Process(Item): """ - Members of the Process Category describe the act of changing the state or properties of something + Other physical item(s) that this physical item was derived from. """ - - model_config = ConfigDict( - json_schema_extra={ - "@context": [ - "/wiki/Category:Item?action=raw&slot=jsonschema", - { - "type": {"@id": "Property:HasType", "@type": "@id"}, - "type*": {"@id": "Property:HasSchema", "@type": "@id"}, - "tool": {"@id": "Property:HasTool", "@type": "@id"}, - "input": {"@id": "Property:HasInput", "@type": "@id"}, - "location": {"@id": "Property:HasLocation", "@type": "@id"}, - "location_name": {"@id": "Property:HasLocation", "@type": "@id"}, - "output": {"@id": "Property:HasOutput", "@type": "@id"}, - "creator": {"@id": "Property:HasCreator", "@type": "@id"}, - "actionees": {"@id": "Property:HasActionee", "@type": "@id"}, - "projects": {"@id": "Property:HasProject", "@type": "@id"}, - "status": {"@id": "Property:HasStatus", "@type": "@id"}, - "start_date_time": { - "@id": "Property:HasStartDateAndTime", - "@type": "xsd:dateTime", - }, - "duration": {"@id": "Property:HasDuration"}, - "end_date_time": { - "@id": "Property:HasEndDateAndTime", - "@type": "xsd:dateTime", - }, - "subprocesses": {"@id": "Property:HasPart", "@type": "@id"}, - }, - ], - "title": "Process", - "title*": {"en": "Process", "de": "Prozess"}, - "uuid": "5a07d666-c55b-4ffa-89d4-9633c708029d", - "description": "Members of the Process Category describe the act of changing the state or properties of something", - "description*": { - "en": "Members of the Process Category describe the act of changing the state or properties of something", - "de": "Prozesse beschreiben den Akt des Änderns eines Zustandes oder der Eigenschaften von etwas.", - }, - "defaultProperties": [ - "actionees", - "start_date_time", - "tool", - "input", - "output", - ], - }, - ) - type: list[str] | None = ["Category:OSWe5aa96bffb1c4d95be7fbd46142ad203"] - creator: Person | None = Field( - None, - json_schema_extra={ - "title*": {"de": "Ersteller"}, - "range": "Category:OSW44deaa5b806d41a2a88594f562b110e9", - }, - title="Creator", - ) - actionees: list[Person] | None = Field( - None, - json_schema_extra={ - "title*": {"de": "Akteure"}, - "range": "Category:OSW44deaa5b806d41a2a88594f562b110e9", - }, - title="Actionees", - ) - start_date_time: AwareDatetime | None = Field( - None, - json_schema_extra={ - "title*": {"de": "Startzeitpunkt"}, - "$comment": 'Note: To hide the time, you can set {"options": {"flatpickr": {"dateFormat": "Z", "altInput": true, "altFormat": "Y-m-d"}}}', - }, - title="Start time", - ) - duration: timedelta | None = Field( - None, json_schema_extra={"title*": {"de": "Dauer"}}, title="Duration" - ) - end_date_time: AwareDatetime | None = Field( - None, json_schema_extra={"title*": {"de": "Endzeitpunkt"}}, title="End time" - ) - location: Location | None = Field( - None, - json_schema_extra={ - "title*": {"de": "Ort"}, - "range": "Category:OSW3d238d05316e45a4ac95a11d7b24e36b", - }, - title="Location", - ) - location_name: str | None = Field( + type_no: str | None = Field( None, json_schema_extra={ - "title*": {"de": "Ort (Text)"}, + "title*": {"de": "Typennummer"}, "description*": { - "de": "Vorzugsweise sollte ein Ort aus dem Autocomplete-Feld 'Ort' ausgewählt oder erstellt werden." + "de": "Typen- oder Modellnummer wie vom Hersteller angegeben" }, }, - title="Location (text)", + title="Type number", ) """ - Its prefered to select or create a location from or in the autocomplete field 'Location'. + Type or model number as specified by the manufacturer """ - status: Status | None = Field( + manufacturer: str | None = Field( None, json_schema_extra={ - "_format": "autocomplete", - "options": { - "_autocomplete": { - "category": "Category:OSW9725d7a91bab4f1aa68f423e4e9bfcf4" - }, - "enum_titles": ["To do", "In work", "Done"], - "enum_titles*": {"de": ["Zu tun", "In Arbeit", "Erledigt"]}, - "grid_columns": 6, + "title*": {"de": "Hersteller"}, + "description*": { + "de": "Der Hersteller dieses Gegendstandes - eine Organisation(seinheit)" }, + "range": "Category:OSW3cb8cef2225e403092f098f99bc4c472", }, - title="Status", + title="Manufacturer", ) - tool: list[Tool] | None = Field( + """ + The manufacturer of this item - an organization(al unit). + """ + data_sheet: set[str] | None = Field( None, json_schema_extra={ - "title*": {"de": "Werkzeuge"}, - "options": {"conditional_visible": {"modes": ["query", "default"]}}, - "range": "Category:OSWe427aafafbac4262955b9f690a83405d", + "title*": {"de": "Datenblatt"}, + "eval_template": { + "type": "mustache-wikitext", + "mode": "render", + "value": "{{=<% %>=}} <%={{ }}=%> {{#data_sheet}}[[:{{{.}}}]];{{/data_sheet}} {{=<% %>=}} <%={{ }}=%>", + }, }, - title="Tools", + title="Data sheet", ) - input: list[Item] | None = Field( + safety_data_sheet: set[str] | None = Field( None, json_schema_extra={ - "title*": {"de": "Eingangsressource (Input)"}, - "options": {"conditional_visible": {"modes": ["query", "default"]}}, - "range": "Category:Item", + "title*": {"de": "Sicherheitsdatenblatt"}, + "eval_template": { + "type": "mustache-wikitext", + "mode": "render", + "value": "{{=<% %>=}} <%={{ }}=%> {{#safety_data_sheet}}[[:{{{.}}}]];{{/safety_data_sheet}} {{=<% %>=}} <%={{ }}=%>", + }, }, - title="Inputs", + title="Safety data sheet", ) - output: list[Item] | None = Field( + manual: set[str] | None = Field( None, json_schema_extra={ - "title*": {"de": "Ausgangsressource (Output)"}, - "options": {"conditional_visible": {"modes": ["query", "default"]}}, - "range": "Category:Item", + "title*": {"de": "Handbuch"}, + "eval_template": { + "type": "mustache-wikitext", + "mode": "render", + "value": "{{=<% %>=}} <%={{ }}=%> {{#manual}}[[:{{{.}}}]];{{/manual}} {{=<% %>=}} <%={{ }}=%>", + }, + "description*": { + "de": "Handbuch, Gerauchsanweisung, Betriebs- oder Bedienungsanleitung mit Einzelheiten zur Verwendung dieses Gegenstands." + }, }, - title="Outputs", + title="Manual", ) - projects: list[Project] | None = Field( + """ + Comprehensive guide that details how to use this item. + """ + instructions: set[str] | None = Field( None, json_schema_extra={ - "title*": {"de": "Projekt(e)"}, - "options": {"conditional_visible": {"modes": ["query", "default"]}}, - "range": "Category:OSWb2d7e6a2eff94c82b7f1f2699d5b0ee3", + "title*": {"de": "Anleitung"}, + "eval_template": { + "type": "mustache-wikitext", + "mode": "render", + "value": "{{=<% %>=}} <%={{ }}=%> {{#instructions}}[[:{{{.}}}]];{{/instructions}} {{=<% %>=}} <%={{ }}=%>", + }, + "description*": { + "de": "Eine Liste auszuführenden Schritte, z. B. die Einrichtungsanweisungen." + }, }, - title="Project(s)", + title="Instructions", ) - parameters: dict[str, Any] | None = Field(None, title="Parameters") + """ + A list of steps to be performed, e.g., the setup instructions. + """ -class Project(Item): +class PhysicalItemType(Category): """ - An enterprise (potentially individual but typically collaborative), planned to achieve a particular aim. + Helps to create subcategories of PhysicalItem """ model_config = ConfigDict( json_schema_extra={ "@context": [ - "/wiki/Category:Item?action=raw&slot=jsonschema", + "/wiki/Category:Category?action=raw&slot=jsonschema", { - "abstract": {"@id": "Property:HasAbstract"}, - "budget_end": {"@id": "Property:HasBudgetEndDate"}, - "budget_ou": {"@id": "Property:HasBusinessUnit", "@type": "@id"}, - "budget_start": {"@id": "Property:HasBudgetStartDate"}, - "budget_type": {"@id": "Property:HasType", "@type": "@id"}, - "budget_year": {"@id": "Property:HasBudgetYear"}, - "end_date": {"@id": "Property:HasEndDate", "@type": "xsd:date"}, - "funding_type": {"@id": "Property:HasFundingType", "@type": "@id"}, - "funding_call": {"@id": "Property:HasFundingCall", "@type": "@id"}, - "funding": {"@id": "schema:funding", "@type": "@id"}, - "funding*": {"@id": "Property:HasFunding", "@type": "@id"}, - "funder": {"@id": "schema:funder", "@type": "@id"}, - "funder*": {"@id": "Property:HasFunder", "@type": "@id"}, - "member": {"@id": "schema:member", "@type": "@id"}, - "member*": {"@id": "Property:HasMember", "@type": "@id"}, - "member_of": {"@id": "schema:memberOf", "@type": "@id"}, - "member_of*": {"@id": "Property:IsMemberOf", "@type": "@id"}, - "other_documents": { - "@id": "Property:HasAdditionalDocument", + "constituents": { "@type": "@id", + "@id": "Property:HasStatement", + "@context": { + "property": "Property:HasProperty", + "type": "Property:HasValue", + }, }, - "ou": {"@id": "Property:HasBusinessUnit", "@type": "@id"}, - "project_manager": {"@id": "Property:HasManager", "@type": "@id"}, - "project_status": {"@id": "Property:HasStatus", "@type": "@id"}, - "project_type": {"@id": "Property:HasType", "@type": "@id"}, - "proposal": {"@id": "Property:HasProposal", "@type": "@id"}, - "report": {"@id": "Property:HasReport", "@type": "@id"}, - "start_date": {"@id": "Property:HasStartDate", "@type": "xsd:date"}, - "subjects": {"@id": "Property:HasTopic", "@type": "@id"}, - "total_budget": {"@id": "Property:HasStatement"}, - "year": {"@id": "Property:HasYear"}, - "yearly_budget": {"@id": "Property:HasBudgetPart", "@type": "@id"}, - "yearly_budget_sum": {"@id": "Property:HasStatement"}, - "yearly_budget_sum_weighted": {"@id": "Property:HasStatement"}, - "probability_of_successful_funding": { - "@id": "Property:HasStatement" + "data_sheet": {"@id": "Property:HasDataSheet", "@type": "@id"}, + "instructions": {"@id": "Property:HasInstructions", "@type": "@id"}, + "manual": {"@id": "Property:HasManual", "@type": "@id"}, + "manufacturer": {"@id": "Property:HasManufacturer", "@type": "@id"}, + "safety_data_sheet": { + "@id": "Property:HasSafetyDataSheet", + "@type": "@id", }, + "type_no": "Property:HasTypeNumber", }, ], - "uuid": "b2d7e6a2-eff9-4c82-b7f1-f2699d5b0ee3", - "title": "Project", - "title*": {"en": "Project", "de": "Projekt"}, - "description": "An enterprise (potentially individual but typically collaborative), planned to achieve a particular aim.", - "description*": { - "de": "Ein (möglicherweise individuelles, in der Regel aber gemeinschaftliches) Unternehmen oder Unternehmung, das auf ein bestimmtes Ziel ausgerichtet ist." - }, - "defaultProperties": [ - "subjects", - "project_status", - "funding_type", - "funding_call", - "funder", - "funding", - "funding_name", - "ou", - "project_manager", - "member", - "member_of", - "start_date", - "end_date", - "total_budget", - "proposal", - "abstract", + "uuid": "ca99a9bb-9ad2-4386-b222-d18a73c2af5e", + "title": "PhysicalItemType", + "title*": {"en": "Physical Item Type"}, + "description": "Helps to create subcategories of PhysicalItem", + "description*": {"en": "Helps to create subcategories of PhysicalItem"}, + "defaultPropertis": [ + "type_no", + "manufacturer", + "data_sheet", + "safety_data_sheet", + "supply", + "specifications", ], }, ) - type: list[str] | None = ["Category:OSWb2d7e6a2eff94c82b7f1f2699d5b0ee3"] - subjects: list[str] | None = Field( - None, json_schema_extra={"title*": {"de": "Themen"}}, title="Subjects" - ) - project_type: ProjectTypeDeprecated | None = Field( - "", + type: list[str] | None = ["Category:OSWca99a9bb9ad24386b222d18a73c2af5e"] + type_no: str | None = Field( + None, json_schema_extra={ - "deprecated": True, - "title*": {"de": "Projekttyp (veraltet)"}, - "description*": {"de": "Ersetzt mit Projekt- bzw. Förderart"}, - "options": { - "enum_titles": ["House project", "Internal", "Public", "Industry"], - "enum_titles*": { - "de": ["Hausprojekt", "Intern", "Öffentlich", "Industrie"] - }, + "title*": {"de": "Typennummer"}, + "description*": { + "de": "Typen- oder Modellnummer wie vom Hersteller angegeben" }, }, - title="Project type (deprecated)", + title="Type number", ) """ - Replaced with Project / Funding Type + Type or model number as specified by the manufacturer """ - funding_type: ProjectType | None = Field( - None, - json_schema_extra={ - "title*": {"de": "Projekt- bzw. Förderart"}, - "range": "Category:OSW67f2ef61ba284c919fefa00d0e95a7a0", - }, - title="Project / Funding Type", - ) - project_status: ProjectStatus | None = Field( - default_factory=lambda: ProjectStatus.model_validate( - "Item:OSW55a9a9bda7b248759e48ae2e3ed6df1d" - ), - json_schema_extra={ - "title*": {"de": "Projektstatus"}, - "range": "Category:OSW490e38f9764f4408a244869a0ea98e7c", - }, - title="Project status", - ) - funding_call: str | None = Field( + manufacturer: str | None = Field( None, json_schema_extra={ - "title*": {"de": "Förderaufruf"}, - "options": { - "autocomplete": { - "category": "Category:OSWd22af0aa3b00462a9da9b509538e8926" - } + "title*": {"de": "Hersteller"}, + "description*": { + "de": "Der Hersteller dieses Gegendstandes - eine Organisation(seinheit)" }, + "range": "Category:OSW3cb8cef2225e403092f098f99bc4c472", }, - title="Funding call", + title="Manufacturer", ) - funder: str | None = Field( + """ + The manufacturer of this item - an organization(al unit). + """ + data_sheet: set[str] | None = Field( None, json_schema_extra={ - "title*": {"de": "Förder- bzw. Auftragsgeber"}, - "category": "Category:OSW3cb8cef2225e403092f098f99bc4c472", + "title*": {"de": "Datenblatt"}, + "eval_template": { + "type": "mustache-wikitext", + "mode": "render", + "value": "{{=<% %>=}} <%={{ }}=%> {{#data_sheet}}[[:{{{.}}}]];{{/data_sheet}} {{=<% %>=}} <%={{ }}=%>", + }, }, - title="Funder", + title="Data sheet", ) - funding: str | None = Field( + safety_data_sheet: set[str] | None = Field( None, json_schema_extra={ - "title*": {"de": "Förderung"}, - "description*": {"de": "Förderung oder Vertrag"}, - "options": { - "autocomplete": { - "category": "Category:OSWbe80b28aefd64921ba2e8e2d6225416e" - } + "title*": {"de": "Sicherheitsdatenblatt"}, + "eval_template": { + "type": "mustache-wikitext", + "mode": "render", + "value": "{{=<% %>=}} <%={{ }}=%> {{#safety_data_sheet}}[[:{{{.}}}]];{{/safety_data_sheet}} {{=<% %>=}} <%={{ }}=%>", }, }, - title="Funding", + title="Safety data sheet", ) - """ - Grant or contract - """ - funding_name: str | None = Field( + instructions: set[str] | None = Field( None, json_schema_extra={ - "title*": {"de": "Förderung (Name)"}, + "title*": {"de": "Anleitung"}, + "eval_template": { + "type": "mustache-wikitext", + "mode": "render", + "value": "{{=<% %>=}} <%={{ }}=%> {{#instructions}}[[:{{{.}}}]];{{/instructions}} {{=<% %>=}} <%={{ }}=%>", + }, "description*": { - "de": "Förderung oder Vertrag. Verwenden Sie diese Eigenschaft, um einen Text einzugeben, wenn Sie keine neue Instanz von Grant erstellen möchten." + "de": "Eine Liste auszuführenden Schritte, z. B. die Einrichtungsanweisungen." }, }, - title="Funding (name)", + title="Instructions", ) """ - Grant or contract. Use this property to enter a text if you don't want to create a new instance of grant. + A list of steps to be performed, e.g., the setup instructions. """ - probability_of_successful_funding: ( - ProbabilityOfSuccessfulFundingInPercent | None - ) = Field( + manual: set[str] | None = Field( None, json_schema_extra={ - "title*": { - "de": "Wahrscheinlichkeit einer erfolgreichen Förderung in Prozent" + "title*": {"de": "Handbuch"}, + "eval_template": { + "type": "mustache-wikitext", + "mode": "render", + "value": "{{=<% %>=}} <%={{ }}=%> {{#manual}}[[:{{{.}}}]];{{/manual}} {{=<% %>=}} <%={{ }}=%>", }, "description*": { - "de": "Gibt die Wahrscheinlichkeit an, dass die Förderung genehmigt wird, bestimmt das gewichtete Budget" + "de": "Handbuch, Gerauchsanweisung, Betriebs- oder Bedienungsanleitung mit Einzelheiten zur Verwendung dieses Gegenstands." }, }, - title="Probability of Successful Funding in percent", + title="Manual", ) """ - Indicates the likelihood that the funding will be approved, determines the weighted budget + Comprehensive guide that details how to use this item. """ - ou: list[str] | None = Field( + supply: list[Supply] | None = Field( None, json_schema_extra={ - "title*": {"en": "OU", "de": "OE"}, + "title*": {"de": "Bezugsmöglichkeit"}, "description*": { - "de": "Organisationseinheit (OE), die das Projekt durchführt" + "de": "Bezugsmöglichkeit des Materials mit Lieferant, Artikelnummer und Link" }, }, - title="OU", + title="Supply", ) """ - Organizational Unit (OU), which carries out the project + Supply of the material with supplier, article no. and link """ - project_manager: list[str] | None = Field( + specifications: list[Attribute] | None = Field( None, - json_schema_extra={ - "title*": {"en": "Project Manager", "de": "Projektleiter*in"} - }, - title="Project Manager", + json_schema_extra={"title*": {"de": "Spezifikation technischer Eigenschaften"}}, + title="Specification of technical properties", ) - member: list[str] | None = Field( - None, - json_schema_extra={"title*": {"en": "Member", "de": "Mitglieder*innen"}}, - title="Member", + constituents: list[Constituent] | None = Field( + None, json_schema_extra={"title*": {"de": "Bestandteile"}}, title="Constituents" ) - member_of: list[str] | None = Field( - None, + """ + Components or parts + """ + + +class Material(PhysicalItem): + """ + Contains chemical substances and engineered matterials / parts + """ + + model_config = ConfigDict( json_schema_extra={ - "title*": {"en": "Member of ", "de": "Mitglied von"}, + "@context": [ + "/wiki/Category:OSW37a57741ae2e4dd4b29b1172b6848be8?action=raw&slot=jsonschema" + ], + "uuid": "31ca9a73-9cb2-4079-b368-24045c0832aa", + "title": "Material", + "title*": {"en": "Material", "de": "Material"}, + "description": "Contains chemical substances and engineered matterials / parts", "description*": { - "de": "Organisationseinheit(en), zu der das Projekt gehört, z. B. ein Projektcluster" + "en": "Contains chemical substances and engineered matterials / parts", + "de": "Enthält chemische Stoffe, Materialien und Bauteile", }, }, - title="Member of", ) + type: list[str] | None = ["Category:OSW31ca9a739cb24079b36824045c0832aa"] + + +class DeviceType(PhysicalItemType): """ - Organizational unit(s), the project is a member of, e.g. a project cluster + Helps Creating DeviceCategories """ - start_date: date | None = Field( - None, - json_schema_extra={"title*": {"de": "Beginn"}, "options": {"flatpicker": {}}}, - title="Start", - ) - end_date: date | None = Field( - None, - json_schema_extra={"title*": {"de": "Ende"}, "options": {"flatpicker": {}}}, - title="End", - ) - total_budget: TotalBudget | None = Field( - None, json_schema_extra={"title*": {"de": "Budgetsumme"}}, title="Total Budget" - ) - yearly_budget: list[YearlyBudget] | None = Field( - None, - json_schema_extra={ - "title*": {"de": "Jahresbudget"}, - "options": {"disable_array_reorder": False, "enable_array_copy": True}, - }, - title="Yearly budget", - ) - proposal: str | None = Field( - None, + + model_config = ConfigDict( json_schema_extra={ - "title*": {"de": "Antrag"}, - "options": {"upload": {}}, - "links": [ - { - "href": "{{#if self}}/w/index.php?title=Special:Redirect/file/{{self}}&width=200&height=200{{/if}}", - "mediaType": "image", - }, + "@context": [ + "/wiki/Category:OSWca99a9bb9ad24386b222d18a73c2af5e?action=raw&slot=jsonschema", { - "href": "{{#if self}}/w/index.php?title=Special:Redirect/file/{{self}}{{/if}}", - "rel": "{{#if self}}download{{/if}}", - "download": True, + "purpose": {"@id": "Property:HasPurpose", "@type": "@id"}, + "typical_processes": { + "@id": "Property:HasTypicalProcess", + "@type": "@id", + }, }, ], + "uuid": "d845b968-13a3-4445-8f14-0e48c4d063fd", + "title": "DeviceType", + "title*": {"en": "Device Type"}, + "description": "Helps Creating DeviceCategories", + "description*": {"en": "Helps Creating DeviceCategories"}, + "defaultProperties": ["manufacturer", "typical_processes", "manual"], }, - title="Proposal", ) - report: str | None = Field( + type: list[str] | None = ["Category:OSWd845b96813a344458f140e48c4d063fd"] + typical_processes: list[str] | None = Field( None, - json_schema_extra={ - "title*": {"de": "Bericht"}, - "options": {"upload": {}}, - "links": [ - { - "href": "{{#if self}}/w/index.php?title=Special:Redirect/file/{{self}}&width=200&height=200{{/if}}", - "mediaType": "image", - }, - { - "href": "{{#if self}}/w/index.php?title=Special:Redirect/file/{{self}}{{/if}}", - "rel": "{{#if self}}download{{/if}}", - "download": True, - }, - ], - }, - title="Report", + json_schema_extra={"title*": {"de": "Typische Prozesse"}}, + title="Typical Processes", ) - other_documents: list[str] | None = Field( + manufacturer_type_id: str | None = Field( None, json_schema_extra={ - "title*": {"en": "Additional documents", "de": "Sonstige Dokumente"} + "title*": {"de": "Hersteller Typen-ID"}, + "description*": {"de": "Produkt-ID des Herstellers."}, }, - title="Additional documents", + title="Manufacturer Type ID", ) - abstract: list[Description] | None = Field( + """ + Product ID provided by the manufacturer + """ + manufacturer_type_name: str | None = Field( None, json_schema_extra={ - "title*": {"de": "Kurzbeschreibung"}, - "eval_template": { - "type": "mustache-wikitext", - "mode": "render", - "$comment": "Displays value according to user language with eng as fallback option. Note: {{=<% %>=}} changes mustache expression from {{..}} to <% %> for mixing with wikitext templates", - "value": "{{=<% %>=}} {{#switch:{{USERLANGUAGECODE}} <%#abstract%> | {{#ifeq: <%lang%>|en|#default|<%lang%>}} = <%text%> <%/abstract%> }}", + "title*": {"de": "Hersteller Typenbezeichnung"}, + "description*": { + "de": "Produktname des Herstellers. Oftmals ein einfacherer Alias neben der Typen-ID" }, }, - title="Abstract", + title="Manufacturer Type Name", ) + """ + Product name provided by the manufacturer. Often more human friendly than the type id. + """ + + +# generated by datamodel-codegen: +# filename: OSWf0fe562f422d49c6877490b3dfee2f3f.json class Device(Tool, PhysicalItem): @@ -4934,45 +5198,6 @@ class StrictParticipantsProcess(Process): """ -class ProjectType(Enumeration): - model_config = ConfigDict( - json_schema_extra={ - "@context": [ - "/wiki/Category:OSWd02741381aaa4709ae0753a0edc341ce?action=raw&slot=jsonschema" - ], - "uuid": "67f2ef61-ba28-4c91-9fef-a00d0e95a7a0", - "title": "ProjectType", - "title*": {"en": "Project Type", "de": "Projekttyp"}, - "description": "", - "description*": {}, - }, - ) - type: list[str] | None = ["Category:OSW67f2ef61ba284c919fefa00d0e95a7a0"] - - -class BudgetType(Enumeration): - """ - Type of usage of a certain budget - """ - - model_config = ConfigDict( - json_schema_extra={ - "@context": [ - "/wiki/Category:OSWd02741381aaa4709ae0753a0edc341ce?action=raw&slot=jsonschema" - ], - "uuid": "595b282a-edf0-4878-8f3e-e326454792ce", - "title": "BudgetType", - "title*": {"en": "Budget Type", "de": "Budget-Typ"}, - "description": "Type of usage of a certain budget", - "description*": { - "en": "Type of usage of a certain budget", - "de": "Art der Verwendung eines bestimmten Budgets", - }, - }, - ) - type: list[str] | None = ["Category:OSW595b282aedf048788f3ee326454792ce"] - - class Group(OrganizationalSubUnit): model_config = ConfigDict( json_schema_extra={ @@ -5019,32 +5244,6 @@ class AdministrativeProcess(StrictParticipantsProcess): type: list[str] | None = ["Category:OSW1a271f289649413488e2841580e43a45"] -class ProjectStatus(StatusEnumeration): - """ - Status for projects and project applications - """ - - model_config = ConfigDict( - json_schema_extra={ - "@context": [ - "/wiki/Category:OSW2c32802be59040248c85eda3479d484c?action=raw&slot=jsonschema" - ], - "uuid": "490e38f9-764f-4408-a244-869a0ea98e7c", - "title": "ProjectStatus", - "title*": { - "en": "Project (Application) Status", - "de": "Projekt(antrags)status", - }, - "description": "Status for projects and project applications", - "description*": { - "en": "Status for projects and project applications", - "de": "Status für Projekte und Projektanträge", - }, - }, - ) - type: list[str] | None = ["Category:OSW490e38f9764f4408a244869a0ea98e7c"] - - class RiskAssessmentProcess(AdministrativeProcess): model_config = ConfigDict( json_schema_extra={ @@ -7969,6 +8168,7 @@ class Requirement(Item): Device.model_rebuild() DeviceType.model_rebuild() DigitalDocument.model_rebuild() +Distribution.model_rebuild() EducationalOrganization.model_rebuild() EmploymentStatus.model_rebuild() Event.model_rebuild() diff --git a/src/opensemantic/base/_pint_csv.py b/src/opensemantic/base/_pint_csv.py new file mode 100644 index 0000000..1ea2fa5 --- /dev/null +++ b/src/opensemantic/base/_pint_csv.py @@ -0,0 +1,92 @@ +"""CSV with a unit header, for tables whose columns are not all quantities. + +pint-pandas writes units into a second header row, which is what makes a CSV +of typed values round-trip. Its own ``dequantify`` / ``quantify`` require +*every* column to carry a unit, and a table row carries plain members too - a +label, a count, a timestamp. The two functions here keep the unit row for the +columns that have one and pass the rest through unchanged. + +The form written is:: + + ,temperature,city + unit,kelvin, + 0,300.0,Cambridge + +so the second row names the units, empty where a column has none. +""" + +import io +from typing import Any + +UNIT_ROW_MARKER = "unit" +"""First cell of the unit row, and how a reader recognizes this form.""" + + +def dequantify(frame: Any) -> Any: + """Move each column's unit into a second header level. + + A column without a unit keeps its values under an empty unit, where + ``frame.pint.dequantify()`` raises. + """ + import pandas as pd + + columns = [] + values = [] + for name in frame.columns: + series = frame[name] + if str(series.dtype).startswith("pint"): + columns.append((str(name), str(series.pint.units))) + values.append(series.pint.magnitude) + else: + columns.append((str(name), "")) + values.append(series) + out = pd.concat(values, axis=1) if values else frame.copy() + out.columns = pd.MultiIndex.from_tuples(columns, names=[None, UNIT_ROW_MARKER]) + return out + + +def quantify(frame: Any) -> Any: + """Turn the second header level back into column units. + + The inverse of :func:`dequantify`: a column whose unit cell is empty stays + as it is, which is what ``frame.pint.quantify()`` cannot express. + """ + import pandas as pd + + out = {} + for name, unit in frame.columns: + series = frame[(name, unit)] + text = "" if unit is None else str(unit).strip() + if text and not text.lower().startswith("unnamed"): + out[name] = pd.Series(series.to_numpy(), dtype=f"pint[{text}]", name=name) + else: + out[name] = pd.Series(series.to_numpy(), name=name) + return pd.DataFrame(out) + + +def has_unit_row(payload: bytes) -> bool: + """Whether a CSV carries the unit header this module writes.""" + lines = payload.splitlines() + if len(lines) < 2: + return False + first_cell = lines[1].split(b",")[0].strip().strip(b'"') + return first_cell.decode("utf-8", "replace").lower() == UNIT_ROW_MARKER + + +def read_csv(payload: bytes) -> Any: + """A CSV as a frame, with or without the unit header. + + A CSV from anywhere else has one header row and no units; reading it as + the two-row form would silently turn its first data row into part of the + header. + """ + import pandas as pd + + if has_unit_row(payload): + return quantify(pd.read_csv(io.BytesIO(payload), header=[0, 1], index_col=0)) + return pd.read_csv(io.BytesIO(payload)) + + +def to_csv(frame: Any) -> bytes: + """A frame as CSV bytes, with the unit header.""" + return dequantify(frame).to_csv().encode("utf-8") diff --git a/src/opensemantic/base/v1/__init__.py b/src/opensemantic/base/v1/__init__.py index d73f3ed..d3521cd 100644 --- a/src/opensemantic/base/v1/__init__.py +++ b/src/opensemantic/base/v1/__init__.py @@ -12,6 +12,26 @@ from opensemantic.base.v1._model import * # noqa try: + from opensemantic.base.v1 import _controller # noqa: F401 from opensemantic.base.v1._controller import * # noqa -except ImportError: +except ImportError as _error: # pragma: no cover - an optional dependency is missing + # Without this the controllers are simply absent and every lookup returns + # the pure model, which reads as "no controller registered" rather than as + # a broken install. + import logging as _logging + + # info, not warning: the controllers are an optional extra, so a + # model-only install is a supported configuration - but a missing + # dependency must still be nameable, instead of the controllers simply + # not being there + _logging.getLogger(__name__).info( + "opensemantic.base controllers are unavailable: %s", _error + ) + +# Assignments, not imports: isort sorts an import above the star import, which +# would put the pure models back. These names resolve to the controllers that +# implement them. +try: + Dataset = _controller.DatasetController +except NameError: # pragma: no cover - controllers unavailable, see above pass diff --git a/src/opensemantic/base/v1/_controller.py b/src/opensemantic/base/v1/_controller.py index f473d21..01a1467 100644 --- a/src/opensemantic/base/v1/_controller.py +++ b/src/opensemantic/base/v1/_controller.py @@ -14,7 +14,11 @@ DownsampleParams, TSDCMixin, ) +from opensemantic.base._dataset_controller_mixin import ( # noqa: F401 (re-export) + DatasetControllerMixin, +) from opensemantic.base.v1._model import Database as _Database +from opensemantic.base.v1._model import Dataset as _Dataset from opensemantic.base.v1._model import DataTool as _DataTool @@ -175,3 +179,19 @@ async def start_offline_sync(self): DeleteToolParams = TSDCMixin.DeleteToolParams WriteToolChannelRawParams = TSDCMixin.WriteToolChannelRawParams ReadToolChannelRawParams = TSDCMixin.ReadToolChannelRawParams + + +class DatasetController(DatasetControllerMixin, _Dataset): + """Dataset controller (v1).""" + + +# A controller stands in for the model it implements, so a Dataset a caller +# builds can convert and materialize itself; it needs nothing beyond what the +# model requires and its __init__ does nothing but construct. +# +# DataToolController and the database controllers keep their own names. The +# first indexes channels, warns about unloaded characteristics and may open an +# archive database on construction, which is not what building a data model +# should do. Of the latter there are three for one Database, and the local one +# needs a db_path, so which applies is the caller's choice, not a default. +Dataset = DatasetController diff --git a/src/opensemantic/base/v1/_model.py b/src/opensemantic/base/v1/_model.py index 3f62c47..947dcf5 100644 --- a/src/opensemantic/base/v1/_model.py +++ b/src/opensemantic/base/v1/_model.py @@ -13,6 +13,7 @@ Description, Entity, Enumeration, + File, IntangibleItem, Item, Label, @@ -907,163 +908,42 @@ class Config: # filename: OSWfe72974590fd4e8ba94cd4e8366375e8.json -class Distribution(OswBaseModel): - class Config: - schema_extra = {"title": "Distribution"} - - download_url: str = Field(..., title="Download URL") - - -class DatasetSchema(Item): - class Config: - schema_extra = { - "@context": [{"schema_definition": "Property:HasSchemaDefinition"}], - "title": "DatasetSchema", - "defaultProperties": ["schema_definition", "label", "uuid"], - } - - schema_definition: str | None = Field(None, title="Dataset schema") - """ - Defintion of a JSON based Schema for a dataset. - """ - type: list[str] | None = ["Category:OSW0d6584b3e2b64e9595733c4c3963c486"] - - -class Dataset(Data): - class Config: - schema_extra = { - "@context": [ - "/wiki/Category:OSW2ac4493f8635481eaf1db961b63c8325?action=raw&slot=jsonschema", - { - "url": "dcat:landingPage", - "url*": "Property:HasUrl", - "themes": {"@type": "@id", "@id": "dcat:theme"}, - "themes*": {"@type": "@id", "@id": "Property:IsRelatedTo"}, - "distributions": {"@type": "@id", "@id": "dcat:distribution"}, - "distributions*": { - "@type": "@id", - "@id": "Property:HasDistribution", - }, - "download_url": "dcat:downloadURL", - "download_url*": "Property:HasUrl", - "data_format": "Property:HasDataFormat", - "dataset_schema": "Property:HasDatasetSchema", - }, - ], - "title": "Dataset", - "defaultProperties": ["url", "themes"], - "uuid": "fe729745-90fd-4e8b-a94c-d4e8366375e8", - "title*": {"en": "Dataset"}, - "description": "", - "description*": {}, - } - - type: list[str] | None = ["Category:OSWfe72974590fd4e8ba94cd4e8366375e8"] - url: list[str] | None = Field(None, title="URL / Websites") - """ - Landing page(s) that documents the dataset - """ - themes: list[Entity] | None = Field( - None, range="Category:Entity", title="Themes / Topics" +class Status(str, Enum): + Item_OSWaa8d29404288446a9f3ec7afa4e2a512 = ( + "Item:OSWaa8d29404288446a9f3ec7afa4e2a512" ) """ - Terms to categorizes this dataset + To do """ - distributions: list[Distribution] | None = Field( - None, title="Distributions / Downloads" + Item_OSWa2b4567ad4874ea1b9adfed19a3d06d1 = ( + "Item:OSWa2b4567ad4874ea1b9adfed19a3d06d1" ) """ - Actual download options for this dataset + In work """ - data_format: list[DataFormat] | None = Field( - None, range="Category:OSWccac243b31f94574847861e5d9685b82", title="Data format" + Item_OSWf474ec34b7df451ea8356134241aef8a = ( + "Item:OSWf474ec34b7df451ea8356134241aef8a" ) - # note: removed min_items/max_items due to forward reference """ - Gives a structure to define specific formats of data. + Done """ - dataset_schema: list[DatasetSchema] | None = Field( - None, - min_items=1, - range="Category:OSW0d6584b3e2b64e9595733c4c3963c486", - title="Dataset schema", - ) - - -class DataTerm(DefinedTerm): - class Config: - schema_extra = { - "@context": [ - "/wiki/Category:OSWa5812d3b5119416c8da1606cbe7054eb?action=raw&slot=jsonschema" - ], - "title": "DataTerm", - } - - type: list[str] | None = ["Category:OSW34f9d66c7e1241c8b9543231526f126d"] -class DataFormat(DataTerm): +class DisplayName(OswBaseModel): class Config: - schema_extra = { - "defaultProperties": [ - "specification", - "description", - "label", - "short_name", - ], - "title": "DataFormat", - } + schema_extra = {"title": "Display name", "title*": {"de": "Anzeigenamen"}} - specification: str | None = Field( + text: Any | None = Field( None, - description_={"de": "Entweder Text oder Link"}, - title="Specification", - title_={"de": "Spezifikation"}, + dynamic_template="{{first_name}}{{#each middle_name}} {{.}}{{/each}}{{#if surname}} {{{surname}}}{{/if}}", + readonly=True, + watch={ + "first_name": "root.first_name", + "middle_name": "root.middle_name", + "surname": "root.surname", + }, ) - """ - Either text or link - """ - type: list[str] | None = ["Category:OSWccac243b31f94574847861e5d9685b82"] - - -# generated by datamodel-codegen: -# filename: OSW0d6584b3e2b64e9595733c4c3963c486.json - - -# generated by datamodel-codegen: -# filename: OSWafcac83979f4472298b6acdc01981728.json - - -class DigitalDocument(CreativeWork): - """ - An electronic file or document. - """ - - class Config: - schema_extra = { - "@context": [ - "/wiki/Category:OSW712583f2479944deb2546b77cf860dda?action=raw&slot=jsonschema" - ], - "uuid": "afcac839-79f4-4722-98b6-acdc01981728", - "title": "DigitalDocument", - "title*": {"en": "Digital document"}, - "description": "An electronic file or document.", - "description*": {"en": "An electronic file or document."}, - } - - type: list[str] | None = ["Category:OSWafcac83979f4472298b6acdc01981728"] - - -# generated by datamodel-codegen: -# filename: OSW34f9d66c7e1241c8b9543231526f126d.json - - -# generated by datamodel-codegen: -# filename: OSWccac243b31f94574847861e5d9685b82.json - - -# generated by datamodel-codegen: -# filename: OSW3d238d05316e45a4ac95a11d7b24e36b.json + lang: str | None = "en" class GPSCoordinates(OswBaseModel): @@ -1103,358 +983,310 @@ class Config: """ -class PostalAddress(OswBaseModel): +class ProjectTypeDeprecated(str, Enum): + """ + Replaced with Project / Funding Type + """ + + house_project = "house_project" + """ + House project + """ + internal = "internal" + """ + Internal + """ + public = "public" + """ + Public + """ + industry = "industry" + """ + Industry + """ + + +class WeightedSum(OswBaseModel): class Config: schema_extra = { - "@context": { - "address_supplement": { - "@id": "Property:HasAddressSupplement", - "@type": "xsd:string", - }, - "city": {"@id": "Property:HasCity", "@type": "@id"}, - "city*": {"@id": "schema:containedInPlace", "@type": "@id"}, - "city**": {"@id": "Property:IsLocatedIn", "@type": "@id"}, - "country": {"@id": "schema:addressCountry", "@type": "@id"}, - "country*": {"@id": "Property:HasCountry", "@type": "@id"}, - "house_no": {"@id": "Property:HasHouseNo", "@type": "xsd:string"}, - "postal_code": {"@id": "schema:postalCode", "@type": "xsd:string"}, - "postal_code*": { - "@id": "Property:HasPostalCode", - "@type": "xsd:string", - }, - "post_office_box_no": { - "@id": "schema:postOfficeBoxNumer", - "@type": "xsd:string", - }, - "post_office_box_no*": { - "@id": "Property:HasPoBoxNo", - "@type": "xsd:string", - }, - "region": {"@id": "schema:addressRegion", "@type": "@id"}, - "region*": {"@id": "Property:HasRegion", "@type": "@id"}, - "state": {"@id": "schema:addressCountry", "@type": "@id"}, - "state*": {"@id": "Property:HasState", "@type": "@id"}, - "street_name": {"@id": "Property:HasStreet", "@type": "xsd:string"}, - }, - "title": "Postal address", - "title*": {"en": "Postal address", "de": "Postalische Adresse"}, - "description": "", - "eval_template": { - "type": "wikitext", - "mode": "render", - "value": "{{#if: {{{addressee|}}}|{{{addressee|}}}
|}}{{{street_name|}}} {{{house_no|}}}
{{#if: {{{address_supplement|}}}|{{{address_supplement|}}}
|}}{{{postal_code|}}} {{#if: {{{city|}}} |[[{{{city|}}}]]|{{{city_name|}}} }}, {{#if: {{{region|}}}|[[{{{region|}}}]], |}}{{#if: {{{state|}}}|[[{{{state|}}}]], |}}{{#if: {{{country|}}} |[[{{{country|}}}]]|{{{country_name|}}} }}{{#if: {{{post_office_box_no|}}}|
{{#switch:{{USERLANGUAGECODE}}|#default=PO Box No|de=Postfach-Nr.}} {{{post_office_box_no|}}}|}}", + "title": "weighted sum", + "title*": {"de": "Gewichtete Summe"}, + "_description": "weighted with probability of successful funding", + "_description*": {"de": "gewichtet mit Erfolgswahrscheinlichkeit"}, + "options": { + "disable_collapse": True, + "disable_properties": True, + "compact": True, }, - "defaultProperties": [ - "uuid", - "street_name", - "house_no", - "postal_code", - "city", - "city_name", - "country", - "country_name", - "address_supplement", - "state", - "region", - "post_office_box_no", - ], } - uuid: UUID = Field(default_factory=uuid4, options={"hidden": True}) - country: Country | None = Field( - None, - range="Category:OSW0551abcd6f734047825e3ded4c8a0ffe", - title="Country", - title_={"en": "Country", "de": "Land"}, - ) - country_name: str | None = Field( - None, title="Country (text)", title_={"de": "Land (Text)"} - ) - state: State | None = Field( - None, - range="Category:OSWab60f9a227954ee0be92344ff6272420", - title="State", - title_={"en": "State", "de": "Bundesland"}, - ) - region: Region | None = Field( - None, - range="Category:OSW95efaf34e2c7439e8e7967233910e44b", - title="Region", - title_={"en": "Region", "de": "Region"}, - ) - post_office_box_no: str | None = Field( - None, - title="PO box number", - title_={"en": "PO box number", "de": "Postfach nummer"}, - ) - postal_code: str | None = Field( - None, title="Postal code", title_={"en": "Postal code", "de": "Postleitzahl"} - ) - city: City | None = Field( - None, - range="Category:OSW807f1da5b42e42f296b213ab06ca873b", - title="City", - title_={"en": "City", "de": "Stadt"}, - ) - city_name: str | None = Field( - None, title="City (text)", title_={"de": "Stadt (Text)"} - ) - street_name: str | None = Field( - None, title="Street", title_={"en": "Street", "de": "Straße"} + uuid: UUID = Field(default_factory=uuid4, options={"hidden": True}, title="UUID") + quantity: str | None = Field("Property:HasWeightedBudget", options={"hidden": True}) + numerical_value: str = Field( + ..., + dynamic_template="{{#calc 0.01 '*'}}{{#calc probability_of_successful_funding '*'}}{{yearly_budget_sum_value}}{{/calc}}{{/calc}}", + field_format="template", + options={ + "grid_columns": 12, + "hidden": True, + "dynamic_template": {"override": "always"}, + }, + watch={ + "probability_of_successful_funding": "probability_of_successful_funding.numerical_value", + "yearly_budget_sum_value": "yearly_budget.yearly_budget_sum.numerical_value", + }, ) - house_no: str | None = Field( - None, title="House number", title_={"en": "House number", "de": "Hausnummer"} + value: str = Field( + ..., + field_format="template", + field_watch={ + "probability_of_successful_funding": "probability_of_successful_funding.numerical_value", + "yearly_budget_sum_value": "yearly_budget.yearly_budget_sum.numerical_value", + "yearly_budget_sum_unit_symbol": "yearly_budget.yearly_budget_sum.unit_symbol", + }, + options={"grid_columns": 12, "hidden": False}, + template="{{{numerical_value}}} {{{unit_symbol}}}", + title="Wert", + watch={ + "numerical_value": "statement.numerical_value", + "unit_symbol": "statement.unit_symbol", + }, ) - address_supplement: str | None = Field( - None, - title="Address supplement", - title_={"en": "Address supplement", "de": "Adresszusatz"}, + unit: str = Field( + ..., + field_format="template", + options={"grid_columns": 6, "hidden": True}, + propertyOrder=1001, + template="{{yearly_budget_sum_unit}}", + title="Currency", + title_={"de": "Währung"}, + watch={"yearly_budget_sum_unit": "yearly_budget.yearly_budget_sum.unit"}, ) - addressee: str | None = Field( - None, - description_={ - "de": "Titelzeile der Adresse falls abweichend vom Organisationsname" + unit_symbol: str = Field( + ..., + options={"grid_columns": 6, "hidden": True}, + template="{{yearly_budget_sum_unit_symbol}}", + watch={ + "yearly_budget_sum_unit_symbol": "yearly_budget.yearly_budget_sum.unit_symbol" }, - title="Addressee", - title_={"de": "Adressat"}, ) - """ - Title line of the address in case different from organization name - """ -class Location(Item): - """ - A location. Entities that have a somewhat fixed, physical extension. - """ - +class Quantity(OswBaseModel): class Config: schema_extra = { - "@context": [ - { - "gps_coordinates": {"@id": "schema:geo", "@type": "xsd:string"}, - "gps_coordinates*": { - "@id": "Property:HasGpsCoordinates", - "@type": "xsd:string", - }, - "latitude": {"@id": "schema:latitude", "@type": "xsd:float"}, - "located_in": {"@id": "schema:containedInPlace", "@type": "@id"}, - "located_in*": {"@id": "Property:IsLocatedIn", "@type": "@id"}, - "longitude": {"@id": "schema:longitude", "@type": "xsd:float"}, - "longitude*": { - "@id": "Property:HasLongitude", - "@type": "xsd:float", - }, - "postal_address": { - "@id": "Property:HasPostalAddress", - "@type": "@id", - "@context": ["/wiki/JsonSchema:PostalAddress?action=raw"], - }, - }, - "/wiki/Category:Item?action=raw&slot=jsonschema", - ], - "title": "Location", - "uuid": "3d238d05-316e-45a4-ac95-a11d7b24e36b", - "title*": {"en": "Location", "de": "Örtlichkeit"}, - "description": "A location. Entities that have a somewhat fixed, physical extension.", - "description*": { - "de": "Eine Örtlichkeit. Entitaeten, die eine mehr oder weniger feste, physische Ausdehnung haben." + "@context": { + "Property": "https://wiki-dev.open-semantic-lab.org/id/Property-3A", + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "quantity*": "Property:HasProperty", + "quantity": "rdf:predicate", + "value*": "Property:HasObject", + "value": "rdf:object", + "unit": "Property:HasUnit", }, - "defaultProperties": ["label", "gps_coordinates", "postal_address"], + "$comment": "A reduced version of JsonSchema:Statement", + "title": "Quantity", + "title*": {"de": "Menge"}, + "_headerTemplate": "{{self.value}}", } - type: list[str] | None = ["Category:OSW3d238d05316e45a4ac95a11d7b24e36b"] - postal_address: PostalAddress | None = None - gps_coordinates: GPSCoordinates | None = Field( - None, - defaultProperties=["uuid", "latitude", "longitude"], - eval_template={ - "type": "wikitext", - "value": "{{{latitude|}}}, {{{longitude|}}}", + uuid: UUID = Field(default_factory=uuid4, options={"hidden": True}, title="UUID") + quantity: str = Field( + ..., + options={ + "grid_columns": 8, + "autocomplete": {"category": "Category:QuantityProperty"}, + }, + propertyOrder=10, + title="Property", + title_={"de": "Attribut"}, + ) + numerical_value: str = Field( + ..., + options={"grid_columns": 2}, + propertyOrder=20, + title="Value", + title_={"de": "Wert"}, + ) + unit: str = Field( + ..., + options={ + "grid_columns": 2, + "autocomplete": { + "query": "[[-HasInputUnit::{{$(quantity)}}]][[Display_title_of::like:*{{_user_input}}*]]|?Display_title_of=label", + "render_template": { + "type": ["handlebars"], + "value": "{{result.printouts.label.[0]}}", + }, + "field_maps": [ + { + "source_path": "$", + "template": "{{{result.printouts.label.[0]}}}", + "target_path": "$(unit_symbol)", + } + ], + }, + }, + propertyOrder=30, + title="Unit", + title_={"de": "Einheit"}, + watch={ + "quantity": "statement.quantity", + "unit_symbol": "statement.unit_symbol", + }, + ) + unit_symbol: str = Field(..., options={"hidden": True}) + value: str = Field( + ..., + options={"hidden": True}, + template="{{{numerical_value}}} {{{unit_symbol}}}", + title="Value", + title_={"de": "Wert"}, + watch={ + "numerical_value": "statement.numerical_value", + "unit_symbol": "statement.unit_symbol", }, - title="GPS coordinates", - title_={"en": "GPS coordinates", "de": "GPS Koordinaten"}, ) -class Place(Item): +class ProbabilityOfSuccessfulFundingInPercent(Quantity): """ - Entities that have a somewhat fixed, physical extension. + Indicates the likelihood that the funding will be approved, determines the weighted budget """ class Config: schema_extra = { - "@context": ["/wiki/Category:Item?action=raw&slot=jsonschema"], - "uuid": "28f71f2c-20ad-48c3-8c4e-4d190a95c0b8", - "title": "Place", - "title*": {"en": "Place", "de": "Ort"}, - "description": "Entities that have a somewhat fixed, physical extension.", + "title": "Probability of Successful Funding in percent", + "title*": { + "de": "Wahrscheinlichkeit einer erfolgreichen Förderung in Prozent" + }, + "description": "Indicates the likelihood that the funding will be approved, determines the weighted budget", "description*": { - "en": "Entities that have a somewhat fixed, physical extension.", - "de": "Entitäten, die eine gewisse feste, physische Ausdehnung haben.", + "de": "Gibt die Wahrscheinlichkeit an, dass die Förderung genehmigt wird, bestimmt das gewichtete Budget" }, } - type: list[str] | None = ["Category:OSW28f71f2c20ad48c38c4e4d190a95c0b8"] - + quantity: str | None = Field( + "Property:HasProbabilityOfSuccessfulFunding", options={"hidden": True} + ) + unit: str | None = Field( + "Property:HasDimensionlessRatio#OSW8b3dc9b793074afc8ab8b03041f97f16", + readOnly=True, + ) -class AdministrativeArea(Place): - """ - A geographical region, typically under the jurisdiction of a particular government. - """ +class TotalBudget(Quantity): class Config: - schema_extra = { - "@context": [ - "/wiki/Category:OSW28f71f2c20ad48c38c4e4d190a95c0b8?action=raw&slot=jsonschema" - ], - "uuid": "137e7443-b2b9-4692-bd59-a0e0a6778b70", - "title": "AdministrativeArea", - "title*": {"en": "Administrative Area", "de": "Verwaltungsbereich"}, - "description": "A geographical region, typically under the jurisdiction of a particular government.", - "description*": { - "en": "A geographical region, typically under the jurisdiction of a particular government.", - "de": "Eine geografische Region, die in der Regel unter die Zuständigkeit einer bestimmten Regierung fällt.", - }, - } - - type: list[str] | None = ["Category:OSW137e7443b2b94692bd59a0e0a6778b70"] + schema_extra = {"title": "Total Budget", "title*": {"de": "Budgetsumme"}} + quantity: str | None = Field("Property:HasBudget", options={"hidden": True}) + unit: str | None = Field(None, title="Currency", title_={"de": "Währung"}) -class Country(AdministrativeArea): - """ - A distinct part of the world, such as a state, nation, or other political entity - """ +class YearlyBudgetSum(Quantity): class Config: schema_extra = { - "@context": [ - "/wiki/Category:OSW137e7443b2b94692bd59a0e0a6778b70?action=raw&slot=jsonschema" - ], - "uuid": "0551abcd-6f73-4047-825e-3ded4c8a0ffe", - "title": "Country", - "title*": {"en": "Country", "de": "Land"}, - "description": "A distinct part of the world, such as a state, nation, or other political entity", - "description*": { - "en": "A distinct part of the world, such as a state, nation, or other political entity", - "de": "Ein bestimmter Teil der Welt, z. B. ein Staat, eine Nation oder eine andere politische Einheit", - }, - } - - type: list[str] | None = ["Category:OSW0551abcd6f734047825e3ded4c8a0ffe"] - - -class State(AdministrativeArea): - """ - A state or province of a country. - """ - - class Config: - schema_extra = { - "@context": [ - "/wiki/Category:OSW137e7443b2b94692bd59a0e0a6778b70?action=raw&slot=jsonschema" - ], - "uuid": "ab60f9a2-2795-4ee0-be92-344ff6272420", - "title": "State", - "title*": {"en": "State", "de": "Staat"}, - "description": "A state or province of a country.", - "description*": { - "en": "A state or province of a country.", - "de": "Ein Staat oder eine Provinz eines Landes.", + "title": "Yearly Budget Sum", + "title*": {"de": "Summe Jahresbudget"}, + "options": { + "disable_collapse": True, + "disable_properties": True, + "compact": True, }, } - type: list[str] | None = ["Category:OSWab60f9a227954ee0be92344ff6272420"] + quantity: str | None = Field("Property:HasBudget", options={"hidden": True}) + numerical_value: str | None = Field(None, options={"grid_columns": 6}) + unit: str | None = Field( + None, + options={"grid_columns": 6}, + propertyOrder=1001, + title="Currency", + title_={"de": "Währung"}, + ) -class Region(AdministrativeArea): +class Distribution(OswBaseModel): class Config: schema_extra = { - "@context": [ - "/wiki/Category:OSW137e7443b2b94692bd59a0e0a6778b70?action=raw&slot=jsonschema" - ], - "uuid": "95efaf34-e2c7-439e-8e79-67233910e44b", - "title": "Region", - "title*": {"en": "Region", "de": "Region"}, - "description": "", - "description*": {}, + "title": "Distribution", + "title*": {"de": "Distribution"}, + "defaultProperties": ["file", "media_type", "conforms_to"], } - type: list[str] | None = ["Category:OSW95efaf34e2c7439e8e7967233910e44b"] - - -class City(AdministrativeArea): + file: File | None = Field( + None, + description_={"de": "Die Dateientität, die die Bytes enthält"}, + range="Category:OSWff333fd349af4f65a69100405a9e60c7", + title="File", + title_={"de": "Datei"}, + ) """ - A city or town. + The file entity holding the bytes """ - - class Config: - schema_extra = { - "@context": [ - "/wiki/Category:OSW137e7443b2b94692bd59a0e0a6778b70?action=raw&slot=jsonschema" - ], - "uuid": "807f1da5-b42e-42f2-96b2-13ab06ca873b", - "title": "City", - "title*": {"en": "Stadt"}, - "description": "A city or town.", - "description*": { - "en": "A city or town.", - "de": "Eine Stadt oder ein Ort, im Sinne einer Gemeinde", - }, - } - - type: list[str] | None = ["Category:OSW807f1da5b42e42f296b213ab06ca873b"] - - -# generated by datamodel-codegen: -# filename: OSW28f71f2c20ad48c38c4e4d190a95c0b8.json - - -# generated by datamodel-codegen: -# filename: OSW473d7a1ed48544d1be83b258b5810948.json - - -class Site(Location): + media_type: str | None = Field( + None, + description_={"de": "IANA-Medientyp dieser Repräsentation, z. B. text/csv"}, + title="Media type", + title_={"de": "Medientyp"}, + ) """ - A site is a location or place where a particular event, activity, or object exists or is situated. + IANA media type of this representation, e. g. text/csv """ - - class Config: - schema_extra = { - "@context": [ - "/wiki/Category:OSW3d238d05316e45a4ac95a11d7b24e36b?action=raw&slot=jsonschema" - ], - "title": "Site", - "title*": {"en": "Site", "de": "Standort"}, - "uuid": "473d7a1e-d485-44d1-be83-b258b5810948", - "description": "A site is a location or place where a particular event, activity, or object exists or is situated.", - "description*": { - "de": "Ein Standort ist ein Ort oder ein Platz, an dem ein bestimmtes Ereignis, eine Aktivität oder ein Objekt existiert oder sich befindet." - }, - } - - type: list[str] | None = ["Category:OSW473d7a1ed48544d1be83b258b5810948"] - - -# generated by datamodel-codegen: -# filename: OSW4bcd4a99a73f482ea40ac4210dfab836.json - - -class DisplayName(OswBaseModel): - class Config: - schema_extra = {"title": "Display name", "title*": {"de": "Anzeigenamen"}} - - text: Any | None = Field( + byte_size: conint(ge=0) | None = Field( + None, title="Byte size", title_={"de": "Größe in Byte"} + ) + package_format: str | None = Field( None, - dynamic_template="{{first_name}}{{#each middle_name}} {{.}}{{/each}}{{#if surname}} {{{surname}}}{{/if}}", - readonly=True, - watch={ - "first_name": "root.first_name", - "middle_name": "root.middle_name", - "surname": "root.surname", + description_={"de": "Container, in dem die Bytes verpackt sind, z. B. zip"}, + title="Package format", + title_={"de": "Paketformat"}, + ) + """ + Container the bytes are packaged in, e. g. zip + """ + compression_format: str | None = Field( + None, title="Compression format", title_={"de": "Kompressionsformat"} + ) + conforms_to: str | None = Field( + None, + description_={"de": "Das Datensatzschema, das diese Bytes verkörpern"}, + options={ + "autocomplete": {"$comment": "Any Category", "query": "[[:Category:%2B]]"} }, + title="Conforms to", + title_={"de": "Entspricht"}, + ) + """ + The dataset schema these bytes embody + """ + table_schema: str | None = Field( + None, + description_={ + "de": "Das Zeilenschema, wenn die Serialisierung tabellarisch ist" + }, + options={ + "autocomplete": {"$comment": "Any Category", "query": "[[:Category:%2B]]"} + }, + title="Table schema", + title_={"de": "Tabellenschema"}, + ) + """ + The row schema, where the serialization is tabular + """ + download_url: str | None = Field( + None, + description_={"de": "Direkte URL, wenn keine Dateientität verwendet wird"}, + title="Download URL", + title_={"de": "Download-URL"}, + ) + """ + Direct URL, where no file entity is used + """ + access_url: str | None = Field( + None, title="Access URL", title_={"de": "Zugriffs-URL"} ) - lang: str | None = "en" class TaxIdAndCountry(OswBaseModel): @@ -1489,273 +1321,594 @@ class Config: ) -class BuildingFunction(Item): - class Config: - schema_extra = {"title": "BuildingFunction"} - - type: list[str] | None = ["Category:OSW07a0faef5be94b788514a2dd5dca20bf"] - - -class Person(Item): - """ - Category for a person in general. Subcategories are e.g. 'User', i.e. persons who have a user ID. - """ - +class PostalAddress(OswBaseModel): class Config: schema_extra = { - "@context": [ - { - "competence": {"@id": "schema:knowsAbout", "@type": "@id"}, - "competence*": {"@id": "Property:HasCompetence", "@type": "@id"}, - "email": {"@id": "schema:email", "@type": "xsd:string"}, - "email*": {"@id": "Property:HasEmail", "@type": "xsd:string"}, - "fax_number": {"@id": "schema:faxNumber", "@type": "xsd:string"}, - "fax_number*": { - "@id": "Property:HasFaxNumber", - "@type": "xsd:string", - }, - "first_name": {"@id": "schema:givenName", "@type": "xsd:string"}, - "first_name*": { - "@id": "Property:HasFirstName", - "@type": "xsd:string", - }, - "located_in": {"@id": "schema:workLocation", "@type": "@id"}, - "located_in*": {"@id": "Property:IsLocatedIn", "@type": "@id"}, - "middle_name": { - "@id": "schema:additionalName", - "@type": "xsd:string", - }, - "middle_name*": { - "@id": "Property:HasMiddleName", - "@type": "xsd:string", - }, - "orcid": {"@id": "schema:identifier", "@type": "xsd:string"}, - "orcid*": {"@id": "Property:HasOrcidId", "@type": "xsd:string"}, - "organization": {"@id": "schema:worksFor", "@type": "@id"}, - "organization*": { - "@id": "Property:HasOrganization", - "@type": "@id", - }, - "organization**": {"@id": "Property:HasOu", "@type": "@id"}, - "organizational_unit": {"@id": "schema:memberOf", "@type": "@id"}, - "organizational_unit*": {"@id": "Property:HasOu", "@type": "@id"}, - "phone_number": {"@id": "schema:telephone", "@type": "xsd:string"}, - "phone_number*": { - "@id": "Property:HasPhoneNumber", - "@type": "xsd:string", - }, - "role": {"@id": "schema:jobTitle", "@type": "@id"}, - "role*": {"@id": "Property:HasRole", "@type": "@id"}, - "surname": {"@id": "schema:familyName", "@type": "xsd:string"}, - "surname*": {"@id": "Property:HasSurname", "@type": "xsd:string"}, - "topic": {"@id": "schema:knowsAbout", "@type": "@id"}, - "topic*": {"@id": "Property:HasTopic", "@type": "@id"}, - "website": {"@id": "schema:subjectOf", "@type": "xsd:string"}, - "website*": {"@id": "Property:HasWebsite", "@type": "xsd:string"}, + "@context": { + "address_supplement": { + "@id": "Property:HasAddressSupplement", + "@type": "xsd:string", }, - "/wiki/Category:Item?action=raw&slot=jsonschema", - ], - "title": "Person", - "title*": {"de": "Person", "en": "Person"}, - "uuid": "44deaa5b-806d-41a2-a885-94f562b110e9", - "description": "Category for a person in general. Subcategories are e.g. 'User', i.e. persons who have a user ID.", - "description*": { - "en": "Category for a person in general. Subcategories are e.g. 'User', i.e. persons who have a user ID.", - "de": "Kategorie für eine Person im Allgemeinen. Unterkategorien sind bsp. 'User', also Personen die über eine Nutzerkennung verfügen.", + "city": {"@id": "Property:HasCity", "@type": "@id"}, + "city*": {"@id": "schema:containedInPlace", "@type": "@id"}, + "city**": {"@id": "Property:IsLocatedIn", "@type": "@id"}, + "country": {"@id": "schema:addressCountry", "@type": "@id"}, + "country*": {"@id": "Property:HasCountry", "@type": "@id"}, + "house_no": {"@id": "Property:HasHouseNo", "@type": "xsd:string"}, + "postal_code": {"@id": "schema:postalCode", "@type": "xsd:string"}, + "postal_code*": { + "@id": "Property:HasPostalCode", + "@type": "xsd:string", + }, + "post_office_box_no": { + "@id": "schema:postOfficeBoxNumer", + "@type": "xsd:string", + }, + "post_office_box_no*": { + "@id": "Property:HasPoBoxNo", + "@type": "xsd:string", + }, + "region": {"@id": "schema:addressRegion", "@type": "@id"}, + "region*": {"@id": "Property:HasRegion", "@type": "@id"}, + "state": {"@id": "schema:addressCountry", "@type": "@id"}, + "state*": {"@id": "Property:HasState", "@type": "@id"}, + "street_name": {"@id": "Property:HasStreet", "@type": "xsd:string"}, + }, + "title": "Postal address", + "title*": {"en": "Postal address", "de": "Postalische Adresse"}, + "description": "", + "eval_template": { + "type": "wikitext", + "mode": "render", + "value": "{{#if: {{{addressee|}}}|{{{addressee|}}}
|}}{{{street_name|}}} {{{house_no|}}}
{{#if: {{{address_supplement|}}}|{{{address_supplement|}}}
|}}{{{postal_code|}}} {{#if: {{{city|}}} |[[{{{city|}}}]]|{{{city_name|}}} }}, {{#if: {{{region|}}}|[[{{{region|}}}]], |}}{{#if: {{{state|}}}|[[{{{state|}}}]], |}}{{#if: {{{country|}}} |[[{{{country|}}}]]|{{{country_name|}}} }}{{#if: {{{post_office_box_no|}}}|
{{#switch:{{USERLANGUAGECODE}}|#default=PO Box No|de=Postfach-Nr.}} {{{post_office_box_no|}}}|}}", }, - "data_source_maps": [ - { - "id": "pub.orcid.org", - "source": "https://pub.orcid.org/v3.0/{{#split '/' -1}}{{orcid}}{{/split}}", - "format": "jsonld", - "label": "ORCID", - "required": ["orcid"], - "object_map": { - "first_name": "$.givenName", - "surname": "$.familyName", - }, - } - ], "defaultProperties": [ - "first_name", - "surname", - "organization", - "email", - "phone_number", + "uuid", + "street_name", + "house_no", + "postal_code", + "city", + "city_name", + "country", + "country_name", + "address_supplement", + "state", + "region", + "post_office_box_no", ], } - type: list[str] | None = ["Category:OSW44deaa5b806d41a2a88594f562b110e9"] - first_name: str = Field( - ..., - propertyOrder=-3, - title="First name / Given name / Forename", - title_={"de": "Vorname"}, - ) - middle_name: set[str] | None = Field( + uuid: UUID = Field(default_factory=uuid4, options={"hidden": True}) + country: Country | None = Field( None, - propertyOrder=-2, - title="Middle name(s)", - title_={"de": "Zweite(r) Vorname(n)"}, + range="Category:OSW0551abcd6f734047825e3ded4c8a0ffe", + title="Country", + title_={"en": "Country", "de": "Land"}, ) - surname: str = Field( - ..., - propertyOrder=-1, - title="Last name / Family name / Surname", - title_={"de": "Nachname"}, + country_name: str | None = Field( + None, title="Country (text)", title_={"de": "Land (Text)"} ) - label: list[DisplayName] | None = Field(None, options={"hidden": True}) - organization: set[OrganizationalUnit] | None = Field( + state: State | None = Field( None, - description_={ - "de": "Organisation(en), derer die Person Mitglied ist. Z.B. Universität, Forschungsinstitut, Unternehmen, etc." - }, - range="Category:OSW3cb8cef2225e403092f098f99bc4c472", - title="Organization", - title_={"de": "Organisation"}, + range="Category:OSWab60f9a227954ee0be92344ff6272420", + title="State", + title_={"en": "State", "de": "Bundesland"}, ) - """ - Organization(s) the person is affiliated with. E.g., university, research institute, company, etc. - """ - organizational_unit: set[OrganizationalSubUnit] | None = Field( + region: Region | None = Field( None, - description_={ - "de": "Organisations(unter)einheit(en), derer die Person Mitglied ist. Z.B. Fakultät, Institut, Abteilung oder Forschungsgruppe, etc." - }, - range="Category:OSWfe3e842b804445c7bb0dd8ee61da2d70", - title="Organizational (sub)unit", - title_={"de": "Organisations(unter)einheit"}, + range="Category:OSW95efaf34e2c7439e8e7967233910e44b", + title="Region", + title_={"en": "Region", "de": "Region"}, ) - """ - Organizational (sub)unit(s) the person is member of. E.g., faculty, institute, department or research group, etc. - """ - email: set[EmailStr] | None = Field( + post_office_box_no: str | None = Field( None, - eval_template={ - "type": "mustache-wikitext", - "mode": "render", - "value": "{{#email}}[mailto:{{.}} {{.}}]
{{/email}}", - }, - title="Email address", - title_={"de": "E-Mail Adresse"}, + title="PO box number", + title_={"en": "PO box number", "de": "Postfach nummer"}, ) - website: set[AnyUrl] | None = Field( + postal_code: str | None = Field( + None, title="Postal code", title_={"en": "Postal code", "de": "Postleitzahl"} + ) + city: City | None = Field( None, - eval_template={ - "type": "mustache-wikitext", - "mode": "render", - "value": "{{#website}}{{{.}}}
{{/website}}", - }, - title="Website", - title_={"de": "Webseite"}, + range="Category:OSW807f1da5b42e42f296b213ab06ca873b", + title="City", + title_={"en": "City", "de": "Stadt"}, ) - orcid: AnyUrl | None = Field( + city_name: str | None = Field( + None, title="City (text)", title_={"de": "Stadt (Text)"} + ) + street_name: str | None = Field( + None, title="Street", title_={"en": "Street", "de": "Straße"} + ) + house_no: str | None = Field( + None, title="House number", title_={"en": "House number", "de": "Hausnummer"} + ) + address_supplement: str | None = Field( + None, + title="Address supplement", + title_={"en": "Address supplement", "de": "Adresszusatz"}, + ) + addressee: str | None = Field( None, description_={ - "de": "Die ORCID iD ist eine https URI mit einer 16-stelligen Nummer, z. B. https://orcid.org/0000-0001-2345-6789." + "de": "Titelzeile der Adresse falls abweichend vom Organisationsname" }, - title="ORCID iD", - title_={"de": "ORCID iD"}, + title="Addressee", + title_={"de": "Adressat"}, ) """ - The ORCID iD is an https URI with a 16-digit number, e.g., https://orcid.org/0000-0001-2345-6789. + Title line of the address in case different from organization name """ - phone_number: ( - set[ - constr( - regex=r"(?:(?:(?:\+|00|011)[\.\/\-\ \t]*([17]|2(?:[07]|[1-689]\d)|3(?:[0-4679]|[578]\d)|4(?:[013-9]|2\d)|5(?:[1-8]|[09]\d)|6(?:[0-6]|[789]\d)|8(?:[1246]|[035789]\d)|9(?:[0-58]|[679]\d))[\.\/\-\ \t]*|([17])[\.\/\-\ ])?(?:\((\d{1,6})\)[\.\/\-\ \t]*)?(?:(\d{1,6})[\.\/\-\ ])?(?:(\d{1,6})[\.\/\-\ ])?(?:(\d{1,6})[\.\/\-\ ])?(?:(\d{1,6})[\.\/\-\ ])?(\d{0,10}?)(\d{1,})(?:[\.\/\-;\ \t]*e?xt?[\.\/\-=\ \t]*(\d{1,14}))?)?" - ) - ] - | None - ) = Field( + + +class Component(OswBaseModel): + class Config: + schema_extra = { + "title": "Component", + "title*": {"de": "Komponente"}, + "headerTemplate": "{{ i1 }} - {{ self.component_id }}", + "defaultProperties": [], + } + + uuid: UUID = Field( + ..., + dynamic_template="{{_uuid_}}", + field_comment="format uuid field are copied, if not set in copy_ignore", + field_template="dynamic_template", + options={"hidden": True, "dynamic_template": {"override": "empty"}}, + title="UUID", + title_={"de": "UUID"}, + ) + component_id: str = Field( + ..., + description_={"de": "Wird automatisch generiert"}, + dynamic_template="Component{{patternformat '00' _array_index_}}", + field_comment="Will be used as a visual reference for the user", + options={ + "hidden": True, + "dynamic_template": {"override": "always"}, + "grid_columns": 6, + }, + propertyOrder=10, + readOnly=True, + title="ID", + title_={"de": "ID"}, + ) + """ + Automatically generated + """ + label: list[Label] | None = Field( None, description_={ - "de": "Telefonnummer mit Landesvorwahl und Bindestrichen formatiert, z.B.. +49-931-4100-172. Entsprechend https://www.wikidata.org/wiki/Property:P1329" + "de": "Bezeichnung der Funktion oder Rolle der Komponente in diesem spezifischen Kontext." }, eval_template={ "type": "mustache-wikitext", "mode": "render", - "value": "{{#phone_number}}[tel:{{.}} {{.}}]
{{/phone_number}}", + "value": "{{=<% %>=}} {{#switch:{{USERLANGUAGECODE}} <%={{ }}=%> {{#label}} |{{lang}}={{text}} {{/label}} {{=<% %>=}} }}", }, - title="Phone number", - title_={"de": "Telefonnummer"}, + options={"grid_columns": 12}, + propertyOrder=20, + title="Label", + title_={"de": "Bezeichnung"}, ) """ - Phone number formatted with country code and hyphens, e.g.. +49-931-4100-172. According to https://www.wikidata.org/wiki/Property:P1329 + Designation of the function or role of the component in this specific context. """ - fax_number: ( - set[ - constr( - regex=r"(?:(?:(?:\+|00|011)[\.\/\-\ \t]*([17]|2(?:[07]|[1-689]\d)|3(?:[0-4679]|[578]\d)|4(?:[013-9]|2\d)|5(?:[1-8]|[09]\d)|6(?:[0-6]|[789]\d)|8(?:[1246]|[035789]\d)|9(?:[0-58]|[679]\d))[\.\/\-\ \t]*|([17])[\.\/\-\ ])?(?:\((\d{1,6})\)[\.\/\-\ \t]*)?(?:(\d{1,6})[\.\/\-\ ])?(?:(\d{1,6})[\.\/\-\ ])?(?:(\d{1,6})[\.\/\-\ ])?(?:(\d{1,6})[\.\/\-\ ])?(\d{0,10}?)(\d{1,})(?:[\.\/\-;\ \t]*e?xt?[\.\/\-=\ \t]*(\d{1,14}))?)?" - ) - ] - | None - ) = Field( + description: list[Description] | None = Field( None, description_={ - "de": "Faxnummer mit Landesvorwahl und Bindestrichen formatiert, z.B.. +49-931-4100-172. Entsprechend https://www.wikidata.org/wiki/Property:P1329" + "de": "Optional, zusätzliche Angaben zur Rolle oder Funktion der Komponente in diesem spezifischen Kontext." }, eval_template={ "type": "mustache-wikitext", "mode": "render", - "value": "{{#fax_number}}[tel:{{.}} {{.}}]
{{/fax_number}}", + "value": "{{=<% %>=}} {{#switch:{{USERLANGUAGECODE}} <%={{ }}=%> {{#description}} |{{lang}}={{text}} {{/description}} {{=<% %>=}} }}", }, - title="Fax number", - title_={"de": "Faxnummer"}, + options={"grid_columns": 12}, + propertyOrder=30, + title="Description", + title_={"de": "Beschreibung"}, ) """ - Fax number formatted with country code and hyphens, e.g.. +49-931-4100-172. According to https://www.wikidata.org/wiki/Property:P1329 + Optional, additional details on the role or function of the component in this specific context. """ - located_in: set[Site] | None = Field( - None, - range="Category:OSW473d7a1ed48544d1be83b258b5810948", - title="Located at ", - title_={"de": "Tätig an (Standort)"}, - ) - role: set[PersonRole] | None = Field( - None, - range="Category:OSW5efde23b1d8c4e1c864ef039cb0616ed", - title="Roles", - title_={"de": "Rollen"}, + component_type: Category | None = Field( + default_factory=lambda: Category.parse_obj( + "Category:OSWe427aafafbac4262955b9f690a83405d" + ), + options={ + "autocomplete": { + "$comment": "Tool", + "query": "[[:Category:OSWe427aafafbac4262955b9f690a83405d]]OR[[SubClassOf::Category:OSWe427aafafbac4262955b9f690a83405d]]OR[[SubClassOf.SubClassOf::Category:OSWe427aafafbac4262955b9f690a83405d]]OR[[SubClassOf.SubClassOf.SubClassOf::Category:OSWe427aafafbac4262955b9f690a83405d]]OR[[SubClassOf.SubClassOf.SubClassOf.SubClassOf::Category:OSWe427aafafbac4262955b9f690a83405d]]OR[[SubClassOf.SubClassOf.SubClassOf.SubClassOf.SubClassOf::Category:OSWe427aafafbac4262955b9f690a83405d]]", + }, + "grid_columns": 12, + }, + propertyOrder=40, + range="Category:Category", + title="Component type", + title_={"de": "Typ der Komponente"}, + x_oold_required_iri=True, ) - competence: set[Competence] | None = Field( - None, - range="Category:OSW5eb9c52b804544dc870dfd54ff434428", - title="Competences", - title_={"de": "Kompetenzen"}, + component_instance_property: str | None = Field( + "Property:HasPart", options={"hidden": True} ) - topic: set[Topic] | None = Field( + component_instance: Tool | None = Field( None, - range="Category:OSW5a13eeda5ed5405ea7ef62ea6feeceec", - title="Topics", - title_={"de": "Themen"}, - ) - - -class OrganizationalUnit(Item): - """ - The most general kind of organizational unit - an organization but also parts of an organization + options={ + "autocomplete": { + "query": "[[HasType::$(component_type_)]]|?Display_title_of=label|?HasImage=image|?HasDescription=description" + }, + "grid_columns": 12, + }, + propertyOrder=50, + range="Category:OSWe427aafafbac4262955b9f690a83405d", + title="Instance", + title_={"de": "Instanz"}, + watch={"component_type_": "component.component_type"}, + x_oold_required_iri=True, + ) + + +class InitialOccupantOfTheSlot(OswBaseModel): + """ + Tool or component installed in the slot. + """ + + class Config: + schema_extra = { + "title": "Initial occupant of the slot", + "title*": {"de": "Initiale Belegung des Slots"}, + "description": "Tool or component installed in the slot.", + "description*": {"de": "Im Slot installiertes Werkzeug oder Komponente."}, + "defaultProperties": ["slot_occupant_type"], + "options": {"grid_columns": 12}, + "propertyOrder": 60, + } + + slot_occupant_type: Category | None = Field( + None, + options={ + "autocomplete": { + "$comment": "Tool", + "query": "[[:$(slot_type)]]OR[[SubClassOf::$(slot_type)]]OR[[SubClassOf.SubClassOf::$(slot_type)]]OR[[SubClassOf.SubClassOf.SubClassOf::$(slot_type)]]OR[[SubClassOf.SubClassOf.SubClassOf.SubClassOf::$(slot_type)]]OR[[SubClassOf.SubClassOf.SubClassOf.SubClassOf.SubClassOf::$(slot_type)]]", + } + }, + propertyOrder=11, + range="Category:Category", + title="Type", + title_={"de": "Typ"}, + watch={"slot_type": "slot.slot_type_restriction"}, + ) + slot_occupant_instance_property: str | None = Field( + "Property:HasOccupant", options={"hidden": True} + ) + slot_occupant_instance: Tool | None = Field( + None, + options={ + "autocomplete": { + "query": "[[HasType::$(slot_occupant_type_)]]|?Display_title_of=label|?HasImage=image|?HasDescription=description" + } + }, + propertyOrder=21, + range="Category:OSWe427aafafbac4262955b9f690a83405d", + title="Instance", + title_={"de": "Instanz"}, + watch={"slot_occupant_type_": "slot_occupant.slot_occupant_type"}, + x_oold_required_iri=True, + ) + + +class Slot(OswBaseModel): + class Config: + schema_extra = { + "title": "Slot", + "title*": {"de": "Slot"}, + "headerTemplate": "{{ i1 }} - {{ self.slot_id }}", + "defaultProperties": ["name", "description", "slot_occupant"], + } + + uuid: str = Field( + ..., + dynamic_template="{{_uuid_}}", + field_comment="format uuid field are copied, if not set in copy_ignore", + field_format="uuid", + field_template="dynamic_template", + options={"hidden": True, "dynamic_template": {"override": "empty"}}, + title="UUID", + title_={"de": "UUID"}, + ) + slot_osw_id: str = Field( + ..., + dynamic_template="{{_current_subject_}}#OSW{{#replace '-' ''}}{{_own_uuid}}{{/replace}}", + field_comment="Will be used an unique reference for slot exchange events.", + field_format="dynamic_template", + options={"hidden": True, "dynamic_template": {"override": "empty"}}, + readOnly=True, + title="OSW-ID", + title_={"de": "OSW-ID"}, + watch={"_own_uuid": "slot.uuid"}, + ) + slot_id: str = Field( + ..., + description_={"de": "Wird automatisch generiert"}, + dynamic_template="Slot{{patternformat '00' _array_index_}}", + field_comment="Will be used as a visual reference for the user", + options={ + "hidden": True, + "dynamic_template": {"override": "always"}, + "grid_columns": 6, + }, + propertyOrder=10, + readOnly=True, + title="ID", + title_={"de": "ID"}, + ) + """ + Automatically generated + """ + name: str | None = Field( + None, + options={"grid_columns": 6}, + propertyOrder=20, + title="Name", + title_={"de": "Name"}, + ) + description: list[Description] | None = Field( + None, + eval_template={ + "type": "mustache-wikitext", + "mode": "render", + "value": "{{=<% %>=}} {{#switch:{{USERLANGUAGECODE}} <%={{ }}=%> {{#description}} |{{lang}}={{text}} {{/description}} {{=<% %>=}} }}", + }, + options={"grid_columns": 12}, + propertyOrder=30, + title="Description", + title_={"de": "Beschreibung"}, + ) + slot_init_date_time: datetime = Field( + ..., + dynamic_template="{{_now_}}", + options={"dynamic_template": {"override": "empty"}, "grid_columns": 4}, + propertyOrder=21, + title="Date of slot initialization", + title_={"de": "Datum der Slot-Initialisierung"}, + ) + slot_type_restriction: Category | None = Field( + default_factory=lambda: Category.parse_obj( + "Category:OSWe427aafafbac4262955b9f690a83405d" + ), + options={ + "autocomplete": { + "$comment": "Tool", + "query": "[[:Category:OSWe427aafafbac4262955b9f690a83405d]]OR[[SubClassOf::Category:OSWe427aafafbac4262955b9f690a83405d]]OR[[SubClassOf.SubClassOf::Category:OSWe427aafafbac4262955b9f690a83405d]]OR[[SubClassOf.SubClassOf.SubClassOf::Category:OSWe427aafafbac4262955b9f690a83405d]]OR[[SubClassOf.SubClassOf.SubClassOf.SubClassOf::Category:OSWe427aafafbac4262955b9f690a83405d]]OR[[SubClassOf.SubClassOf.SubClassOf.SubClassOf.SubClassOf::Category:OSWe427aafafbac4262955b9f690a83405d]]", + } + }, + propertyOrder=50, + range="Category:Category", + title="Type restriction of the slot", + title_={"de": "Typeinschränkung des Slots"}, + x_oold_required_iri=True, + ) + slot_occupant: InitialOccupantOfTheSlot | None = Field( + None, + defaultProperties=["slot_occupant_type"], + description_={"de": "Im Slot installiertes Werkzeug oder Komponente."}, + options={"grid_columns": 12}, + propertyOrder=60, + title="Initial occupant of the slot", + title_={"de": "Initiale Belegung des Slots"}, + ) + """ + Tool or component installed in the slot. + """ + + +class YearlyBudget(OswBaseModel): + class Config: + schema_extra = { + "title": "Yearly budget", + "title*": {"de": "Jahresbudget"}, + "defaultProperties": [ + "budget_year", + "yearly_budget_sum", + "budget_type", + "budget_ou", + ], + } + + uuid: UUID = Field(default_factory=uuid4, options={"hidden": True}, title="UUID") + budget_year: str | None = Field(None, title="Year", title_={"de": "Jahr"}) + yearly_budget_sum: YearlyBudgetSum | None = Field( + None, + options={"disable_collapse": True, "disable_properties": True, "compact": True}, + title="Yearly Budget Sum", + title_={"de": "Summe Jahresbudget"}, + ) + yearly_budget_sum_weighted: WeightedSum | None = Field( + None, + field_description="weighted with probability of successful funding", + field_description_={"de": "gewichtet mit Erfolgswahrscheinlichkeit"}, + options={"disable_collapse": True, "disable_properties": True, "compact": True}, + title="weighted sum", + title_={"de": "Gewichtete Summe"}, + ) + budget_start: date | None = Field(None, title="Start", title_={"de": "Beginn"}) + budget_end: date | None = Field(None, title="End", title_={"de": "Ende"}) + budget_ou: OrganizationalUnit | None = Field( + None, + range="Category:OSW3cb8cef2225e403092f098f99bc4c472", + title="OU", + title_={"en": "OU", "de": "OE"}, + ) + budget_type: BudgetType | None = Field( + None, + range="Category:OSW595b282aedf048788f3ee326454792ce", + title="Type", + title_={"de": "Typ"}, + ) + + +class DatasetSchema(Item): + class Config: + schema_extra = { + "@context": [{"schema_definition": "Property:HasSchemaDefinition"}], + "title": "DatasetSchema", + "defaultProperties": ["schema_definition", "label", "uuid"], + } + + schema_definition: str | None = Field(None, title="Dataset schema") + """ + Defintion of a JSON based Schema for a dataset. + """ + type: list[str] | None = ["Category:OSW0d6584b3e2b64e9595733c4c3963c486"] + + +class Process(Item): + """ + Members of the Process Category describe the act of changing the state or properties of something """ class Config: schema_extra = { "@context": [ + "/wiki/Category:Item?action=raw&slot=jsonschema", { - "abbreviation": {"@id": "Property:HasId", "@type": "xsd:string"}, - "abbreviation*": { - "@id": "Property:HasAbbreviation", - "@type": "xsd:string", - }, - "abbreviation**": { - "@id": "Property:HasAcronym", - "@type": "xsd:string", + "type": {"@id": "Property:HasType", "@type": "@id"}, + "type*": {"@id": "Property:HasSchema", "@type": "@id"}, + "tool": {"@id": "Property:HasTool", "@type": "@id"}, + "input": {"@id": "Property:HasInput", "@type": "@id"}, + "location": {"@id": "Property:HasLocation", "@type": "@id"}, + "location_name": {"@id": "Property:HasLocation", "@type": "@id"}, + "output": {"@id": "Property:HasOutput", "@type": "@id"}, + "creator": {"@id": "Property:HasCreator", "@type": "@id"}, + "actionees": {"@id": "Property:HasActionee", "@type": "@id"}, + "projects": {"@id": "Property:HasProject", "@type": "@id"}, + "status": {"@id": "Property:HasStatus", "@type": "@id"}, + "start_date_time": { + "@id": "Property:HasStartDateAndTime", + "@type": "xsd:dateTime", }, + "duration": {"@id": "Property:HasDuration"}, + "end_date_time": { + "@id": "Property:HasEndDateAndTime", + "@type": "xsd:dateTime", + }, + "subprocesses": {"@id": "Property:HasPart", "@type": "@id"}, + }, + ], + "title": "Process", + "title*": {"en": "Process", "de": "Prozess"}, + "uuid": "5a07d666-c55b-4ffa-89d4-9633c708029d", + "description": "Members of the Process Category describe the act of changing the state or properties of something", + "description*": { + "en": "Members of the Process Category describe the act of changing the state or properties of something", + "de": "Prozesse beschreiben den Akt des Änderns eines Zustandes oder der Eigenschaften von etwas.", + }, + "defaultProperties": [ + "actionees", + "start_date_time", + "tool", + "input", + "output", + ], + } + + type: list[str] | None = ["Category:OSWe5aa96bffb1c4d95be7fbd46142ad203"] + creator: Person | None = Field( + None, + range="Category:OSW44deaa5b806d41a2a88594f562b110e9", + title="Creator", + title_={"de": "Ersteller"}, + ) + actionees: list[Person] | None = Field( + None, + range="Category:OSW44deaa5b806d41a2a88594f562b110e9", + title="Actionees", + title_={"de": "Akteure"}, + ) + start_date_time: datetime | None = Field( + None, + field_comment='Note: To hide the time, you can set {"options": {"flatpickr": {"dateFormat": "Z", "altInput": true, "altFormat": "Y-m-d"}}}', + title="Start time", + title_={"de": "Startzeitpunkt"}, + ) + duration: timedelta | None = Field(None, title="Duration", title_={"de": "Dauer"}) + end_date_time: datetime | None = Field( + None, title="End time", title_={"de": "Endzeitpunkt"} + ) + location: Location | None = Field( + None, + range="Category:OSW3d238d05316e45a4ac95a11d7b24e36b", + title="Location", + title_={"de": "Ort"}, + ) + location_name: str | None = Field( + None, + description_={ + "de": "Vorzugsweise sollte ein Ort aus dem Autocomplete-Feld 'Ort' ausgewählt oder erstellt werden." + }, + title="Location (text)", + title_={"de": "Ort (Text)"}, + ) + """ + Its prefered to select or create a location from or in the autocomplete field 'Location'. + """ + status: Status | None = Field( + None, + field_format="autocomplete", + options={ + "_autocomplete": { + "category": "Category:OSW9725d7a91bab4f1aa68f423e4e9bfcf4" + }, + "enum_titles": ["To do", "In work", "Done"], + "enum_titles*": {"de": ["Zu tun", "In Arbeit", "Erledigt"]}, + "grid_columns": 6, + }, + title="Status", + ) + tool: list[Tool] | None = Field( + None, + options={"conditional_visible": {"modes": ["query", "default"]}}, + range="Category:OSWe427aafafbac4262955b9f690a83405d", + title="Tools", + title_={"de": "Werkzeuge"}, + ) + input: list[Item] | None = Field( + None, + options={"conditional_visible": {"modes": ["query", "default"]}}, + range="Category:Item", + title="Inputs", + title_={"de": "Eingangsressource (Input)"}, + ) + output: list[Item] | None = Field( + None, + options={"conditional_visible": {"modes": ["query", "default"]}}, + range="Category:Item", + title="Outputs", + title_={"de": "Ausgangsressource (Output)"}, + ) + projects: list[Project] | None = Field( + None, + options={"conditional_visible": {"modes": ["query", "default"]}}, + range="Category:OSWb2d7e6a2eff94c82b7f1f2699d5b0ee3", + title="Project(s)", + title_={"de": "Projekt(e)"}, + ) + parameters: dict[str, Any] | None = Field(None, title="Parameters") + + +class Person(Item): + """ + Category for a person in general. Subcategories are e.g. 'User', i.e. persons who have a user ID. + """ + + class Config: + schema_extra = { + "@context": [ + { "competence": {"@id": "schema:knowsAbout", "@type": "@id"}, "competence*": {"@id": "Property:HasCompetence", "@type": "@id"}, - "deputy_manager": { - "@id": "Property:HasDeputyManager", - "@type": "@id", - }, "email": {"@id": "schema:email", "@type": "xsd:string"}, "email*": {"@id": "Property:HasEmail", "@type": "xsd:string"}, "fax_number": {"@id": "schema:faxNumber", "@type": "xsd:string"}, @@ -1763,713 +1916,1345 @@ class Config: "@id": "Property:HasFaxNumber", "@type": "xsd:string", }, - "founder": {"@id": "schema:founder", "@type": "xsd:string"}, - "founder*": {"@id": "Property:HasFounder", "@type": "@id"}, - "founding_date": { - "@id": "schema:foundingDate", - "@type": "xsd:date", + "first_name": {"@id": "schema:givenName", "@type": "xsd:string"}, + "first_name*": { + "@id": "Property:HasFirstName", + "@type": "xsd:string", }, - "founding_date*": { - "@id": "Property:HasFoundingDate", - "@type": "xsd:date", + "located_in": {"@id": "schema:workLocation", "@type": "@id"}, + "located_in*": {"@id": "Property:IsLocatedIn", "@type": "@id"}, + "middle_name": { + "@id": "schema:additionalName", + "@type": "xsd:string", }, - "founding_location": { - "@id": "schema:foundingLocation", - "@type": "@id", + "middle_name*": { + "@id": "Property:HasMiddleName", + "@type": "xsd:string", }, - "founding_location*": { - "@id": "Property:HasFoundingLocation", + "orcid": {"@id": "schema:identifier", "@type": "xsd:string"}, + "orcid*": {"@id": "Property:HasOrcidId", "@type": "xsd:string"}, + "organization": {"@id": "schema:worksFor", "@type": "@id"}, + "organization*": { + "@id": "Property:HasOrganization", "@type": "@id", }, - "funder": {"@id": "schema:funder", "@type": "@id"}, - "funder*": {"@id": "Property:HasFunder", "@type": "@id"}, - "image": {"@id": "schema:logo", "@type": "@id"}, - "image*": {"@id": "Property:HasLogo", "@type": "@id"}, - "legal_name": {"@id": "schema:legalName", "@type": "xsd:string"}, - "legal_name*": { - "@id": "Property:HasLegalName", + "organization**": {"@id": "Property:HasOu", "@type": "@id"}, + "organizational_unit": {"@id": "schema:memberOf", "@type": "@id"}, + "organizational_unit*": {"@id": "Property:HasOu", "@type": "@id"}, + "phone_number": {"@id": "schema:telephone", "@type": "xsd:string"}, + "phone_number*": { + "@id": "Property:HasPhoneNumber", + "@type": "xsd:string", + }, + "role": {"@id": "schema:jobTitle", "@type": "@id"}, + "role*": {"@id": "Property:HasRole", "@type": "@id"}, + "surname": {"@id": "schema:familyName", "@type": "xsd:string"}, + "surname*": {"@id": "Property:HasSurname", "@type": "xsd:string"}, + "topic": {"@id": "schema:knowsAbout", "@type": "@id"}, + "topic*": {"@id": "Property:HasTopic", "@type": "@id"}, + "website": {"@id": "schema:subjectOf", "@type": "xsd:string"}, + "website*": {"@id": "Property:HasWebsite", "@type": "xsd:string"}, + }, + "/wiki/Category:Item?action=raw&slot=jsonschema", + ], + "title": "Person", + "title*": {"de": "Person", "en": "Person"}, + "uuid": "44deaa5b-806d-41a2-a885-94f562b110e9", + "description": "Category for a person in general. Subcategories are e.g. 'User', i.e. persons who have a user ID.", + "description*": { + "en": "Category for a person in general. Subcategories are e.g. 'User', i.e. persons who have a user ID.", + "de": "Kategorie für eine Person im Allgemeinen. Unterkategorien sind bsp. 'User', also Personen die über eine Nutzerkennung verfügen.", + }, + "data_source_maps": [ + { + "id": "pub.orcid.org", + "source": "https://pub.orcid.org/v3.0/{{#split '/' -1}}{{orcid}}{{/split}}", + "format": "jsonld", + "label": "ORCID", + "required": ["orcid"], + "object_map": { + "first_name": "$.givenName", + "surname": "$.familyName", + }, + } + ], + "defaultProperties": [ + "first_name", + "surname", + "organization", + "email", + "phone_number", + ], + } + + type: list[str] | None = ["Category:OSW44deaa5b806d41a2a88594f562b110e9"] + first_name: str = Field( + ..., + propertyOrder=-3, + title="First name / Given name / Forename", + title_={"de": "Vorname"}, + ) + middle_name: set[str] | None = Field( + None, + propertyOrder=-2, + title="Middle name(s)", + title_={"de": "Zweite(r) Vorname(n)"}, + ) + surname: str = Field( + ..., + propertyOrder=-1, + title="Last name / Family name / Surname", + title_={"de": "Nachname"}, + ) + label: list[DisplayName] | None = Field(None, options={"hidden": True}) + organization: set[OrganizationalUnit] | None = Field( + None, + description_={ + "de": "Organisation(en), derer die Person Mitglied ist. Z.B. Universität, Forschungsinstitut, Unternehmen, etc." + }, + range="Category:OSW3cb8cef2225e403092f098f99bc4c472", + title="Organization", + title_={"de": "Organisation"}, + ) + """ + Organization(s) the person is affiliated with. E.g., university, research institute, company, etc. + """ + organizational_unit: set[OrganizationalSubUnit] | None = Field( + None, + description_={ + "de": "Organisations(unter)einheit(en), derer die Person Mitglied ist. Z.B. Fakultät, Institut, Abteilung oder Forschungsgruppe, etc." + }, + range="Category:OSWfe3e842b804445c7bb0dd8ee61da2d70", + title="Organizational (sub)unit", + title_={"de": "Organisations(unter)einheit"}, + ) + """ + Organizational (sub)unit(s) the person is member of. E.g., faculty, institute, department or research group, etc. + """ + email: set[EmailStr] | None = Field( + None, + eval_template={ + "type": "mustache-wikitext", + "mode": "render", + "value": "{{#email}}[mailto:{{.}} {{.}}]
{{/email}}", + }, + title="Email address", + title_={"de": "E-Mail Adresse"}, + ) + website: set[AnyUrl] | None = Field( + None, + eval_template={ + "type": "mustache-wikitext", + "mode": "render", + "value": "{{#website}}{{{.}}}
{{/website}}", + }, + title="Website", + title_={"de": "Webseite"}, + ) + orcid: AnyUrl | None = Field( + None, + description_={ + "de": "Die ORCID iD ist eine https URI mit einer 16-stelligen Nummer, z. B. https://orcid.org/0000-0001-2345-6789." + }, + title="ORCID iD", + title_={"de": "ORCID iD"}, + ) + """ + The ORCID iD is an https URI with a 16-digit number, e.g., https://orcid.org/0000-0001-2345-6789. + """ + phone_number: ( + set[ + constr( + regex=r"(?:(?:(?:\+|00|011)[\.\/\-\ \t]*([17]|2(?:[07]|[1-689]\d)|3(?:[0-4679]|[578]\d)|4(?:[013-9]|2\d)|5(?:[1-8]|[09]\d)|6(?:[0-6]|[789]\d)|8(?:[1246]|[035789]\d)|9(?:[0-58]|[679]\d))[\.\/\-\ \t]*|([17])[\.\/\-\ ])?(?:\((\d{1,6})\)[\.\/\-\ \t]*)?(?:(\d{1,6})[\.\/\-\ ])?(?:(\d{1,6})[\.\/\-\ ])?(?:(\d{1,6})[\.\/\-\ ])?(?:(\d{1,6})[\.\/\-\ ])?(\d{0,10}?)(\d{1,})(?:[\.\/\-;\ \t]*e?xt?[\.\/\-=\ \t]*(\d{1,14}))?)?" + ) + ] + | None + ) = Field( + None, + description_={ + "de": "Telefonnummer mit Landesvorwahl und Bindestrichen formatiert, z.B.. +49-931-4100-172. Entsprechend https://www.wikidata.org/wiki/Property:P1329" + }, + eval_template={ + "type": "mustache-wikitext", + "mode": "render", + "value": "{{#phone_number}}[tel:{{.}} {{.}}]
{{/phone_number}}", + }, + title="Phone number", + title_={"de": "Telefonnummer"}, + ) + """ + Phone number formatted with country code and hyphens, e.g.. +49-931-4100-172. According to https://www.wikidata.org/wiki/Property:P1329 + """ + fax_number: ( + set[ + constr( + regex=r"(?:(?:(?:\+|00|011)[\.\/\-\ \t]*([17]|2(?:[07]|[1-689]\d)|3(?:[0-4679]|[578]\d)|4(?:[013-9]|2\d)|5(?:[1-8]|[09]\d)|6(?:[0-6]|[789]\d)|8(?:[1246]|[035789]\d)|9(?:[0-58]|[679]\d))[\.\/\-\ \t]*|([17])[\.\/\-\ ])?(?:\((\d{1,6})\)[\.\/\-\ \t]*)?(?:(\d{1,6})[\.\/\-\ ])?(?:(\d{1,6})[\.\/\-\ ])?(?:(\d{1,6})[\.\/\-\ ])?(?:(\d{1,6})[\.\/\-\ ])?(\d{0,10}?)(\d{1,})(?:[\.\/\-;\ \t]*e?xt?[\.\/\-=\ \t]*(\d{1,14}))?)?" + ) + ] + | None + ) = Field( + None, + description_={ + "de": "Faxnummer mit Landesvorwahl und Bindestrichen formatiert, z.B.. +49-931-4100-172. Entsprechend https://www.wikidata.org/wiki/Property:P1329" + }, + eval_template={ + "type": "mustache-wikitext", + "mode": "render", + "value": "{{#fax_number}}[tel:{{.}} {{.}}]
{{/fax_number}}", + }, + title="Fax number", + title_={"de": "Faxnummer"}, + ) + """ + Fax number formatted with country code and hyphens, e.g.. +49-931-4100-172. According to https://www.wikidata.org/wiki/Property:P1329 + """ + located_in: set[Site] | None = Field( + None, + range="Category:OSW473d7a1ed48544d1be83b258b5810948", + title="Located at ", + title_={"de": "Tätig an (Standort)"}, + ) + role: set[PersonRole] | None = Field( + None, + range="Category:OSW5efde23b1d8c4e1c864ef039cb0616ed", + title="Roles", + title_={"de": "Rollen"}, + ) + competence: set[Competence] | None = Field( + None, + range="Category:OSW5eb9c52b804544dc870dfd54ff434428", + title="Competences", + title_={"de": "Kompetenzen"}, + ) + topic: set[Topic] | None = Field( + None, + range="Category:OSW5a13eeda5ed5405ea7ef62ea6feeceec", + title="Topics", + title_={"de": "Themen"}, + ) + + +class OrganizationalUnit(Item): + """ + The most general kind of organizational unit - an organization but also parts of an organization + """ + + class Config: + schema_extra = { + "@context": [ + { + "abbreviation": {"@id": "Property:HasId", "@type": "xsd:string"}, + "abbreviation*": { + "@id": "Property:HasAbbreviation", + "@type": "xsd:string", + }, + "abbreviation**": { + "@id": "Property:HasAcronym", + "@type": "xsd:string", + }, + "competence": {"@id": "schema:knowsAbout", "@type": "@id"}, + "competence*": {"@id": "Property:HasCompetence", "@type": "@id"}, + "deputy_manager": { + "@id": "Property:HasDeputyManager", + "@type": "@id", + }, + "email": {"@id": "schema:email", "@type": "xsd:string"}, + "email*": {"@id": "Property:HasEmail", "@type": "xsd:string"}, + "fax_number": {"@id": "schema:faxNumber", "@type": "xsd:string"}, + "fax_number*": { + "@id": "Property:HasFaxNumber", + "@type": "xsd:string", + }, + "founder": {"@id": "schema:founder", "@type": "xsd:string"}, + "founder*": {"@id": "Property:HasFounder", "@type": "@id"}, + "founding_date": { + "@id": "schema:foundingDate", + "@type": "xsd:date", + }, + "founding_date*": { + "@id": "Property:HasFoundingDate", + "@type": "xsd:date", + }, + "founding_location": { + "@id": "schema:foundingLocation", + "@type": "@id", + }, + "founding_location*": { + "@id": "Property:HasFoundingLocation", + "@type": "@id", + }, + "funder": {"@id": "schema:funder", "@type": "@id"}, + "funder*": {"@id": "Property:HasFunder", "@type": "@id"}, + "image": {"@id": "schema:logo", "@type": "@id"}, + "image*": {"@id": "Property:HasLogo", "@type": "@id"}, + "legal_name": {"@id": "schema:legalName", "@type": "xsd:string"}, + "legal_name*": { + "@id": "Property:HasLegalName", + "@type": "xsd:string", + }, + "mailing_list": {"@id": "Property:HasMailingList", "@type": "@id"}, + "manager": {"@id": "Property:HasManager", "@type": "@id"}, + "member_ous": {"@id": "schema:member", "@type": "@id"}, + "member_ous*": {"@id": "Property:HasMember", "@type": "@id"}, + "member_persons": {"@id": "schema:member", "@type": "@id"}, + "member_persons*": {"@id": "Property:HasMember", "@type": "@id"}, + "member_of": {"@id": "schema:memberOf", "@type": "@id"}, + "member_of*": {"@id": "Property:IsMemberOf", "@type": "@id"}, + "employees*": {"@id": "schema:employee", "@type": "@id"}, + "employees**": { + "@reverse": "Property:HasOrganization", + "@type": "@id", + }, + "phone_number": {"@id": "schema:telephone", "@type": "@id"}, + "phone_number*": { + "@id": "Property:HasPhoneNumber", + "@type": "xsd:string", + }, + "postal_address": { + "@id": "Property:HasPostalAddress", + "@type": "@id", + "@context": ["/wiki/JsonSchema:PostalAddress?action=raw"], + }, + "ror_id": {"@id": "Property:HasRorId", "@type": "xsd:string"}, + "secretary": {"@id": "Property:HasSecretary", "@type": "@id"}, + "site": {"@id": "schema:location", "@type": "@id"}, + "site*": {"@id": "Property:IsLocatedIn", "@type": "@id"}, + "superordinate_ou": { + "@id": "schema:parentOrganization", + "@type": "@id", + }, + "superordinate_ou*": { + "@id": "Property:HasSuperordinateOu", + "@type": "@id", + }, + "tax_id": {"@id": "schema:taxID", "@type": "xsd:string"}, + "tax_id*": {"@id": "Property:HasTaxId", "@type": "xsd:string"}, + "topic": {"@id": "schema:knowsAbout", "@type": "@id"}, + "topic*": {"@id": "Property:HasTopic", "@type": "@id"}, + "vat_id": {"@id": "schema:vatID", "@type": "xsd:string"}, + "vat_id*": {"@id": "Property:HasVatId", "@type": "xsd:string"}, + "website": {"@id": "schema:subjectOf", "@type": "@id"}, + "website*": {"@id": "Property:HasWebsite", "@type": "xsd:anyURI"}, + "associated_acl_roles*": {"@id": "Property:HasAssociatedAclRole"}, + }, + "/wiki/Category:Item?action=raw&slot=jsonschema", + ], + "title": "OrganizationalUnit", + "title*": {"de": "Organisationseinheit", "en": "Organizational unit"}, + "uuid": "3cb8cef2-225e-4030-92f0-98f99bc4c472", + "description": "The most general kind of organizational unit - an organization but also parts of an organization", + "description*": { + "de": "Die allgemeinste Art von Organisationseinheit - eine Organisation, aber auch Teile einer Organisation", + "en": "The most general kind of organizational unit - an organization but also parts of an organization", + }, + "defaultProperties": ["abbreviation"], + "x-oold-reverse-defaultProperties": ["employees"], + "x-oold-reverse-properties": { + "employees": { + "type": "array", + "title": "Employees", + "items": { + "type": "string", + "format": "autocomplete", + "title": "Person", + "$comment": "range is Person", + "range": "Category:OSW44deaa5b806d41a2a88594f562b110e9", + }, + } + }, + } + + type: list[str] | None = ["Category:OSW3cb8cef2225e403092f098f99bc4c472"] + abbreviation: str | None = Field( + None, + description_={"de": "Akronym der Organisationseinheit."}, + title="Acronym", + title_={"de": "Akronym"}, + ) + """ + Acronym of the organizational unit. + """ + competence: set[Competence] | None = Field( + None, + range="Category:OSW5eb9c52b804544dc870dfd54ff434428", + title="Competence(s)", + title_={"de": "Kompetenz(en)"}, + ) + deputy_manager: set[Person] | None = Field( + None, + range="Category:OSW44deaa5b806d41a2a88594f562b110e9", + title="Deputy manager", + title_={"de": "Stellvertretende:r Manager:in"}, + ) + founder: set[Person] | None = Field( + None, + range="Category:OSW44deaa5b806d41a2a88594f562b110e9", + title="Founder", + title_={"de": "Gründer:in"}, + ) + founding_date: date | None = Field( + None, + title="Founding date", + title_={"en": "Founding date", "de": "Gründungsdatum"}, + ) + founding_location: str | None = Field( + None, + title="Founding location", + title_={"en": "Founding location", "de": "Gründungsort"}, + ) + funder: str | None = Field( + None, + description_={ + "de": "Der/die Geldgeber*in eines Konsortiums ist die Organisation, die die Finanzierung des Konsortiums bereitstellt" + }, + options={ + "autocomplete": { + "query": "[[Category:OSW3cb8cef2225e403092f098f99bc4c472]] OR [[Category:OSW44deaa5b806d41a2a88594f562b110e9]] |?Display_title_of=label" + } + }, + title="Funder", + title_={"de": "Förderer*in"}, + ) + """ + The Funder of a Consortium is the Organization that provides the funding for the Consortium. + """ + image: str | None = Field(None, title="Logo", title_={"de": "Logo"}) + legal_name: str | None = Field( + None, title="Legal name", title_={"en": "Legal name", "de": "Rechtlicher Name"} + ) + legal_form: str | None = Field( + None, title="Legal form", title_={"en": "Legal form", "de": "Rechtsform"} + ) + mailing_list: set[EmailStr] | None = Field( + None, + description_={"de": "Mailingliste der Organisationseinheit."}, + title="Mailing list", + title_={"de": "E-Mail-Verteiler"}, + ) + """ + Mailing list of the organizational unit. + """ + manager: set[Person] | None = Field( + None, + range="Category:OSW44deaa5b806d41a2a88594f562b110e9", + title="Manager", + title_={"de": "Manager:in"}, + ) + member_of: set[OrganizationalUnit] | None = Field( + None, + description_={ + "de": "Die Organisation(seinheit), der diese Organisation angehört." + }, + range="Category:OSW3cb8cef2225e403092f098f99bc4c472", + title="Member of", + title_={"de": "Mitglied in"}, + ) + """ + The organization(al unit) this organization is a member of. + """ + member_persons: set[Person] | None = Field( + None, + description_={"de": "Die Mitglieder (Personen) dieser Organisation(seinheit)."}, + range="Category:OSW44deaa5b806d41a2a88594f562b110e9", + title="Member person(s)", + title_={"de": "Mitgliedsperson(en)"}, + ) + """ + The members (persons) of this organization(al unit). + """ + member_ous: set[OrganizationalUnit] | None = Field( + None, + description_={ + "de": "Die Mitglieder (Organisationseinheiten) dieser Organisation(seinheit)." + }, + range="Category:OSW3cb8cef2225e403092f098f99bc4c472", + title="Member OU(s)", + title_={"de": "Mitglied OE(s)"}, + ) + """ + The members (organization units) of this organization(al unit). + """ + secretary: set[Person] | None = Field( + None, + range="Category:OSW44deaa5b806d41a2a88594f562b110e9", + title="Secretary", + title_={"de": "Sekretär:in"}, + ) + postal_address: PostalAddress | None = None + ror_id: str | None = Field( + None, + description_={"de": "ID bereitgestellt von https://ror.org/"}, + title="ROR ID", + title_={"de": "ROR ID"}, + ) + """ + ID provided by https://ror.org/ + """ + site: set[Site] | None = Field( + None, + range="Category:OSW473d7a1ed48544d1be83b258b5810948", + title="Site(s)", + title_={"de": "Standort(e)"}, + ) + superordinate_ou: set[OrganizationalUnit] | None = Field( + None, + range="Category:OSW3cb8cef2225e403092f098f99bc4c472", + title="Superordinate OU(s)", + title_={"de": "Übergeordnete OE(s)"}, + ) + tax_id_obj: list[TaxIdAndCountry] | None = Field( + None, + description_={"de": "Steuer-ID der Organisationseinheit."}, + title="Tax ID", + title_={"de": "Steuer-ID"}, + ) + """ + Tax ID of the organizational unit. + """ + vat_id_obj: list[VatIdAndCountry] | None = Field( + None, + description_={"de": "Umsatzsteuer-ID der Organisationseinheit."}, + title="VAT ID", + title_={"de": "Umsatzsteuer-ID"}, + ) + """ + VAT ID of the organizational unit. + """ + topic: set[Topic] | None = Field( + None, + range="Category:OSW5a13eeda5ed5405ea7ef62ea6feeceec", + title="Topic(s)", + title_={"de": "Thema/en"}, + ) + website: set[AnyUrl] | None = Field( + None, + eval_template={ + "type": "mustache-wikitext", + "mode": "render", + "value": "{{#website}}{{{.}}}
{{/website}}", + }, + title="Website", + title_={"de": "Webseite"}, + ) + email: set[EmailStr] | None = Field( + None, + eval_template={ + "type": "mustache-wikitext", + "mode": "render", + "value": "{{#email}}[mailto:{{.}} {{.}}]
{{/email}}", + }, + title="Email address", + title_={"de": "E-Mail"}, + ) + phone_number: ( + set[ + constr( + regex=r"(?:(?:(?:\+|00|011)[\.\/\-\ \t]*([17]|2(?:[07]|[1-689]\d)|3(?:[0-4679]|[578]\d)|4(?:[013-9]|2\d)|5(?:[1-8]|[09]\d)|6(?:[0-6]|[789]\d)|8(?:[1246]|[035789]\d)|9(?:[0-58]|[679]\d))[\.\/\-\ \t]*|([17])[\.\/\-\ ])?(?:\((\d{1,6})\)[\.\/\-\ \t]*)?(?:(\d{1,6})[\.\/\-\ ])?(?:(\d{1,6})[\.\/\-\ ])?(?:(\d{1,6})[\.\/\-\ ])?(?:(\d{1,6})[\.\/\-\ ])?(\d{0,10}?)(\d{1,})(?:[\.\/\-;\ \t]*e?xt?[\.\/\-=\ \t]*(\d{1,14}))?)?" + ) + ] + | None + ) = Field( + None, + description_={ + "de": "Telefonnummer mit Landesvorwahl und Bindestrichen formatiert, z.B.. +49-931-4100-172. Entsprechend https://www.wikidata.org/wiki/Property:P1329" + }, + eval_template={ + "type": "mustache-wikitext", + "mode": "render", + "value": "{{#phone_number}}[tel:{{.}} {{.}}]
{{/phone_number}}", + }, + title="Phone number", + title_={"de": "Telefonnummer"}, + ) + """ + Phone number formatted with country code and hyphens, e.g.. +49-931-4100-172. According to https://www.wikidata.org/wiki/Property:P1329 + """ + fax_number: ( + set[ + constr( + regex=r"(?:(?:(?:\+|00|011)[\.\/\-\ \t]*([17]|2(?:[07]|[1-689]\d)|3(?:[0-4679]|[578]\d)|4(?:[013-9]|2\d)|5(?:[1-8]|[09]\d)|6(?:[0-6]|[789]\d)|8(?:[1246]|[035789]\d)|9(?:[0-58]|[679]\d))[\.\/\-\ \t]*|([17])[\.\/\-\ ])?(?:\((\d{1,6})\)[\.\/\-\ \t]*)?(?:(\d{1,6})[\.\/\-\ ])?(?:(\d{1,6})[\.\/\-\ ])?(?:(\d{1,6})[\.\/\-\ ])?(?:(\d{1,6})[\.\/\-\ ])?(\d{0,10}?)(\d{1,})(?:[\.\/\-;\ \t]*e?xt?[\.\/\-=\ \t]*(\d{1,14}))?)?" + ) + ] + | None + ) = Field( + None, + description_={ + "de": "Faxnummer mit Landesvorwahl und Bindestrichen formatiert, z.B.. +49-931-4100-172. Entsprechend https://www.wikidata.org/wiki/Property:P1329" + }, + eval_template={ + "type": "mustache-wikitext", + "mode": "render", + "value": "{{#fax_number}}[tel:{{.}} {{.}}]
{{/fax_number}}", + }, + title="Fax number", + title_={"de": "Faxnummer"}, + ) + """ + Fax number formatted with country code and hyphens, e.g.. +49-931-4100-172. According to https://www.wikidata.org/wiki/Property:P1329 + """ + associated_acl_roles: list[str] | None = Field( + None, + title="Access control roles", + title_={"de": "Rollen für die Zugriffskontrolle"}, + ) + + +class Place(Item): + """ + Entities that have a somewhat fixed, physical extension. + """ + + class Config: + schema_extra = { + "@context": ["/wiki/Category:Item?action=raw&slot=jsonschema"], + "uuid": "28f71f2c-20ad-48c3-8c4e-4d190a95c0b8", + "title": "Place", + "title*": {"en": "Place", "de": "Ort"}, + "description": "Entities that have a somewhat fixed, physical extension.", + "description*": { + "en": "Entities that have a somewhat fixed, physical extension.", + "de": "Entitäten, die eine gewisse feste, physische Ausdehnung haben.", + }, + } + + type: list[str] | None = ["Category:OSW28f71f2c20ad48c38c4e4d190a95c0b8"] + + +class Location(Item): + """ + A location. Entities that have a somewhat fixed, physical extension. + """ + + class Config: + schema_extra = { + "@context": [ + { + "gps_coordinates": {"@id": "schema:geo", "@type": "xsd:string"}, + "gps_coordinates*": { + "@id": "Property:HasGpsCoordinates", "@type": "xsd:string", }, - "mailing_list": {"@id": "Property:HasMailingList", "@type": "@id"}, - "manager": {"@id": "Property:HasManager", "@type": "@id"}, - "member_ous": {"@id": "schema:member", "@type": "@id"}, - "member_ous*": {"@id": "Property:HasMember", "@type": "@id"}, - "member_persons": {"@id": "schema:member", "@type": "@id"}, - "member_persons*": {"@id": "Property:HasMember", "@type": "@id"}, - "member_of": {"@id": "schema:memberOf", "@type": "@id"}, - "member_of*": {"@id": "Property:IsMemberOf", "@type": "@id"}, - "employees*": {"@id": "schema:employee", "@type": "@id"}, - "employees**": { - "@reverse": "Property:HasOrganization", - "@type": "@id", - }, - "phone_number": {"@id": "schema:telephone", "@type": "@id"}, - "phone_number*": { - "@id": "Property:HasPhoneNumber", - "@type": "xsd:string", + "latitude": {"@id": "schema:latitude", "@type": "xsd:float"}, + "located_in": {"@id": "schema:containedInPlace", "@type": "@id"}, + "located_in*": {"@id": "Property:IsLocatedIn", "@type": "@id"}, + "longitude": {"@id": "schema:longitude", "@type": "xsd:float"}, + "longitude*": { + "@id": "Property:HasLongitude", + "@type": "xsd:float", }, "postal_address": { "@id": "Property:HasPostalAddress", "@type": "@id", "@context": ["/wiki/JsonSchema:PostalAddress?action=raw"], }, - "ror_id": {"@id": "Property:HasRorId", "@type": "xsd:string"}, - "secretary": {"@id": "Property:HasSecretary", "@type": "@id"}, - "site": {"@id": "schema:location", "@type": "@id"}, - "site*": {"@id": "Property:IsLocatedIn", "@type": "@id"}, - "superordinate_ou": { - "@id": "schema:parentOrganization", - "@type": "@id", - }, - "superordinate_ou*": { - "@id": "Property:HasSuperordinateOu", - "@type": "@id", - }, - "tax_id": {"@id": "schema:taxID", "@type": "xsd:string"}, - "tax_id*": {"@id": "Property:HasTaxId", "@type": "xsd:string"}, - "topic": {"@id": "schema:knowsAbout", "@type": "@id"}, - "topic*": {"@id": "Property:HasTopic", "@type": "@id"}, - "vat_id": {"@id": "schema:vatID", "@type": "xsd:string"}, - "vat_id*": {"@id": "Property:HasVatId", "@type": "xsd:string"}, - "website": {"@id": "schema:subjectOf", "@type": "@id"}, - "website*": {"@id": "Property:HasWebsite", "@type": "xsd:anyURI"}, - "associated_acl_roles*": {"@id": "Property:HasAssociatedAclRole"}, }, "/wiki/Category:Item?action=raw&slot=jsonschema", ], - "title": "OrganizationalUnit", - "title*": {"de": "Organisationseinheit", "en": "Organizational unit"}, - "uuid": "3cb8cef2-225e-4030-92f0-98f99bc4c472", - "description": "The most general kind of organizational unit - an organization but also parts of an organization", + "title": "Location", + "uuid": "3d238d05-316e-45a4-ac95-a11d7b24e36b", + "title*": {"en": "Location", "de": "Örtlichkeit"}, + "description": "A location. Entities that have a somewhat fixed, physical extension.", "description*": { - "de": "Die allgemeinste Art von Organisationseinheit - eine Organisation, aber auch Teile einer Organisation", - "en": "The most general kind of organizational unit - an organization but also parts of an organization", + "de": "Eine Örtlichkeit. Entitaeten, die eine mehr oder weniger feste, physische Ausdehnung haben." }, - "defaultProperties": ["abbreviation"], - "x-oold-reverse-defaultProperties": ["employees"], - "x-oold-reverse-properties": { - "employees": { - "type": "array", - "title": "Employees", - "items": { - "type": "string", - "format": "autocomplete", - "title": "Person", - "$comment": "range is Person", - "range": "Category:OSW44deaa5b806d41a2a88594f562b110e9", - }, + "defaultProperties": ["label", "gps_coordinates", "postal_address"], + } + + type: list[str] | None = ["Category:OSW3d238d05316e45a4ac95a11d7b24e36b"] + postal_address: PostalAddress | None = None + gps_coordinates: GPSCoordinates | None = Field( + None, + defaultProperties=["uuid", "latitude", "longitude"], + eval_template={ + "type": "wikitext", + "value": "{{{latitude|}}}, {{{longitude|}}}", + }, + title="GPS coordinates", + title_={"en": "GPS coordinates", "de": "GPS Koordinaten"}, + ) + + +class PersonRole(Item): + class Config: + schema_extra = { + "title": "Person role", + "@context": [ + { + "ad_label": "Property:HasAdLabel", + "miri_label": "Property:HasMiriLabel", + "miri_id": "Property:HasMiriId", } - }, + ], } - type: list[str] | None = ["Category:OSW3cb8cef2225e403092f098f99bc4c472"] - abbreviation: str | None = Field( + ad_label: list[str] | None = Field( None, - description_={"de": "Akronym der Organisationseinheit."}, - title="Acronym", - title_={"de": "Akronym"}, + description_={"de": "Label des Rolle im Active Directory"}, + title="AD label", + title_={"de": "AD-Label"}, ) """ - Acronym of the organizational unit. + Label of the role in the Active Directory """ - competence: set[Competence] | None = Field( - None, - range="Category:OSW5eb9c52b804544dc870dfd54ff434428", - title="Competence(s)", - title_={"de": "Kompetenz(en)"}, - ) - deputy_manager: set[Person] | None = Field( - None, - range="Category:OSW44deaa5b806d41a2a88594f562b110e9", - title="Deputy manager", - title_={"de": "Stellvertretende:r Manager:in"}, - ) - founder: set[Person] | None = Field( - None, - range="Category:OSW44deaa5b806d41a2a88594f562b110e9", - title="Founder", - title_={"de": "Gründer:in"}, - ) - founding_date: date | None = Field( + miri_label: list[str] | None = Field( None, - title="Founding date", - title_={"en": "Founding date", "de": "Gründungsdatum"}, + description_={"de": "Label der Rolle in MIRI und eDirectory"}, + title="MIRI label", + title_={"de": "MIRI-Label"}, ) - founding_location: str | None = Field( + """ + Label of the role in MIRI and eDirectory + """ + miri_id: list[str] | None = Field( None, - title="Founding location", - title_={"en": "Founding location", "de": "Gründungsort"}, + description_={"de": "ID der Rolle in MIRI"}, + title="MIRI id", + title_={"de": "MIRI-ID"}, ) - funder: str | None = Field( + """ + ID of the role in MIRI + """ + miri_label_orig: list[str] | None = Field( None, - description_={ - "de": "Der/die Geldgeber*in eines Konsortiums ist die Organisation, die die Finanzierung des Konsortiums bereitstellt" - }, - options={ - "autocomplete": { - "query": "[[Category:OSW3cb8cef2225e403092f098f99bc4c472]] OR [[Category:OSW44deaa5b806d41a2a88594f562b110e9]] |?Display_title_of=label" - } - }, - title="Funder", - title_={"de": "Förderer*in"}, + description_={"de": "Ursprüngliches Label der Rolle in MIRI"}, + title="Original MIRI label", + title_={"de": "Ursprüngliches MIRI-Label"}, ) """ - The Funder of a Consortium is the Organization that provides the funding for the Consortium. + Original label of the role in MIRI """ - image: str | None = Field(None, title="Logo", title_={"de": "Logo"}) - legal_name: str | None = Field( - None, title="Legal name", title_={"en": "Legal name", "de": "Rechtlicher Name"} - ) - legal_form: str | None = Field( - None, title="Legal form", title_={"en": "Legal form", "de": "Rechtsform"} - ) - mailing_list: set[EmailStr] | None = Field( + type: list[str] | None = ["Category:OSW5efde23b1d8c4e1c864ef039cb0616ed"] + + +class Tool(Item): + """ + Item that participates as a utility (almost) unchanged in a process + """ + + class Config: + schema_extra = { + "@context": [ + "/wiki/Category:Item?action=raw&slot=jsonschema", + { + "components": { + "@id": "Property:HasStatement", + "@type": "@id", + "@context": { + "component_instance_property": { + "@id": "Property:HasProperty", + "@type": "@id", + }, + "component_instance": { + "@id": "Property:HasObject", + "@type": "@id", + }, + }, + }, + "events": {"@id": "Property:HasEvent", "@type": "@id"}, + "purposes": {"@id": "Property:HasPurpose", "@type": "xsd:string"}, + "slots": { + "@id": "Property:HasSlot", + "@type": "@id", + "@context": { + "slot_osw_id": { + "@id": "Property:HasOswId", + "@type": "xsd:string", + }, + "slot_id": {"@id": "Property:HasId", "@type": "xsd:string"}, + "name": {"@id": "Property:HasName", "@type": "xsd:string"}, + "description": { + "@id": "Property:HasDescription", + "@type": "@id", + }, + "slot_init_date_time": { + "@id": "Property:HasInitDate", + "@type": "xsd:dateTime", + }, + "slot_occupant": { + "@id": "Property:HasStatement", + "@type": "@id", + "@context": { + "slot_occupant_instance_property": "Property:HasProperty", + "slot_occupant_instance": "Property:HasObject", + }, + }, + "slot_type_restriction": { + "@id": "Property:HasTypeRestriction", + "@type": "@id", + }, + }, + }, + "typical_process": { + "@id": "Property:HasTypicalProcess", + "@type": "@id", + }, + }, + ], + "uuid": "e427aafa-fbac-4262-955b-9f690a83405d", + "title": "Tool", + "title*": {"en": "Tool", "de": "Werkzeug"}, + "description": "Item that participates as a utility (almost) unchanged in a process", + "description*": { + "en": "Item that participates as a utility (almost) unchanged in a process", + "de": "Gegenstand der als Hilfsmittel (nahezu) unverändert in einem Prozess teilnimmt", + }, + "defaultProperties": [], + } + + type: list[str] | None = ["Category:OSWe427aafafbac4262955b9f690a83405d"] + purposes: list[str] | None = Field( None, - description_={"de": "Mailingliste der Organisationseinheit."}, - title="Mailing list", - title_={"de": "E-Mail-Verteiler"}, + eval_template=[ + { + "type": "mustache-wikitext", + "mode": "render", + "value": "{{=<% %>=}} ", + } + ], + title="Purpose(s)", + title_={"de": "Zweck(e)"}, ) - """ - Mailing list of the organizational unit. - """ - manager: set[Person] | None = Field( + typical_process: list[Category] | None = Field( None, - range="Category:OSW44deaa5b806d41a2a88594f562b110e9", - title="Manager", - title_={"de": "Manager:in"}, + eval_template=[ + { + "type": "mustache-wikitext", + "mode": "render", + "value": "{{=<% %>=}} ", + } + ], + range="Category:Category", + title="Typical Process(es)", + title_={"de": "Typische(r) Prozess(e)"}, ) - member_of: set[OrganizationalUnit] | None = Field( + components: list[Component] | None = Field( None, description_={ - "de": "Die Organisation(seinheit), der diese Organisation angehört." + "de": "Komponenten sind dauerhafte Teile eines Werkzeugs (im Gegensatz zu Slots für austauschbare Teile)." }, - range="Category:OSW3cb8cef2225e403092f098f99bc4c472", - title="Member of", - title_={"de": "Mitglied in"}, - ) - """ - The organization(al unit) this organization is a member of. - """ - member_persons: set[Person] | None = Field( - None, - description_={"de": "Die Mitglieder (Personen) dieser Organisation(seinheit)."}, - range="Category:OSW44deaa5b806d41a2a88594f562b110e9", - title="Member person(s)", - title_={"de": "Mitgliedsperson(en)"}, + eval_template=[ + { + "type": "mustache-wikitext", + "mode": "render", + "value": "{{=<% %>=}} ", + } + ], + options={ + "enable_array_copy": True, + "array_copy_ignore": ["uuid", "component_id", "attachments"], + }, + title="Components", + title_={"de": "Komponenten"}, ) """ - The members (persons) of this organization(al unit). + Component are permanent parts of a tool (vs. Slots for exchangeable parts). """ - member_ous: set[OrganizationalUnit] | None = Field( + slots: list[Slot] | None = Field( None, description_={ - "de": "Die Mitglieder (Organisationseinheiten) dieser Organisation(seinheit)." + "de": "Slots stellen Plätze für austauschbare Teile oder Komponenten eines Werkzeugs dar (im Gegensatz zu Komponenten, die permanente Teile sind). Slot-Austauschereignisse können verwendet werden, um Änderungen an Slots zu dokumentieren. Dies ist die anfängliche Slot-Konfiguration!" }, - range="Category:OSW3cb8cef2225e403092f098f99bc4c472", - title="Member OU(s)", - title_={"de": "Mitglied OE(s)"}, - ) - """ - The members (organization units) of this organization(al unit). - """ - secretary: set[Person] | None = Field( - None, - range="Category:OSW44deaa5b806d41a2a88594f562b110e9", - title="Secretary", - title_={"de": "Sekretär:in"}, - ) - postal_address: PostalAddress | None = None - ror_id: str | None = Field( - None, - description_={"de": "ID bereitgestellt von https://ror.org/"}, - title="ROR ID", - title_={"de": "ROR ID"}, - ) - """ - ID provided by https://ror.org/ - """ - site: set[Site] | None = Field( - None, - range="Category:OSW473d7a1ed48544d1be83b258b5810948", - title="Site(s)", - title_={"de": "Standort(e)"}, - ) - superordinate_ou: set[OrganizationalUnit] | None = Field( - None, - range="Category:OSW3cb8cef2225e403092f098f99bc4c472", - title="Superordinate OU(s)", - title_={"de": "Übergeordnete OE(s)"}, - ) - tax_id_obj: list[TaxIdAndCountry] | None = Field( - None, - description_={"de": "Steuer-ID der Organisationseinheit."}, - title="Tax ID", - title_={"de": "Steuer-ID"}, + eval_template=[ + { + "type": "mustache-wikitext", + "mode": "render", + "value": "{{=<% %>=}} ", + } + ], + options={ + "enable_array_copy": True, + "array_copy_ignore": ["uuid", "slot_osw_id", "slot_id", "attachments"], + }, + title="Slot configuration", + title_={"de": "Slot-Konfiguration"}, ) """ - Tax ID of the organizational unit. + Slots represent spaces for exchangable parts or components of a tool (vs. Components, which are permanent parts). Slot exchange events can be used to document changes on slots. This is the initial slot configuration! """ - vat_id_obj: list[VatIdAndCountry] | None = Field( + events: list[Event] | None = Field( None, - description_={"de": "Umsatzsteuer-ID der Organisationseinheit."}, - title="VAT ID", - title_={"de": "Umsatzsteuer-ID"}, + range="Category:OSWb97757b46edb430591758662c18d354d", + title="Event(s)", + title_={"de": "Ereignis(se)"}, ) + + +class Project(Item): """ - VAT ID of the organizational unit. + An enterprise (potentially individual but typically collaborative), planned to achieve a particular aim. """ - topic: set[Topic] | None = Field( - None, - range="Category:OSW5a13eeda5ed5405ea7ef62ea6feeceec", - title="Topic(s)", - title_={"de": "Thema/en"}, - ) - website: set[AnyUrl] | None = Field( - None, - eval_template={ - "type": "mustache-wikitext", - "mode": "render", - "value": "{{#website}}{{{.}}}
{{/website}}", - }, - title="Website", - title_={"de": "Webseite"}, - ) - email: set[EmailStr] | None = Field( - None, - eval_template={ - "type": "mustache-wikitext", - "mode": "render", - "value": "{{#email}}[mailto:{{.}} {{.}}]
{{/email}}", - }, - title="Email address", - title_={"de": "E-Mail"}, - ) - phone_number: ( - set[ - constr( - regex=r"(?:(?:(?:\+|00|011)[\.\/\-\ \t]*([17]|2(?:[07]|[1-689]\d)|3(?:[0-4679]|[578]\d)|4(?:[013-9]|2\d)|5(?:[1-8]|[09]\d)|6(?:[0-6]|[789]\d)|8(?:[1246]|[035789]\d)|9(?:[0-58]|[679]\d))[\.\/\-\ \t]*|([17])[\.\/\-\ ])?(?:\((\d{1,6})\)[\.\/\-\ \t]*)?(?:(\d{1,6})[\.\/\-\ ])?(?:(\d{1,6})[\.\/\-\ ])?(?:(\d{1,6})[\.\/\-\ ])?(?:(\d{1,6})[\.\/\-\ ])?(\d{0,10}?)(\d{1,})(?:[\.\/\-;\ \t]*e?xt?[\.\/\-=\ \t]*(\d{1,14}))?)?" - ) - ] - | None - ) = Field( - None, - description_={ - "de": "Telefonnummer mit Landesvorwahl und Bindestrichen formatiert, z.B.. +49-931-4100-172. Entsprechend https://www.wikidata.org/wiki/Property:P1329" - }, - eval_template={ - "type": "mustache-wikitext", - "mode": "render", - "value": "{{#phone_number}}[tel:{{.}} {{.}}]
{{/phone_number}}", + + class Config: + schema_extra = { + "@context": [ + "/wiki/Category:Item?action=raw&slot=jsonschema", + { + "abstract": {"@id": "Property:HasAbstract"}, + "budget_end": {"@id": "Property:HasBudgetEndDate"}, + "budget_ou": {"@id": "Property:HasBusinessUnit", "@type": "@id"}, + "budget_start": {"@id": "Property:HasBudgetStartDate"}, + "budget_type": {"@id": "Property:HasType", "@type": "@id"}, + "budget_year": {"@id": "Property:HasBudgetYear"}, + "end_date": {"@id": "Property:HasEndDate", "@type": "xsd:date"}, + "funding_type": {"@id": "Property:HasFundingType", "@type": "@id"}, + "funding_call": {"@id": "Property:HasFundingCall", "@type": "@id"}, + "funding": {"@id": "schema:funding", "@type": "@id"}, + "funding*": {"@id": "Property:HasFunding", "@type": "@id"}, + "funder": {"@id": "schema:funder", "@type": "@id"}, + "funder*": {"@id": "Property:HasFunder", "@type": "@id"}, + "member": {"@id": "schema:member", "@type": "@id"}, + "member*": {"@id": "Property:HasMember", "@type": "@id"}, + "member_of": {"@id": "schema:memberOf", "@type": "@id"}, + "member_of*": {"@id": "Property:IsMemberOf", "@type": "@id"}, + "other_documents": { + "@id": "Property:HasAdditionalDocument", + "@type": "@id", + }, + "ou": {"@id": "Property:HasBusinessUnit", "@type": "@id"}, + "project_manager": {"@id": "Property:HasManager", "@type": "@id"}, + "project_status": {"@id": "Property:HasStatus", "@type": "@id"}, + "project_type": {"@id": "Property:HasType", "@type": "@id"}, + "proposal": {"@id": "Property:HasProposal", "@type": "@id"}, + "report": {"@id": "Property:HasReport", "@type": "@id"}, + "start_date": {"@id": "Property:HasStartDate", "@type": "xsd:date"}, + "subjects": {"@id": "Property:HasTopic", "@type": "@id"}, + "total_budget": {"@id": "Property:HasStatement"}, + "year": {"@id": "Property:HasYear"}, + "yearly_budget": {"@id": "Property:HasBudgetPart", "@type": "@id"}, + "yearly_budget_sum": {"@id": "Property:HasStatement"}, + "yearly_budget_sum_weighted": {"@id": "Property:HasStatement"}, + "probability_of_successful_funding": { + "@id": "Property:HasStatement" + }, + }, + ], + "uuid": "b2d7e6a2-eff9-4c82-b7f1-f2699d5b0ee3", + "title": "Project", + "title*": {"en": "Project", "de": "Projekt"}, + "description": "An enterprise (potentially individual but typically collaborative), planned to achieve a particular aim.", + "description*": { + "de": "Ein (möglicherweise individuelles, in der Regel aber gemeinschaftliches) Unternehmen oder Unternehmung, das auf ein bestimmtes Ziel ausgerichtet ist." + }, + "defaultProperties": [ + "subjects", + "project_status", + "funding_type", + "funding_call", + "funder", + "funding", + "funding_name", + "ou", + "project_manager", + "member", + "member_of", + "start_date", + "end_date", + "total_budget", + "proposal", + "abstract", + ], + } + + type: list[str] | None = ["Category:OSWb2d7e6a2eff94c82b7f1f2699d5b0ee3"] + subjects: list[str] | None = Field(None, title="Subjects", title_={"de": "Themen"}) + project_type: ProjectTypeDeprecated | None = Field( + "", + deprecated=True, + description_={"de": "Ersetzt mit Projekt- bzw. Förderart"}, + options={ + "enum_titles": ["House project", "Internal", "Public", "Industry"], + "enum_titles*": { + "de": ["Hausprojekt", "Intern", "Öffentlich", "Industrie"] + }, }, - title="Phone number", - title_={"de": "Telefonnummer"}, + title="Project type (deprecated)", + title_={"de": "Projekttyp (veraltet)"}, ) """ - Phone number formatted with country code and hyphens, e.g.. +49-931-4100-172. According to https://www.wikidata.org/wiki/Property:P1329 + Replaced with Project / Funding Type """ - fax_number: ( - set[ - constr( - regex=r"(?:(?:(?:\+|00|011)[\.\/\-\ \t]*([17]|2(?:[07]|[1-689]\d)|3(?:[0-4679]|[578]\d)|4(?:[013-9]|2\d)|5(?:[1-8]|[09]\d)|6(?:[0-6]|[789]\d)|8(?:[1246]|[035789]\d)|9(?:[0-58]|[679]\d))[\.\/\-\ \t]*|([17])[\.\/\-\ ])?(?:\((\d{1,6})\)[\.\/\-\ \t]*)?(?:(\d{1,6})[\.\/\-\ ])?(?:(\d{1,6})[\.\/\-\ ])?(?:(\d{1,6})[\.\/\-\ ])?(?:(\d{1,6})[\.\/\-\ ])?(\d{0,10}?)(\d{1,})(?:[\.\/\-;\ \t]*e?xt?[\.\/\-=\ \t]*(\d{1,14}))?)?" - ) - ] - | None - ) = Field( + funding_type: ProjectType | None = Field( None, - description_={ - "de": "Faxnummer mit Landesvorwahl und Bindestrichen formatiert, z.B.. +49-931-4100-172. Entsprechend https://www.wikidata.org/wiki/Property:P1329" - }, - eval_template={ - "type": "mustache-wikitext", - "mode": "render", - "value": "{{#fax_number}}[tel:{{.}} {{.}}]
{{/fax_number}}", + range="Category:OSW67f2ef61ba284c919fefa00d0e95a7a0", + title="Project / Funding Type", + title_={"de": "Projekt- bzw. Förderart"}, + ) + project_status: ProjectStatus | None = Field( + default_factory=lambda: ProjectStatus.parse_obj( + "Item:OSW55a9a9bda7b248759e48ae2e3ed6df1d" + ), + range="Category:OSW490e38f9764f4408a244869a0ea98e7c", + title="Project status", + title_={"de": "Projektstatus"}, + ) + funding_call: str | None = Field( + None, + options={ + "autocomplete": {"category": "Category:OSWd22af0aa3b00462a9da9b509538e8926"} }, - title="Fax number", - title_={"de": "Faxnummer"}, + title="Funding call", + title_={"de": "Förderaufruf"}, ) - """ - Fax number formatted with country code and hyphens, e.g.. +49-931-4100-172. According to https://www.wikidata.org/wiki/Property:P1329 - """ - associated_acl_roles: list[str] | None = Field( + funder: str | None = Field( None, - title="Access control roles", - title_={"de": "Rollen für die Zugriffskontrolle"}, + category="Category:OSW3cb8cef2225e403092f098f99bc4c472", + title="Funder", + title_={"de": "Förder- bzw. Auftragsgeber"}, ) - - -class PersonRole(Item): - class Config: - schema_extra = { - "title": "Person role", - "@context": [ - { - "ad_label": "Property:HasAdLabel", - "miri_label": "Property:HasMiriLabel", - "miri_id": "Property:HasMiriId", - } - ], - } - - ad_label: list[str] | None = Field( + funding: str | None = Field( None, - description_={"de": "Label des Rolle im Active Directory"}, - title="AD label", - title_={"de": "AD-Label"}, + description_={"de": "Förderung oder Vertrag"}, + options={ + "autocomplete": {"category": "Category:OSWbe80b28aefd64921ba2e8e2d6225416e"} + }, + title="Funding", + title_={"de": "Förderung"}, ) """ - Label of the role in the Active Directory + Grant or contract """ - miri_label: list[str] | None = Field( + funding_name: str | None = Field( None, - description_={"de": "Label der Rolle in MIRI und eDirectory"}, - title="MIRI label", - title_={"de": "MIRI-Label"}, + description_={ + "de": "Förderung oder Vertrag. Verwenden Sie diese Eigenschaft, um einen Text einzugeben, wenn Sie keine neue Instanz von Grant erstellen möchten." + }, + title="Funding (name)", + title_={"de": "Förderung (Name)"}, ) """ - Label of the role in MIRI and eDirectory + Grant or contract. Use this property to enter a text if you don't want to create a new instance of grant. """ - miri_id: list[str] | None = Field( + probability_of_successful_funding: ( + ProbabilityOfSuccessfulFundingInPercent | None + ) = Field( None, - description_={"de": "ID der Rolle in MIRI"}, - title="MIRI id", - title_={"de": "MIRI-ID"}, + description_={ + "de": "Gibt die Wahrscheinlichkeit an, dass die Förderung genehmigt wird, bestimmt das gewichtete Budget" + }, + title="Probability of Successful Funding in percent", + title_={"de": "Wahrscheinlichkeit einer erfolgreichen Förderung in Prozent"}, ) """ - ID of the role in MIRI + Indicates the likelihood that the funding will be approved, determines the weighted budget """ - miri_label_orig: list[str] | None = Field( + ou: list[str] | None = Field( None, - description_={"de": "Ursprüngliches Label der Rolle in MIRI"}, - title="Original MIRI label", - title_={"de": "Ursprüngliches MIRI-Label"}, + description_={"de": "Organisationseinheit (OE), die das Projekt durchführt"}, + title="OU", + title_={"en": "OU", "de": "OE"}, ) """ - Original label of the role in MIRI + Organizational Unit (OU), which carries out the project """ - type: list[str] | None = ["Category:OSW5efde23b1d8c4e1c864ef039cb0616ed"] - - -class AreaUsageType(Item): - class Config: - schema_extra = { - "title": "AreaUsageType", - "@context": [{"din277_label": "Property:HasDin277Label"}], - } - - din277_label: list[str] | None = Field( - None, - desciption="Label according to DIN 277", - description_={"de": "Bezeichnung nach DIN 277"}, - title="DIN 277 label", - title_={"de": "DIN 277 Bezeichnung"}, - ) - type: list[str] | None = ["Category:OSWae92be81cdb34d22844d4791ef790d93"] - - -class RoomUsage(Item): - class Config: - schema_extra = { - "title": "RoomUsage", - "@context": [{"din277_label": "Property:HasDin277Label"}], - } - - din277_label: list[str] | None = Field( + project_manager: list[str] | None = Field( None, - desciption="Label according to DIN 277", - description_={"de": "Bezeichnung nach DIN 277"}, - title="DIN 277 label", - title_={"de": "DIN 277 Bezeichnung"}, + title="Project Manager", + title_={"en": "Project Manager", "de": "Projektleiter*in"}, ) - type: list[str] | None = ["Category:OSWac9f0e49d8024804bd7d77058322a3fe"] - - -class Building(Location): - class Config: - schema_extra = { - "@context": [ - { - "area": {"@id": "schema:floorSize", "@type": "@id"}, - "area*": {"@id": "Property:HasArea", "@type": "xsd:float"}, - "construction_year": { - "@id": "schema:yearBuilt", - "@type": "xsd:integer", - }, - "construction_year*": { - "@id": "Property:HasConstructionYear", - "@type": "xsd:integer", - }, - "footprint": {"@id": "Property:HasFootprint", "@type": "xsd:float"}, - "function": {"@id": "Property:HasBuildingFunction", "@type": "@id"}, - "height": {"@id": "schema:height", "@type": "xsd:float"}, - "height*": {"@id": "Property:HasHeight", "@type": "xsd:float"}, - "length": {"@id": "Property:HasLength", "@type": "xsd:float"}, - "located_in": {"@id": "schema:containedInPlace", "@type": "@id"}, - "located_in*": {"@id": "Property:IsLocatedIn", "@type": "@id"}, - "responsible_person": { - "@id": "Property:HasResponsiblePerson", - "@type": "@id", - }, - "width": {"@id": "schema:width", "@type": "xsd:float"}, - "width*": {"@id": "Property:HasWidth", "@type": "xsd:float"}, - }, - "/wiki/Category:OSW3d238d05316e45a4ac95a11d7b24e36b?action=raw&slot=jsonschema", - ], - "title": "Building", - "title*": {"en": "Building", "de": "Gebäude"}, - } - - type: list[str] | None = ["Category:OSW4bcd4a99a73f482ea40ac4210dfab836"] - located_in: set[Site] | None = Field( - None, - range="Category:OSW473d7a1ed48544d1be83b258b5810948", - title="Site", - title_={"en": "Site", "de": "Standort"}, + member: list[str] | None = Field( + None, title="Member", title_={"en": "Member", "de": "Mitglieder*innen"} ) - construction_year: float | None = Field( + member_of: list[str] | None = Field( None, description_={ - "de": "Das Jahr, in dem der Bau abgeschlossen wurde.", - "en": "The year in which the construction was completed.", + "de": "Organisationseinheit(en), zu der das Projekt gehört, z. B. ein Projektcluster" }, - title="Construction year", - title_={"de": "Baujahr", "en": "Construction year"}, + title="Member of", + title_={"en": "Member of ", "de": "Mitglied von"}, ) """ - The year in which the construction was completed. + Organizational unit(s), the project is a member of, e.g. a project cluster """ - length: float | None = Field( - None, title="Length", title_={"de": "Länge", "en": "Length"} + start_date: date | None = Field( + None, options={"flatpicker": {}}, title="Start", title_={"de": "Beginn"} ) - width: float | None = Field( - None, title="Width", title_={"de": "Breite", "en": "Width"} + end_date: date | None = Field( + None, options={"flatpicker": {}}, title="End", title_={"de": "Ende"} ) - height: float | None = Field( - None, title="Height", title_={"de": "Höhe", "en": "Height"} + total_budget: TotalBudget | None = Field( + None, title="Total Budget", title_={"de": "Budgetsumme"} ) - footprint: float | None = Field( + yearly_budget: list[YearlyBudget] | None = Field( None, - title="Area at base level", - title_={"de": "Grundfläche", "en": "Area at base level"}, + options={"disable_array_reorder": False, "enable_array_copy": True}, + title="Yearly budget", + title_={"de": "Jahresbudget"}, ) - area: float | None = Field( + proposal: str | None = Field( + None, + links=[ + { + "href": "{{#if self}}/w/index.php?title=Special:Redirect/file/{{self}}&width=200&height=200{{/if}}", + "mediaType": "image", + }, + { + "href": "{{#if self}}/w/index.php?title=Special:Redirect/file/{{self}}{{/if}}", + "rel": "{{#if self}}download{{/if}}", + "download": True, + }, + ], + options={"upload": {}}, + title="Proposal", + title_={"de": "Antrag"}, + ) + report: str | None = Field( None, - title="Total floor area", - title_={"de": "Gesamtfläche", "en": "Total floor area"}, + links=[ + { + "href": "{{#if self}}/w/index.php?title=Special:Redirect/file/{{self}}&width=200&height=200{{/if}}", + "mediaType": "image", + }, + { + "href": "{{#if self}}/w/index.php?title=Special:Redirect/file/{{self}}{{/if}}", + "rel": "{{#if self}}download{{/if}}", + "download": True, + }, + ], + options={"upload": {}}, + title="Report", + title_={"de": "Bericht"}, ) - function: set[BuildingFunction] | None = Field( + other_documents: list[str] | None = Field( None, - range="Category:OSW07a0faef5be94b788514a2dd5dca20bf", - title="Building function", - title_={"en": "Building function", "de": "Gebäudefunktion"}, + title="Additional documents", + title_={"en": "Additional documents", "de": "Sonstige Dokumente"}, ) - responsible_person: set[User] | None = Field( + abstract: list[Description] | None = Field( None, - range="Category:OSWd9aa0bca9b0040d8af6f5c091bf9eec7", - title="Responsible person", - title_={"de": "Verantwortliche Person", "en": "Responsible person"}, + eval_template={ + "type": "mustache-wikitext", + "mode": "render", + "$comment": "Displays value according to user language with eng as fallback option. Note: {{=<% %>=}} changes mustache expression from {{..}} to <% %> for mixing with wikitext templates", + "value": "{{=<% %>=}} {{#switch:{{USERLANGUAGECODE}} <%#abstract%> | {{#ifeq: <%lang%>|en|#default|<%lang%>}} = <%text%> <%/abstract%> }}", + }, + title="Abstract", + title_={"de": "Kurzbeschreibung"}, ) -class Room(Location): +class Dataset(Data): class Config: schema_extra = { "@context": [ + "/wiki/Category:OSW2ac4493f8635481eaf1db961b63c8325?action=raw&slot=jsonschema", { - "area": {"@id": "schema:floorSize", "@type": "xsd:float"}, - "area*": {"@id": "Property:HasArea", "@type": "xsd:float"}, - "construction_year": { - "@id": "schema:yearBuilt", - "@type": "xsd:integer", - }, - "construction_year*": { - "@id": "Property:HasConstructionYear", - "@type": "xsd:integer", - }, - "door_height": { - "@id": "Property:HasDoorHeight", - "@type": "xsd:float", - }, - "door_width": { - "@id": "Property:HasDoorWidth", - "@type": "xsd:float", + "url": "dcat:landingPage", + "url*": "Property:HasUrl", + "themes": {"@type": "@id", "@id": "dcat:theme"}, + "themes*": {"@type": "@id", "@id": "Property:IsRelatedTo"}, + "distributions": { + "@type": "@id", + "@id": "dcat:distribution", + "@context": { + "file": {"@id": "dcat:accessURL", "@type": "@id"}, + "file*": { + "@id": "Property:HasFileAttachment", + "@type": "@id", + }, + "download_url": "dcat:downloadURL", + "access_url": "dcat:accessURL", + "media_type": "dcat:mediaType", + "byte_size": "dcat:byteSize", + "package_format": "dcat:packageFormat", + "compression_format": "dcat:compressionFormat", + "conforms_to": { + "@id": "dcterms:conformsTo", + "@type": "@id", + }, + "table_schema": {"@id": "csvw:tableSchema", "@type": "@id"}, + }, }, - "height": {"@id": "schema:height", "@type": "xsd:float"}, - "height*": {"@id": "Property:HasHeight", "@type": "xsd:float"}, - "length": {"@id": "Property:HasLength", "@type": "xsd:float"}, - "located_in": {"@id": "schema:containedInPlace", "@type": "@id"}, - "located_in*": {"@id": "Property:IsLocatedIn", "@type": "@id"}, - "number": {"@id": "Property:HasRoomNumber", "@type": "xsd:string"}, - "responsible_person": { - "@id": "Property:HasResponsiblePerson", + "distributions*": { "@type": "@id", + "@id": "Property:HasDistribution", }, - "usage": {"@id": "Property:HasRoomUsage", "@type": "@id"}, - "usage_type": {"@id": "Property:HasRoomUsageType", "@type": "@id"}, - "width": {"@id": "schema:width", "@type": "xsd:float"}, - "width*": {"@id": "Property:HasWidth", "@type": "xsd:float"}, + "data_format": "Property:HasDataFormat", + "dataset_schema": "Property:HasDatasetSchema", + "dcterms": "http://purl.org/dc/terms/", + "prov": "http://www.w3.org/ns/prov#", + "csvw": "http://www.w3.org/ns/csvw#", + "parts": {"@id": "dcterms:hasPart", "@type": "@id"}, + "parts*": {"@id": "Property:HasPart", "@type": "@id"}, + "about": {"@id": "schema:about", "@type": "@id"}, + "generated_by": {"@id": "prov:wasGeneratedBy", "@type": "@id"}, }, - "/wiki/Category:OSW3d238d05316e45a4ac95a11d7b24e36b?action=raw&slot=jsonschema", ], - "title": "Room", - "uuid": "c5ed0ed1-e33c-4b31-887c-67af25a610c1", - "title*": {"en": "Room", "de": "Raum"}, + "title": "Dataset", + "defaultProperties": ["distributions", "themes", "about"], + "uuid": "fe729745-90fd-4e8b-a94c-d4e8366375e8", + "title*": {"en": "Dataset"}, "description": "", "description*": {}, } - type: list[str] | None = ["Category:OSWc5ed0ed1e33c4b31887c67af25a610c1"] - located_in: set[Floor] | None = Field( - None, - range="Category:OSW6c4212f1a39342be963d2b9efd19c5c2", - title="Floor", - title_={"de": "Stockwerk", "en": "Floor"}, + type: list[str] | None = ["Category:OSWfe72974590fd4e8ba94cd4e8366375e8"] + url: list[str] | None = Field(None, title="URL / Websites") + """ + Landing page(s) that documents the dataset + """ + themes: list[Entity] | None = Field( + None, range="Category:Entity", title="Themes / Topics" ) - usage_type: set[AreaUsageType] | None = Field( + """ + Terms to categorizes this dataset + """ + distributions: list[Distribution] | None = Field( None, - range="Category:OSWae92be81cdb34d22844d4791ef790d93", - title="Room usage type", - title_={"en": "Room usage type", "de": "Raumnutzungsart"}, - ) - length: float | None = Field( - None, title="Length", title_={"de": "Länge", "en": "Length"} - ) - width: float | None = Field( - None, title="Width", title_={"de": "Breite", "en": "Width"} - ) - height: float | None = Field( - None, title="Height", title_={"de": "Höhe", "en": "Height"} - ) - area: float | None = Field( - None, title="Area", title_={"de": "Fläche", "en": "Area"} + description_={ + "de": "Serialisierungen dieses Datensatzes. Jeder Eintrag beschreibt eine Datei als Repräsentation dieses Datensatzes, sodass dieselbe Datei mehrere Datensätze mit unterschiedlichen Schemata bedienen kann." + }, + title="Distributions", + title_={"de": "Distributionen"}, ) - door_width: float | None = Field( - None, title="Door width", title_={"de": "Türbreite", "en": "Door width"} + """ + Serializations of this dataset. Each entry describes one file as a representation of this dataset, so the same file can serve several datasets with different schemas. + """ + data_format: list[DataFormat] | None = Field( + None, range="Category:OSWccac243b31f94574847861e5d9685b82", title="Data format" ) - door_height: float | None = Field( - None, title="Door height", title_={"de": "Türhöhe", "en": "Door height"} + # note: removed min_items/max_items due to forward reference + """ + Gives a structure to define specific formats of data. + """ + dataset_schema: list[DatasetSchema] | None = Field( + None, + deprecated=True, + description_={"de": "Veraltet: Der Typ des Feldes data ist sein Schema"}, + options={"hidden": True}, + range="Category:OSW0d6584b3e2b64e9595733c4c3963c486", + title="Dataset schema", ) - number: str | None = Field( - None, title="Number", title_={"en": "Number", "de": "Nummer"} + """ + Deprecated: the type of the data field is its schema + """ + data: str | None = Field( + None, + description_={ + "de": "Die Nutzdaten dieses Datensatzes. Ihr Typ ist ihr Schema, ein Unterschema schränkt sie also ein." + }, + title="Data", + title_={"de": "Daten"}, ) - usage: set[RoomUsage] | None = Field( + """ + The payload of this dataset. Its type is its schema, so a subschema restricts it. + """ + parts: list[Dataset] | None = Field( None, - range="Category:OSWac9f0e49d8024804bd7d77058322a3fe", - title="Room usage", - title_={"en": "Room usage", "de": "Raumnutzung"}, + description_={"de": "Teildatensätze dieses Datensatzes"}, + range="Category:OSWfe72974590fd4e8ba94cd4e8366375e8", + title="Parts", + title_={"de": "Teile"}, ) - responsible_person: set[User] | None = Field( + """ + Sub-datasets of this dataset + """ + about: Entity | None = Field( None, - range="Category:OSWd9aa0bca9b0040d8af6f5c091bf9eec7", - title="Responsible person", - title_={"de": "Verantwortliche Person", "en": "Responsible person"}, + description_={ + "de": "Worum es in den Daten geht, z. B. die Probe oder das Gerät, von dem sie stammen" + }, + options={ + "autocomplete": { + "$comment": "Any Item or Category", + "query": "[[Item:%2B]]OR[[:Category:%2B]]", + } + }, + range="Category:Entity", + title="About", + title_={"de": "Handelt von"}, ) - - -class Floor(Location): - class Config: - schema_extra = { - "@context": [ - { - "located_in": {"@id": "schema:containedInPlace", "@type": "@id"}, - "located_in*": {"@id": "Property:IsLocatedIn", "@type": "@id"}, - }, - "/wiki/Category:OSW3d238d05316e45a4ac95a11d7b24e36b?action=raw&slot=jsonschema", - ], - "title": "Floor", - } - - type: list[str] | None = ["Category:OSW6c4212f1a39342be963d2b9efd19c5c2"] - located_in: set[Building] | None = Field( + """ + What the data is about, e. g. the sample or device it was taken from + """ + generated_by: Process | None = Field( None, - range="Category:OSW4bcd4a99a73f482ea40ac4210dfab836", - title="Building", - title_={"en": "Building", "de": "Gebäude"}, + description_={"de": "Der Prozess, der diesen Datensatz erzeugt hat"}, + range="Category:OSWe5aa96bffb1c4d95be7fbd46142ad203", + title="Generated by", + title_={"de": "Erzeugt durch"}, ) + """ + The process that produced this dataset + """ -class User(Person, UserAccount): +class OrganizationalSubUnit(OrganizationalUnit): """ - A person who has a user ID. + An organizational unit that explicitly is part of a larger organizational unit. """ class Config: schema_extra = { "@context": [ - "/wiki/Category:OSW44deaa5b806d41a2a88594f562b110e9?action=raw&slot=jsonschema", - "/wiki/Category:OSW8b3e627eb76b46d68fce3a12ff220c8e?action=raw&slot=jsonschema", - { - "employment_contract_status": { - "@id": "Property:HasEmploymentContractStatus", - "@type": "@id", - }, - "room": {"@id": "Property:HasRoom", "@type": "@id"}, - "superior": {"@id": "Property:HasSuperior", "@type": "@id"}, - }, + "/wiki/Category:OSW3cb8cef2225e403092f098f99bc4c472?action=raw&slot=jsonschema" ], - "title": "User", - "title*": {"de": "Nutzer"}, - "uuid": "d9aa0bca-9b00-40d8-af6f-5c091bf9eec7", - "description": "A person who has a user ID.", - "description*": {"de": "Eine Person mit Nutzerkennung"}, + "title": "OrganizationalSubUnit", + "title*": {"de": "Organisationsuntereinheit"}, + "description": "An organizational unit that explicitly is part of a larger organizational unit.", + "description*": { + "de": "Eine Organisationseinheit, die ausdrücklich Teil einer größeren Organisationseinheit ist." + }, + "defaultProperties": ["superordinate_ou"], } - room: set[Room] | None = Field( - None, - description_={"de": "Büro"}, - range="Category:OSWc5ed0ed1e33c4b31887c67af25a610c1", - title="Room(s)", - title_={"de": "Raum"}, - ) - """ - Office - """ - superior: set[User] | None = Field( - None, - description_={"de": "Direkte Führungsperson(en)"}, - range="Category:OSWd9aa0bca9b0040d8af6f5c091bf9eec7", - title="Superior(s)", - title_={"de": "Führungsperson(en)"}, - ) - """ - Direct superior(s) - """ - employment_contract_status: EmploymentStatus | None = Field( - default_factory=lambda: EmploymentStatus.parse_obj( - "Item:OSW62770459451644f3841c502df8a5cb1d" - ), - description_={ - "de": "Gibt an, ob ein Nutzer einen aktiven Arbeitsvertrag hat (noch beschäftigt ist) oder nicht" - }, - range="Category:OSW781ad17c7eef4161ade5a7b690aca6b5", - title="Status of the employment contract", - title_={"de": "Status des Arbeitsvertrages"}, - ) + type: list[str] | None = ["Category:OSWfe3e842b804445c7bb0dd8ee61da2d70"] + + +class AdministrativeArea(Place): """ - Whether a user has an active employment contract (stil employed) or not + A geographical region, typically under the jurisdiction of a particular government. """ - type: list[str] | None = ["Category:OSWd9aa0bca9b0040d8af6f5c091bf9eec7"] + class Config: + schema_extra = { + "@context": [ + "/wiki/Category:OSW28f71f2c20ad48c38c4e4d190a95c0b8?action=raw&slot=jsonschema" + ], + "uuid": "137e7443-b2b9-4692-bd59-a0e0a6778b70", + "title": "AdministrativeArea", + "title*": {"en": "Administrative Area", "de": "Verwaltungsbereich"}, + "description": "A geographical region, typically under the jurisdiction of a particular government.", + "description*": { + "en": "A geographical region, typically under the jurisdiction of a particular government.", + "de": "Eine geografische Region, die in der Regel unter die Zuständigkeit einer bestimmten Regierung fällt.", + }, + } + + type: list[str] | None = ["Category:OSW137e7443b2b94692bd59a0e0a6778b70"] -class OrganizationalSubUnit(OrganizationalUnit): + +class Site(Location): """ - An organizational unit that explicitly is part of a larger organizational unit. + A site is a location or place where a particular event, activity, or object exists or is situated. """ class Config: schema_extra = { "@context": [ - "/wiki/Category:OSW3cb8cef2225e403092f098f99bc4c472?action=raw&slot=jsonschema" + "/wiki/Category:OSW3d238d05316e45a4ac95a11d7b24e36b?action=raw&slot=jsonschema" ], - "title": "OrganizationalSubUnit", - "title*": {"de": "Organisationsuntereinheit"}, - "description": "An organizational unit that explicitly is part of a larger organizational unit.", + "title": "Site", + "title*": {"en": "Site", "de": "Standort"}, + "uuid": "473d7a1e-d485-44d1-be83-b258b5810948", + "description": "A site is a location or place where a particular event, activity, or object exists or is situated.", "description*": { - "de": "Eine Organisationseinheit, die ausdrücklich Teil einer größeren Organisationseinheit ist." + "de": "Ein Standort ist ein Ort oder ein Platz, an dem ein bestimmtes Ereignis, eine Aktivität oder ein Objekt existiert oder sich befindet." }, - "defaultProperties": ["superordinate_ou"], } - type: list[str] | None = ["Category:OSWfe3e842b804445c7bb0dd8ee61da2d70"] + type: list[str] | None = ["Category:OSW473d7a1ed48544d1be83b258b5810948"] + + +class DataTerm(DefinedTerm): + class Config: + schema_extra = { + "@context": [ + "/wiki/Category:OSWa5812d3b5119416c8da1606cbe7054eb?action=raw&slot=jsonschema" + ], + "title": "DataTerm", + } + + type: list[str] | None = ["Category:OSW34f9d66c7e1241c8b9543231526f126d"] class Competence(DefinedTerm): @@ -2498,1150 +3283,759 @@ class Config: type: list[str] | None = ["Category:OSW5a13eeda5ed5405ea7ef62ea6feeceec"] -class StatusEnumeration(Enumeration): - """ - Lists or enumerations dealing with status types. - """ - +class ProjectType(Enumeration): class Config: schema_extra = { "@context": [ "/wiki/Category:OSWd02741381aaa4709ae0753a0edc341ce?action=raw&slot=jsonschema" ], - "uuid": "2c32802b-e590-4024-8c85-eda3479d484c", - "title": "StatusEnumeration", - "title*": { - "en": "Zustandsaufzählungen", - "de": "Aufzählung von Zustandsbeschreibungen", - }, - "description": "Lists or enumerations dealing with status types.", - "description*": { - "en": "Lists or enumerations dealing with status types.", - "de": "Listen oder Aufzählungen, die sich mit Statusarten (Zustandsarten) befassen.", - }, + "uuid": "67f2ef61-ba28-4c91-9fef-a00d0e95a7a0", + "title": "ProjectType", + "title*": {"en": "Project Type", "de": "Projekttyp"}, + "description": "", + "description*": {}, } - type: list[str] | None = ["Category:OSW2c32802be59040248c85eda3479d484c"] + type: list[str] | None = ["Category:OSW67f2ef61ba284c919fefa00d0e95a7a0"] -class EmploymentStatus(StatusEnumeration): +class StatusEnumeration(Enumeration): """ - Describes the status of an employment (contract) + Lists or enumerations dealing with status types. """ class Config: schema_extra = { "@context": [ - "/wiki/Category:OSW2c32802be59040248c85eda3479d484c?action=raw&slot=jsonschema" + "/wiki/Category:OSWd02741381aaa4709ae0753a0edc341ce?action=raw&slot=jsonschema" ], - "uuid": "781ad17c-7eef-4161-ade5-a7b690aca6b5", - "title": "EmploymentStatus", + "uuid": "2c32802b-e590-4024-8c85-eda3479d484c", + "title": "StatusEnumeration", "title*": { - "en": "Employment status", - "de": "Status des Beschäftigungsverhältnisses", - }, - "description": "Describes the status of an employment (contract)", - "description*": { - "en": "Describes the status of an employment (contract)", - "de": "Beschreibt den Status eines Arbeitsverhältnisses(vertrages)", - }, - } - - type: list[str] | None = ["Category:OSW781ad17c7eef4161ade5a7b690aca6b5"] - - -# generated by datamodel-codegen: -# filename: OSW6c4212f1a39342be963d2b9efd19c5c2.json - - -# generated by datamodel-codegen: -# filename: OSWc5ed0ed1e33c4b31887c67af25a610c1.json - - -# generated by datamodel-codegen: -# filename: OSW137e7443b2b94692bd59a0e0a6778b70.json - - -# generated by datamodel-codegen: -# filename: OSW0551abcd6f734047825e3ded4c8a0ffe.json - - -# generated by datamodel-codegen: -# filename: OSWab60f9a227954ee0be92344ff6272420.json - - -# generated by datamodel-codegen: -# filename: OSW807f1da5b42e42f296b213ab06ca873b.json - - -# generated by datamodel-codegen: -# filename: OSW95efaf34e2c7439e8e7967233910e44b.json - - -# generated by datamodel-codegen: -# filename: OSWd845b96813a344458f140e48c4d063fd.json - - -class Supply(OswBaseModel): - class Config: - schema_extra = {"title": "Supply", "title*": {"de": "Bezugsmöglichkeit"}} - - supplier: str | None = Field( - None, - options={ - "autocomplete": {"category": "Category:OSW3cb8cef2225e403092f098f99bc4c472"} - }, - title="Supplier", - title_={"de": "Lieferant"}, - ) - article_no: str | None = Field( - None, - description_={"de": "Artikelnummer im Katalog des Lieferanten"}, - title="Article no.", - title_={"de": "Artikelnummer"}, - ) - """ - Article number in the catalogue of the supplier - """ - comment: str | None = Field( - None, - description_={"de": "Kommentar bezüglich der Bezugsmöglichkeit des Materials"}, - title="Comment", - title_={"de": "Kommentar"}, - ) - """ - Comment on the supply of the material - """ - link: AnyUrl | None = Field( - None, - description_={"de": "Link zum Artikel im Online-Katalog des Lieferanten"}, - title="Link", - title_={"de": "Link"}, - ) - """ - Link to the article in the online catalogue of the supplier - """ - - -class Quantity(OswBaseModel): - class Config: - schema_extra = { - "@context": { - "Property": "https://wiki-dev.open-semantic-lab.org/id/Property-3A", - "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", - "rdfs": "http://www.w3.org/2000/01/rdf-schema#", - "quantity*": "Property:HasProperty", - "quantity": "rdf:predicate", - "value*": "Property:HasObject", - "value": "rdf:object", - "unit": "Property:HasUnit", - }, - "$comment": "A reduced version of JsonSchema:Statement", - "title": "Quantity", - "title*": {"de": "Menge"}, - "_headerTemplate": "{{self.value}}", - } - - uuid: UUID = Field(default_factory=uuid4, options={"hidden": True}, title="UUID") - quantity: str = Field( - ..., - options={ - "grid_columns": 8, - "autocomplete": {"category": "Category:QuantityProperty"}, - }, - propertyOrder=10, - title="Property", - title_={"de": "Attribut"}, - ) - numerical_value: str = Field( - ..., - options={"grid_columns": 2}, - propertyOrder=20, - title="Value", - title_={"de": "Wert"}, - ) - unit: str = Field( - ..., - options={ - "grid_columns": 2, - "autocomplete": { - "query": "[[-HasInputUnit::{{$(quantity)}}]][[Display_title_of::like:*{{_user_input}}*]]|?Display_title_of=label", - "render_template": { - "type": ["handlebars"], - "value": "{{result.printouts.label.[0]}}", - }, - "field_maps": [ - { - "source_path": "$", - "template": "{{{result.printouts.label.[0]}}}", - "target_path": "$(unit_symbol)", - } - ], - }, - }, - propertyOrder=30, - title="Unit", - title_={"de": "Einheit"}, - watch={ - "quantity": "statement.quantity", - "unit_symbol": "statement.unit_symbol", - }, - ) - unit_symbol: str = Field(..., options={"hidden": True}) - value: str = Field( - ..., - options={"hidden": True}, - template="{{{numerical_value}}} {{{unit_symbol}}}", - title="Value", - title_={"de": "Wert"}, - watch={ - "numerical_value": "statement.numerical_value", - "unit_symbol": "statement.unit_symbol", - }, - ) - - -class Attribute(OswBaseModel): - class Config: - schema_extra = { - "title": "Attribute", - "title*": {"de": "Attribut"}, - "headerTemplate": "{{i1}} - {{self.name}}", + "en": "Zustandsaufzählungen", + "de": "Aufzählung von Zustandsbeschreibungen", + }, + "description": "Lists or enumerations dealing with status types.", + "description*": { + "en": "Lists or enumerations dealing with status types.", + "de": "Listen oder Aufzählungen, die sich mit Statusarten (Zustandsarten) befassen.", + }, } - attribute_name: list[Label] = Field(..., min_items=1, title="Name") - quantity_prop: Quantity + type: list[str] | None = ["Category:OSW2c32802be59040248c85eda3479d484c"] -class Constituent(OswBaseModel): +class BudgetType(Enumeration): + """ + Type of usage of a certain budget + """ + class Config: schema_extra = { - "title": "Constituent", - "title*": {"de": "Bestandteil"}, - "headerTemplate": "{{i1}} - {{self.name}}", + "@context": [ + "/wiki/Category:OSWd02741381aaa4709ae0753a0edc341ce?action=raw&slot=jsonschema" + ], + "uuid": "595b282a-edf0-4878-8f3e-e326454792ce", + "title": "BudgetType", + "title*": {"en": "Budget Type", "de": "Budget-Typ"}, + "description": "Type of usage of a certain budget", + "description*": { + "en": "Type of usage of a certain budget", + "de": "Art der Verwendung eines bestimmten Budgets", + }, } - uuid: UUID = Field(default_factory=uuid4, options={"hidden": True}, title="UUID") - property: str | None = Field("Property:HasPart", options={"hidden": True}) - is_array: bool | None = Field(None, title="Is array") - name: str = Field(..., title="Name") - type: Material | None = Field( - None, - field_comment="Material", - options={ - "autocomplete": { - "$comment": "todo: we need an any-subcategory-of shortcut", - "query": "[[SubClassOf::Category:OSW31ca9a739cb24079b36824045c0832aa]]OR[[SubClassOf.SubClassOf::Category:OSW31ca9a739cb24079b36824045c0832aa]]OR[[SubClassOf.SubClassOf.SubClassOf::Category:OSW31ca9a739cb24079b36824045c0832aa]]OR[[SubClassOf.SubClassOf.SubClassOf.SubClassOf::Category:OSW31ca9a739cb24079b36824045c0832aa]]OR[[SubClassOf.SubClassOf.SubClassOf.SubClassOf.SubClassOf::Category:OSW31ca9a739cb24079b36824045c0832aa]]", - } - }, - range="Category:OSW31ca9a739cb24079b36824045c0832aa", - title="Type", - x_oold_required_iri=True, - ) - default: str | None = Field(None, title="Default value") + type: list[str] | None = ["Category:OSW595b282aedf048788f3ee326454792ce"] -class OtherPhysicalItem(OswBaseModel): +class Country(AdministrativeArea): + """ + A distinct part of the world, such as a state, nation, or other political entity + """ + class Config: schema_extra = { - "title": "Other physical Item", - "title*": {"de": "Anderer physischer Gegenstand"}, - "headerTemplate": "{{ i1 }}", - "defaultProperties": [], + "@context": [ + "/wiki/Category:OSW137e7443b2b94692bd59a0e0a6778b70?action=raw&slot=jsonschema" + ], + "uuid": "0551abcd-6f73-4047-825e-3ded4c8a0ffe", + "title": "Country", + "title*": {"en": "Country", "de": "Land"}, + "description": "A distinct part of the world, such as a state, nation, or other political entity", + "description*": { + "en": "A distinct part of the world, such as a state, nation, or other political entity", + "de": "Ein bestimmter Teil der Welt, z. B. ein Staat, eine Nation oder eine andere politische Einheit", + }, } - uuid: str = Field( - ..., - dynamic_template="{{_uuid_}}", - options={"hidden": True, "dynamic_template": {"override": "empty"}}, - ) - origin_item_type: Category | None = Field( - default_factory=lambda: Category.parse_obj( - "Category:OSW37a57741ae2e4dd4b29b1172b6848be8" - ), - options={ - "autocomplete": { - "$comment": "Tool", - "query": "[[:Category:OSW37a57741ae2e4dd4b29b1172b6848be8]]OR[[SubClassOf::Category:OSW37a57741ae2e4dd4b29b1172b6848be8]]OR[[SubClassOf.SubClassOf::Category:OSW37a57741ae2e4dd4b29b1172b6848be8]]OR[[SubClassOf.SubClassOf.SubClassOf::Category:OSW37a57741ae2e4dd4b29b1172b6848be8]]OR[[SubClassOf.SubClassOf.SubClassOf.SubClassOf::Category:OSW37a57741ae2e4dd4b29b1172b6848be8]]OR[[SubClassOf.SubClassOf.SubClassOf.SubClassOf.SubClassOf::Category:OSW37a57741ae2e4dd4b29b1172b6848be8]]", - }, - "grid_columns": 12, - }, - propertyOrder=40, - range="Category:Category", - title="Type", - title_={"de": "Typ"}, - x_oold_required_iri=True, - ) - origin_item_instance_property: str | None = Field( - "Property:HasOrigin", options={"hidden": True} - ) - origin_item_instance: PhysicalItem | None = Field( - None, - options={ - "autocomplete": { - "query": "[[HasType::$(origin_item_type_)]]|?Display_title_of=label|?HasImage=image|?HasDescription=description" - }, - "grid_columns": 12, - }, - propertyOrder=50, - range="Category:OSW37a57741ae2e4dd4b29b1172b6848be8", - title="Instance", - title_={"de": "Instanz"}, - watch={"origin_item_type_": "origin_item.origin_item_type"}, - x_oold_required_iri=True, - ) + type: list[str] | None = ["Category:OSW0551abcd6f734047825e3ded4c8a0ffe"] -class PhysicalItem(Item): +class State(AdministrativeArea): """ - Physical item as opposed to intangible item. It can posses properties such as position, geometry, weight, volume , etc. + A state or province of a country. """ class Config: schema_extra = { "@context": [ - "/wiki/Category:Item?action=raw&slot=jsonschema", - { - "data_sheet": {"@id": "Property:HasDataSheet", "@type": "@id"}, - "instructions": {"@id": "Property:HasInstructions", "@type": "@id"}, - "manual": {"@id": "Property:HasManual", "@type": "@id"}, - "manufacturer": {"@id": "Property:HasManufacturer", "@type": "@id"}, - "origin": { - "@id": "Property:HasStatement", - "@type": "@id", - "@context": { - "origin_item_instance_property": "Property:HasProperty", - "origin_item_instance": "Property:HasObject", - }, - }, - "quantity_statements": { - "@id": "Property:HasStatement", - "@type": "@id", - }, - "safety_data_sheet": { - "@id": "Property:HasSafetyDataSheet", - "@type": "@id", - }, - "serial_number": "Property:HasSerialNumber", - "type_no": "Property:HasTypeNumber", - }, + "/wiki/Category:OSW137e7443b2b94692bd59a0e0a6778b70?action=raw&slot=jsonschema" ], - "uuid": "37a57741-ae2e-4dd4-b29b-1172b6848be8", - "title": "PhysicalItem", - "title*": {"en": "Physical Item", "de": "Physischer Gegenstand"}, - "description": "Physical item as opposed to intangible item. It can posses properties such as position, geometry, weight, volume , etc. ", + "uuid": "ab60f9a2-2795-4ee0-be92-344ff6272420", + "title": "State", + "title*": {"en": "State", "de": "Staat"}, + "description": "A state or province of a country.", "description*": { - "en": "Physical item as opposed to intangible item. It can posses properties such as position, geometry, weight, volume , etc. ", - "de": "Physischer Gegenstand im Gegensatz zu immateriellen Gegenständen. Er kann Eigenschaften wie Position, Geometrie, Gewicht, Volumen usw. besitzen. ", + "en": "A state or province of a country.", + "de": "Ein Staat oder eine Provinz eines Landes.", }, } - type: list[str] | None = ["Category:OSW37a57741ae2e4dd4b29b1172b6848be8"] - quantity_statements: list[Quantity] | None = Field( - None, - eval_template={ - "type": "mustache-wikitext", - "mode": "render", - "value": "{{#quantity_statements}}.. {{#quantity}}[[{{quantity}}]]{{/quantity}} {{#value}}{{value}}{{/value}}
{{/quantity_statements}}", - }, - title="Quantitative statement(s)", - title_={"de": "Quantitative Aussage(n)"}, - ) - origin: list[OtherPhysicalItem] | None = Field( - None, - description_={ - "de": "Andere(r) physische(r) Gegenstand/Gegenstände aus der dieser physische Gegenstand hergestellt wurde." - }, - eval_template=[ - { - "type": "mustache-wikitext", - "mode": "render", - "value": "{{=<% %>=}} ", - } - ], - options={ - "enable_array_copy": True, - "array_copy_ignore": ["uuid", "attachments"], - }, - title="Origin", - title_={"de": "Ursprung"}, - ) - """ - Other physical item(s) that this physical item was derived from. - """ - type_no: str | None = Field( - None, - description_={"de": "Typen- oder Modellnummer wie vom Hersteller angegeben"}, - title="Type number", - title_={"de": "Typennummer"}, - ) - """ - Type or model number as specified by the manufacturer - """ - manufacturer: str | None = Field( - None, - description_={ - "de": "Der Hersteller dieses Gegendstandes - eine Organisation(seinheit)" - }, - range="Category:OSW3cb8cef2225e403092f098f99bc4c472", - title="Manufacturer", - title_={"de": "Hersteller"}, - ) - """ - The manufacturer of this item - an organization(al unit). - """ - data_sheet: set[str] | None = Field( - None, - eval_template={ - "type": "mustache-wikitext", - "mode": "render", - "value": "{{=<% %>=}} <%={{ }}=%> {{#data_sheet}}[[:{{{.}}}]];{{/data_sheet}} {{=<% %>=}} <%={{ }}=%>", - }, - title="Data sheet", - title_={"de": "Datenblatt"}, - ) - safety_data_sheet: set[str] | None = Field( - None, - eval_template={ - "type": "mustache-wikitext", - "mode": "render", - "value": "{{=<% %>=}} <%={{ }}=%> {{#safety_data_sheet}}[[:{{{.}}}]];{{/safety_data_sheet}} {{=<% %>=}} <%={{ }}=%>", - }, - title="Safety data sheet", - title_={"de": "Sicherheitsdatenblatt"}, - ) - manual: set[str] | None = Field( - None, - description_={ - "de": "Handbuch, Gerauchsanweisung, Betriebs- oder Bedienungsanleitung mit Einzelheiten zur Verwendung dieses Gegenstands." - }, - eval_template={ - "type": "mustache-wikitext", - "mode": "render", - "value": "{{=<% %>=}} <%={{ }}=%> {{#manual}}[[:{{{.}}}]];{{/manual}} {{=<% %>=}} <%={{ }}=%>", - }, - title="Manual", - title_={"de": "Handbuch"}, - ) + type: list[str] | None = ["Category:OSWab60f9a227954ee0be92344ff6272420"] + + +class Region(AdministrativeArea): + class Config: + schema_extra = { + "@context": [ + "/wiki/Category:OSW137e7443b2b94692bd59a0e0a6778b70?action=raw&slot=jsonschema" + ], + "uuid": "95efaf34-e2c7-439e-8e79-67233910e44b", + "title": "Region", + "title*": {"en": "Region", "de": "Region"}, + "description": "", + "description*": {}, + } + + type: list[str] | None = ["Category:OSW95efaf34e2c7439e8e7967233910e44b"] + + +class City(AdministrativeArea): """ - Comprehensive guide that details how to use this item. + A city or town. """ - instructions: set[str] | None = Field( + + class Config: + schema_extra = { + "@context": [ + "/wiki/Category:OSW137e7443b2b94692bd59a0e0a6778b70?action=raw&slot=jsonschema" + ], + "uuid": "807f1da5-b42e-42f2-96b2-13ab06ca873b", + "title": "City", + "title*": {"en": "Stadt"}, + "description": "A city or town.", + "description*": { + "en": "A city or town.", + "de": "Eine Stadt oder ein Ort, im Sinne einer Gemeinde", + }, + } + + type: list[str] | None = ["Category:OSW807f1da5b42e42f296b213ab06ca873b"] + + +class DataFormat(DataTerm): + class Config: + schema_extra = { + "defaultProperties": [ + "specification", + "description", + "label", + "short_name", + ], + "title": "DataFormat", + } + + specification: str | None = Field( None, - description_={ - "de": "Eine Liste auszuführenden Schritte, z. B. die Einrichtungsanweisungen." - }, - eval_template={ - "type": "mustache-wikitext", - "mode": "render", - "value": "{{=<% %>=}} <%={{ }}=%> {{#instructions}}[[:{{{.}}}]];{{/instructions}} {{=<% %>=}} <%={{ }}=%>", - }, - title="Instructions", - title_={"de": "Anleitung"}, + description_={"de": "Entweder Text oder Link"}, + title="Specification", + title_={"de": "Spezifikation"}, ) """ - A list of steps to be performed, e.g., the setup instructions. + Either text or link """ + type: list[str] | None = ["Category:OSWccac243b31f94574847861e5d9685b82"] -class PhysicalItemType(Category): +class ProjectStatus(StatusEnumeration): """ - Helps to create subcategories of PhysicalItem + Status for projects and project applications """ class Config: schema_extra = { "@context": [ - "/wiki/Category:Category?action=raw&slot=jsonschema", - { - "constituents": { - "@type": "@id", - "@id": "Property:HasStatement", - "@context": { - "property": "Property:HasProperty", - "type": "Property:HasValue", - }, - }, - "data_sheet": {"@id": "Property:HasDataSheet", "@type": "@id"}, - "instructions": {"@id": "Property:HasInstructions", "@type": "@id"}, - "manual": {"@id": "Property:HasManual", "@type": "@id"}, - "manufacturer": {"@id": "Property:HasManufacturer", "@type": "@id"}, - "safety_data_sheet": { - "@id": "Property:HasSafetyDataSheet", - "@type": "@id", - }, - "type_no": "Property:HasTypeNumber", - }, - ], - "uuid": "ca99a9bb-9ad2-4386-b222-d18a73c2af5e", - "title": "PhysicalItemType", - "title*": {"en": "Physical Item Type"}, - "description": "Helps to create subcategories of PhysicalItem", - "description*": {"en": "Helps to create subcategories of PhysicalItem"}, - "defaultPropertis": [ - "type_no", - "manufacturer", - "data_sheet", - "safety_data_sheet", - "supply", - "specifications", + "/wiki/Category:OSW2c32802be59040248c85eda3479d484c?action=raw&slot=jsonschema" ], + "uuid": "490e38f9-764f-4408-a244-869a0ea98e7c", + "title": "ProjectStatus", + "title*": { + "en": "Project (Application) Status", + "de": "Projekt(antrags)status", + }, + "description": "Status for projects and project applications", + "description*": { + "en": "Status for projects and project applications", + "de": "Status für Projekte und Projektanträge", + }, } - type: list[str] | None = ["Category:OSWca99a9bb9ad24386b222d18a73c2af5e"] - type_no: str | None = Field( - None, - description_={"de": "Typen- oder Modellnummer wie vom Hersteller angegeben"}, - title="Type number", - title_={"de": "Typennummer"}, - ) + type: list[str] | None = ["Category:OSW490e38f9764f4408a244869a0ea98e7c"] + + +# generated by datamodel-codegen: +# filename: OSW0d6584b3e2b64e9595733c4c3963c486.json + + +# generated by datamodel-codegen: +# filename: OSWafcac83979f4472298b6acdc01981728.json + + +class DigitalDocument(CreativeWork): """ - Type or model number as specified by the manufacturer + An electronic file or document. """ - manufacturer: str | None = Field( + + class Config: + schema_extra = { + "@context": [ + "/wiki/Category:OSW712583f2479944deb2546b77cf860dda?action=raw&slot=jsonschema" + ], + "uuid": "afcac839-79f4-4722-98b6-acdc01981728", + "title": "DigitalDocument", + "title*": {"en": "Digital document"}, + "description": "An electronic file or document.", + "description*": {"en": "An electronic file or document."}, + } + + type: list[str] | None = ["Category:OSWafcac83979f4472298b6acdc01981728"] + + +# generated by datamodel-codegen: +# filename: OSW34f9d66c7e1241c8b9543231526f126d.json + + +# generated by datamodel-codegen: +# filename: OSWccac243b31f94574847861e5d9685b82.json + + +# generated by datamodel-codegen: +# filename: OSW3d238d05316e45a4ac95a11d7b24e36b.json + + +# generated by datamodel-codegen: +# filename: OSW28f71f2c20ad48c38c4e4d190a95c0b8.json + + +# generated by datamodel-codegen: +# filename: OSW473d7a1ed48544d1be83b258b5810948.json + + +# generated by datamodel-codegen: +# filename: OSW4bcd4a99a73f482ea40ac4210dfab836.json + + +class BuildingFunction(Item): + class Config: + schema_extra = {"title": "BuildingFunction"} + + type: list[str] | None = ["Category:OSW07a0faef5be94b788514a2dd5dca20bf"] + + +class AreaUsageType(Item): + class Config: + schema_extra = { + "title": "AreaUsageType", + "@context": [{"din277_label": "Property:HasDin277Label"}], + } + + din277_label: list[str] | None = Field( None, - description_={ - "de": "Der Hersteller dieses Gegendstandes - eine Organisation(seinheit)" - }, - range="Category:OSW3cb8cef2225e403092f098f99bc4c472", - title="Manufacturer", - title_={"de": "Hersteller"}, + desciption="Label according to DIN 277", + description_={"de": "Bezeichnung nach DIN 277"}, + title="DIN 277 label", + title_={"de": "DIN 277 Bezeichnung"}, ) - """ - The manufacturer of this item - an organization(al unit). - """ - data_sheet: set[str] | None = Field( + type: list[str] | None = ["Category:OSWae92be81cdb34d22844d4791ef790d93"] + + +class RoomUsage(Item): + class Config: + schema_extra = { + "title": "RoomUsage", + "@context": [{"din277_label": "Property:HasDin277Label"}], + } + + din277_label: list[str] | None = Field( None, - eval_template={ - "type": "mustache-wikitext", - "mode": "render", - "value": "{{=<% %>=}} <%={{ }}=%> {{#data_sheet}}[[:{{{.}}}]];{{/data_sheet}} {{=<% %>=}} <%={{ }}=%>", - }, - title="Data sheet", - title_={"de": "Datenblatt"}, + desciption="Label according to DIN 277", + description_={"de": "Bezeichnung nach DIN 277"}, + title="DIN 277 label", + title_={"de": "DIN 277 Bezeichnung"}, ) - safety_data_sheet: set[str] | None = Field( + type: list[str] | None = ["Category:OSWac9f0e49d8024804bd7d77058322a3fe"] + + +class Building(Location): + class Config: + schema_extra = { + "@context": [ + { + "area": {"@id": "schema:floorSize", "@type": "@id"}, + "area*": {"@id": "Property:HasArea", "@type": "xsd:float"}, + "construction_year": { + "@id": "schema:yearBuilt", + "@type": "xsd:integer", + }, + "construction_year*": { + "@id": "Property:HasConstructionYear", + "@type": "xsd:integer", + }, + "footprint": {"@id": "Property:HasFootprint", "@type": "xsd:float"}, + "function": {"@id": "Property:HasBuildingFunction", "@type": "@id"}, + "height": {"@id": "schema:height", "@type": "xsd:float"}, + "height*": {"@id": "Property:HasHeight", "@type": "xsd:float"}, + "length": {"@id": "Property:HasLength", "@type": "xsd:float"}, + "located_in": {"@id": "schema:containedInPlace", "@type": "@id"}, + "located_in*": {"@id": "Property:IsLocatedIn", "@type": "@id"}, + "responsible_person": { + "@id": "Property:HasResponsiblePerson", + "@type": "@id", + }, + "width": {"@id": "schema:width", "@type": "xsd:float"}, + "width*": {"@id": "Property:HasWidth", "@type": "xsd:float"}, + }, + "/wiki/Category:OSW3d238d05316e45a4ac95a11d7b24e36b?action=raw&slot=jsonschema", + ], + "title": "Building", + "title*": {"en": "Building", "de": "Gebäude"}, + } + + type: list[str] | None = ["Category:OSW4bcd4a99a73f482ea40ac4210dfab836"] + located_in: set[Site] | None = Field( None, - eval_template={ - "type": "mustache-wikitext", - "mode": "render", - "value": "{{=<% %>=}} <%={{ }}=%> {{#safety_data_sheet}}[[:{{{.}}}]];{{/safety_data_sheet}} {{=<% %>=}} <%={{ }}=%>", - }, - title="Safety data sheet", - title_={"de": "Sicherheitsdatenblatt"}, + range="Category:OSW473d7a1ed48544d1be83b258b5810948", + title="Site", + title_={"en": "Site", "de": "Standort"}, ) - instructions: set[str] | None = Field( + construction_year: float | None = Field( None, description_={ - "de": "Eine Liste auszuführenden Schritte, z. B. die Einrichtungsanweisungen." - }, - eval_template={ - "type": "mustache-wikitext", - "mode": "render", - "value": "{{=<% %>=}} <%={{ }}=%> {{#instructions}}[[:{{{.}}}]];{{/instructions}} {{=<% %>=}} <%={{ }}=%>", + "de": "Das Jahr, in dem der Bau abgeschlossen wurde.", + "en": "The year in which the construction was completed.", }, - title="Instructions", - title_={"de": "Anleitung"}, + title="Construction year", + title_={"de": "Baujahr", "en": "Construction year"}, ) """ - A list of steps to be performed, e.g., the setup instructions. + The year in which the construction was completed. """ - manual: set[str] | None = Field( + length: float | None = Field( + None, title="Length", title_={"de": "Länge", "en": "Length"} + ) + width: float | None = Field( + None, title="Width", title_={"de": "Breite", "en": "Width"} + ) + height: float | None = Field( + None, title="Height", title_={"de": "Höhe", "en": "Height"} + ) + footprint: float | None = Field( None, - description_={ - "de": "Handbuch, Gerauchsanweisung, Betriebs- oder Bedienungsanleitung mit Einzelheiten zur Verwendung dieses Gegenstands." - }, - eval_template={ - "type": "mustache-wikitext", - "mode": "render", - "value": "{{=<% %>=}} <%={{ }}=%> {{#manual}}[[:{{{.}}}]];{{/manual}} {{=<% %>=}} <%={{ }}=%>", - }, - title="Manual", - title_={"de": "Handbuch"}, + title="Area at base level", + title_={"de": "Grundfläche", "en": "Area at base level"}, ) - """ - Comprehensive guide that details how to use this item. - """ - supply: list[Supply] | None = Field( + area: float | None = Field( None, - description_={ - "de": "Bezugsmöglichkeit des Materials mit Lieferant, Artikelnummer und Link" - }, - title="Supply", - title_={"de": "Bezugsmöglichkeit"}, + title="Total floor area", + title_={"de": "Gesamtfläche", "en": "Total floor area"}, ) - """ - Supply of the material with supplier, article no. and link - """ - specifications: list[Attribute] | None = Field( + function: set[BuildingFunction] | None = Field( None, - title="Specification of technical properties", - title_={"de": "Spezifikation technischer Eigenschaften"}, + range="Category:OSW07a0faef5be94b788514a2dd5dca20bf", + title="Building function", + title_={"en": "Building function", "de": "Gebäudefunktion"}, ) - constituents: list[Constituent] | None = Field( - None, title="Constituents", title_={"de": "Bestandteile"} + responsible_person: set[User] | None = Field( + None, + range="Category:OSWd9aa0bca9b0040d8af6f5c091bf9eec7", + title="Responsible person", + title_={"de": "Verantwortliche Person", "en": "Responsible person"}, ) - """ - Components or parts - """ - - -class Material(PhysicalItem): - """ - Contains chemical substances and engineered matterials / parts - """ - - class Config: - schema_extra = { - "@context": [ - "/wiki/Category:OSW37a57741ae2e4dd4b29b1172b6848be8?action=raw&slot=jsonschema" - ], - "uuid": "31ca9a73-9cb2-4079-b368-24045c0832aa", - "title": "Material", - "title*": {"en": "Material", "de": "Material"}, - "description": "Contains chemical substances and engineered matterials / parts", - "description*": { - "en": "Contains chemical substances and engineered matterials / parts", - "de": "Enthält chemische Stoffe, Materialien und Bauteile", - }, - } - - type: list[str] | None = ["Category:OSW31ca9a739cb24079b36824045c0832aa"] - -class DeviceType(PhysicalItemType): - """ - Helps Creating DeviceCategories - """ +class Room(Location): class Config: schema_extra = { "@context": [ - "/wiki/Category:OSWca99a9bb9ad24386b222d18a73c2af5e?action=raw&slot=jsonschema", { - "purpose": {"@id": "Property:HasPurpose", "@type": "@id"}, - "typical_processes": { - "@id": "Property:HasTypicalProcess", + "area": {"@id": "schema:floorSize", "@type": "xsd:float"}, + "area*": {"@id": "Property:HasArea", "@type": "xsd:float"}, + "construction_year": { + "@id": "schema:yearBuilt", + "@type": "xsd:integer", + }, + "construction_year*": { + "@id": "Property:HasConstructionYear", + "@type": "xsd:integer", + }, + "door_height": { + "@id": "Property:HasDoorHeight", + "@type": "xsd:float", + }, + "door_width": { + "@id": "Property:HasDoorWidth", + "@type": "xsd:float", + }, + "height": {"@id": "schema:height", "@type": "xsd:float"}, + "height*": {"@id": "Property:HasHeight", "@type": "xsd:float"}, + "length": {"@id": "Property:HasLength", "@type": "xsd:float"}, + "located_in": {"@id": "schema:containedInPlace", "@type": "@id"}, + "located_in*": {"@id": "Property:IsLocatedIn", "@type": "@id"}, + "number": {"@id": "Property:HasRoomNumber", "@type": "xsd:string"}, + "responsible_person": { + "@id": "Property:HasResponsiblePerson", "@type": "@id", }, + "usage": {"@id": "Property:HasRoomUsage", "@type": "@id"}, + "usage_type": {"@id": "Property:HasRoomUsageType", "@type": "@id"}, + "width": {"@id": "schema:width", "@type": "xsd:float"}, + "width*": {"@id": "Property:HasWidth", "@type": "xsd:float"}, }, + "/wiki/Category:OSW3d238d05316e45a4ac95a11d7b24e36b?action=raw&slot=jsonschema", ], - "uuid": "d845b968-13a3-4445-8f14-0e48c4d063fd", - "title": "DeviceType", - "title*": {"en": "Device Type"}, - "description": "Helps Creating DeviceCategories", - "description*": {"en": "Helps Creating DeviceCategories"}, - "defaultProperties": ["manufacturer", "typical_processes", "manual"], + "title": "Room", + "uuid": "c5ed0ed1-e33c-4b31-887c-67af25a610c1", + "title*": {"en": "Room", "de": "Raum"}, + "description": "", + "description*": {}, } - type: list[str] | None = ["Category:OSWd845b96813a344458f140e48c4d063fd"] - typical_processes: list[str] | None = Field( - None, title="Typical Processes", title_={"de": "Typische Prozesse"} + type: list[str] | None = ["Category:OSWc5ed0ed1e33c4b31887c67af25a610c1"] + located_in: set[Floor] | None = Field( + None, + range="Category:OSW6c4212f1a39342be963d2b9efd19c5c2", + title="Floor", + title_={"de": "Stockwerk", "en": "Floor"}, ) - manufacturer_type_id: str | None = Field( + usage_type: set[AreaUsageType] | None = Field( None, - description_={"de": "Produkt-ID des Herstellers."}, - title="Manufacturer Type ID", - title_={"de": "Hersteller Typen-ID"}, + range="Category:OSWae92be81cdb34d22844d4791ef790d93", + title="Room usage type", + title_={"en": "Room usage type", "de": "Raumnutzungsart"}, ) - """ - Product ID provided by the manufacturer - """ - manufacturer_type_name: str | None = Field( + length: float | None = Field( + None, title="Length", title_={"de": "Länge", "en": "Length"} + ) + width: float | None = Field( + None, title="Width", title_={"de": "Breite", "en": "Width"} + ) + height: float | None = Field( + None, title="Height", title_={"de": "Höhe", "en": "Height"} + ) + area: float | None = Field( + None, title="Area", title_={"de": "Fläche", "en": "Area"} + ) + door_width: float | None = Field( + None, title="Door width", title_={"de": "Türbreite", "en": "Door width"} + ) + door_height: float | None = Field( + None, title="Door height", title_={"de": "Türhöhe", "en": "Door height"} + ) + number: str | None = Field( + None, title="Number", title_={"en": "Number", "de": "Nummer"} + ) + usage: set[RoomUsage] | None = Field( None, - description_={ - "de": "Produktname des Herstellers. Oftmals ein einfacherer Alias neben der Typen-ID" - }, - title="Manufacturer Type Name", - title_={"de": "Hersteller Typenbezeichnung"}, + range="Category:OSWac9f0e49d8024804bd7d77058322a3fe", + title="Room usage", + title_={"en": "Room usage", "de": "Raumnutzung"}, + ) + responsible_person: set[User] | None = Field( + None, + range="Category:OSWd9aa0bca9b0040d8af6f5c091bf9eec7", + title="Responsible person", + title_={"de": "Verantwortliche Person", "en": "Responsible person"}, ) - """ - Product name provided by the manufacturer. Often more human friendly than the type id. - """ - -# generated by datamodel-codegen: -# filename: OSWf0fe562f422d49c6877490b3dfee2f3f.json +class Floor(Location): + class Config: + schema_extra = { + "@context": [ + { + "located_in": {"@id": "schema:containedInPlace", "@type": "@id"}, + "located_in*": {"@id": "Property:IsLocatedIn", "@type": "@id"}, + }, + "/wiki/Category:OSW3d238d05316e45a4ac95a11d7b24e36b?action=raw&slot=jsonschema", + ], + "title": "Floor", + } -class Status(str, Enum): - Item_OSWaa8d29404288446a9f3ec7afa4e2a512 = ( - "Item:OSWaa8d29404288446a9f3ec7afa4e2a512" - ) - """ - To do - """ - Item_OSWa2b4567ad4874ea1b9adfed19a3d06d1 = ( - "Item:OSWa2b4567ad4874ea1b9adfed19a3d06d1" - ) - """ - In work - """ - Item_OSWf474ec34b7df451ea8356134241aef8a = ( - "Item:OSWf474ec34b7df451ea8356134241aef8a" - ) - """ - Done - """ + type: list[str] | None = ["Category:OSW6c4212f1a39342be963d2b9efd19c5c2"] + located_in: set[Building] | None = Field( + None, + range="Category:OSW4bcd4a99a73f482ea40ac4210dfab836", + title="Building", + title_={"en": "Building", "de": "Gebäude"}, + ) -class ProjectTypeDeprecated(str, Enum): +class User(Person, UserAccount): """ - Replaced with Project / Funding Type + A person who has a user ID. """ - house_project = "house_project" - """ - House project - """ - internal = "internal" + class Config: + schema_extra = { + "@context": [ + "/wiki/Category:OSW44deaa5b806d41a2a88594f562b110e9?action=raw&slot=jsonschema", + "/wiki/Category:OSW8b3e627eb76b46d68fce3a12ff220c8e?action=raw&slot=jsonschema", + { + "employment_contract_status": { + "@id": "Property:HasEmploymentContractStatus", + "@type": "@id", + }, + "room": {"@id": "Property:HasRoom", "@type": "@id"}, + "superior": {"@id": "Property:HasSuperior", "@type": "@id"}, + }, + ], + "title": "User", + "title*": {"de": "Nutzer"}, + "uuid": "d9aa0bca-9b00-40d8-af6f-5c091bf9eec7", + "description": "A person who has a user ID.", + "description*": {"de": "Eine Person mit Nutzerkennung"}, + } + + room: set[Room] | None = Field( + None, + description_={"de": "Büro"}, + range="Category:OSWc5ed0ed1e33c4b31887c67af25a610c1", + title="Room(s)", + title_={"de": "Raum"}, + ) """ - Internal + Office """ - public = "public" + superior: set[User] | None = Field( + None, + description_={"de": "Direkte Führungsperson(en)"}, + range="Category:OSWd9aa0bca9b0040d8af6f5c091bf9eec7", + title="Superior(s)", + title_={"de": "Führungsperson(en)"}, + ) """ - Public + Direct superior(s) """ - industry = "industry" + employment_contract_status: EmploymentStatus | None = Field( + default_factory=lambda: EmploymentStatus.parse_obj( + "Item:OSW62770459451644f3841c502df8a5cb1d" + ), + description_={ + "de": "Gibt an, ob ein Nutzer einen aktiven Arbeitsvertrag hat (noch beschäftigt ist) oder nicht" + }, + range="Category:OSW781ad17c7eef4161ade5a7b690aca6b5", + title="Status of the employment contract", + title_={"de": "Status des Arbeitsvertrages"}, + ) """ - Industry + Whether a user has an active employment contract (stil employed) or not """ + type: list[str] | None = ["Category:OSWd9aa0bca9b0040d8af6f5c091bf9eec7"] -class ProbabilityOfSuccessfulFundingInPercent(Quantity): +class EmploymentStatus(StatusEnumeration): """ - Indicates the likelihood that the funding will be approved, determines the weighted budget + Describes the status of an employment (contract) """ class Config: schema_extra = { - "title": "Probability of Successful Funding in percent", + "@context": [ + "/wiki/Category:OSW2c32802be59040248c85eda3479d484c?action=raw&slot=jsonschema" + ], + "uuid": "781ad17c-7eef-4161-ade5-a7b690aca6b5", + "title": "EmploymentStatus", "title*": { - "de": "Wahrscheinlichkeit einer erfolgreichen Förderung in Prozent" + "en": "Employment status", + "de": "Status des Beschäftigungsverhältnisses", }, - "description": "Indicates the likelihood that the funding will be approved, determines the weighted budget", + "description": "Describes the status of an employment (contract)", "description*": { - "de": "Gibt die Wahrscheinlichkeit an, dass die Förderung genehmigt wird, bestimmt das gewichtete Budget" + "en": "Describes the status of an employment (contract)", + "de": "Beschreibt den Status eines Arbeitsverhältnisses(vertrages)", }, } - quantity: str | None = Field( - "Property:HasProbabilityOfSuccessfulFunding", options={"hidden": True} - ) - unit: str | None = Field( - "Property:HasDimensionlessRatio#OSW8b3dc9b793074afc8ab8b03041f97f16", - readOnly=True, - ) + type: list[str] | None = ["Category:OSW781ad17c7eef4161ade5a7b690aca6b5"] -class TotalBudget(Quantity): - class Config: - schema_extra = {"title": "Total Budget", "title*": {"de": "Budgetsumme"}} +# generated by datamodel-codegen: +# filename: OSW6c4212f1a39342be963d2b9efd19c5c2.json - quantity: str | None = Field("Property:HasBudget", options={"hidden": True}) - unit: str | None = Field(None, title="Currency", title_={"de": "Währung"}) +# generated by datamodel-codegen: +# filename: OSWc5ed0ed1e33c4b31887c67af25a610c1.json -class YearlyBudgetSum(Quantity): - class Config: - schema_extra = { - "title": "Yearly Budget Sum", - "title*": {"de": "Summe Jahresbudget"}, - "options": { - "disable_collapse": True, - "disable_properties": True, - "compact": True, - }, - } - quantity: str | None = Field("Property:HasBudget", options={"hidden": True}) - numerical_value: str | None = Field(None, options={"grid_columns": 6}) - unit: str | None = Field( - None, - options={"grid_columns": 6}, - propertyOrder=1001, - title="Currency", - title_={"de": "Währung"}, - ) +# generated by datamodel-codegen: +# filename: OSW137e7443b2b94692bd59a0e0a6778b70.json -class WeightedSum(OswBaseModel): - class Config: - schema_extra = { - "title": "weighted sum", - "title*": {"de": "Gewichtete Summe"}, - "_description": "weighted with probability of successful funding", - "_description*": {"de": "gewichtet mit Erfolgswahrscheinlichkeit"}, - "options": { - "disable_collapse": True, - "disable_properties": True, - "compact": True, - }, - } +# generated by datamodel-codegen: +# filename: OSW0551abcd6f734047825e3ded4c8a0ffe.json - uuid: UUID = Field(default_factory=uuid4, options={"hidden": True}, title="UUID") - quantity: str | None = Field("Property:HasWeightedBudget", options={"hidden": True}) - numerical_value: str = Field( - ..., - dynamic_template="{{#calc 0.01 '*'}}{{#calc probability_of_successful_funding '*'}}{{yearly_budget_sum_value}}{{/calc}}{{/calc}}", - field_format="template", - options={ - "grid_columns": 12, - "hidden": True, - "dynamic_template": {"override": "always"}, - }, - watch={ - "probability_of_successful_funding": "probability_of_successful_funding.numerical_value", - "yearly_budget_sum_value": "yearly_budget.yearly_budget_sum.numerical_value", - }, - ) - value: str = Field( - ..., - field_format="template", - field_watch={ - "probability_of_successful_funding": "probability_of_successful_funding.numerical_value", - "yearly_budget_sum_value": "yearly_budget.yearly_budget_sum.numerical_value", - "yearly_budget_sum_unit_symbol": "yearly_budget.yearly_budget_sum.unit_symbol", - }, - options={"grid_columns": 12, "hidden": False}, - template="{{{numerical_value}}} {{{unit_symbol}}}", - title="Wert", - watch={ - "numerical_value": "statement.numerical_value", - "unit_symbol": "statement.unit_symbol", - }, - ) - unit: str = Field( - ..., - field_format="template", - options={"grid_columns": 6, "hidden": True}, - propertyOrder=1001, - template="{{yearly_budget_sum_unit}}", - title="Currency", - title_={"de": "Währung"}, - watch={"yearly_budget_sum_unit": "yearly_budget.yearly_budget_sum.unit"}, - ) - unit_symbol: str = Field( - ..., - options={"grid_columns": 6, "hidden": True}, - template="{{yearly_budget_sum_unit_symbol}}", - watch={ - "yearly_budget_sum_unit_symbol": "yearly_budget.yearly_budget_sum.unit_symbol" - }, - ) +# generated by datamodel-codegen: +# filename: OSWab60f9a227954ee0be92344ff6272420.json -class Component(OswBaseModel): + +# generated by datamodel-codegen: +# filename: OSW807f1da5b42e42f296b213ab06ca873b.json + + +# generated by datamodel-codegen: +# filename: OSW95efaf34e2c7439e8e7967233910e44b.json + + +# generated by datamodel-codegen: +# filename: OSWd845b96813a344458f140e48c4d063fd.json + + +class Supply(OswBaseModel): class Config: - schema_extra = { - "title": "Component", - "title*": {"de": "Komponente"}, - "headerTemplate": "{{ i1 }} - {{ self.component_id }}", - "defaultProperties": [], - } + schema_extra = {"title": "Supply", "title*": {"de": "Bezugsmöglichkeit"}} - uuid: UUID = Field( - ..., - dynamic_template="{{_uuid_}}", - field_comment="format uuid field are copied, if not set in copy_ignore", - field_template="dynamic_template", - options={"hidden": True, "dynamic_template": {"override": "empty"}}, - title="UUID", - title_={"de": "UUID"}, - ) - component_id: str = Field( - ..., - description_={"de": "Wird automatisch generiert"}, - dynamic_template="Component{{patternformat '00' _array_index_}}", - field_comment="Will be used as a visual reference for the user", - options={ - "hidden": True, - "dynamic_template": {"override": "always"}, - "grid_columns": 6, - }, - propertyOrder=10, - readOnly=True, - title="ID", - title_={"de": "ID"}, - ) - """ - Automatically generated - """ - label: list[Label] | None = Field( + supplier: str | None = Field( None, - description_={ - "de": "Bezeichnung der Funktion oder Rolle der Komponente in diesem spezifischen Kontext." - }, - eval_template={ - "type": "mustache-wikitext", - "mode": "render", - "value": "{{=<% %>=}} {{#switch:{{USERLANGUAGECODE}} <%={{ }}=%> {{#label}} |{{lang}}={{text}} {{/label}} {{=<% %>=}} }}", + options={ + "autocomplete": {"category": "Category:OSW3cb8cef2225e403092f098f99bc4c472"} }, - options={"grid_columns": 12}, - propertyOrder=20, - title="Label", - title_={"de": "Bezeichnung"}, + title="Supplier", + title_={"de": "Lieferant"}, + ) + article_no: str | None = Field( + None, + description_={"de": "Artikelnummer im Katalog des Lieferanten"}, + title="Article no.", + title_={"de": "Artikelnummer"}, ) """ - Designation of the function or role of the component in this specific context. + Article number in the catalogue of the supplier """ - description: list[Description] | None = Field( + comment: str | None = Field( None, - description_={ - "de": "Optional, zusätzliche Angaben zur Rolle oder Funktion der Komponente in diesem spezifischen Kontext." - }, - eval_template={ - "type": "mustache-wikitext", - "mode": "render", - "value": "{{=<% %>=}} {{#switch:{{USERLANGUAGECODE}} <%={{ }}=%> {{#description}} |{{lang}}={{text}} {{/description}} {{=<% %>=}} }}", - }, - options={"grid_columns": 12}, - propertyOrder=30, - title="Description", - title_={"de": "Beschreibung"}, + description_={"de": "Kommentar bezüglich der Bezugsmöglichkeit des Materials"}, + title="Comment", + title_={"de": "Kommentar"}, ) """ - Optional, additional details on the role or function of the component in this specific context. + Comment on the supply of the material """ - component_type: Category | None = Field( - default_factory=lambda: Category.parse_obj( - "Category:OSWe427aafafbac4262955b9f690a83405d" - ), - options={ - "autocomplete": { - "$comment": "Tool", - "query": "[[:Category:OSWe427aafafbac4262955b9f690a83405d]]OR[[SubClassOf::Category:OSWe427aafafbac4262955b9f690a83405d]]OR[[SubClassOf.SubClassOf::Category:OSWe427aafafbac4262955b9f690a83405d]]OR[[SubClassOf.SubClassOf.SubClassOf::Category:OSWe427aafafbac4262955b9f690a83405d]]OR[[SubClassOf.SubClassOf.SubClassOf.SubClassOf::Category:OSWe427aafafbac4262955b9f690a83405d]]OR[[SubClassOf.SubClassOf.SubClassOf.SubClassOf.SubClassOf::Category:OSWe427aafafbac4262955b9f690a83405d]]", - }, - "grid_columns": 12, - }, - propertyOrder=40, - range="Category:Category", - title="Component type", - title_={"de": "Typ der Komponente"}, - x_oold_required_iri=True, - ) - component_instance_property: str | None = Field( - "Property:HasPart", options={"hidden": True} - ) - component_instance: Tool | None = Field( + link: AnyUrl | None = Field( None, - options={ - "autocomplete": { - "query": "[[HasType::$(component_type_)]]|?Display_title_of=label|?HasImage=image|?HasDescription=description" - }, - "grid_columns": 12, - }, - propertyOrder=50, - range="Category:OSWe427aafafbac4262955b9f690a83405d", - title="Instance", - title_={"de": "Instanz"}, - watch={"component_type_": "component.component_type"}, - x_oold_required_iri=True, + description_={"de": "Link zum Artikel im Online-Katalog des Lieferanten"}, + title="Link", + title_={"de": "Link"}, ) - - -class InitialOccupantOfTheSlot(OswBaseModel): """ - Tool or component installed in the slot. + Link to the article in the online catalogue of the supplier """ + +class Attribute(OswBaseModel): class Config: schema_extra = { - "title": "Initial occupant of the slot", - "title*": {"de": "Initiale Belegung des Slots"}, - "description": "Tool or component installed in the slot.", - "description*": {"de": "Im Slot installiertes Werkzeug oder Komponente."}, - "defaultProperties": ["slot_occupant_type"], - "options": {"grid_columns": 12}, - "propertyOrder": 60, + "title": "Attribute", + "title*": {"de": "Attribut"}, + "headerTemplate": "{{i1}} - {{self.name}}", } - slot_occupant_type: Category | None = Field( + attribute_name: list[Label] = Field(..., min_items=1, title="Name") + quantity_prop: Quantity + + +class Constituent(OswBaseModel): + class Config: + schema_extra = { + "title": "Constituent", + "title*": {"de": "Bestandteil"}, + "headerTemplate": "{{i1}} - {{self.name}}", + } + + uuid: UUID = Field(default_factory=uuid4, options={"hidden": True}, title="UUID") + property: str | None = Field("Property:HasPart", options={"hidden": True}) + is_array: bool | None = Field(None, title="Is array") + name: str = Field(..., title="Name") + type: Material | None = Field( None, + field_comment="Material", options={ "autocomplete": { - "$comment": "Tool", - "query": "[[:$(slot_type)]]OR[[SubClassOf::$(slot_type)]]OR[[SubClassOf.SubClassOf::$(slot_type)]]OR[[SubClassOf.SubClassOf.SubClassOf::$(slot_type)]]OR[[SubClassOf.SubClassOf.SubClassOf.SubClassOf::$(slot_type)]]OR[[SubClassOf.SubClassOf.SubClassOf.SubClassOf.SubClassOf::$(slot_type)]]", + "$comment": "todo: we need an any-subcategory-of shortcut", + "query": "[[SubClassOf::Category:OSW31ca9a739cb24079b36824045c0832aa]]OR[[SubClassOf.SubClassOf::Category:OSW31ca9a739cb24079b36824045c0832aa]]OR[[SubClassOf.SubClassOf.SubClassOf::Category:OSW31ca9a739cb24079b36824045c0832aa]]OR[[SubClassOf.SubClassOf.SubClassOf.SubClassOf::Category:OSW31ca9a739cb24079b36824045c0832aa]]OR[[SubClassOf.SubClassOf.SubClassOf.SubClassOf.SubClassOf::Category:OSW31ca9a739cb24079b36824045c0832aa]]", } }, - propertyOrder=11, - range="Category:Category", + range="Category:OSW31ca9a739cb24079b36824045c0832aa", title="Type", - title_={"de": "Typ"}, - watch={"slot_type": "slot.slot_type_restriction"}, - ) - slot_occupant_instance_property: str | None = Field( - "Property:HasOccupant", options={"hidden": True} - ) - slot_occupant_instance: Tool | None = Field( - None, - options={ - "autocomplete": { - "query": "[[HasType::$(slot_occupant_type_)]]|?Display_title_of=label|?HasImage=image|?HasDescription=description" - } - }, - propertyOrder=21, - range="Category:OSWe427aafafbac4262955b9f690a83405d", - title="Instance", - title_={"de": "Instanz"}, - watch={"slot_occupant_type_": "slot_occupant.slot_occupant_type"}, x_oold_required_iri=True, ) + default: str | None = Field(None, title="Default value") -class Slot(OswBaseModel): +class OtherPhysicalItem(OswBaseModel): class Config: schema_extra = { - "title": "Slot", - "title*": {"de": "Slot"}, - "headerTemplate": "{{ i1 }} - {{ self.slot_id }}", - "defaultProperties": ["name", "description", "slot_occupant"], + "title": "Other physical Item", + "title*": {"de": "Anderer physischer Gegenstand"}, + "headerTemplate": "{{ i1 }}", + "defaultProperties": [], } uuid: str = Field( ..., dynamic_template="{{_uuid_}}", - field_comment="format uuid field are copied, if not set in copy_ignore", - field_format="uuid", - field_template="dynamic_template", - options={"hidden": True, "dynamic_template": {"override": "empty"}}, - title="UUID", - title_={"de": "UUID"}, - ) - slot_osw_id: str = Field( - ..., - dynamic_template="{{_current_subject_}}#OSW{{#replace '-' ''}}{{_own_uuid}}{{/replace}}", - field_comment="Will be used an unique reference for slot exchange events.", - field_format="dynamic_template", options={"hidden": True, "dynamic_template": {"override": "empty"}}, - readOnly=True, - title="OSW-ID", - title_={"de": "OSW-ID"}, - watch={"_own_uuid": "slot.uuid"}, - ) - slot_id: str = Field( - ..., - description_={"de": "Wird automatisch generiert"}, - dynamic_template="Slot{{patternformat '00' _array_index_}}", - field_comment="Will be used as a visual reference for the user", - options={ - "hidden": True, - "dynamic_template": {"override": "always"}, - "grid_columns": 6, - }, - propertyOrder=10, - readOnly=True, - title="ID", - title_={"de": "ID"}, - ) - """ - Automatically generated - """ - name: str | None = Field( - None, - options={"grid_columns": 6}, - propertyOrder=20, - title="Name", - title_={"de": "Name"}, - ) - description: list[Description] | None = Field( - None, - eval_template={ - "type": "mustache-wikitext", - "mode": "render", - "value": "{{=<% %>=}} {{#switch:{{USERLANGUAGECODE}} <%={{ }}=%> {{#description}} |{{lang}}={{text}} {{/description}} {{=<% %>=}} }}", - }, - options={"grid_columns": 12}, - propertyOrder=30, - title="Description", - title_={"de": "Beschreibung"}, - ) - slot_init_date_time: datetime = Field( - ..., - dynamic_template="{{_now_}}", - options={"dynamic_template": {"override": "empty"}, "grid_columns": 4}, - propertyOrder=21, - title="Date of slot initialization", - title_={"de": "Datum der Slot-Initialisierung"}, ) - slot_type_restriction: Category | None = Field( + origin_item_type: Category | None = Field( default_factory=lambda: Category.parse_obj( - "Category:OSWe427aafafbac4262955b9f690a83405d" + "Category:OSW37a57741ae2e4dd4b29b1172b6848be8" ), options={ "autocomplete": { "$comment": "Tool", - "query": "[[:Category:OSWe427aafafbac4262955b9f690a83405d]]OR[[SubClassOf::Category:OSWe427aafafbac4262955b9f690a83405d]]OR[[SubClassOf.SubClassOf::Category:OSWe427aafafbac4262955b9f690a83405d]]OR[[SubClassOf.SubClassOf.SubClassOf::Category:OSWe427aafafbac4262955b9f690a83405d]]OR[[SubClassOf.SubClassOf.SubClassOf.SubClassOf::Category:OSWe427aafafbac4262955b9f690a83405d]]OR[[SubClassOf.SubClassOf.SubClassOf.SubClassOf.SubClassOf::Category:OSWe427aafafbac4262955b9f690a83405d]]", - } + "query": "[[:Category:OSW37a57741ae2e4dd4b29b1172b6848be8]]OR[[SubClassOf::Category:OSW37a57741ae2e4dd4b29b1172b6848be8]]OR[[SubClassOf.SubClassOf::Category:OSW37a57741ae2e4dd4b29b1172b6848be8]]OR[[SubClassOf.SubClassOf.SubClassOf::Category:OSW37a57741ae2e4dd4b29b1172b6848be8]]OR[[SubClassOf.SubClassOf.SubClassOf.SubClassOf::Category:OSW37a57741ae2e4dd4b29b1172b6848be8]]OR[[SubClassOf.SubClassOf.SubClassOf.SubClassOf.SubClassOf::Category:OSW37a57741ae2e4dd4b29b1172b6848be8]]", + }, + "grid_columns": 12, }, - propertyOrder=50, + propertyOrder=40, range="Category:Category", - title="Type restriction of the slot", - title_={"de": "Typeinschränkung des Slots"}, - x_oold_required_iri=True, - ) - slot_occupant: InitialOccupantOfTheSlot | None = Field( - None, - defaultProperties=["slot_occupant_type"], - description_={"de": "Im Slot installiertes Werkzeug oder Komponente."}, - options={"grid_columns": 12}, - propertyOrder=60, - title="Initial occupant of the slot", - title_={"de": "Initiale Belegung des Slots"}, - ) - """ - Tool or component installed in the slot. - """ - - -class YearlyBudget(OswBaseModel): - class Config: - schema_extra = { - "title": "Yearly budget", - "title*": {"de": "Jahresbudget"}, - "defaultProperties": [ - "budget_year", - "yearly_budget_sum", - "budget_type", - "budget_ou", - ], - } - - uuid: UUID = Field(default_factory=uuid4, options={"hidden": True}, title="UUID") - budget_year: str | None = Field(None, title="Year", title_={"de": "Jahr"}) - yearly_budget_sum: YearlyBudgetSum | None = Field( - None, - options={"disable_collapse": True, "disable_properties": True, "compact": True}, - title="Yearly Budget Sum", - title_={"de": "Summe Jahresbudget"}, - ) - yearly_budget_sum_weighted: WeightedSum | None = Field( - None, - field_description="weighted with probability of successful funding", - field_description_={"de": "gewichtet mit Erfolgswahrscheinlichkeit"}, - options={"disable_collapse": True, "disable_properties": True, "compact": True}, - title="weighted sum", - title_={"de": "Gewichtete Summe"}, + title="Type", + title_={"de": "Typ"}, + x_oold_required_iri=True, ) - budget_start: date | None = Field(None, title="Start", title_={"de": "Beginn"}) - budget_end: date | None = Field(None, title="End", title_={"de": "Ende"}) - budget_ou: OrganizationalUnit | None = Field( - None, - range="Category:OSW3cb8cef2225e403092f098f99bc4c472", - title="OU", - title_={"en": "OU", "de": "OE"}, + origin_item_instance_property: str | None = Field( + "Property:HasOrigin", options={"hidden": True} ) - budget_type: BudgetType | None = Field( + origin_item_instance: PhysicalItem | None = Field( None, - range="Category:OSW595b282aedf048788f3ee326454792ce", - title="Type", - title_={"de": "Typ"}, + options={ + "autocomplete": { + "query": "[[HasType::$(origin_item_type_)]]|?Display_title_of=label|?HasImage=image|?HasDescription=description" + }, + "grid_columns": 12, + }, + propertyOrder=50, + range="Category:OSW37a57741ae2e4dd4b29b1172b6848be8", + title="Instance", + title_={"de": "Instanz"}, + watch={"origin_item_type_": "origin_item.origin_item_type"}, + x_oold_required_iri=True, ) -class Tool(Item): +class PhysicalItem(Item): """ - Item that participates as a utility (almost) unchanged in a process + Physical item as opposed to intangible item. It can posses properties such as position, geometry, weight, volume , etc. """ class Config: @@ -3649,534 +4043,366 @@ class Config: "@context": [ "/wiki/Category:Item?action=raw&slot=jsonschema", { - "components": { + "data_sheet": {"@id": "Property:HasDataSheet", "@type": "@id"}, + "instructions": {"@id": "Property:HasInstructions", "@type": "@id"}, + "manual": {"@id": "Property:HasManual", "@type": "@id"}, + "manufacturer": {"@id": "Property:HasManufacturer", "@type": "@id"}, + "origin": { "@id": "Property:HasStatement", "@type": "@id", "@context": { - "component_instance_property": { - "@id": "Property:HasProperty", - "@type": "@id", - }, - "component_instance": { - "@id": "Property:HasObject", - "@type": "@id", - }, + "origin_item_instance_property": "Property:HasProperty", + "origin_item_instance": "Property:HasObject", }, }, - "events": {"@id": "Property:HasEvent", "@type": "@id"}, - "purposes": {"@id": "Property:HasPurpose", "@type": "xsd:string"}, - "slots": { - "@id": "Property:HasSlot", + "quantity_statements": { + "@id": "Property:HasStatement", "@type": "@id", - "@context": { - "slot_osw_id": { - "@id": "Property:HasOswId", - "@type": "xsd:string", - }, - "slot_id": {"@id": "Property:HasId", "@type": "xsd:string"}, - "name": {"@id": "Property:HasName", "@type": "xsd:string"}, - "description": { - "@id": "Property:HasDescription", - "@type": "@id", - }, - "slot_init_date_time": { - "@id": "Property:HasInitDate", - "@type": "xsd:dateTime", - }, - "slot_occupant": { - "@id": "Property:HasStatement", - "@type": "@id", - "@context": { - "slot_occupant_instance_property": "Property:HasProperty", - "slot_occupant_instance": "Property:HasObject", - }, - }, - "slot_type_restriction": { - "@id": "Property:HasTypeRestriction", - "@type": "@id", - }, - }, }, - "typical_process": { - "@id": "Property:HasTypicalProcess", + "safety_data_sheet": { + "@id": "Property:HasSafetyDataSheet", "@type": "@id", }, + "serial_number": "Property:HasSerialNumber", + "type_no": "Property:HasTypeNumber", }, ], - "uuid": "e427aafa-fbac-4262-955b-9f690a83405d", - "title": "Tool", - "title*": {"en": "Tool", "de": "Werkzeug"}, - "description": "Item that participates as a utility (almost) unchanged in a process", + "uuid": "37a57741-ae2e-4dd4-b29b-1172b6848be8", + "title": "PhysicalItem", + "title*": {"en": "Physical Item", "de": "Physischer Gegenstand"}, + "description": "Physical item as opposed to intangible item. It can posses properties such as position, geometry, weight, volume , etc. ", "description*": { - "en": "Item that participates as a utility (almost) unchanged in a process", - "de": "Gegenstand der als Hilfsmittel (nahezu) unverändert in einem Prozess teilnimmt", + "en": "Physical item as opposed to intangible item. It can posses properties such as position, geometry, weight, volume , etc. ", + "de": "Physischer Gegenstand im Gegensatz zu immateriellen Gegenständen. Er kann Eigenschaften wie Position, Geometrie, Gewicht, Volumen usw. besitzen. ", }, - "defaultProperties": [], } - type: list[str] | None = ["Category:OSWe427aafafbac4262955b9f690a83405d"] - purposes: list[str] | None = Field( - None, - eval_template=[ - { - "type": "mustache-wikitext", - "mode": "render", - "value": "{{=<% %>=}} ", - } - ], - title="Purpose(s)", - title_={"de": "Zweck(e)"}, - ) - typical_process: list[Category] | None = Field( - None, - eval_template=[ - { - "type": "mustache-wikitext", - "mode": "render", - "value": "{{=<% %>=}} ", - } - ], - range="Category:Category", - title="Typical Process(es)", - title_={"de": "Typische(r) Prozess(e)"}, - ) - components: list[Component] | None = Field( + type: list[str] | None = ["Category:OSW37a57741ae2e4dd4b29b1172b6848be8"] + quantity_statements: list[Quantity] | None = Field( None, - description_={ - "de": "Komponenten sind dauerhafte Teile eines Werkzeugs (im Gegensatz zu Slots für austauschbare Teile)." - }, - eval_template=[ - { - "type": "mustache-wikitext", - "mode": "render", - "value": "{{=<% %>=}} ", - } - ], - options={ - "enable_array_copy": True, - "array_copy_ignore": ["uuid", "component_id", "attachments"], + eval_template={ + "type": "mustache-wikitext", + "mode": "render", + "value": "{{#quantity_statements}}.. {{#quantity}}[[{{quantity}}]]{{/quantity}} {{#value}}{{value}}{{/value}}
{{/quantity_statements}}", }, - title="Components", - title_={"de": "Komponenten"}, + title="Quantitative statement(s)", + title_={"de": "Quantitative Aussage(n)"}, ) - """ - Component are permanent parts of a tool (vs. Slots for exchangeable parts). - """ - slots: list[Slot] | None = Field( + origin: list[OtherPhysicalItem] | None = Field( None, description_={ - "de": "Slots stellen Plätze für austauschbare Teile oder Komponenten eines Werkzeugs dar (im Gegensatz zu Komponenten, die permanente Teile sind). Slot-Austauschereignisse können verwendet werden, um Änderungen an Slots zu dokumentieren. Dies ist die anfängliche Slot-Konfiguration!" + "de": "Andere(r) physische(r) Gegenstand/Gegenstände aus der dieser physische Gegenstand hergestellt wurde." }, eval_template=[ { "type": "mustache-wikitext", "mode": "render", - "value": "{{=<% %>=}} ", + "value": "{{=<% %>=}} ", } ], options={ "enable_array_copy": True, - "array_copy_ignore": ["uuid", "slot_osw_id", "slot_id", "attachments"], + "array_copy_ignore": ["uuid", "attachments"], }, - title="Slot configuration", - title_={"de": "Slot-Konfiguration"}, + title="Origin", + title_={"de": "Ursprung"}, ) """ - Slots represent spaces for exchangable parts or components of a tool (vs. Components, which are permanent parts). Slot exchange events can be used to document changes on slots. This is the initial slot configuration! + Other physical item(s) that this physical item was derived from. """ - events: list[Event] | None = Field( + type_no: str | None = Field( None, - range="Category:OSWb97757b46edb430591758662c18d354d", - title="Event(s)", - title_={"de": "Ereignis(se)"}, + description_={"de": "Typen- oder Modellnummer wie vom Hersteller angegeben"}, + title="Type number", + title_={"de": "Typennummer"}, ) - - -class Process(Item): - """ - Members of the Process Category describe the act of changing the state or properties of something """ - - class Config: - schema_extra = { - "@context": [ - "/wiki/Category:Item?action=raw&slot=jsonschema", - { - "type": {"@id": "Property:HasType", "@type": "@id"}, - "type*": {"@id": "Property:HasSchema", "@type": "@id"}, - "tool": {"@id": "Property:HasTool", "@type": "@id"}, - "input": {"@id": "Property:HasInput", "@type": "@id"}, - "location": {"@id": "Property:HasLocation", "@type": "@id"}, - "location_name": {"@id": "Property:HasLocation", "@type": "@id"}, - "output": {"@id": "Property:HasOutput", "@type": "@id"}, - "creator": {"@id": "Property:HasCreator", "@type": "@id"}, - "actionees": {"@id": "Property:HasActionee", "@type": "@id"}, - "projects": {"@id": "Property:HasProject", "@type": "@id"}, - "status": {"@id": "Property:HasStatus", "@type": "@id"}, - "start_date_time": { - "@id": "Property:HasStartDateAndTime", - "@type": "xsd:dateTime", - }, - "duration": {"@id": "Property:HasDuration"}, - "end_date_time": { - "@id": "Property:HasEndDateAndTime", - "@type": "xsd:dateTime", - }, - "subprocesses": {"@id": "Property:HasPart", "@type": "@id"}, - }, - ], - "title": "Process", - "title*": {"en": "Process", "de": "Prozess"}, - "uuid": "5a07d666-c55b-4ffa-89d4-9633c708029d", - "description": "Members of the Process Category describe the act of changing the state or properties of something", - "description*": { - "en": "Members of the Process Category describe the act of changing the state or properties of something", - "de": "Prozesse beschreiben den Akt des Änderns eines Zustandes oder der Eigenschaften von etwas.", - }, - "defaultProperties": [ - "actionees", - "start_date_time", - "tool", - "input", - "output", - ], - } - - type: list[str] | None = ["Category:OSWe5aa96bffb1c4d95be7fbd46142ad203"] - creator: Person | None = Field( - None, - range="Category:OSW44deaa5b806d41a2a88594f562b110e9", - title="Creator", - title_={"de": "Ersteller"}, - ) - actionees: list[Person] | None = Field( - None, - range="Category:OSW44deaa5b806d41a2a88594f562b110e9", - title="Actionees", - title_={"de": "Akteure"}, - ) - start_date_time: datetime | None = Field( - None, - field_comment='Note: To hide the time, you can set {"options": {"flatpickr": {"dateFormat": "Z", "altInput": true, "altFormat": "Y-m-d"}}}', - title="Start time", - title_={"de": "Startzeitpunkt"}, - ) - duration: timedelta | None = Field(None, title="Duration", title_={"de": "Dauer"}) - end_date_time: datetime | None = Field( - None, title="End time", title_={"de": "Endzeitpunkt"} - ) - location: Location | None = Field( - None, - range="Category:OSW3d238d05316e45a4ac95a11d7b24e36b", - title="Location", - title_={"de": "Ort"}, - ) - location_name: str | None = Field( + Type or model number as specified by the manufacturer + """ + manufacturer: str | None = Field( None, description_={ - "de": "Vorzugsweise sollte ein Ort aus dem Autocomplete-Feld 'Ort' ausgewählt oder erstellt werden." + "de": "Der Hersteller dieses Gegendstandes - eine Organisation(seinheit)" }, - title="Location (text)", - title_={"de": "Ort (Text)"}, + range="Category:OSW3cb8cef2225e403092f098f99bc4c472", + title="Manufacturer", + title_={"de": "Hersteller"}, ) """ - Its prefered to select or create a location from or in the autocomplete field 'Location'. + The manufacturer of this item - an organization(al unit). """ - status: Status | None = Field( + data_sheet: set[str] | None = Field( None, - field_format="autocomplete", - options={ - "_autocomplete": { - "category": "Category:OSW9725d7a91bab4f1aa68f423e4e9bfcf4" - }, - "enum_titles": ["To do", "In work", "Done"], - "enum_titles*": {"de": ["Zu tun", "In Arbeit", "Erledigt"]}, - "grid_columns": 6, + eval_template={ + "type": "mustache-wikitext", + "mode": "render", + "value": "{{=<% %>=}} <%={{ }}=%> {{#data_sheet}}[[:{{{.}}}]];{{/data_sheet}} {{=<% %>=}} <%={{ }}=%>", }, - title="Status", - ) - tool: list[Tool] | None = Field( - None, - options={"conditional_visible": {"modes": ["query", "default"]}}, - range="Category:OSWe427aafafbac4262955b9f690a83405d", - title="Tools", - title_={"de": "Werkzeuge"}, + title="Data sheet", + title_={"de": "Datenblatt"}, ) - input: list[Item] | None = Field( + safety_data_sheet: set[str] | None = Field( None, - options={"conditional_visible": {"modes": ["query", "default"]}}, - range="Category:Item", - title="Inputs", - title_={"de": "Eingangsressource (Input)"}, + eval_template={ + "type": "mustache-wikitext", + "mode": "render", + "value": "{{=<% %>=}} <%={{ }}=%> {{#safety_data_sheet}}[[:{{{.}}}]];{{/safety_data_sheet}} {{=<% %>=}} <%={{ }}=%>", + }, + title="Safety data sheet", + title_={"de": "Sicherheitsdatenblatt"}, ) - output: list[Item] | None = Field( + manual: set[str] | None = Field( None, - options={"conditional_visible": {"modes": ["query", "default"]}}, - range="Category:Item", - title="Outputs", - title_={"de": "Ausgangsressource (Output)"}, + description_={ + "de": "Handbuch, Gerauchsanweisung, Betriebs- oder Bedienungsanleitung mit Einzelheiten zur Verwendung dieses Gegenstands." + }, + eval_template={ + "type": "mustache-wikitext", + "mode": "render", + "value": "{{=<% %>=}} <%={{ }}=%> {{#manual}}[[:{{{.}}}]];{{/manual}} {{=<% %>=}} <%={{ }}=%>", + }, + title="Manual", + title_={"de": "Handbuch"}, ) - projects: list[Project] | None = Field( + """ + Comprehensive guide that details how to use this item. + """ + instructions: set[str] | None = Field( None, - options={"conditional_visible": {"modes": ["query", "default"]}}, - range="Category:OSWb2d7e6a2eff94c82b7f1f2699d5b0ee3", - title="Project(s)", - title_={"de": "Projekt(e)"}, + description_={ + "de": "Eine Liste auszuführenden Schritte, z. B. die Einrichtungsanweisungen." + }, + eval_template={ + "type": "mustache-wikitext", + "mode": "render", + "value": "{{=<% %>=}} <%={{ }}=%> {{#instructions}}[[:{{{.}}}]];{{/instructions}} {{=<% %>=}} <%={{ }}=%>", + }, + title="Instructions", + title_={"de": "Anleitung"}, ) - parameters: dict[str, Any] | None = Field(None, title="Parameters") + """ + A list of steps to be performed, e.g., the setup instructions. + """ -class Project(Item): +class PhysicalItemType(Category): """ - An enterprise (potentially individual but typically collaborative), planned to achieve a particular aim. + Helps to create subcategories of PhysicalItem """ class Config: schema_extra = { "@context": [ - "/wiki/Category:Item?action=raw&slot=jsonschema", + "/wiki/Category:Category?action=raw&slot=jsonschema", { - "abstract": {"@id": "Property:HasAbstract"}, - "budget_end": {"@id": "Property:HasBudgetEndDate"}, - "budget_ou": {"@id": "Property:HasBusinessUnit", "@type": "@id"}, - "budget_start": {"@id": "Property:HasBudgetStartDate"}, - "budget_type": {"@id": "Property:HasType", "@type": "@id"}, - "budget_year": {"@id": "Property:HasBudgetYear"}, - "end_date": {"@id": "Property:HasEndDate", "@type": "xsd:date"}, - "funding_type": {"@id": "Property:HasFundingType", "@type": "@id"}, - "funding_call": {"@id": "Property:HasFundingCall", "@type": "@id"}, - "funding": {"@id": "schema:funding", "@type": "@id"}, - "funding*": {"@id": "Property:HasFunding", "@type": "@id"}, - "funder": {"@id": "schema:funder", "@type": "@id"}, - "funder*": {"@id": "Property:HasFunder", "@type": "@id"}, - "member": {"@id": "schema:member", "@type": "@id"}, - "member*": {"@id": "Property:HasMember", "@type": "@id"}, - "member_of": {"@id": "schema:memberOf", "@type": "@id"}, - "member_of*": {"@id": "Property:IsMemberOf", "@type": "@id"}, - "other_documents": { - "@id": "Property:HasAdditionalDocument", + "constituents": { "@type": "@id", + "@id": "Property:HasStatement", + "@context": { + "property": "Property:HasProperty", + "type": "Property:HasValue", + }, }, - "ou": {"@id": "Property:HasBusinessUnit", "@type": "@id"}, - "project_manager": {"@id": "Property:HasManager", "@type": "@id"}, - "project_status": {"@id": "Property:HasStatus", "@type": "@id"}, - "project_type": {"@id": "Property:HasType", "@type": "@id"}, - "proposal": {"@id": "Property:HasProposal", "@type": "@id"}, - "report": {"@id": "Property:HasReport", "@type": "@id"}, - "start_date": {"@id": "Property:HasStartDate", "@type": "xsd:date"}, - "subjects": {"@id": "Property:HasTopic", "@type": "@id"}, - "total_budget": {"@id": "Property:HasStatement"}, - "year": {"@id": "Property:HasYear"}, - "yearly_budget": {"@id": "Property:HasBudgetPart", "@type": "@id"}, - "yearly_budget_sum": {"@id": "Property:HasStatement"}, - "yearly_budget_sum_weighted": {"@id": "Property:HasStatement"}, - "probability_of_successful_funding": { - "@id": "Property:HasStatement" + "data_sheet": {"@id": "Property:HasDataSheet", "@type": "@id"}, + "instructions": {"@id": "Property:HasInstructions", "@type": "@id"}, + "manual": {"@id": "Property:HasManual", "@type": "@id"}, + "manufacturer": {"@id": "Property:HasManufacturer", "@type": "@id"}, + "safety_data_sheet": { + "@id": "Property:HasSafetyDataSheet", + "@type": "@id", }, + "type_no": "Property:HasTypeNumber", }, ], - "uuid": "b2d7e6a2-eff9-4c82-b7f1-f2699d5b0ee3", - "title": "Project", - "title*": {"en": "Project", "de": "Projekt"}, - "description": "An enterprise (potentially individual but typically collaborative), planned to achieve a particular aim.", - "description*": { - "de": "Ein (möglicherweise individuelles, in der Regel aber gemeinschaftliches) Unternehmen oder Unternehmung, das auf ein bestimmtes Ziel ausgerichtet ist." - }, - "defaultProperties": [ - "subjects", - "project_status", - "funding_type", - "funding_call", - "funder", - "funding", - "funding_name", - "ou", - "project_manager", - "member", - "member_of", - "start_date", - "end_date", - "total_budget", - "proposal", - "abstract", + "uuid": "ca99a9bb-9ad2-4386-b222-d18a73c2af5e", + "title": "PhysicalItemType", + "title*": {"en": "Physical Item Type"}, + "description": "Helps to create subcategories of PhysicalItem", + "description*": {"en": "Helps to create subcategories of PhysicalItem"}, + "defaultPropertis": [ + "type_no", + "manufacturer", + "data_sheet", + "safety_data_sheet", + "supply", + "specifications", ], } - type: list[str] | None = ["Category:OSWb2d7e6a2eff94c82b7f1f2699d5b0ee3"] - subjects: list[str] | None = Field(None, title="Subjects", title_={"de": "Themen"}) - project_type: ProjectTypeDeprecated | None = Field( - "", - deprecated=True, - description_={"de": "Ersetzt mit Projekt- bzw. Förderart"}, - options={ - "enum_titles": ["House project", "Internal", "Public", "Industry"], - "enum_titles*": { - "de": ["Hausprojekt", "Intern", "Öffentlich", "Industrie"] - }, - }, - title="Project type (deprecated)", - title_={"de": "Projekttyp (veraltet)"}, + type: list[str] | None = ["Category:OSWca99a9bb9ad24386b222d18a73c2af5e"] + type_no: str | None = Field( + None, + description_={"de": "Typen- oder Modellnummer wie vom Hersteller angegeben"}, + title="Type number", + title_={"de": "Typennummer"}, ) """ - Replaced with Project / Funding Type + Type or model number as specified by the manufacturer """ - funding_type: ProjectType | None = Field( + manufacturer: str | None = Field( None, - range="Category:OSW67f2ef61ba284c919fefa00d0e95a7a0", - title="Project / Funding Type", - title_={"de": "Projekt- bzw. Förderart"}, - ) - project_status: ProjectStatus | None = Field( - default_factory=lambda: ProjectStatus.parse_obj( - "Item:OSW55a9a9bda7b248759e48ae2e3ed6df1d" - ), - range="Category:OSW490e38f9764f4408a244869a0ea98e7c", - title="Project status", - title_={"de": "Projektstatus"}, + description_={ + "de": "Der Hersteller dieses Gegendstandes - eine Organisation(seinheit)" + }, + range="Category:OSW3cb8cef2225e403092f098f99bc4c472", + title="Manufacturer", + title_={"de": "Hersteller"}, ) - funding_call: str | None = Field( + """ + The manufacturer of this item - an organization(al unit). + """ + data_sheet: set[str] | None = Field( None, - options={ - "autocomplete": {"category": "Category:OSWd22af0aa3b00462a9da9b509538e8926"} + eval_template={ + "type": "mustache-wikitext", + "mode": "render", + "value": "{{=<% %>=}} <%={{ }}=%> {{#data_sheet}}[[:{{{.}}}]];{{/data_sheet}} {{=<% %>=}} <%={{ }}=%>", }, - title="Funding call", - title_={"de": "Förderaufruf"}, + title="Data sheet", + title_={"de": "Datenblatt"}, ) - funder: str | None = Field( + safety_data_sheet: set[str] | None = Field( None, - category="Category:OSW3cb8cef2225e403092f098f99bc4c472", - title="Funder", - title_={"de": "Förder- bzw. Auftragsgeber"}, + eval_template={ + "type": "mustache-wikitext", + "mode": "render", + "value": "{{=<% %>=}} <%={{ }}=%> {{#safety_data_sheet}}[[:{{{.}}}]];{{/safety_data_sheet}} {{=<% %>=}} <%={{ }}=%>", + }, + title="Safety data sheet", + title_={"de": "Sicherheitsdatenblatt"}, ) - funding: str | None = Field( + instructions: set[str] | None = Field( None, - description_={"de": "Förderung oder Vertrag"}, - options={ - "autocomplete": {"category": "Category:OSWbe80b28aefd64921ba2e8e2d6225416e"} + description_={ + "de": "Eine Liste auszuführenden Schritte, z. B. die Einrichtungsanweisungen." + }, + eval_template={ + "type": "mustache-wikitext", + "mode": "render", + "value": "{{=<% %>=}} <%={{ }}=%> {{#instructions}}[[:{{{.}}}]];{{/instructions}} {{=<% %>=}} <%={{ }}=%>", }, - title="Funding", - title_={"de": "Förderung"}, + title="Instructions", + title_={"de": "Anleitung"}, ) """ - Grant or contract + A list of steps to be performed, e.g., the setup instructions. """ - funding_name: str | None = Field( + manual: set[str] | None = Field( None, description_={ - "de": "Förderung oder Vertrag. Verwenden Sie diese Eigenschaft, um einen Text einzugeben, wenn Sie keine neue Instanz von Grant erstellen möchten." + "de": "Handbuch, Gerauchsanweisung, Betriebs- oder Bedienungsanleitung mit Einzelheiten zur Verwendung dieses Gegenstands." }, - title="Funding (name)", - title_={"de": "Förderung (Name)"}, + eval_template={ + "type": "mustache-wikitext", + "mode": "render", + "value": "{{=<% %>=}} <%={{ }}=%> {{#manual}}[[:{{{.}}}]];{{/manual}} {{=<% %>=}} <%={{ }}=%>", + }, + title="Manual", + title_={"de": "Handbuch"}, ) """ - Grant or contract. Use this property to enter a text if you don't want to create a new instance of grant. + Comprehensive guide that details how to use this item. """ - probability_of_successful_funding: ( - ProbabilityOfSuccessfulFundingInPercent | None - ) = Field( + supply: list[Supply] | None = Field( None, description_={ - "de": "Gibt die Wahrscheinlichkeit an, dass die Förderung genehmigt wird, bestimmt das gewichtete Budget" + "de": "Bezugsmöglichkeit des Materials mit Lieferant, Artikelnummer und Link" }, - title="Probability of Successful Funding in percent", - title_={"de": "Wahrscheinlichkeit einer erfolgreichen Förderung in Prozent"}, + title="Supply", + title_={"de": "Bezugsmöglichkeit"}, ) """ - Indicates the likelihood that the funding will be approved, determines the weighted budget + Supply of the material with supplier, article no. and link """ - ou: list[str] | None = Field( + specifications: list[Attribute] | None = Field( None, - description_={"de": "Organisationseinheit (OE), die das Projekt durchführt"}, - title="OU", - title_={"en": "OU", "de": "OE"}, + title="Specification of technical properties", + title_={"de": "Spezifikation technischer Eigenschaften"}, + ) + constituents: list[Constituent] | None = Field( + None, title="Constituents", title_={"de": "Bestandteile"} ) """ - Organizational Unit (OU), which carries out the project + Components or parts """ - project_manager: list[str] | None = Field( - None, - title="Project Manager", - title_={"en": "Project Manager", "de": "Projektleiter*in"}, - ) - member: list[str] | None = Field( - None, title="Member", title_={"en": "Member", "de": "Mitglieder*innen"} - ) - member_of: list[str] | None = Field( - None, - description_={ - "de": "Organisationseinheit(en), zu der das Projekt gehört, z. B. ein Projektcluster" - }, - title="Member of", - title_={"en": "Member of ", "de": "Mitglied von"}, - ) + + +class Material(PhysicalItem): """ - Organizational unit(s), the project is a member of, e.g. a project cluster + Contains chemical substances and engineered matterials / parts """ - start_date: date | None = Field( - None, options={"flatpicker": {}}, title="Start", title_={"de": "Beginn"} - ) - end_date: date | None = Field( - None, options={"flatpicker": {}}, title="End", title_={"de": "Ende"} - ) - total_budget: TotalBudget | None = Field( - None, title="Total Budget", title_={"de": "Budgetsumme"} - ) - yearly_budget: list[YearlyBudget] | None = Field( - None, - options={"disable_array_reorder": False, "enable_array_copy": True}, - title="Yearly budget", - title_={"de": "Jahresbudget"}, - ) - proposal: str | None = Field( - None, - links=[ - { - "href": "{{#if self}}/w/index.php?title=Special:Redirect/file/{{self}}&width=200&height=200{{/if}}", - "mediaType": "image", - }, - { - "href": "{{#if self}}/w/index.php?title=Special:Redirect/file/{{self}}{{/if}}", - "rel": "{{#if self}}download{{/if}}", - "download": True, - }, - ], - options={"upload": {}}, - title="Proposal", - title_={"de": "Antrag"}, - ) - report: str | None = Field( - None, - links=[ - { - "href": "{{#if self}}/w/index.php?title=Special:Redirect/file/{{self}}&width=200&height=200{{/if}}", - "mediaType": "image", - }, - { - "href": "{{#if self}}/w/index.php?title=Special:Redirect/file/{{self}}{{/if}}", - "rel": "{{#if self}}download{{/if}}", - "download": True, + + class Config: + schema_extra = { + "@context": [ + "/wiki/Category:OSW37a57741ae2e4dd4b29b1172b6848be8?action=raw&slot=jsonschema" + ], + "uuid": "31ca9a73-9cb2-4079-b368-24045c0832aa", + "title": "Material", + "title*": {"en": "Material", "de": "Material"}, + "description": "Contains chemical substances and engineered matterials / parts", + "description*": { + "en": "Contains chemical substances and engineered matterials / parts", + "de": "Enthält chemische Stoffe, Materialien und Bauteile", }, - ], - options={"upload": {}}, - title="Report", - title_={"de": "Bericht"}, + } + + type: list[str] | None = ["Category:OSW31ca9a739cb24079b36824045c0832aa"] + + +class DeviceType(PhysicalItemType): + """ + Helps Creating DeviceCategories + """ + + class Config: + schema_extra = { + "@context": [ + "/wiki/Category:OSWca99a9bb9ad24386b222d18a73c2af5e?action=raw&slot=jsonschema", + { + "purpose": {"@id": "Property:HasPurpose", "@type": "@id"}, + "typical_processes": { + "@id": "Property:HasTypicalProcess", + "@type": "@id", + }, + }, + ], + "uuid": "d845b968-13a3-4445-8f14-0e48c4d063fd", + "title": "DeviceType", + "title*": {"en": "Device Type"}, + "description": "Helps Creating DeviceCategories", + "description*": {"en": "Helps Creating DeviceCategories"}, + "defaultProperties": ["manufacturer", "typical_processes", "manual"], + } + + type: list[str] | None = ["Category:OSWd845b96813a344458f140e48c4d063fd"] + typical_processes: list[str] | None = Field( + None, title="Typical Processes", title_={"de": "Typische Prozesse"} ) - other_documents: list[str] | None = Field( + manufacturer_type_id: str | None = Field( None, - title="Additional documents", - title_={"en": "Additional documents", "de": "Sonstige Dokumente"}, + description_={"de": "Produkt-ID des Herstellers."}, + title="Manufacturer Type ID", + title_={"de": "Hersteller Typen-ID"}, ) - abstract: list[Description] | None = Field( + """ + Product ID provided by the manufacturer + """ + manufacturer_type_name: str | None = Field( None, - eval_template={ - "type": "mustache-wikitext", - "mode": "render", - "$comment": "Displays value according to user language with eng as fallback option. Note: {{=<% %>=}} changes mustache expression from {{..}} to <% %> for mixing with wikitext templates", - "value": "{{=<% %>=}} {{#switch:{{USERLANGUAGECODE}} <%#abstract%> | {{#ifeq: <%lang%>|en|#default|<%lang%>}} = <%text%> <%/abstract%> }}", + description_={ + "de": "Produktname des Herstellers. Oftmals ein einfacherer Alias neben der Typen-ID" }, - title="Abstract", - title_={"de": "Kurzbeschreibung"}, + title="Manufacturer Type Name", + title_={"de": "Hersteller Typenbezeichnung"}, ) + """ + Product name provided by the manufacturer. Often more human friendly than the type id. + """ + + +# generated by datamodel-codegen: +# filename: OSWf0fe562f422d49c6877490b3dfee2f3f.json class Device(Tool, PhysicalItem): @@ -4393,45 +4619,6 @@ class Config: """ -class ProjectType(Enumeration): - class Config: - schema_extra = { - "@context": [ - "/wiki/Category:OSWd02741381aaa4709ae0753a0edc341ce?action=raw&slot=jsonschema" - ], - "uuid": "67f2ef61-ba28-4c91-9fef-a00d0e95a7a0", - "title": "ProjectType", - "title*": {"en": "Project Type", "de": "Projekttyp"}, - "description": "", - "description*": {}, - } - - type: list[str] | None = ["Category:OSW67f2ef61ba284c919fefa00d0e95a7a0"] - - -class BudgetType(Enumeration): - """ - Type of usage of a certain budget - """ - - class Config: - schema_extra = { - "@context": [ - "/wiki/Category:OSWd02741381aaa4709ae0753a0edc341ce?action=raw&slot=jsonschema" - ], - "uuid": "595b282a-edf0-4878-8f3e-e326454792ce", - "title": "BudgetType", - "title*": {"en": "Budget Type", "de": "Budget-Typ"}, - "description": "Type of usage of a certain budget", - "description*": { - "en": "Type of usage of a certain budget", - "de": "Art der Verwendung eines bestimmten Budgets", - }, - } - - type: list[str] | None = ["Category:OSW595b282aedf048788f3ee326454792ce"] - - class Group(OrganizationalSubUnit): class Config: schema_extra = { @@ -4474,32 +4661,6 @@ class Config: type: list[str] | None = ["Category:OSW1a271f289649413488e2841580e43a45"] -class ProjectStatus(StatusEnumeration): - """ - Status for projects and project applications - """ - - class Config: - schema_extra = { - "@context": [ - "/wiki/Category:OSW2c32802be59040248c85eda3479d484c?action=raw&slot=jsonschema" - ], - "uuid": "490e38f9-764f-4408-a244-869a0ea98e7c", - "title": "ProjectStatus", - "title*": { - "en": "Project (Application) Status", - "de": "Projekt(antrags)status", - }, - "description": "Status for projects and project applications", - "description*": { - "en": "Status for projects and project applications", - "de": "Status für Projekte und Projektanträge", - }, - } - - type: list[str] | None = ["Category:OSW490e38f9764f4408a244869a0ea98e7c"] - - class RiskAssessmentProcess(AdministrativeProcess): class Config: schema_extra = { @@ -7153,6 +7314,7 @@ class Config: Device.update_forward_refs() DeviceType.update_forward_refs() DigitalDocument.update_forward_refs() +Distribution.update_forward_refs() EducationalOrganization.update_forward_refs() EmploymentStatus.update_forward_refs() Event.update_forward_refs() diff --git a/src/opensemantic/base/view/__init__.py b/src/opensemantic/base/view/__init__.py index 76ca2c6..7ee17ab 100644 --- a/src/opensemantic/base/view/__init__.py +++ b/src/opensemantic/base/view/__init__.py @@ -1,5 +1,9 @@ """DataTool view UI components.""" +from opensemantic.base.view._base_view import ( + COLORS, + BaseDataView, +) from opensemantic.base.view._channel_utils import ( build_tree_source, flatten_composite_channels, @@ -39,6 +43,8 @@ ) __all__ = [ + "BaseDataView", + "COLORS", "DataToolView", "ProcessObjectView", "BaseViewConfig", diff --git a/src/opensemantic/base/view/_base_view.py b/src/opensemantic/base/view/_base_view.py index 35cb530..cbe23df 100644 --- a/src/opensemantic/base/view/_base_view.py +++ b/src/opensemantic/base/view/_base_view.py @@ -210,24 +210,14 @@ def _dequantify(df): Produces a two-level column header ``(label, unit)`` so a dedicated unit header row is written on export and the column keys stay unit-free. Pint - columns contribute their magnitude and unit; plain (text) columns keep their - values under an empty unit. + columns contribute their magnitude and unit; plain (text) columns keep + their values under an empty unit. + + Shared with the dataset controller, which reads this form back. """ - import pandas as pd - - tuples = [] - mags = [] - for name in df.columns: - s = df[name] - if str(s.dtype).startswith("pint"): - tuples.append((str(name), str(s.pint.units))) - mags.append(s.pint.magnitude) - else: - tuples.append((str(name), "")) - mags.append(s) - out = pd.concat(mags, axis=1) - out.columns = pd.MultiIndex.from_tuples(tuples, names=[None, "unit"]) - return out + from opensemantic.base._pint_csv import dequantify + + return dequantify(df) class BaseDataView: diff --git a/tests/test_dataset_controller.py b/tests/test_dataset_controller.py new file mode 100644 index 0000000..7996b94 --- /dev/null +++ b/tests/test_dataset_controller.py @@ -0,0 +1,529 @@ +"""Tests for ``DatasetControllerMixin`` itself. + +The externalization test next door models the same workflow by hand, so the +controller that downstream packages actually call had no test of its own. This +drives it directly, on both pydantic versions: rows to a frame and back, the +JSON and CSV files a distribution points at, and the failure paths. +""" + +import io +import json +from types import SimpleNamespace +from typing import List, Optional + +import pytest + +import opensemantic.base +import opensemantic.base.v1 +import opensemantic.core +import opensemantic.core.v1 +from opensemantic.base._dataset_controller_mixin import ( + _declared_unit, + _file_url, + _unwrap, + row_class_of, +) + + +def _modules(version): + if version == "v1": + return opensemantic.base.v1, opensemantic.core.v1 + return opensemantic.base, opensemantic.core + + +def _quantities(version): + if version == "v1": + from opensemantic.characteristics.quantitative.v1 import ( + QuantityValue, + Temperature, + Time, + ) + else: + from opensemantic.characteristics.quantitative import ( + QuantityValue, + Temperature, + Time, + ) + return QuantityValue, Temperature, Time + + +def _row_base(version): + if version == "v1": + from pydantic.v1 import BaseModel + else: + from pydantic import BaseModel + return BaseModel + + +@pytest.fixture(params=["v2", "v1"]) +def ctx(request): + """The models of one pydantic version, plus a dataset built on them.""" + version = request.param + base_mod, core_mod = _modules(version) + quantity_value, temperature_cls, time_cls = _quantities(version) + row_base = _row_base(version) + + class Row(row_base): + time: Optional[time_cls] = None + temperature: Optional[temperature_cls] = None + + class TempDataset(base_mod.Dataset): + data: Optional[List[Row]] = None + + return SimpleNamespace( + version=version, + base=base_mod, + core=core_mod, + QuantityValue=quantity_value, + Temperature=temperature_cls, + Time=time_cls, + row_base=row_base, + Row=Row, + cls=TempDataset, + ) + + +@pytest.fixture +def dataset(ctx): + return ctx.cls( + label=[ctx.core.Label(text="Cell 42")], + data=[ + ctx.Row(time=ctx.Time(value=0.0), temperature=ctx.Temperature(value=300.0)), + ctx.Row( + time=ctx.Time(value=60.0), temperature=ctx.Temperature(value=301.5) + ), + ], + ) + + +def _in_grams(ctx, magnitude): + """A QuantityValue in a unit the model does not declare as its default.""" + import pint + + quantity = pint.get_application_registry().Quantity(magnitude, "gram") + return ctx.QuantityValue.from_pint(quantity, quantity_type=ctx.QuantityValue) + + +def _local_file(ctx, path): + return ctx.core.LocalFile( + label=[ctx.core.Label(text=path.name)], local_path=str(path) + ) + + +# -- frame conversions -------------------------------------------------------- + + +def test_to_df_carries_the_declared_unit(dataset): + df = dataset.to_df() + assert list(df.columns) == ["time", "temperature"] + assert str(df["temperature"].pint.units) == "kelvin" + assert df["temperature"].pint.magnitude.tolist() == [300.0, 301.5] + + +def test_from_df_round_trips_the_rows(dataset): + restored = type(dataset).from_df(dataset.to_df(), label=dataset.label) + assert len(restored.data) == 2 + assert restored.data[1].temperature.to_pint().magnitude == pytest.approx(301.5) + + +def test_from_df_keeps_a_unit_the_model_does_not_declare(ctx): + """``QuantityValue`` has no default unit, so the column's unit must travel.""" + + quantity_value = ctx.QuantityValue + + class GenericRow(ctx.row_base): + reading: Optional[quantity_value] = None + + class GenericDataset(ctx.base.Dataset): + data: Optional[List[GenericRow]] = None + + source = GenericDataset( + label=[ctx.core.Label(text="Generic")], + data=[GenericRow(reading=_in_grams(ctx, 5.0))], + ) + df = source.to_df() + assert str(df["reading"].pint.units) == "gram" + + restored = GenericDataset.from_df(df, label=source.label) + + assert restored.data[0].reading.to_pint().to("gram").magnitude == pytest.approx(5.0) + + +def test_from_df_ignores_unknown_columns(dataset): + df = dataset.to_df() + df["not_a_field"] = [1, 2] + restored = type(dataset).from_df(df, label=dataset.label) + assert len(restored.data) == 2 + + +def test_from_df_reports_a_column_it_cannot_build(dataset): + import pandas as pd + + df = pd.DataFrame({"temperature": ["warm", "cold"]}) + with pytest.raises(TypeError, match="temperature"): + type(dataset).from_df(df, label=dataset.label) + + +def test_to_df_without_a_row_model(): + plain = opensemantic.base.Dataset(label=[opensemantic.core.Label(text="Plain")]) + with pytest.raises(TypeError, match="no row model"): + plain.to_df() + + +# -- serialization ------------------------------------------------------------ + + +def test_serialize_data_json(dataset): + entries = json.loads(dataset.serialize_data("json").decode("utf-8")) + assert len(entries) == 2 + assert entries[0]["temperature"]["value"] == 300.0 + + +def test_serialize_data_csv_has_a_unit_header(dataset): + header = dataset.serialize_data("csv").decode("utf-8").splitlines()[:2] + assert "temperature" in header[0] + assert "kelvin" in header[1] + + +def test_serialize_data_rejects_an_unknown_format(dataset): + with pytest.raises(ValueError, match="Unsupported format"): + dataset.serialize_data("parquet") + + +# -- distributions ------------------------------------------------------------ + + +@pytest.mark.parametrize("fmt", ["json", "csv"]) +def test_externalize_then_materialize(ctx, dataset, fmt, tmp_path): + target = tmp_path / f"rows.{fmt}" + expected = [row.temperature.to_pint() for row in dataset.data] + + distribution = dataset.externalize_data(_local_file(ctx, target), fmt=fmt) + + assert dataset.data is None + assert target.exists() + assert distribution.byte_size == target.stat().st_size + assert distribution.media_type == ( + "text/csv" if fmt == "csv" else "application/json" + ) + + rows = dataset.materialize_data() + + assert len(rows) == 2 + for row, want in zip(rows, expected): + assert row.temperature.to_pint().to(want.units).magnitude == pytest.approx( + want.magnitude + ) + + +def test_externalize_can_keep_the_inline_rows(ctx, dataset, tmp_path): + dataset.externalize_data(_local_file(ctx, tmp_path / "rows.json"), keep_data=True) + assert dataset.data is not None + + +def test_externalize_rejects_a_file_without_a_controller(ctx, dataset): + plain = ctx.core.File(label=[ctx.core.Label(text="No content access")]) + with pytest.raises(ValueError, match="No file controller"): + dataset.externalize_data(plain) + + +def test_materialize_skips_a_distribution_it_cannot_read( + ctx, dataset, tmp_path, caplog +): + """The docstring promises the next distribution is tried.""" + dataset.externalize_data(_local_file(ctx, tmp_path / "rows.json"), keep_data=True) + broken = ctx.base.Distribution( + file=_local_file(ctx, tmp_path / "missing.json"), + media_type="application/json", + ) + dataset.distributions = [broken] + list(dataset.distributions) + dataset.data = None + + rows = dataset.materialize_data() + + assert len(rows) == 2 + assert "could not be read" in caplog.text + + +def test_materialize_without_a_readable_distribution(dataset): + dataset.distributions = None + with pytest.raises(ValueError, match="no distribution"): + dataset.materialize_data() + + +def test_materialize_from_a_url_distribution(ctx, dataset, monkeypatch): + """A distribution that carries only a URL resolves on the dataset's layer.""" + payload = dataset.serialize_data("json") + + class _Response(io.BytesIO): + def __enter__(self): + return self + + def __exit__(self, *exc): + self.close() + return False + + monkeypatch.setattr( + "urllib.request.urlopen", lambda *a, **k: _Response(payload), raising=True + ) + + dataset.distributions = [ + ctx.base.Distribution( + download_url="https://example.org/rows.json", + media_type="application/json", + ) + ] + dataset.data = None + + assert len(dataset.materialize_data()) == 2 + + +# -- helpers ------------------------------------------------------------------ + + +def test_unwrap_keeps_a_union_of_several_members(): + from typing import Dict, Union + + assert _unwrap(Optional[List[int]]) is int + assert _unwrap(Optional[Dict[str, float]]) is float + assert _unwrap(Optional[Union[int, str]]) == Optional[Union[int, str]] + + +def test_declared_unit_of_a_field_that_is_not_a_model(): + from datetime import datetime + + class Row(_row_base("v2")): + stamp: Optional[datetime] = None + name: Optional[str] = None + + assert _declared_unit(Row, "stamp") is None + assert _declared_unit(Row, "name") is None + + +def test_row_class_of_a_dataset_without_rows(): + assert row_class_of(opensemantic.base.Dataset) is None + + +def test_file_url_reports_an_unreadable_attribute(caplog): + import logging + + class Broken: + @property + def download_url(self): + raise OSError("not connected") + + url = "https://example.org/a.bin" + + with caplog.at_level( + logging.INFO, logger="opensemantic.base._dataset_controller_mixin" + ): + assert _file_url(Broken()) == "https://example.org/a.bin" + assert "not readable" in caplog.text + + +# -- rows that are not quantities --------------------------------------------- + + +@pytest.fixture +def mixed_ctx(ctx): + """A dataset whose rows mix a quantity with plain fields.""" + from datetime import datetime + + temperature_cls = ctx.Temperature + + class MixedRow(ctx.row_base): + temperature: Optional[temperature_cls] = None + stamp: Optional[datetime] = None + note: Optional[str] = None + cycle: Optional[int] = None + + class MixedDataset(ctx.base.Dataset): + data: Optional[List[MixedRow]] = None + + ctx.MixedRow = MixedRow + ctx.MixedController = MixedDataset + return ctx + + +def _mixed_dataset(ctx): + from datetime import datetime + + return ctx.MixedController( + label=[ctx.core.Label(text="Mixed")], + data=[ + ctx.MixedRow( + temperature=ctx.Temperature(value=300.0), + stamp=datetime(2026, 1, 1, 12, 0, 0), + note="start", + cycle=1, + ), + ctx.MixedRow( + temperature=ctx.Temperature(value=301.0), + stamp=datetime(2026, 1, 1, 12, 1, 0), + note="end", + cycle=2, + ), + ], + ) + + +def test_from_df_keeps_a_field_that_is_not_a_quantity(mixed_ctx): + dataset = _mixed_dataset(mixed_ctx) + + restored = type(dataset).from_df(dataset.to_df(), label=dataset.label) + + assert restored.data[0].note == "start" + assert restored.data[1].stamp == dataset.data[1].stamp + + +@pytest.mark.parametrize("fmt", ["json", "csv"]) +def test_mixed_rows_survive_a_file_round_trip(mixed_ctx, fmt, tmp_path): + dataset = _mixed_dataset(mixed_ctx) + target = tmp_path / f"mixed.{fmt}" + + dataset.externalize_data(_local_file(mixed_ctx, target), fmt=fmt) + rows = dataset.materialize_data() + + assert [row.note for row in rows] == ["start", "end"] + assert [row.cycle for row in rows] == [1, 2] + assert rows[0].temperature.to_pint().magnitude == pytest.approx(300.0) + + +def test_serialize_data_json_keeps_a_datetime(mixed_ctx): + dataset = _mixed_dataset(mixed_ctx) + + entries = json.loads(dataset.serialize_data("json").decode("utf-8")) + + assert entries[0]["stamp"].startswith("2026-01-01") + + +# -- failures are reported with their cause ----------------------------------- + + +def test_materialize_names_the_column_it_could_not_build(ctx, dataset, tmp_path): + """The TypeError from from_df must not be hidden behind 'no readable file'.""" + target = tmp_path / "broken.csv" + dataset.externalize_data(_local_file(ctx, target), fmt="csv") + target.write_text("temperature\nkelvin\n0,warm\n", encoding="utf-8") + + with pytest.raises(ValueError, match="no distribution") as caught: + dataset.materialize_data() + + assert caught.value.__cause__ is not None + + +def test_materialize_without_a_row_model(): + plain = opensemantic.base.Dataset(label=[opensemantic.core.Label(text="Plain")]) + with pytest.raises(TypeError, match="no row model"): + plain.materialize_data() + + +def test_materialize_passes_controller_kwargs_on(ctx, dataset, tmp_path, monkeypatch): + """The session a wiki file needs travels with the call.""" + seen = {} + import opensemantic.base._dataset_controller_mixin as module + + original = module.get_file_controller + + def _spy(file, **kwargs): + seen.update(kwargs) + return original(file, **kwargs) + + monkeypatch.setattr(module, "get_file_controller", _spy) + dataset.externalize_data(_local_file(ctx, tmp_path / "rows.json")) + + dataset.materialize_data(osw="SESSION") + + assert seen.get("osw") == "SESSION" + + +def test_unwrap_sees_through_an_annotated_type(): + from typing import Annotated + + assert _unwrap(Optional[Annotated[int, "metres"]]) is int + + +def test_file_url_survives_a_property_that_raises_anything(caplog): + class Broken: + @property + def download_url(self): + raise RuntimeError("the wiki said no") + + url = None + access_url = None + + assert _file_url(Broken()) is None + assert "the wiki said no" in caplog.text + + +# -- a table with no quantity column at all ----------------------------------- + + +@pytest.fixture +def plain_ctx(ctx): + """A dataset whose rows carry only str and int, no quantity.""" + + class AddressRow(ctx.row_base): + ID: Optional[int] = None + city: Optional[str] = None + state: Optional[str] = None + + class AddressDataset(ctx.base.Dataset): + data: Optional[List[AddressRow]] = None + + ctx.AddressRow = AddressRow + ctx.AddressController = AddressDataset + return ctx + + +def _addresses(ctx): + return ctx.AddressController( + label=[ctx.core.Label(text="Addresses")], + data=[ + ctx.AddressRow(ID=18, city="Cambridge", state="MA"), + ctx.AddressRow(ID=19, city="Boston", state="MA"), + ], + ) + + +def test_csv_of_a_table_without_units(plain_ctx): + """pint-pandas refuses a frame with no unit column; the dataset must not.""" + dataset = _addresses(plain_ctx) + + text = dataset.serialize_data("csv").decode("utf-8") + + lines = text.splitlines() + assert lines[0].split(",")[1:] == ["ID", "city", "state"] + assert lines[1] == "unit,,," + assert lines[2].endswith("18,Cambridge,MA") + + +@pytest.mark.parametrize("fmt", ["json", "csv"]) +def test_a_table_without_units_round_trips(plain_ctx, fmt, tmp_path): + dataset = _addresses(plain_ctx) + + dataset.externalize_data(_local_file(plain_ctx, tmp_path / f"a.{fmt}"), fmt=fmt) + rows = dataset.materialize_data() + + assert [(row.ID, row.city, row.state) for row in rows] == [ + (18, "Cambridge", "MA"), + (19, "Boston", "MA"), + ] + + +def test_a_foreign_csv_is_read_with_one_header_row(plain_ctx, tmp_path): + """A CSV from anywhere else has no unit row, and must not lose a data row.""" + target = tmp_path / "foreign.csv" + target.write_text("ID,city,state\n18,Cambridge,MA\n", encoding="utf-8") + dataset = plain_ctx.AddressController( + label=[plain_ctx.core.Label(text="Addresses")], + distributions=[ + plain_ctx.base.Distribution( + file=_local_file(plain_ctx, target), media_type="text/csv" + ) + ], + ) + + rows = dataset.materialize_data() + + assert [(row.ID, row.city) for row in rows] == [(18, "Cambridge")] diff --git a/tests/test_dataset_data_externalization.py b/tests/test_dataset_data_externalization.py new file mode 100644 index 0000000..2cfa655 --- /dev/null +++ b/tests/test_dataset_data_externalization.py @@ -0,0 +1,192 @@ +"""Externalize a Dataset's inline ``data`` payload into a file and back. + +Follows the data-bundling principle of +https://github.com/OO-LD/oold-schema/issues/109: the same logical content is +either carried inline on the dataset (mode A) or materialized into a file that +a ``Distribution`` describes (mode C). Converting between the two is lossless, +so a payload that is uploaded and later read back is unchanged. + +``Dataset.data`` is typed by its schema ("the type of data IS the schema"), so +the generic ``Dataset`` does not accept an arbitrary payload; a dataset that +carries one narrows the field in a subclass, here to a plain dict. +""" + +import json +from pathlib import Path +from typing import Optional + +import pytest + +import opensemantic.base +import opensemantic.base.v1 +import opensemantic.core +import opensemantic.core.v1 + +PAYLOAD = { + "rows": [ + {"test_time": {"value": 0.1}, "voltage": {"value": 3.7}}, + {"test_time": {"value": 0.2}, "voltage": {"value": 3.6}}, + ], + "meta": {"cell": "cell42"}, +} + +MEDIA_TYPE = "application/json" + +MODULES = [ + pytest.param(opensemantic.base, opensemantic.core, id="v2"), + pytest.param(opensemantic.base.v1, opensemantic.core.v1, id="v1"), +] + + +def _rows_dataset_cls(base_mod): + """A Dataset whose schema narrows ``data`` to a dict payload.""" + + class RowsDataset(base_mod.Dataset): + data: Optional[dict] = None + + return RowsDataset + + +def _dump(model) -> str: + return ( + model.model_dump_json() + if hasattr(model, "model_dump_json") + else model.json() # pydantic v1 + ) + + +def _load(cls, raw: str): + return ( + cls.model_validate_json(raw) + if hasattr(cls, "model_validate_json") + else cls.parse_raw(raw) # pydantic v1 + ) + + +def _externalize(dataset, base_mod, core_mod, target: Path): + """Emulate an upload: write ``data`` to a file, attach it, clear ``data``. + + Returns the created file entity so a caller can put it into a store. + """ + payload = json.dumps(dataset.data).encode("utf-8") + target.write_bytes(payload) + local_file = core_mod.LocalFile( + label=[core_mod.Label(text=target.name)], + local_path=str(target), + ) + dataset.distributions = [ + base_mod.Distribution( + file=local_file, + media_type=MEDIA_TYPE, + byte_size=len(payload), + ) + ] + dataset.data = None + return local_file + + +def _materialize(dataset): + """The inverse: read the attached file back into ``data``.""" + distribution = dataset.distributions[0] + stored = Path(distribution.file.local_path) + dataset.data = json.loads(stored.read_text(encoding="utf-8")) + dataset.distributions = None + + +@pytest.mark.parametrize("base_mod, core_mod", MODULES) +def test_generic_dataset_rejects_a_dict_payload(base_mod, core_mod): + """The payload type comes from the schema, not from the generic Dataset.""" + with pytest.raises(Exception): + base_mod.Dataset(label=[core_mod.Label(text="Cell 42")], data=PAYLOAD) + + +@pytest.mark.parametrize("base_mod, core_mod", MODULES) +def test_data_is_externalized_into_an_attached_local_file(base_mod, core_mod, tmp_path): + dataset = _rows_dataset_cls(base_mod)( + label=[core_mod.Label(text="Cell 42 cycling")], + data=PAYLOAD, + ) + assert dataset.data == PAYLOAD + assert not dataset.distributions + + _externalize(dataset, base_mod, core_mod, tmp_path / "cell42.data.json") + + # The payload no longer sits on the dataset; it lives in the file that the + # distribution describes. + assert dataset.data is None + assert len(dataset.distributions) == 1 + + distribution = dataset.distributions[0] + assert isinstance(distribution.file, core_mod.LocalFile) + assert distribution.media_type == MEDIA_TYPE + + stored = Path(distribution.file.local_path) + assert stored.exists() + assert distribution.byte_size == stored.stat().st_size + assert json.loads(stored.read_text(encoding="utf-8")) == PAYLOAD + + +@pytest.mark.parametrize("base_mod, core_mod", MODULES) +def test_file_round_trips_back_into_data(base_mod, core_mod, tmp_path): + """File -> Dataset.data restores the payload unchanged (lossless).""" + dataset = _rows_dataset_cls(base_mod)( + label=[core_mod.Label(text="Cell 42 cycling")], + data=PAYLOAD, + ) + _externalize(dataset, base_mod, core_mod, tmp_path / "cell42.data.json") + assert dataset.data is None + + _materialize(dataset) + + assert dataset.data == PAYLOAD + assert not dataset.distributions + + +@pytest.fixture +def resolver_registry(): + """Isolate the global oold resolver registry from other tests.""" + from oold.backend import interface + + saved = dict(interface._resolvers) + yield + interface._resolvers.clear() + interface._resolvers.update(saved) + + +@pytest.mark.parametrize("base_mod, core_mod", MODULES) +def test_file_round_trips_back_into_data_across_serialization( + base_mod, core_mod, tmp_path, resolver_registry +): + """The payload is recoverable from a serialized dataset. + + The distribution keeps only a node reference to the file entity, so a + loader has to dereference it before the payload can be read back. + """ + from oold.backend.document_store import SimpleDictDocumentStore + from oold.backend.interface import SetResolverParam, StoreParam, set_resolver + + cls = _rows_dataset_cls(base_mod) + dataset = cls( + label=[core_mod.Label(text="Cell 42 cycling")], + data=PAYLOAD, + ) + local_file = _externalize( + dataset, base_mod, core_mod, tmp_path / "cell42.data.json" + ) + + # The file entity is stored on its own, like an uploaded file would be. + store = SimpleDictDocumentStore() + store.store(StoreParam(nodes={local_file.get_iri(): local_file})) + set_resolver(SetResolverParam(iri="Item", resolver=store)) + + # The serialized dataset references the file instead of inlining the payload. + raw = _dump(dataset) + assert "test_time" not in raw + assert local_file.get_iri() in raw + + restored = _load(cls, raw) + assert restored.data is None + + _materialize(restored) + + assert restored.data == PAYLOAD