Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ODK 14 migration #169

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/qc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ 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.4

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
Expand Down
209 changes: 137 additions & 72 deletions src/ontology/Makefile

Large diffs are not rendered by default.

56 changes: 54 additions & 2 deletions src/ontology/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,70 @@
# 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}
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

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}

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."
TIMECMD="/usr/bin/time -f ### DEBUG STATS ###\nElapsed time: %E\nPeak memory: %M kb"
fi

docker run -v $PWD/../../:/work -w /work/src/ontology -e ROBOT_JAVA_ARGS='-Xmx8G' -e JAVA_OPTS='-Xmx8G' --rm -ti obolibrary/$IMAGE $TIMECMD "$@"
VOLUME_BIND=$PWD/../../:/work
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" \
--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" \
--rm -ti obolibrary/$ODK_IMAGE:$ODK_TAG $TIMECMD "$@"
fi

case "$@" in
*update_repo*|*release*)
echo "Please remember to update your ODK image from time to time: https://oboacademy.github.io/obook/howto/odk-update/."
;;
esac
4 changes: 3 additions & 1 deletion src/scripts/update_repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,7 @@ mkdir -p $ROOTDIR/.github/workflows
cp -n 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 "Update successfully completed."
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."
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#>
Expand Down
2 changes: 1 addition & 1 deletion src/sparql/inject-subset-declaration.ru
Original file line number Diff line number Diff line change
Expand Up @@ -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)"))
}
11 changes: 11 additions & 0 deletions src/sparql/inject-synonymtype-declaration.ru
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
PREFIX : <http://www.test.com/ns/test#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

INSERT { ?y rdfs:subPropertyOf <http://www.geneontology.org/formats/oboInOwl#SynonymTypeProperty> . }

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/)") || 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
Expand Up @@ -13,7 +13,7 @@ WHERE {
oboInOwl:inSubset
dcterms:contributor }
?term ?property ?value .
FILTER(isIRI(?term) && (STRSTARTS(str(?term), "http://purl.obolibrary.org/obo/ZFA_") || STRSTARTS(str(?term), "http://purl.obolibrary.org/obo/ZFA_") || STRSTARTS(str(?term), "http://purl.obolibrary.org/obo/zfa.owl") || STRSTARTS(str(?term), "http://purl.obolibrary.org/obo/ZFS_")))
FILTER(isIRI(?term) && (STRSTARTS(str(?term), "http://purl.obolibrary.org/obo/ZFA_") || STRSTARTS(str(?term), "http://purl.obolibrary.org/obo/zfa.owl") || STRSTARTS(str(?term), "http://purl.obolibrary.org/obo/ZFS_")))
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
Expand Up @@ -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/ZFA_") || STRSTARTS(str(?term), "http://purl.obolibrary.org/obo/ZFA_") || STRSTARTS(str(?term), "http://purl.obolibrary.org/obo/zfa.owl") || STRSTARTS(str(?term), "http://purl.obolibrary.org/obo/ZFS_")))
FILTER(isIRI(?term) && (STRSTARTS(str(?term), "http://purl.obolibrary.org/obo/ZFA_") || STRSTARTS(str(?term), "http://purl.obolibrary.org/obo/zfa.owl") || STRSTARTS(str(?term), "http://purl.obolibrary.org/obo/ZFS_")))
}

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
Expand Up @@ -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/ZFA_") || STRSTARTS(str(?term), "http://purl.obolibrary.org/obo/ZFA_") || STRSTARTS(str(?term), "http://purl.obolibrary.org/obo/zfa.owl") || STRSTARTS(str(?term), "http://purl.obolibrary.org/obo/ZFS_")))
FILTER(isIRI(?term) && (STRSTARTS(str(?term), "http://purl.obolibrary.org/obo/ZFA_") || STRSTARTS(str(?term), "http://purl.obolibrary.org/obo/zfa.owl") || STRSTARTS(str(?term), "http://purl.obolibrary.org/obo/ZFS_")))
}

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
{
Expand Down
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#>
Expand Down
2 changes: 1 addition & 1 deletion src/sparql/zfa_terms.sparql
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ WHERE {
{ ?s1 ?p1 ?term . }
UNION
{ ?term ?p2 ?o2 . }
FILTER(isIRI(?term) && (STRSTARTS(str(?term), "http://purl.obolibrary.org/obo/ZFA_") || STRSTARTS(str(?term), "http://purl.obolibrary.org/obo/ZFA_") || STRSTARTS(str(?term), "http://purl.obolibrary.org/obo/zfa.owl") || STRSTARTS(str(?term), "http://purl.obolibrary.org/obo/ZFS_")))
FILTER(isIRI(?term) && (STRSTARTS(str(?term), "http://purl.obolibrary.org/obo/ZFA_") || STRSTARTS(str(?term), "http://purl.obolibrary.org/obo/zfa.owl") || STRSTARTS(str(?term), "http://purl.obolibrary.org/obo/ZFS_")))
}