Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Support "Operations" in SimPhoNy #783

Merged
merged 8 commits into from
Jun 3, 2022
Merged

Support "Operations" in SimPhoNy #783

merged 8 commits into from
Jun 3, 2022

Conversation

kysrpex
Copy link
Contributor

@kysrpex kysrpex commented May 25, 2022

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, ...

  • See test_files.py for an example of how they are used with files (lines 276, 304 are the most relevant).
  • See file.py and setup.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.

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, ...
@kysrpex kysrpex added API details 🌱 new feature Solving the issue involves the incorporation of a new feature. 📜 ontology 🔨 simple fix Likely to be solvable in at most a few hours (full-time). 🏗️ software architecture ⚡ breaking change Solution introduces incompatible API changes, MAJOR version number update. See https://semver.org. labels May 25, 2022
@kysrpex kysrpex self-assigned this May 25, 2022
@kysrpex
Copy link
Contributor Author

kysrpex commented May 25, 2022

@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.

@yoavnash
Copy link
Member

I like the idea. I wonder if actions is descriptive enough. operations could be an alternative.

@kysrpex
Copy link
Contributor Author

kysrpex commented May 31, 2022

  • Use the underscore convention instead of the @action decorator.
  • Offer possibility to read actions from a folder in the home directory.
  • Rename actions to operations.

kysrpex and others added 3 commits June 1, 2022 16:56
* 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.
@kysrpex
Copy link
Contributor Author

kysrpex commented Jun 1, 2022

  • Convert the Container class to a set of actions.

@kysrpex kysrpex changed the title Support "Actions" in SimPhony Support "Operations" in SimPhony Jun 1, 2022
@kysrpex kysrpex changed the title Support "Operations" in SimPhony Support "Operations" in SimPhoNy Jun 1, 2022
@kysrpex kysrpex marked this pull request as ready for review June 2, 2022 10:56
Copy link
Member

@yoavnash yoavnash left a 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.

@kysrpex kysrpex merged commit a906709 into release/4/dev Jun 3, 2022
@kysrpex kysrpex deleted the feature/actions branch June 3, 2022 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API details 🏗️ software architecture 🔨 simple fix Likely to be solvable in at most a few hours (full-time). 📜 ontology 🌱 new feature Solving the issue involves the incorporation of a new feature. ⚡ breaking change Solution introduces incompatible API changes, MAJOR version number update. See https://semver.org.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants