Skip to content

Conversation

kmcginnes
Copy link
Collaborator

@kmcginnes kmcginnes commented Apr 7, 2025

Description

Fixes issues with neighbor expansion in RDF databases. It uses a single query to retrieve the following information using subqueries and unions:

  • Distinct neighbors of source
    • Filter by class
    • Filter by property value
    • Limit results
  • Edges between neighbor and source in both directions
  • Neighbor properties and classes
  • Resource classes of source

Fixes issues

  • Property value filter not working
  • Neighbor counts inconsistent (only sometimes correct)
  • Limit properly applied to neighbor list before getting to edges

Does not fix

Other changes

  • Moved parseEdgeId function out of types.ts file
  • Update idParam to accept a plain string param

Validation

  • Verified with air routes in Neptune
  • Verified with premiere league in Neptune (includes blank nodes)

Related Issues

Check List

  • I confirm that my contribution is made under the terms of the Apache 2.0
    license.
  • I have run pnpm checks to ensure code compiles and meets standards.
  • I have run pnpm test to check if all tests are passing.
  • I have covered new added functionality with unit tests if necessary.
  • I have added an entry in the Changelog.md.

@kmcginnes kmcginnes marked this pull request as ready for review April 7, 2025 21:45
@kmcginnes kmcginnes force-pushed the fix-rdf-expansion branch from 73e3710 to f7f90d1 Compare April 9, 2025 00:04
@andreachild
Copy link
Contributor

LGTM

@kmcginnes kmcginnes merged commit 01daa72 into aws:main Apr 9, 2025
2 checks passed
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.

RDF neighbor expansion issues Optimize the SPARQL query for neighbor types and count [Bug] Neighbor expansion is slow and unreliable
2 participants