-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support "Operations" in SimPhoNy #783
Conversation
Adds support for registering methods as "actions" associated to ontology classes. For example, download and upload commands for files are now implemented in this way. But it would also be possible to write actions that multiply EMMO vectors, retrieve arrays from a URL, convert EMMO units, download a DCAT dataset, ...
@pablo-de-andres @paulzierep @yoavnash This should be useful for integrating ontology and data. There are of course other, more sophisticated approaches such as RDFLib lexicalizers and constructors, or triples fabricated on the fly by the wrappers. I believe it's good to have this also available to be future-proof. I think the fine-details of how a user is supposed to access the actions or whether they should be implemented in a different way are a good topic for a dev meeting. |
I like the idea. I wonder if |
|
* Rename "Actions" to "Operations". * Remove the `@action` decorator and use the `_underscore` convention instead to determine which methods should be declared as operations. * Read operations from Python files in ~./simphony_osp/operations (also configurable via the environment variable `SIMPHONY_OPERATIONS_DIR`). * Include the `Operations` abstract class in module `simphony_osp.develop`. * Include the new `find_operations` function in the `simphony_osp.develop`. This function generates entry point declarations for operations automatically.
for more information, see https://pre-commit.ci
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good all in all.
Adds support for registering methods as "actions" associated to ontology classes. For example, download and upload commands for files are now implemented in this way (and in fact need to in order to fix #669 cleanly). But it would also be possible to write actions that multiply EMMO vectors, retrieve arrays from a URL, convert EMMO units, download a DCAT dataset, ...
test_files.py
for an example of how they are used with files (lines 276, 304 are the most relevant).file.py
andsetup.py
for an example of how a developer implements an action.Note: The PR is not finished because the
Container
class still needs to be converted to a set of actions too.