Skip to content

feat: support ?s ?p ?o shorthand in SPARQL query results#1769

Merged
kmcginnes merged 3 commits into
aws:mainfrom
vishwakt:issue-1766-sparql-shorthand
May 18, 2026
Merged

feat: support ?s ?p ?o shorthand in SPARQL query results#1769
kmcginnes merged 3 commits into
aws:mainfrom
vishwakt:issue-1766-sparql-shorthand

Conversation

@vishwakt
Copy link
Copy Markdown
Contributor

Description

This PR supports the ?s ?p ?o shorthand in the Query Editor so results render correctly as graph entities.

Changes include:

  • Updates sparqlQuadBindingSchema to normalize the {s, p, o} short form into {subject, predicate, object}.
  • Adds validation tests to verify shorthand parsing and strict rejection of partial matches.
  • Updates query logic tests to ensure SELECT ?s ?p ?o executes and behaves as a CONSTRUCT query.

Related Issues

Fixes #1766

Check List

  • I confirm that my contribution is made under the terms of the Apache 2.0 license.
  • I have verified pnpm checks passes with no errors.
  • I have verified pnpm test passes with no failures.
  • I have covered new added functionality with unit tests if necessary.
  • I have updated documentation if necessary.

Fixes aws#1766

- Modifies sparqlQuadBindingSchema in types.ts to support shorthand aliases natively
- Transforms validated shorthand schema structures back to canonical form
- Updates rawQuery and parseAndMapQuads test cases to validate new schema mapping behaviors
@vishwakt vishwakt force-pushed the issue-1766-sparql-shorthand branch from 2652972 to 7e9f6a4 Compare May 14, 2026 17:53
@kmcginnes kmcginnes self-requested a review May 15, 2026 19:16
Comment thread packages/graph-explorer/src/connector/sparql/types.ts
Copy link
Copy Markdown
Collaborator

@kmcginnes kmcginnes left a comment

Choose a reason for hiding this comment

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

This looks good to me. Just run pnpm format at the root to fix the formatting issues.

@kmcginnes
Copy link
Copy Markdown
Collaborator

Tested this locally and it works as expected.

@vishwakt
Copy link
Copy Markdown
Contributor Author

@kmcginnes i did see that there was a CVE in one of the packages for which the build was failing on the previous run. The CVE is pre-existing on main and would need a separate dependency bump to resolve. Happy to file a follow-up issue and work on the fix as well if useful.

@kmcginnes
Copy link
Copy Markdown
Collaborator

If you rebase on main you should get the fix. Unless there's been another one since.

@vishwakt
Copy link
Copy Markdown
Contributor Author

fair point. just merged main.

@kmcginnes kmcginnes merged commit 8056216 into aws:main May 18, 2026
3 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.

Support ?s ?p ?o shorthand in SPARQL query editor results

2 participants