Skip to content

Commit

Permalink
Merge pull request #81 from INCATools/h2-patch-2
Browse files Browse the repository at this point in the history
Remove `node_id` and replace with `about_node` for `ClassCreation` and `NodeCreation`
  • Loading branch information
hrshdhgd authored Aug 15, 2024
2 parents 0a37270 + 46f9792 commit 8a62f0e
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 9 deletions.
3 changes: 1 addition & 2 deletions src/data/examples/examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,15 @@ Test_9:
Test_10:
id: CHANGE:001
type: ClassCreation
about_node: GO:9999999
about_node_representation: curie
node_id: GO:9999999
command_with_curie: create GO:9999999
command_with_uri: create http://purl.obolibrary.org/obo/GO_9999999
Test_11:
id: CHANGE:001
type: NodeCreation
about_node: GO:9999999
about_node_representation: curie
node_id: GO:9999999
name: foo
command_with_curie: create node GO:9999999 'foo'
command_with_uri: TODO
Expand Down
3 changes: 1 addition & 2 deletions src/docs/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ Class: [`ClassCreation`](https://w3id.org/kgcl/ClassCreation) </br></br>Command:
```
id: CHANGE:001
type: ClassCreation
about_node: GO:9999999
about_node_representation: curie
node_id: GO:9999999
```
## Example: Creation of new node.
Expand All @@ -98,7 +98,6 @@ id: CHANGE:001
type: NodeCreation
about_node: GO:9999999
about_node_representation: curie
node_id: GO:9999999
name: foo
```
Expand Down
3 changes: 1 addition & 2 deletions src/kgcl_schema/grammar/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def parse_create_class(tree, id):
entity, representation = get_entity_representation(term_id_token)

return ClassCreation(
id=id, node_id=entity, about_node_representation=representation
id=id, about_node=entity, about_node_representation=representation
)


Expand Down Expand Up @@ -317,7 +317,6 @@ def parse_create(tree, id):
id=id,
about_node=entity,
about_node_representation=representation,
node_id=entity, # was term_id_token
name=label_value,
language=language_token,
)
Expand Down
2 changes: 1 addition & 1 deletion src/kgcl_schema/grammar/render_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def render(kgcl_instance: Change) -> str:
return "create " + subject

if type(kgcl_instance) is ClassCreation:
subject = render_entity(kgcl_instance.node_id, "uri")
subject = render_entity(kgcl_instance.about_node, "uri")
return "create " + subject

if type(kgcl_instance) is NewSynonym:
Expand Down
3 changes: 1 addition & 2 deletions tests/cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
(
f"create {NEW_TERM}",
f"create {NEW_TERM_URI}",
ClassCreation(id=UID, node_id=NEW_TERM, about_node_representation="curie"),
ClassCreation(id=UID, about_node=NEW_TERM, about_node_representation="curie"),
None,
),
(
Expand All @@ -196,7 +196,6 @@
TODO_TOKEN,
NodeCreation(
id=UID,
node_id=NEW_TERM, ## TODO: remove this
about_node=NEW_TERM,
name="foo",
about_node_representation="curie",
Expand Down

0 comments on commit 8a62f0e

Please sign in to comment.