Skip to content

Commit 69ef8e2

Browse files
committed
Add more documentation about input/output semantic type params to the is_fairstep decorator
1 parent 6f698cb commit 69ef8e2

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

fairworkflows/fairstep.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,17 @@ def is_fairstep(label: str = None, is_pplan_step: bool = True, is_manual_task: b
390390
is_script_task (str): Denotes whether this step is a bpmn.ScriptTask
391391
392392
All additional arguments are expected to correspond to input parameters of the decorated
393-
function, and are used to provide extra semantic types for that parameter.
393+
function, and are used to provide extra semantic types for that parameter. For example,
394+
consider the following decorated function:
395+
@is_fairstep(label='Addition', a='http://www.example.org/number', out1='http://www.example.org/float')
396+
def add(a:float, b:float) -> float:
397+
return a + b
398+
1. Note that using 'a' as parameter to the decorator allows the user to provide a URI for a semantic type
399+
that should be associated with the function's input parameter, 'a'. This can be either a string, an
400+
rdflib.URIRef, or a list of these.
401+
2. Note that the return parameter is referred to using 'out1', because it does not otherwise have a name.
402+
In this case, the function only returns one value. However, if e.g. a tuple of 3 values were returned,
403+
you could use out1, out2 and out3 to set the semantic types of each return value, if so desired.
394404
"""
395405

396406
def _modify_function(func):

0 commit comments

Comments
 (0)