Skip to content

Commit

Permalink
SPARQL example template repository
Browse files Browse the repository at this point in the history
  • Loading branch information
JervenBolleman committed Nov 12, 2024
0 parents commit 18c406f
Show file tree
Hide file tree
Showing 9 changed files with 308 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Check SPARQL queries
on: [push, pull_request, workflow_call, workflow_dispatch]

jobs:

check:
name: Run SPARQL checks
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'

- name: Install tester
run: wget "https://github.com/sib-swiss/sparql-examples-utils/releases/download/v2.0.6/sparql-examples-utils-2.0.6-uber.jar" -O sparql-examples-utils.jar

- name: Run tests
run: java -jar sparql-examples-utils.jar test --input-directory=examples/
66 changes: 66 additions & 0 deletions .github/workflows/publish_github_pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Publishes the Markdown pages.
name: Publish to github-pages

on:
push:
branches: [ "master" ]

workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
publish_html:
name: "publish html"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'

- name: Install tester
run: wget "https://github.com/sib-swiss/sparql-examples-utils/releases/download/v2.0.6/sparql-examples-utils-2.0.6-uber.jar" -O sparql-examples-utils-uber.jar

- name: generate markdown
run: java -jar sparql-examples-utils-uber.jar convert -i examples/ -m

- name: generate rq files
run: java -jar sparql-examples-utils-uber.jar convert -i examples/ -r

- name: Setup Pages
id: pages
uses: actions/configure-pages@v5

- name: Build with Jekyll
uses: actions/jekyll-build-pages@v1
with:
source: ./
destination: ./_site

