Skip to content

Added markdown integration for SPARQL and SHACL code blocks:#134

Open
arne-bdt wants to merge 1 commit intozazuko:mainfrom
arne-bdt:add_markdown_integration_and_shacl
Open

Added markdown integration for SPARQL and SHACL code blocks:#134
arne-bdt wants to merge 1 commit intozazuko:mainfrom
arne-bdt:add_markdown_integration_and_shacl

Conversation

@arne-bdt
Copy link
Copy Markdown

@arne-bdt arne-bdt commented Mar 3, 2026

Summary

This PR introduces Markdown integration and SHACL (Shapes Constraint Language) support to the SPARQL Notebook extension.

Changes

  • Added Markdown cell support for enhanced documentation within notebooks
  • Integrated SHACL validation capabilities for RDF data
  • Updated dependencies and configuration

Testing

  • Unit tests updated and passing
  • Manual testing performed in VS Code environment

Notes

  • The extension vemonet.stardog-rdf-grammars was referenced but not available in the VS Code Marketplace. Switched back to stardog-union.stardog-rdf-grammars.
  • The SHACL implementation was originally developed over a year ago and has been re-applied to the latest version of the extension using Claude Code assistance.
  • The Markdown integration was implemented with Claude Code. The code has been reviewed and appears sound.
  • Introduced "shx" to be able to build under any platform including windows.

Details:

  • Created MarkdownNotebookSerializer to parse markdown files into notebook cells
  • SPARQL code blocks (```sparql) become executable SPARQL cells
  • SHACL code blocks (```shacl) become executable SHACL cells
  • Other code blocks remain as markdown content
  • Created MarkdownNotebookController for executing cells in markdown notebooks
  • Refactored cell execution logic into shared NotebookCellExecutor class
  • Added configuration setting sparqlbook.markdownIntegration.enabled (default: true)
  • Registered as optional notebook type with priority "option" (use "Open With...")
  • Added sample markdown file demonstrating the feature
  • Updated documentation with markdown integration instructions

Added tests and updated documentation for markdown integration:

  • Added comprehensive test suite for MarkdownNotebookSerializer
  • Tests cover SPARQL/SHACL parsing, mixed content, case-insensitive languages
  • Tests include execution against file endpoints
  • Updated README.md with markdown integration feature documentation
  • Added usage instructions and configuration options

Added support for SHACL validation:

  • In addition to SPARQL, SHACL is now available as a language in the code blocks.
    • enabling SHACL validation at /rw/shacl?graph=
  • SHACL must use the text/turtle syntax.
  • The result is in text/turtle format.
  • Tested against Apache Jena Fuseki 4.6 SHACL endpoint.
    • Following the guidelines at https://jena.apache.org/documentation/shacl/, the graph to be validated is encoded in the URL. Therefore, for SHACL, I recommend specifying the endpoint configuration as a comment in each code block.
    • Added fuseki:serviceShacl "shacl" to the read-write service endpoint,
  • Enable SHACL validation in test Fuseki configuration
  • Added tslib as dependency.
  • Extended file linking to support .shacl and .ttl files for SHACL cells
  • Updated add-query-from-file command to recognize SHACL files and set the correct language ID
  • Updated README.md with SHACL features in the feature list
  • Added comprehensive SHACL documentation section in doc/00_intro.md covering endpoint configuration, Apache Jena Fuseki integration, and file binding

Users specify the full endpoint URL including any query parameters directly in [endpoint=...]. This is simpler and more flexible since different SHACL endpoints may use different parameter names.

- Created MarkdownNotebookSerializer to parse markdown files into notebook cells
- SPARQL code blocks (```sparql) become executable SPARQL cells
- SHACL code blocks (```shacl) become executable SHACL cells
- Other code blocks remain as markdown content
- Created MarkdownNotebookController for executing cells in markdown notebooks
- Refactored cell execution logic into shared NotebookCellExecutor class
- Added configuration setting sparqlbook.markdownIntegration.enabled (default: true)
- Registered as optional notebook type with priority "option" (use "Open With...")
- Added sample markdown file demonstrating the feature
- Updated documentation with markdown integration instructions

Added tests and updated documentation for markdown integration:
- Added comprehensive test suite for MarkdownNotebookSerializer
- Tests cover SPARQL/SHACL parsing, mixed content, case-insensitive languages
- Tests include execution against file endpoints
- Updated README.md with markdown integration feature documentation
- Added usage instructions and configuration options

Introduced "shx" to be able to build under any platform including windows.

Added support for SHACL validation:
- In addition to SPARQL, SHACL is now available as a language in the code blocks.
  - enabling SHACL validation at /rw/shacl?graph=<target-graph>
- SHACL must use the text/turtle syntax.
- The result is in text/turtle format.
- Tested against Apache Jena Fuseki 4.6 SHACL endpoint.
  - Following the guidelines at https://jena.apache.org/documentation/shacl/, the graph to be validated is encoded in the URL. Therefore, for SHACL, I recommend specifying the endpoint configuration as a comment in each code block.
  - Added fuseki:serviceShacl "shacl" to the read-write service endpoint,
- Enable SHACL validation in test Fuseki configuration
- Added tslib as dependency.
- Extended file linking to support .shacl and .ttl files for SHACL cells
- Updated add-query-from-file command to recognize SHACL files and set
  the correct language ID
- Updated README.md with SHACL features in the feature list
- Added comprehensive SHACL documentation section in doc/00_intro.md
  covering endpoint configuration, Apache Jena Fuseki integration,
  and file binding

Users specify the full endpoint URL including any query parameters
directly in [endpoint=...]. This is simpler and more flexible since
different SHACL endpoints may use different parameter names.
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 3, 2026

⚠️ No Changeset found

Latest commit: b514a64

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@iwan-soptim
Copy link
Copy Markdown

This is a fantastic addition to the SPARQL Notebook extension! 🎉

The Markdown integration and SHACL support are exactly the kind of features that take this extension to the next level. Being able to mix documentation with executable SPARQL and SHACL cells directly in Markdown files will significantly improve my daily workflow when working with RDF data.

A few things I especially appreciate:

  • The Markdown cell support makes notebooks much more readable and shareable for documentation purposes
  • The SHACL validation integration is a huge win for anyone working with RDF shape constraints — having this directly in the notebook is a game changer
  • The comprehensive test suite and updated documentation show that this has been carefully implemented and thought through. I would love to see this merged — it will make working with RDF data and SPARQL so much more productive.

Thank you for the effort that went into this PR! 🙏

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.

2 participants