Skip to content

Commit

Permalink
Merge pull request #164 from obophenotype/odk15-migration
Browse files Browse the repository at this point in the history
ODK 1.5 migration
matentzn authored Apr 21, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents b7d3a44 + e260766 commit 31ca267
Showing 17 changed files with 334 additions and 109 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/qc.yml
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ name: CI

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
pull_request:
@@ -19,12 +19,12 @@ jobs:
ontology_qc:
# The type of runner that the job will run on
runs-on: ubuntu-latest
container: obolibrary/odkfull:v1.3.0
container: obolibrary/odkfull:v1.5

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Run ontology QC checks
env:
306 changes: 215 additions & 91 deletions src/ontology/Makefile

Large diffs are not rendered by default.

83 changes: 79 additions & 4 deletions src/ontology/run.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -8,22 +8,97 @@
# The assumption is that you are working in the src/ontology folder;
# we therefore map the whole repo (../..) to a docker volume.
#
# To use singularity instead of docker, please issue
# export USE_SINGULARITY=<any-value>
# before running this script.
#
# See README-editors.md for more details.

IMAGE=${IMAGE:-odkfull}
ODK_JAVA_OPTS=-Xmx8G
set -e

if [ -f run.sh.conf ]; then
. ./run.sh.conf
fi

# Look for a GitHub token
if [ -n "$GH_TOKEN" ]; then
:
elif [ -f ../../.github/token.txt ]; then
GH_TOKEN=$(cat ../../.github/token.txt)
elif [ -f $XDG_CONFIG_HOME/ontology-development-kit/github/token ]; then
GH_TOKEN=$(cat $XDG_CONFIG_HOME/ontology-development-kit/github/token)
elif [ -f "$HOME/Library/Application Support/ontology-development-kit/github/token" ]; then
GH_TOKEN=$(cat "$HOME/Library/Application Support/ontology-development-kit/github/token")
fi

# SSH agent socket
# On macOS, we cannot use $SSH_AUTH_SOCK directly,
# we need to use a "magic" socket instead.
case "$(uname)" in
Darwin)
ODK_SSH_AUTH_SOCKET=/run/host-services/ssh-auth.sock
;;
*)
ODK_SSH_AUTH_SOCKET=$SSH_AUTH_SOCK
;;
esac
ODK_SSH_BIND=
if [ -n "$ODK_SSH_AUTH_SOCKET" ]; then
ODK_SSH_BIND=",$ODK_SSH_AUTH_SOCKET:/run/host-services/ssh-auth.sock"
fi

ODK_IMAGE=${ODK_IMAGE:-odkfull}
TAG_IN_IMAGE=$(echo $ODK_IMAGE | awk -F':' '{ print $2 }')
if [ -n "$TAG_IN_IMAGE" ]; then
# Override ODK_TAG env var if IMAGE already includes a tag
ODK_TAG=$TAG_IN_IMAGE
ODK_IMAGE=$(echo $ODK_IMAGE | awk -F':' '{ print $1 }')
fi
ODK_TAG=${ODK_TAG:-latest}
ODK_JAVA_OPTS=${ODK_JAVA_OPTS:--Xmx8G}
ODK_DEBUG=${ODK_DEBUG:-no}

ODK_USER_ID=${ODK_USER_ID:-$(id -u)}
ODK_GROUP_ID=${ODK_GROUP_ID:-$(id -g)}

