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

[patch] remove var_name because it's never used and anyway appears in the key #104

Merged
merged 1 commit into from
Jan 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 9 additions & 14 deletions pyiron_ontology/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,9 @@ def get_inputs_and_outputs(node: Node) -> dict:
if inputs[key] is None:
inputs[key] = {}
inputs[key]["value"] = value.value
inputs[key]["var_name"] = key
inputs[key]["connection"] = get_source_output(value)
for key, value in node.outputs.to_value_dict().items():
outputs[key]["value"] = value
outputs[key]["var_name"] = key
return {
"inputs": inputs,
"outputs": outputs,
Expand All @@ -66,18 +64,17 @@ def get_triples(
workflow_namespace: str | None = None,
) -> Graph:
"""
Generate triples from a dictionary containing input output information. The
dictionary should be obtained from the get_inputs_and_outputs function, and
should contain the keys "inputs", "outputs", "function" and "label". Within
"inputs" and "outputs", the keys should be the variable names, and the values
should be dictionaries containing the keys "type", "value", "var_name" and
Generate triples from a dictionary containing input output information.
The dictionary should be obtained from the get_inputs_and_outputs function,
and should contain the keys "inputs", "outputs", "function" and "label".
Within "inputs" and "outputs", the keys should be the variable names, and
the values should be dictionaries containing the keys "type", "value" and
"connection". The "connection" key should contain the label of the output
variable that the input is connected to. The "type" key should contain the
URI of the type of the variable. The "value" key should contain the value of
the variable. The "var_name" key should contain the variable name. The "function"
key should contain the name of the function that the node is connected to. The
"label" key should contain the label of the node. In terms of python code,
it should look like this:
URI of the type of the variable. The "value" key should contain the value
of the variable. The "function" key should contain the name of the function
that the node is connected to. The "label" key should contain the label of
the node. In terms of python code, it should look like this:

>>> data = {
>>> "inputs": {
Expand All @@ -86,7 +83,6 @@ def get_triples(
>>> "value": 1,
>>> "triples": some_triples,
>>> "restrictions": some_restrictions,
>>> "var_name": "input1",
>>> "connection": "output1"
>>> }
>>> },
Expand All @@ -95,7 +91,6 @@ def get_triples(
>>> "type": URIRef("http://example.org/Type"),
>>> "value": 1,
>>> "triples": other_triples,
>>> "var_name": "output1"
>>> }
>>> },
>>> "function": "function_name",
Expand Down
Loading