- name: Upload artifact
uses: actions/upload-pages-artifact@v3

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: publish_html
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
65 changes: 65 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
cff-version: 1.2.0
message: "If you use this software, please cite it as below."
title: "A large collection of bioinformatics question-query pairs over federated knowledge graphs: methodology and applications"
repository-code: https://github.com/sib-swiss/sparql-examples-utils
date-released: 2024-10-08
doi: 10.48550/arXiv.2410.06010
license: MIT
authors:
- given-names: Jerven
family-names: Bolleman
orcid: https://orcid.org/0000-0002-7449-1266,
email: [email protected]
affiliation: SIB Swiss Institute of Bioinformatics
- given-names: Vincent
family-names: Emonet
orcid: https://orcid.org/0000-0002-1501-1082
affiliation: SIB Swiss Institute of Bioinformatics
- given-names: Adrian
family-names: Altenhoff
affiliation: SIB Swiss Institute of Bioinformatics
- given-names: Amos
family-names: Bairoch
affiliation: SIB Swiss Institute of Bioinformatics
- given-names: Marie-Claude
family-names: Blatter
affiliation: SIB Swiss Institute of Bioinformatics
- given-names: Alan
family-names: Bridge
affiliation: SIB Swiss Institute of Bioinformatics
- given-names: Severine
family-names: Duvaud
orcid: https://orcid.org/0000-0001-7892-9678
affiliation: SIB Swiss Institute of Bioinformatics
- given-names: Elisabeth
family-names: Gasteiger
affiliation: SIB Swiss Institute of Bioinformatics
- given-names: Dmitry
family-names: Kuznetsov
affiliation: SIB Swiss Institute of Bioinformatics
- given-names: Sebastien
family-names: Moretti
affiliation: SIB Swiss Institute of Bioinformatics
- given-names: Pierre-Andre
family-names: Michel
affiliation: SIB Swiss Institute of Bioinformatics
- given-names: Anne
family-names: Morgat
affiliation: SIB Swiss Institute of Bioinformatics
- given-names: Marco
family-names: Pagni
affiliation: SIB Swiss Institute of Bioinformatics
- given-names: Nicole
family-names: Redaschi
affiliation: SIB Swiss Institute of Bioinformatics
- given-names: Monique
family-names: Zahn-Zabal
affiliation: SIB Swiss Institute of Bioinformatics
- given-names: Tarcisio
family-names: Mendes de Farias
orcid: https://orcid.org/0000-0002-3175-5372
affiliation: SIB Swiss Institute of Bioinformatics
- given-names: Ana Claudia
family-names: Sima
orcid: https://orcid.org/0000-0003-3213-4495
affiliation: SIB Swiss Institute of Bioinformatics
22 changes: 22 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
All example queries are dual licensed under [CC-BY 4.0](https://creativecommons.org/licenses/by/4.0/) and the MIT license as included below. The code arround the sparql-examples under src/ is only licensed under the MIT license included below.

The MIT License (MIT)

Copyright (c) 2024 SIB Swiss Institute of Bioinformatics

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# SPARQL examples template repository

This is a template repository to help you get started with sharing your sparql examples in a structured maner.


The idea comes from the [SIB SPARQL Examples](https://github.com/sib-swiss/sparql-examples/) project.

# Upon forking

Change YOUR\_PROJECT to what you need it to be, adapt the index.md files.
Add your prefixes.ttl and examples in \*.ttl files.
Correct the LICSENSE.md and CITATION.cff to account for your project.


# For more inspiration see

* [SIB Sparql Examples](https://github.com/sib-swiss/sparql-examples/)
* [Wikibase Examples](https://github.com/JervenBolleman/wikibase-sparql-examples/)
* [BiGCAT-UM](https://github.com/BiGCAT-UM/sparql-examples)

# The QA and markdown

Can be found in the project [SIB SPARQL Examples Utils](https://github.com/sib-swiss/sparql-examples-utils/

8 changes: 8 additions & 0 deletions _includes/mermaid.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<script type="module">
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs';

mermaid.initialize({ startOnLoad: false });
await mermaid.run({
querySelector: '.language-mermaid',
});
</script>
57 changes: 57 additions & 0 deletions _layouts/default.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<!DOCTYPE html>
<html lang="{{ site.lang | default: "en-US" }}">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">

{% seo %}
<link rel="stylesheet" href="{{ "/assets/css/style.css?v=" | append: site.github.build_revision | relative_url }}">
<!--[if lt IE 9]>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
<![endif]-->
{% include head-custom.html %}
</head>
<body>
<div class="wrapper">
<header>
<h1><a href="{{ "/" | absolute_url }}">{{ site.title | default: site.github.repository_name }}</a></h1>

{% if site.logo %}
<img src="{{site.logo | relative_url}}" alt="Logo" />
{% endif %}

<p>{{ site.description | default: site.github.project_tagline }}</p>

{% if site.github.is_project_page %}
<p class="view"><a href="{{ site.github.repository_url }}">View the Project on GitHub <small>{{ site.github.repository_nwo }}</small></a></p>
{% endif %}

{% if site.github.is_user_page %}
<p class="view"><a href="{{ site.github.owner_url }}">View My GitHub Profile</a></p>
{% endif %}

{% if site.show_downloads %}
<ul class="downloads">
<li><a href="{{ site.github.zip_url }}">Download <strong>ZIP File</strong></a></li>
<li><a href="{{ site.github.tar_url }}">Download <strong>TAR Ball</strong></a></li>
<li><a href="{{ site.github.repository_url }}">View On <strong>GitHub</strong></a></li>
</ul>
{% endif %}
</header>
<section>

{{ content }}

</section>
<footer>
{% if site.github.is_project_page %}
<p>This project is maintained by <a href="{{ site.github.owner_url }}">{{ site.github.owner_name }}</a></p>
{% endif %}
<p><small>Hosted on GitHub Pages &mdash; Theme by <a href="https://github.com/orderedlist">orderedlist</a></small></p>
</footer>
</div>
{% include mermaid.html %}
<script src="{{ "/assets/js/scale.fix.js" | relative_url }}"></script>
</body>
</html>
33 changes: 33 additions & 0 deletions examples/prefixes.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
prefix sh: <http://www.w3.org/ns/shacl#>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>
prefix owl: <http://www.w3.org/2002/07/owl#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>

_:sparql_examples_prefixes
a owl:Ontology ;
owl:imports sh: .

_:sparql_examples_prefixes sh:declare _:prefix_rdf .
_:prefix_rdf
sh:prefix "rdf" ;
sh:namespace "http://www.w3.org/1999/02/22-rdf-syntax-ns#"^^xsd:anyURI .

_:sparql_examples_prefixes sh:declare _:prefix_rdfs .
_:prefix_rdfs
sh:prefix "rdfs" ;
sh:namespace "http://www.w3.org/2000/01/rdf-schema#"^^xsd:anyURI .

_:sparql_examples_prefixes sh:declare _:prefix_skos .
_:prefix_skos
sh:prefix "skos" ;
sh:namespace "http://www.w3.org/2004/02/skos/core#"^^xsd:anyURI .

_:sparql_examples_prefixes sh:declare _:prefix_owl .
_:prefix_owl
sh:prefix "owl" ;
sh:namespace "http://www.w3.org/2002/07/owl#"^^xsd:anyURI .

_:sparql_examples_prefixes sh:declare _:prefix_xsd .
_:prefix_xsd
sh:prefix "xsd" ;
sh:namespace "http://www.w3.org/2001/XMLSchema#"^^xsd:anyURI .
11 changes: 11 additions & 0 deletions index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# SPARQL examples

Edit this file to change YOUR\_PROJECT to the name of your actual project.
In YOUR\_PROJECT. In that directory keep your project specific prefixes.ttl and
the ttl files containing your example queries.

* [YOUR PROJECT](./examples/YOUR_PROJECT/)

# Examples

* [SIB Swiss Institute of Bioinformatics](https://sib-swiss.github.io/sparql-examples/)

0 comments on commit 18c406f

Please sign in to comment.