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

Replace represents network attribute #20

Merged
merged 1 commit into from
Oct 8, 2024
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
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