Skip to content

[Suggestion] Possible integration with AWL and its SPARQL interface  #127

Description

@simontaurus

I like the idea of seeing annotated and typed function signatures are way to go for interoperability, together with a graph-like data structure.

However, going beyond linear workflow (loops, conditionals) may represent a challenge, see also #126

With AWL (https://github.com/OO-LD/awl-schema) we develop a more general way in using the Abstract Syntax Tree (AST) represenation of such a function-oriented code (on python or another programming languages) including also control structures.
By applying JSON-LD on the AST this lead directly to and RDF representation of the code, which can be queried or transformed with SPARQL (and re-transpiled to python)

The benefits of an integration in my view would be:
a) Workflows written in AWL ~ native python representation can be transfered to any workflow environment supported by PWD
b) PWD would get a semantic (RDF) representation out of the box by applying AWL to the native python representations (could be further enriched with https://github.com/pyiron/semantikon)
c) This RDF representation may also be utilized within PWD to parse more complex workflows

For c) @samwaseda and I also explored a transformation from AWL to the node and edge oriented representation of PWD:

Example code

def function_one(x):
    return x

def function_two(x, y):
    return x + y

SPARQL

PREFIX awl: <https://oo-ld.github.io/awl-schema/>
PREFIX ex: <https://example.org/>
CONSTRUCT { 
  ex:Workflow awl:HasNode ?function .
  ex:Workflow a awl:Workflow .
  ?function awl:HasName ?functionName .
  ?function awl:HasInput ?input .
  ?input awl:HasName ?key
}
WHERE { 
  ?module awl:HasPart ?functionDef .
  ?functionDef a awl:FunctionDef . 
  ?functionDef awl:HasArgument/awl:HasArgument ?arg .
  ?functionDef awl:HasName ?functionName .
  BIND (URI(concat(str(ex:),STR(?functionName))) as ?function)
  ?arg awl:HasKey ?key . 
  BIND (URI(concat(str(ex:),STR(?functionName),"/",STR(?key))) as ?input)
}

Result:

{
  "id": "ex:Workflow",
  "type": "awl:Workflow",
  "nodes": [
    {
      "id": "ex:function_one",
      "inputs": {
        "id": "ex:function_one/x",
        "name": "x"
      },
      "name": "function_one"
    },
    {
      "id": "ex:my_workflow",
      "inputs": [
        {
          "id": "ex:my_workflow/a",
          "name": "a"
        },
        {
          "id": "ex:my_workflow/b",
          "name": "b"
        }
      ],
      "name": "my_workflow"
    },
    {
      "id": "ex:function_two",
      "inputs": [
        {
          "id": "ex:function_two/x",
          "name": "x"
        },
        {
          "id": "ex:function_two/y",
          "name": "y"
        }
      ],
      "name": "function_two"
    }
  ]
}

Activity

  1. jan-janssen commented on Jul 6, 2025

    @jan-janssen
    Member

    For DAGs this is already working as https://github.com/pyiron/semantikon is parsing the Python code and creates a https://github.com/pyiron/pyiron_workflow compatible representation, which then can be loaded with the Python Workflow Definition based on the interface to pyiron_workflow in #111 . It is currently a multi step process which can still be optimized but at least is highlights the possibility of converting Python code directly to the Python Workflow Definition for using it with any of the supported workflow frameworks.

    The extension to more complex logical structures including if-statements and while-loops is currently prototyped in collaboration with @samwaseda in https://github.com/pyiron/semantikon as outlined in #18 and #126 .

    For me it is still a bit unclear how the AWL and its SPARQL representation is used in this context. Is there already an existing database using the AWL SPARQL interface? In the current publication the Python Workflow Definition is only focused on supporting the publication of workflows in a workflow framework independent format, still it would definitely be a nice extension to provide a database where users could query for existing workflows based on your AWL and its SPARQL representation.

  2. changed the title [-]Possible integration with AWL[/-] [+][Suggestion] Possible integration with AWL and its SPARQL interface [/+] on Jul 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions