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

Fix issues in fetchSchema for OpenCypher #245

Merged
merged 10 commits into from
Mar 4, 2024
Merged

Conversation

kmcginnes
Copy link
Collaborator

@kmcginnes kmcginnes commented Feb 29, 2024

Issue #, if available: N/A

Description of changes:

  • Gracefully handle getting edge attributes where there are no attributes
  • Allow edge labels to be either string[] or string
  • Fix incorrect edge labeling and missing counts
  • Add .gitignore to /packages/graph-explorer to give VS Code the info it needs to search in the right folders

On older versions of Neptune, where the summary API is not supported, there were some issues when fetching the schema for an OpenCypher connection.

In the case where OpenCypher returns an empty list for the edge properties, the entire fetchSchema stack would fail. Now it will simply move to the next edge.

I also determined that OpenCypher was returning an empty list in my case because of an incorrect assumption around the edge labels. It was trying to extract the label name from an array of label names, but in reality it was not an array. So we ended up with just the first character of the label name. To fix this, I check the response to ensure it is an array. If it isn't, then assume it is a string.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@kmcginnes kmcginnes marked this pull request as ready for review February 29, 2024 17:03
@kmcginnes kmcginnes marked this pull request as draft February 29, 2024 17:04
@kmcginnes kmcginnes marked this pull request as ready for review February 29, 2024 17:08
Copy link

codecov bot commented Feb 29, 2024

Codecov Report

Attention: Patch coverage is 90.19608% with 10 lines in your changes are missing coverage. Please review.

Project coverage is 11.02%. Comparing base (f82a663) to head (60c7ed6).

❗ Current head 60c7ed6 differs from pull request most recent head 0a54c4b. Consider uploading reports for the commit 0a54c4b to get more accurate results

Files Patch % Lines
...er/src/connector/openCypher/queries/fetchSchema.ts 90.19% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #245      +/-   ##
==========================================
+ Coverage   10.06%   11.02%   +0.95%     
==========================================
  Files         409      408       -1     
  Lines       30156    30166      +10     
  Branches      660      706      +46     
==========================================
+ Hits         3036     3325     +289     
+ Misses      26785    26508     -277     
+ Partials      335      333       -2     
Flag Coverage Δ
unittests 11.02% <90.19%> (+0.95%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kmcginnes
Copy link
Collaborator Author

@alexey-temnikov I believe with my recent changes this is ready for another review pass.

@kmcginnes
Copy link
Collaborator Author

I believe I have covered all comments in this PR and it is ready for another look.

alexey-temnikov
alexey-temnikov previously approved these changes Mar 2, 2024
kmcginnes and others added 10 commits March 4, 2024 10:09
Some OpenCypher labels have no edges, but we were assuming they all did. This caused a null reference exception.

I changed the assumption to allow for empty edges and added a guard check to skip empty labels.
Co-authored-by: Alexey Temnikov <alexey.temnikov@improving.com>
@kmcginnes
Copy link
Collaborator Author

I brought in the latest from main and fixed the conflict.

Copy link
Contributor

@vkagamlyk vkagamlyk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@xiazcy xiazcy merged commit 7778108 into aws:main Mar 4, 2024
1 check passed
@kmcginnes kmcginnes deleted the fix-fetch-schema branch March 5, 2024 15:28
vkagamlyk pushed a commit that referenced this pull request Mar 12, 2024
Description of changes:

Fixes failure when retrieving schema of older Neptune DB with OpenCypher (moved to PR 
Fix issues in fetchSchema for OpenCypher #245)
Fixes SPARQL keyword search by exact match
Adds ID attribute for Gremlin and OpenCypher connections
Adds test cases to keywordSearchTemplate for new ID functionality
Adds missing test cases for SPARQL keywordSearchTemplate cases
Changes default search attribute to ID for Gremlin and OpenCypher
Changes default search attribute to rdfs:label for SPARQL
Changes default search precision to Exact
Changes behavior when node type selection changes to reset attribute and precision to the values above
Changes OpenCypher search queries to execute concurrently when searching multiple vertices (i.e. "All")
Includes formatting of only files that were modified
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants