Skip to content

Replace SPARQL.js with Traqula (#429) - #563

Draft
namedgraph wants to merge 14 commits into
developfrom
feat/traqula
Draft

namedgraph wants to merge 14 commits into
developfrom
feat/traqula

Conversation

@namedgraph

Copy link
Copy Markdown
Member

Closes #429. Supersedes #534. It builds on @dajiaohuang's commit from #534, kept with its original author, and finishes the port.

What's here

  • The @traqula packages are pinned to the 1.4.0 stable release. traqula.min.js (253 KB) is rebuilt from the lockfile, so the bundle committed in Replace SPARQL.js with Traqula #534 doesn't ship.
  • The parser shim (src/main/js/sparql/index.js):
    • On parse, it expands prefixed names and BASE-relative IRIs to full IRIs. It also flattens [ … ] and ( … ) into plain triples.
    • On generate, it adds the source locations Traqula's generator needs. It also wraps UNION branches in groups and drops empty modifiers.
  • Blank nodes carry their name as Traqula's label. This is fixed in ParseQuery.term(), ldh:typed-term-node and ldh:term-node.
  • The port now covers everything Replace SPARQL.js with Traqula #534 left on the SPARQL.js shape:
    • views: paging, sort, facets, ldh:alt-path-uris, parallax;
    • the constructor editor;
    • chart save, block add, creating an instance from a view, the modal's filters, and resource removal;
    • the VALUES callers.
  • Stale SPARQL.js references are updated in tests, comments and the README.

Verified

  • client.xsl compiles to SEF with the Dockerfile's xslt3-he. The server layout.xsl and admin/layout.xsl compile with Saxon-HE 12.9.
  • The shim's tests pass (8/8), and so does ParseQueryTest (3/3).
  • I ran 24 query rewrites end to end: parsed by the shim, transformed by the real query-transforms.xsl, generated, then parsed by Jena and read. They cover paging, count, the container select, parallax, link predicates, facet counts, IN, ORDER BY, VALUES, regex escaping and constructor triples.
  • All npm and esbuild steps ran in throwaway containers.

Not verified (why this is a draft)

  • Nothing has run in Saxon-JS or a browser yet. Before merging, run these ui-tests:

    • document/blocks/view/*, document/blocks/chart/*, document/blocks/map, document/blocks/query;
    • forms/*;
    • overlays/modal/constructor-editor, document-form, delete-document, settings;
    • shell/drawer/class-list, saved-views, document-tree/*;
    • document/content-aside/concept-tree.

    Then run make tests, including static/content-type-charset.sh and signup.sh.

  • Traqula parses more strictly than SPARQL.js, and stored view queries haven't been checked against it.

  • Generated queries print full IRIs with no PREFIX declarations, so GET query strings get longer.

  • Table chart pagination (#219) and text-search facet (#99) #562 adds new rewrites in query-transforms.xsl that use the SPARQL.js shape. Whichever of the two PRs merges second has to port them.

🤖 Generated with Claude Code

dajiaohuang and others added 14 commits November 18, 2026 22:09
…im hands the stylesheets flat triples with full IRIs and fills in the source locations and query members the generator needs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s label, so the generator prints it and constructor instances, value-range markers and RDF/XML descriptions find it

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…raqula's AST, and its rewrites build EXISTS, IN and DESC the way Traqula's generator prints them

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ilds the CONSTRUCT it saves, in Traqula's AST

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ting in a modal and removing a resource build their triples and updates in Traqula's AST

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…able name, as Traqula keys VALUES rows

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he parser shim adds when it generates the query

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…a as the browser's SPARQL parser, and the CHANGELOG records the switch

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…attern, a match pattern Saxon-HE compiles as well as Saxon-JS

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e Traqula port had keyed by its JSON node

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… a template triple, so the add-row button, which calls it from the HTML form, no longer passes the button to ldh:term-key

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The inline-creation submit keeps develop's containment check and derived title, with the linking
and title triples built as Traqula terms. The text-search rewrite from #556 is ported to the
Traqula shape: the bgp goes into where/patterns, and the query literal is no longer escaped by
hand, since Traqula's generator escapes it on output. The constructor VALUES keeps develop's
$for-class name and Traqula's sigil-less key.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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