Closed kysrpex closed 2 years ago
@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 actions
is descriptive enough. operations
could be an alternative.
@action
decorator.actions
to operations
.
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.