# Convert OWLAPI_* environment variables to the OWLAPI as Java options
# See http://owlcs.github.io/owlapi/apidocs_4/org/semanticweb/owlapi/model/parameters/ConfigurationOptions.html
# for a list of allowed options
OWLAPI_OPTIONS_NAMESPACE=org.semanticweb.owlapi.model.parameters.ConfigurationOptions
for owlapi_var in $(env | sed -n s/^OWLAPI_//p) ; do
ODK_JAVA_OPTS="$ODK_JAVA_OPTS -D$OWLAPI_OPTIONS_NAMESPACE.${owlapi_var%=*}=${owlapi_var#*=}"
done

TIMECMD=
if [ x$ODK_DEBUG = xyes ]; then
# If you wish to change the format string, take care of using
# non-breaking spaces (U+00A0) instead of normal spaces, to
# prevent the shell from tokenizing the format string.
echo "Running ${IMAGE} with ${ODK_JAVA_OPTS} of memory for ROBOT and Java-based pipeline steps."
echo "Running obolibrary/${ODK_IMAGE}:${ODK_TAG} with '${ODK_JAVA_OPTS}' as options for ROBOT and other Java-based pipeline steps."
TIMECMD="/usr/bin/time -f ### DEBUG STATS ###\nElapsed time: %E\nPeak memory: %M kb"
fi
rm -f tmp/debug.log

docker run -v $PWD/../../:/work -w /work/src/ontology -e ROBOT_JAVA_ARGS="$ODK_JAVA_OPTS" -e JAVA_OPTS="$ODK_JAVA_OPTS" --rm -ti obolibrary/$IMAGE $TIMECMD "$@"
VOLUME_BIND=$PWD/../../:/work$ODK_SSH_BIND
WORK_DIR=/work/src/ontology

if [ -n "$ODK_BINDS" ]; then
VOLUME_BIND="$VOLUME_BIND,$ODK_BINDS"
fi

if [ -n "$USE_SINGULARITY" ]; then

singularity exec --cleanenv $ODK_SINGULARITY_OPTIONS \
--env "ROBOT_JAVA_ARGS=$ODK_JAVA_OPTS,JAVA_OPTS=$ODK_JAVA_OPTS,SSH_AUTH_SOCK=/run/host-services/ssh-auth.sock,ODK_USER_ID=$ODK_USER_ID,ODK_GROUP_ID=$ODK_GROUP_ID,ODK_DEBUG=$ODK_DEBUG" \
--bind $VOLUME_BIND \
-W $WORK_DIR \
docker://obolibrary/$ODK_IMAGE:$ODK_TAG $TIMECMD "$@"
else
BIND_OPTIONS="-v $(echo $VOLUME_BIND | sed 's/,/ -v /')"
docker run $ODK_DOCKER_OPTIONS $BIND_OPTIONS -w $WORK_DIR \
-e ROBOT_JAVA_ARGS="$ODK_JAVA_OPTS" -e JAVA_OPTS="$ODK_JAVA_OPTS" -e SSH_AUTH_SOCK=/run/host-services/ssh-auth.sock -e ODK_USER_ID=$ODK_USER_ID -e ODK_GROUP_ID=$ODK_GROUP_ID -e ODK_DEBUG=$ODK_DEBUG \
--rm -ti obolibrary/$ODK_IMAGE:$ODK_TAG $TIMECMD "$@"
fi

case "$@" in
*update_repo*|*release*)
1 change: 1 addition & 0 deletions src/ontology/xpo-odk.yaml
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ title: "Xenopus Phenotype Ontology"
github_org: obophenotype
repo: xenopus-phenotype-ontology
report_fail_on: ERROR
git_main_branch: master
use_dosdps: TRUE
dosdp_tools_options: "--obo-prefixes=true"
namespaces:
4 changes: 4 additions & 0 deletions src/scripts/run-command.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
ODK_DEBUG_FILE=${ODK_DEBUG_FILE:-debug.log}
echo "Command: sh $@" >> $ODK_DEBUG_FILE
/usr/bin/time -a -o $ODK_DEBUG_FILE -f "Elapsed time: %E\nPeak memory: %M kb" /bin/sh "$@"
5 changes: 3 additions & 2 deletions src/scripts/update_repo.sh
Original file line number Diff line number Diff line change
@@ -21,10 +21,11 @@ cp target/$OID/src/ontology/run.sh $SRCDIR/ontology/
cp -r target/$OID/src/sparql/* $SRCDIR/sparql/
mkdir -p $ROOTDIR/.github
mkdir -p $ROOTDIR/.github/workflows
cp -n target/$OID/.github/workflows/qc.yml $ROOTDIR/.github/workflows/qc.yml
cp target/$OID/.github/workflows/qc.yml $ROOTDIR/.github/workflows/qc.yml




echo "WARNING: These files should be manually migrated: mkdocs.yaml, .gitignore, src/ontology/catalog.xml (if you added a new import or component)"
echo "WARNING: Your QC workflows have not been updated automatically. Please update the ODK version number(s) in .github/workflows/qc.yml."

echo "Ontology repository update successfully completed."
11 changes: 11 additions & 0 deletions src/sparql/dc-properties-violation.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# The purpose of this violation is to make sure people update
# from using the deprecated DC Elements 1.1 namespace (http://purl.org/dc/elements/1.1/)
# to using the recommended DC Terms namespace (http://purl.org/dc/terms/)
# See also discussion on https://github.com/oborel/obo-relations/pull/692

SELECT ?term ?predicate WHERE {
?term ?predicate ?value .
FILTER(STRSTARTS(STR(?predicate), "http://purl.org/dc/elements/1.1/"))
FILTER(isIRI(?term) && (STRSTARTS(str(?term), "http://purl.obolibrary.org/obo/XPO_")))
}

1 change: 0 additions & 1 deletion src/sparql/edges.sparql
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
prefix obo: <http://purl.obolibrary.org/obo/>
prefix owl: <http://www.w3.org/2002/07/owl#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
2 changes: 1 addition & 1 deletion src/sparql/inject-subset-declaration.ru
Original file line number Diff line number Diff line change
@@ -7,5 +7,5 @@ INSERT { ?y rdfs:subPropertyOf <http://www.geneontology.org/formats/oboInOwl#Sub
WHERE {
?x <http://www.geneontology.org/formats/oboInOwl#inSubset> ?y .
FILTER(isIRI(?y))
FILTER(regex(str(?y),"^(http://purl.obolibrary.org/obo/)") || regex(str(?y),"^(http://www.ebi.ac.uk/efo/)") || regex(str(?y),"^(https://w3id.org/biolink/)"))
FILTER(regex(str(?y),"^(http://purl.obolibrary.org/obo/)") || regex(str(?y),"^(http://www.ebi.ac.uk/efo/)") || regex(str(?y),"^(https://w3id.org/biolink/)") || regex(str(?y),"^(http://purl.obolibrary.org/obo)"))
}
2 changes: 1 addition & 1 deletion src/sparql/inject-synonymtype-declaration.ru
Original file line number Diff line number Diff line change
@@ -7,5 +7,5 @@ INSERT { ?y rdfs:subPropertyOf <http://www.geneontology.org/formats/oboInOwl#Syn
WHERE {
?x <http://www.geneontology.org/formats/oboInOwl#hasSynonymType> ?y .
FILTER(isIRI(?y))
FILTER(regex(str(?y),"^(http://purl.obolibrary.org/obo/)") || regex(str(?y),"^(http://www.ebi.ac.uk/efo/)") || regex(str(?y),"^(https://w3id.org/biolink/)"))
FILTER(regex(str(?y),"^(http://purl.obolibrary.org/obo/)") || regex(str(?y),"^(http://www.ebi.ac.uk/efo/)") || regex(str(?y),"^(https://w3id.org/biolink/)") || regex(str(?y),"^(http://purl.obolibrary.org/obo)"))
}
2 changes: 1 addition & 1 deletion src/sparql/iri-range-violation.sparql
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ WHERE {
oboInOwl:inSubset
dcterms:contributor }
?term ?property ?value .
FILTER(isIRI(?term) && (STRSTARTS(str(?term), "http://purl.obolibrary.org/obo/XPO_") || STRSTARTS(str(?term), "http://purl.obolibrary.org/obo/XPO_")))
FILTER(isIRI(?term) && (STRSTARTS(str(?term), "http://purl.obolibrary.org/obo/XPO_")))
FILTER (!isIRI(?value))
}

2 changes: 1 addition & 1 deletion src/sparql/label-with-iri-violation.sparql
Original file line number Diff line number Diff line change
@@ -4,6 +4,6 @@ SELECT ?term ?value
WHERE {
?term rdfs:label ?value .
FILTER (REGEX(?value, "http[s]?[:]"))
FILTER(isIRI(?term) && (STRSTARTS(str(?term), "http://purl.obolibrary.org/obo/XPO_") || STRSTARTS(str(?term), "http://purl.obolibrary.org/obo/XPO_")))
FILTER(isIRI(?term) && (STRSTARTS(str(?term), "http://purl.obolibrary.org/obo/XPO_")))
}

12 changes: 12 additions & 0 deletions src/sparql/multiple-replaced_by-violation.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
PREFIX replaced_by: <http://purl.obolibrary.org/obo/IAO_0100001>

SELECT DISTINCT ?entity ?property ?value WHERE {
VALUES ?property {
replaced_by:
}
?entity ?property ?value1 .
?entity ?property ?value2 .
FILTER(?value1!=?value2)
BIND(CONCAT(str(?value1), CONCAT("|", str(?value2))) as ?value)
}

2 changes: 1 addition & 1 deletion src/sparql/owldef-self-reference-violation.sparql
Original file line number Diff line number Diff line change
@@ -7,6 +7,6 @@ SELECT ?term WHERE {
{ ?term owl:equivalentClass [ owl:intersectionOf [ rdf:rest*/rdf:first ?term ] ] }
UNION
{ ?term owl:equivalentClass [ owl:intersectionOf [ rdf:rest*/rdf:first [ owl:someValuesFrom ?term ] ] ] }
FILTER(isIRI(?term) && (STRSTARTS(str(?term), "http://purl.obolibrary.org/obo/XPO_") || STRSTARTS(str(?term), "http://purl.obolibrary.org/obo/XPO_")))
FILTER(isIRI(?term) && (STRSTARTS(str(?term), "http://purl.obolibrary.org/obo/XPO_")))
}

