Repository navigation
Keep the examples as .ttl files with identifiers, versions and metadata - #35
Merged
Merged
Conversation
collection.ttl describes the set of examples: its IRI base https://sparql.wikipathways.org/.well-known/sparql-examples/ and the identifier prefix WPQ. categories.ttl replaces categories.json as a SKOS scheme, with the old folders as subcategories. contributors.ttl gives a name for every creator and contributor IRI.
Each .rq file gets a .ttl file next to it in the format of SIB's
sparql-examples, made by scripts/migrate_rq_to_ttl.py:
- identifier WPQnnn, using the number the query already has in
BiGCAT-UM/sparql-examples, so the two map one to one; the two neXtProt
queries, which had no number, get WPQ084 and WPQ085 and are marked
deprecated because their endpoint has been archived;
- version 1.0.0, creation date, creator and contributors from git history,
category, keywords, and the .rq path as snorql:alias so old links work;
- every {{param}} becomes a query variable bound to its default in a
VALUES block, and the parameter a sh:Parameter, so each query is valid
SPARQL as it is; the PREFIX lines Virtuoso does not need are added.
scripts/compare_live.py ran every old and new query against the endpoint:
all 60 give the same columns and rows, except the LIPID MAPS one, which
fails before and after because lipidmaps.org returns 502.
The .rq files stay until the query editor reads the new index.
23 examples written for the BiGCaT examples site, most of them from the queries on the WikiPathways website pages (sparql, federated and metabolome). With them every WPQ example is in this repository, and the BiGCaT site can copy from here. They keep their numbers; the queries from the website are credited to the WikiPathways team.
examples.yml calls the reusable workflow of wikipathways/Snorql-UI. On every pull request it checks the .ttl files (format, identifiers, VALUES blocks, categories, names), runs SIB's sparql-examples-utils test and checks that every changed example got a higher version. On master it publishes the examples-index branch the query editor reads: index.json, history.json, a snapshot of every version, all examples in one Turtle file, and .rq copies with the old header. live-test.yml runs every example against the endpoint once a week and checks snorql:expect. The .ttl-to-.rq workflow and its scripts go: the .ttl files are now the source and nothing writes .rq files on master any more. commit-index.yml keeps running for links pinned to older .rq versions.
AUTHORING.md replaces HEADER_CONVENTIONS.md: a template for a new example, the fields, parameters as VALUES blocks, version rules, deprecation instead of deletion, and how to run the checks. CITATION.cff for releases.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This makes Turtle files the source of the examples, as discussed in #23 and #26. Next to each .rq file there is now a .ttl file in SIB's sparql-examples format, with a permanent identifier (WPQ001 to WPQ085), version 1.0.0, creators and contributors, category, keywords and parameters. The editor side is wikipathways/Snorql-UI#40.
The identifiers reuse the numbers the queries already have in BiGCAT-UM/sparql-examples, and the IRIs are https://sparql.wikipathways.org/.well-known/sparql-examples/WPQnnn. That means files can be moved or renamed from now on. Where an example shows up in the editor comes from the category in the file, and old
?example=<path>.rqlinks still work through snorql:alias.Parameters are now VALUES blocks with the default value, so every query also runs outside the editor. scripts/compare_live.py ran each old and new query against the endpoint. The 60 that could be compared return the same columns and rows. The LIPID MAPS query fails before and after, because lipidmaps.org returns 502. One oddity: in WPQ060 (protein titles and identifiers for metabolic reactions) Virtuoso's answer depends on where the VALUES block is. I put it at the end of the group, where the result matches the old query, but both versions miss some valid rows. That looks like a Virtuoso problem and probably deserves its own issue.
I also imported the 23 examples that only existed on the BiGCaT site, mostly the queries from the website pages. They are in a separate commit in case you'd rather leave them out. The two neXtProt queries stay but are marked deprecated, since their endpoint is archived. categories.ttl replaces categories.json, AUTHORING.md replaces HEADER_CONVENTIONS.md, and the .ttl-to-.rq workflow is removed.
examples.yml checks every pull request (format, version bumps, SIB's test) and publishes the examples-index branch from master. live-test.yml runs all examples once a week and compares with snorql:expect. Today it would flag WPQ019, WPQ027, WPQ033 and WPQ034, which return nothing.
Please look at the creators. They come from git history, and for most files that starts at the 2020 restructure, so several examples credit whoever moved them rather than whoever wrote them. The workflows point at the Snorql-UI PR branch for now and need pinning to v1.4.0 after that release. The .rq files stay until the editor reads the index; a follow-up PR will remove them.