feat(kg): support optional label property as display name for graph nodes#2757
Closed
4ST-499 wants to merge 1 commit intoHKUDS:mainfrom
Closed
feat(kg): support optional label property as display name for graph nodes#27574ST-499 wants to merge 1 commit intoHKUDS:mainfrom
4ST-499 wants to merge 1 commit intoHKUDS:mainfrom
Conversation
…odes When a node has a `label` property, it is used as the display name instead of the raw entity_id in all graph query endpoints: get_all_labels, search_labels, get_popular_labels, get_knowledge_graph. This is useful when node IDs are UUIDs or hashes rather than human-readable strings. Nodes without a label property fall back to entity_id (fully backward-compatible). Changes across all storage backends: - NetworkXStorage, Neo4JStorage, PGGraphStorage, MongoGraphStorage, MemgraphStorage: use label property with entity_id fallback - acreate_entity: forward label from entity_data to graph node - Add offline tests (NetworkX) and PG/AGE integration tests
Collaborator
|
The The frontend's reliance on Based on this, we recommend hiding Based on the analysis above, unfortunately this PR will not be merged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
labelproperty, all graph query endpoints (get_all_labels,search_labels,get_popular_labels,get_knowledge_graph) now use it as the display name instead of the rawentity_idlabelproperty fall back toentity_id— fully backward-compatible, zero behavior change for existing usersMotivation
Currently
KnowledgeGraphNode(labels=[str(node)])uses the raw node ID as display text. This works when IDs are human-readable strings like"ELON MUSK", but breaks for workflows that use UUIDs, hashes, or other non-human-readable node keys. Adding an optionallabelproperty decouples display name from graph identity.Changes
networkx_impl.py.get("label", entity_id)fallback in 4 query methodsneo4j_impl.pyCOALESCE(n.label, n.entity_id)in 7 Cypher queriespostgres_impl.pyCOALESCEin Cypher + agtype access + Python.get()fallbacksmongo_impl.py$ifNullin aggregation pipelines,$orregex for search,$lookupfor popular labelsmemgraph_impl.pyCOALESCE(n.label, n.entity_id)in 4 Cypher queriesutils_graph.pyacreate_entity()forwardslabelfrom entity_data to node propertiesTest plan