From 247baa60264fc7dad5118f1ca5c335e012c0f990 Mon Sep 17 00:00:00 2001 From: Harshad Hegde Date: Fri, 29 Mar 2024 12:33:56 -0500 Subject: [PATCH 1/2] Add render_entity where necessary. --- src/kgcl_schema/grammar/render_operations.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/kgcl_schema/grammar/render_operations.py b/src/kgcl_schema/grammar/render_operations.py index 269272a..ceaf1fb 100644 --- a/src/kgcl_schema/grammar/render_operations.py +++ b/src/kgcl_schema/grammar/render_operations.py @@ -290,21 +290,22 @@ def render(kgcl_instance: Change) -> str: return "delete edge " + subclass + " " + property + " " + filler if type(kgcl_instance) is NodeDeepening: - subject = kgcl_instance.about_edge.subject - old_value = kgcl_instance.old_value - new_value = kgcl_instance.new_value + subject = render_entity(kgcl_instance.about_edge.subject, "uri") + old_value = render_entity(kgcl_instance.old_value, "uri") + new_value = render_entity(kgcl_instance.new_value, "uri") return "deepen " + subject + " from " + old_value + " to " + new_value if type(kgcl_instance) is NewTextDefinition: - subject = kgcl_instance.about_node - definition = kgcl_instance.new_value + subject = render_entity(kgcl_instance.about_node, "uri") + definition = render_entity(kgcl_instance.new_value, "label"`) return "add definition " + definition + " to " + subject if type(kgcl_instance) is NodeTextDefinitionChange: - subject = kgcl_instance.about_node - new_definition = kgcl_instance.new_value + subject = render_entity(kgcl_instance.about_node, "uri") + new_definition = render_entity(kgcl_instance.new_value, "label") if kgcl_instance.old_value: - old_definition = kgcl_instance.old_value + old_definition = render_entity(kgcl_instance.old_value, "label") + # old_definition = kgcl_instance.old_value return ( "change definition of " + subject From cba7e37cb9b1c4bfe26d6ffed28c9580567c50e3 Mon Sep 17 00:00:00 2001 From: Harshad Hegde Date: Fri, 29 Mar 2024 12:34:33 -0500 Subject: [PATCH 2/2] foramtted and typo correction --- src/kgcl_schema/grammar/render_operations.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kgcl_schema/grammar/render_operations.py b/src/kgcl_schema/grammar/render_operations.py index ceaf1fb..57b556e 100644 --- a/src/kgcl_schema/grammar/render_operations.py +++ b/src/kgcl_schema/grammar/render_operations.py @@ -297,7 +297,7 @@ def render(kgcl_instance: Change) -> str: if type(kgcl_instance) is NewTextDefinition: subject = render_entity(kgcl_instance.about_node, "uri") - definition = render_entity(kgcl_instance.new_value, "label"`) + definition = render_entity(kgcl_instance.new_value, "label") return "add definition " + definition + " to " + subject if type(kgcl_instance) is NodeTextDefinitionChange: