Skip to content

Add automated SPARQL syntax validation for all queries#30

Closed
Copilot wants to merge 4 commits into
mainfrom
copilot/lint-sparql-files
Closed

Add automated SPARQL syntax validation for all queries#30
Copilot wants to merge 4 commits into
mainfrom
copilot/lint-sparql-files

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 27, 2026

Adds comprehensive SPARQL linting to catch syntax errors before merge. All 49 SPARQL files across queries/ and ical/ directories are now automatically validated.

Implementation

  • Test suite (tests/test_lint_all_sparql_files.py): Parametrized pytest that discovers and validates all .sparql files using rdflib.plugins.sparql.prepareQuery

  • GitHub workflow (.github/workflows/test-sparql.yml): Runs on PRs and pushes to main when SPARQL files, tests, or dependencies change

Edge cases handled

  • Federated SERVICE calls: Replaced with stub VALUES clauses since rdflib can't parse without network
  • Vendor-specific syntax: Strips from onto:explicit clause
  • RDF-star syntax: 3 files use quoted triples (<< ?s ?p ?o >>) not supported by rdflib - validated structurally via regex, skipped full parse

Validation results

  • 46 files: Full syntax validation via rdflib parser
  • 3 files: Basic structural validation (SELECT/CONSTRUCT/WHERE clauses present)
Original prompt

This section details on the original issue you should resolve

<issue_title>Lint all SPARQLs</issue_title>
<issue_description>Modify the Python tests to lint all the SPARQL files in the query directory and in the iCal directory. Add a workflow that runs this test before a commit can be merged with the main branch. </issue_description>

<agent_instructions>Only use Python tests not Ruby tests.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits January 27, 2026 12:49
Co-authored-by: saumier <419491+saumier@users.noreply.github.com>
Co-authored-by: saumier <419491+saumier@users.noreply.github.com>
Co-authored-by: saumier <419491+saumier@users.noreply.github.com>
Copilot AI changed the title [WIP] Add linting for all SPARQL files in tests Add automated SPARQL syntax validation for all queries Jan 27, 2026
Copilot AI requested a review from saumier January 27, 2026 12:54
@saumier saumier closed this Jan 29, 2026
@saumier
Copy link
Copy Markdown
Member

saumier commented Jan 29, 2026

Since Python libraries do not support Triple terms (<< >>) then I don't think this will be a good approach since I am adding more use of triple terms to the SPARQLs to track provenance.

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.

Lint all SPARQLs

2 participants