Skip to content

Commit

Permalink
docs: Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ewuerger committed Mar 2, 2023
1 parent 6787664 commit ddeb5be
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 11 deletions.
77 changes: 71 additions & 6 deletions docs/source/examples/10 Declarative Modeling.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -154,29 +154,89 @@
" promise_id: cm-port-promise\n",
"\"\"\"\n",
"# the below line applies the model_update to the model\n",
"decl.apply(model, io.StringIO(model_update))"
"decl.apply(model, io.StringIO(model_update), strict=False)"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"and now we can verify the changes by visualizing the context of our system under analysis:"
"**Notice**: The `strict=False` was needed since no metadata was included into the\n",
"`model_update`:"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"ename": "ValueError",
"evalue": "No metadata found.",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn [6], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m decl\u001b[39m.\u001b[39;49mapply(model, io\u001b[39m.\u001b[39;49mStringIO(model_update))\n",
"File \u001b[0;32m~/wörk/py-capellambse/capellambse/decl.py:160\u001b[0m, in \u001b[0;36mapply\u001b[0;34m(model, file, strict)\u001b[0m\n\u001b[1;32m 158\u001b[0m \u001b[39mif\u001b[39;00m strict:\n\u001b[1;32m 159\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mnot\u001b[39;00m metadata:\n\u001b[0;32m--> 160\u001b[0m \u001b[39mraise\u001b[39;00m \u001b[39mValueError\u001b[39;00m(\u001b[39m\"\u001b[39m\u001b[39mNo metadata found.\u001b[39m\u001b[39m\"\u001b[39m)\n\u001b[1;32m 162\u001b[0m _metadata_matches_modelinfo(model, metadata)\n\u001b[1;32m 164\u001b[0m \u001b[39mwhile\u001b[39;00m instructions:\n",
"\u001b[0;31mValueError\u001b[0m: No metadata found."
]
}
],
"source": [
"decl.apply(model, io.StringIO(model_update))"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"`decl.apply` expects a metadata section and checks the values against the model.info:"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"from importlib import metadata as imm\n",
"\n",
"model_update = f\"\"\"\n",
"capellambse: {imm.version('capellambse')}\n",
"model:\n",
" version: null\n",
" url: null\n",
"referencing: explicit\n",
"generator: Me, the author\n",
"---\n",
"{model_update}\n",
"\"\"\""
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"Now we can verify the changes by visualizing the context of our system under analysis:"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYQAAABBCAIAAABejUQ3AAAABmJLR0QA/wD/AP+gvaeTAAARHElEQVR4nO3deVQTV9sA8GeSQILsi5Q9shZQEcNW+RTcAH351BaqliJVoWq1VGulX+0ivJQj2BbFjarQalUWd6hLXSnyKcpLRVE2QUQWQRRQkAIhyWTeP2JjDBBAQ4z6/M4cz+TOzL3PHJLHO3fmJgRFUYAQQi8b7WUHgBBCAJiMEEJKApMRQkgpYDJCCCkFTEYIIaWAyQghpBQwGSGElAImI4SQUsBkhBBSCgzZm/39tysmDjR0Tpz45GWHgFD/+klGAJBwFN/Kr7CVM/G/E/RqwMs0hJBS6L9nhBNpEUIK0H8yAkxGCKGhN4CekQKiQAgpk/b2dj6fr6enp8hGBzBmROHyKi8IDcaBAwdsbGwNDIabm5sbm5gmJiYKhULFNI09I4TQExs3bvxp/Yb/nRNiYz+KIIi71VUJm7eWlJb+nJiogNaxZ/S6LwgNTFdXV3R0dMjSL2wdRhMEAQBmI6zmfxqRkpJSU1OjgADwbhpCCACgoqJCQ1PbwNBIslBtmLqVrX1BQQGbzR7qAPAyDSEEAMBisbq7uT3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"<Diagram 'Context of Coffee Machine'>"
]
},
"execution_count": 6,
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -186,10 +246,15 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"Please note: the changes we made are not yet stored - if you like those to be saved you may use `model.save()` method. This will save the model back to where it was loaded from, for example by writing back into local files, or by creating a Git commit and pushing it back to the remote.\n"
"Please note: the changes we made are not yet stored - if you like those to be saved you may use `model.save()` method. This will save the model back to where it was loaded from, for example by writing back into local files, or by creating a Git commit and pushing it back to the remote.\n",
"\n",
"For more information checkout the documentation about the [declarative modelling] feature.\n",
"\n",
"[declarative modelling]: https://dsd-dbs.github.io/py-capellambse/start/declarative.html"
]
}
],
Expand All @@ -214,7 +279,7 @@
"orig_nbformat": 4,
"vscode": {
"interpreter": {
"hash": "c5ea7dc634d8047a259e5b898f154d237fbe6934b444b1a949475949608d751e"
"hash": "68692079392476f3e5957229567211dae86496de106b15869a99d77792561652"
}
}
},
Expand Down
38 changes: 35 additions & 3 deletions docs/source/start/declarative.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,41 @@ containing YAML, wrap it in :external:class:`io.StringIO`:
Format description
==================

The expected YAML follows a simple format, where a parent object (i.e. an
object that already exists in the model) is selected, and one or more of three
different operations is applied to it:
Metadata
--------
.. versionadded:: 0.5.16
Added metadata document to the declarative modelling YAML.

The metadata has the following format:

.. code-block:: yaml
capellambse: 1.0.0
model:
version: 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12
url: https://example.com/model.git
referencing: explicit
generator: Declarative Modelling Generator 1.0.0
It gives information about which model the declarative modelling YAML file
wants to change, with which capellambse version and generator it was written
with and the referencing-type. A versioned model (using a gitURL) can be
uniquely identified by its commit-hash and the repository ``url``. These values
are checked against the ``model.info`` during ``decl.apply`` when the
``strict`` parameter is ``True`` (default).

The only accepted referencing-type for ``decl.apply`` is ``explicit``.
Instructions in the declarative modelling YAML may need additional instructions
for references such that the changes are correctly displayed in Capella. E.g.
a delete instruction of a port should be followed by a delete instruction of
the connected exchanges, since an exchange always needs a source and a target.

Instructions
------------

The expected instruction document in the YAML follows a simple format, where a
parent object (i.e. an object that already exists in the model) is selected,
and one or more of three different operations is applied to it:

- ``extend``-ing the object on list attributes,
- ``modify``-ing the object itself, or
Expand Down
4 changes: 2 additions & 2 deletions tests/data/decl/coffee-machine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
capellambse: 1.0.0
model:
version: 12345678
url: example.com
url: https://example.com/model.git
referencing: explicit
generator: example 1.0.0
generator: Declarative Modelling Generator 1.0.0
---
- parent: !uuid 0d2edb8f-fa34-4e73-89ec-fb9a63001440 # root logical component
extend:
Expand Down

0 comments on commit ddeb5be

Please sign in to comment.