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

Remove node_id and replace with about_node for ClassCreation and NodeCreation #81

Merged
merged 1 commit into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
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
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
Loading