lplalbert commented on code in PR #421:
URL: https://github.com/apache/hugegraph-ai/pull/421#discussion_r4579476436


##########
hugegraph-llm/src/hugegraph_llm/nodes/hugegraph_node/graph_query_node.py:
##########
@@ -326,14 +326,37 @@ def _extract_labels_from_schema(self) -> Tuple[List[str], 
List[str]]:
         edge_labels = self._extract_label_names(edge_props_str)
         return vertex_labels, edge_labels
 
+    def _format_props_str(self, props: Any, item_type: str) -> str:
+        """Canonical property rendering so the same element always formats to 
the same string."""
+        return ", ".join(f"{k}: {self._limit_property_query(v, item_type)}" 
for k, v in props.items() if v)

Review Comment:
   Fixed — pushed (317862f). Root cause: the canonical `_format_props_str` 
filter was `if v`, which treats `0` and `False` as padding, so both renderers 
that share it (the path renderer and `_format_graph_from_vertex`) dropped them 
— `{name: widget, stock: 0, active: False}` rendered as `P{name: widget}`.
   
   Structural fix: the filter now skips only `None` and `""` (the absent 
values), so falsy-but-present values render as data in both renderers. The 
existing pin for `""` staying skipped remains green.
   
   Test: `test_falsy_property_values_render_in_both_knowledge_forms` covers 
both renderers — the standalone vertex must render `P{name: widget, stock: 0, 
active: False}` and the path must render `A{name: alice, stock: 0, active: 
False}--[knows{since: 0}]-->B{name: bob}`. Red without the fix.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to