Fix language dispatch and result processing in Grafeo backend#6
Closed
XXXM1R0XXX wants to merge 3 commits into
Closed
Fix language dispatch and result processing in Grafeo backend#6XXXM1R0XXX wants to merge 3 commits into
XXXM1R0XXX wants to merge 3 commits into
Conversation
Co-authored-by: XXXM1R0XXX <87042609+XXXM1R0XXX@users.noreply.github.com>
…rameters Fix GrafeoBackend: language-aware dispatch and grafeo result parsing
StevenBtw
added a commit
that referenced
this pull request
Mar 14, 2026
GrafeoBackend now routes queries to language-specific methods (execute_cypher, execute_gremlin, etc.) when available, falling back to generic execute(). Adds detection and conversion of Grafeo's internal _id/_labels/_source/_target/_type dict format so native query results render correctly in the widget. Based on PR #6 by Богдан Кристиан, with added ClassVar annotation, test coverage, and version bump to 0.2.8. Co-Authored-By: Богдан Кристиан <87042609+XXXM1R0XXX@users.noreply.github.com>
Contributor
|
Thanks for this contribution @XXXM1R0XXX! I have just incorporated your changes Closing in favor of the release branch, which includes your work. |
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.
This pull request refactors and extends the
GrafeoBackendclass insrc/anywidget_graph/backends/grafeo.pyto improve support for multiple query languages and to better handle Grafeo-specific node and relationship formats. The main changes include adding language-specific execution logic, and introducing robust methods for processing Grafeo node and relationship dictionaries.Language support enhancements:
_LANGUAGE_METHODSmapping to associate query languages (like"cypher","gremlin", etc.) with their corresponding execution methods, enabling flexible query execution based on language.executemethod to use the appropriate database method for the specified language, falling back to a genericexecuteif no match is found.Grafeo node and relationship processing improvements:
_process_resultto prioritize Grafeo node and relationship detection using new helper methods, ensuring correct conversion to widget formats._is_grafeo_node,_is_grafeo_relationship,_grafeo_node_to_dict, and_grafeo_relationship_to_dictto reliably identify and transform Grafeo node and relationship dictionaries for downstream use.Simplified API Usage Examples
Thanks to these improvements, you no longer need to manually parse raw results using internal private methods (like
_process_result). You can now easily render a Grafeo graph using one of the following simplified approaches:Setup data:
Option 1: Using Widget Properties (Recommended)
The widget can now natively parse the query using the assigned query language.
Option 2: Using the Backend Execute Method directly
The
executemethod now properly respects thelanguageparameter and correctly formats the output out-of-the-box.