Skip to content

Commit f30a276

Browse files
authored
Merge pull request #216 from BAMresearch/ghpagesupdate
Ontology pages
2 parents 91c3fc8 + df34e9c commit f30a276

File tree

3 files changed

+68
-4
lines changed

3 files changed

+68
-4
lines changed

.github/workflows/GHPagesOntology.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Deploy
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
ontology_path:
7+
description: 'Relative path to the ontology file'
8+
required: true
9+
default: 'lebedigital/ConcreteOntology/BaseOntology/ConcreteProductionAndTestingOntology.owl'
10+
11+
jobs:
12+
deploy:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v3
16+
with:
17+
path: repo
18+
19+
- name: Install dependencies
20+
run: |
21+
pip install rdflib
22+
wget -O widoco.jar https://github.com/dgarijo/Widoco/releases/download/v1.4.17/java-11-widoco-1.4.17-jar-with-dependencies.jar
23+
24+
- name: Get ontology version
25+
run: |
26+
echo "ONTOLOGY_FILE_PATH=${{ github.event.inputs.ontology_path }}"
27+
echo "ONTO_VERSION=$(python repo/.github/workflows/get_ontoversion.py $ONTOLOGY_FILE_PATH)" >> "$GITHUB_ENV"
28+
29+
- name: Build HTML for ontology
30+
run: |
31+
mkdir -p public/v$ONTO_VERSION
32+
java -jar widoco.jar -ontFile $ONTOLOGY_FILE_PATH -outFolder public/v$ONTO_VERSION -htaccess -uniteSections -includeAnnotationProperties -lang en-de -getOntologyMetadata -noPlaceHolderText -rewriteAll -webVowl
33+
cp public/v$ONTO_VERSION/index-en.html public/v$ONTO_VERSION/index.html
34+
35+
- name: Deploy to GitHub Pages
36+
if: success()
37+
uses: crazy-max/ghaction-github-pages@v3
38+
with:
39+
target_branch: gh-pages
40+
build_dir: public
41+
keep_history: true
42+
env:
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/get_ontoversion.py

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
"""
2+
Get version of an ontology
3+
"""
4+
import argparse
5+
import rdflib
6+
7+
parser = argparse.ArgumentParser(prog='get_ontoversion', description='Get version of an ontology')
8+
parser.add_argument('ontology_file', help='Location of the ontology file')
9+
args = parser.parse_args()
10+
11+
g = rdflib.Graph()
12+
g.parse(location=args.ontology_file)
13+
14+
# Get first URI and version of the ontology (assuming there is only one)
15+
QUERY_OBJECT="""
16+
PREFIX owl: <http://www.w3.org/2002/07/owl#>
17+
SELECT ?s ?o WHERE {
18+
?s a owl:Ontology ;
19+
owl:versionInfo ?o .
20+
}
21+
LIMIT 1
22+
"""
23+
for row in g.query(QUERY_OBJECT):
24+
print(row.o)
25+
break

.github/workflows/lebedigital.yml

-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ on:
99
# Allows you to run this workflow manually from the Actions tab
1010
workflow_dispatch:
1111

12-
# Runs the workflow once per day at 3:15am
13-
schedule:
14-
- cron: '3 15 * * *'
15-
1612
env:
1713
CACHE_NUMBER: 2 # increase to reset cache manually
1814

0 commit comments

Comments
 (0)