Skip to content

Commit

Permalink
Replace represents network attribute with labels and `prov:wasDer…
Browse files Browse the repository at this point in the history
…ivedFrom`
  • Loading branch information
pkalita-lbl committed Oct 8, 2024
1 parent 3dd5859 commit 5b108c9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/gocam/translation/cx2/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def _remove_species_code_suffix(label: str) -> str:

@cache
def _get_context():
return prefixmaps.load_context("go").as_dict()
return prefixmaps.load_context("go")


# Regex from
Expand Down Expand Up @@ -105,14 +105,18 @@ def _add_input_output_nodes(
)

# Create the CX2 network and set network-level attributes
go_context = _get_context()
go_converter = go_context.as_converter()
cx2_network = CX2Network()
cx2_network.set_network_attributes(
{
"@context": json.dumps(_get_context()),
"@context": json.dumps(go_context.as_dict()),
"name": gocam.title if gocam.title is not None else gocam.id,
"represents": gocam.id,
"prov:wasDerivedFrom": go_converter.expand(gocam.id),
}
)
# This gets added separately so we can declare the datatype
cx2_network.add_network_attribute("labels", [gocam.id], "list_of_string")

# Add nodes for activities, labeled by the activity's enabled_by object
for activity in gocam.activities:
Expand Down

0 comments on commit 5b108c9

Please sign in to comment.