1 change: 0 additions & 1 deletion src/sparql/simple-seed.sparql
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
prefix owl: <http://www.w3.org/2002/07/owl#>
prefix obo: <http://purl.obolibrary.org/obo/>

SELECT DISTINCT ?cls WHERE
{
1 change: 0 additions & 1 deletion src/sparql/subsets-labeled.sparql
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
prefix oio: <http://www.geneontology.org/formats/oboInOwl#>
prefix def: <http://purl.obolibrary.org/obo/IAO_0000115>
prefix owl: <http://www.w3.org/2002/07/owl#>
prefix inSubset: <http://www.geneontology.org/formats/oboInOwl#inSubset>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
2 changes: 1 addition & 1 deletion src/sparql/xpo_terms.sparql
Original file line number Diff line number Diff line change
@@ -3,5 +3,5 @@ WHERE {
{ ?s1 ?p1 ?term . }
UNION
{ ?term ?p2 ?o2 . }
FILTER(isIRI(?term) && (STRSTARTS(str(?term), "http://purl.obolibrary.org/obo/XPO_") || STRSTARTS(str(?term), "http://purl.obolibrary.org/obo/XPO_")))
FILTER(isIRI(?term) && (STRSTARTS(str(?term), "http://purl.obolibrary.org/obo/XPO_")))
}

0 comments on commit 31ca267

Please sign in to comment.