-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added basic shape expression testing
- Loading branch information
Showing
3 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Update the Open SbD4Nano Cache | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
|
||
jobs: | ||
fetch-data: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
fetch-depth: 0 | ||
|
||
- name: Install groovy | ||
run: sudo apt install groovy | ||
|
||
- name: Generate the Shex validation reports | ||
run: | | ||
groovy validate.groovy |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
BASE <http://bigcat-um.github.io/KinRDF/shapes#> | ||
PREFIX : <http://bigcat-um.github.io/KinRDF/shapes#> | ||
|
||
PREFIX dc: <http://purl.org/dc/elements/1.1/> | ||
PREFIX dct: <http://purl.org/dc/terms/> | ||
PREFIX foaf: <http://xmlns.com/foaf/0.1/> | ||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
PREFIX sbd: <https://www.sbd4nano.eu/rdf/#> | ||
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> | ||
PREFIX wp: <http://vocabularies.wikipathways.org/wp#> | ||
|
||
:InteractionData { | ||
a [ wp:InteractionData ] | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// MIT, Copyright (c) Egon Willighagen | ||
@Grab(group='io.github.egonw.bacting', module='managers-rdf', version='0.3.6') | ||
|
||
import org.apache.jena.shex.ShexStatus | ||
|
||
workspaceRoot = "." | ||
rdf = new net.bioclipse.managers.RDFManager(workspaceRoot); | ||
|
||
file = "/Output/RDF_Kin_Data_2022-Dec.ttl" | ||
clazz = "InteractionData" | ||
|
||
store = rdf.createInMemoryStore(true); | ||
store = rdf.importFile(store, "${file}", "TURTLE") | ||
report = rdf.validateAllOfType( | ||
store, | ||
"/shapes/${clazz}.shex", | ||
"http://bigcat-um.github.io/KinRDF/shapes#${clazz}", | ||
"http://vocabularies.wikipathways.org/wp#${clazz}" | ||
) | ||
|
||
println "{" | ||
println " \"target\": \"${clazz}\"," | ||
println " \"conformant\": [" | ||
report.forEachReport { reportEntry -> | ||
status = reportEntry.status | ||
reason = reportEntry.reason | ||
focusNode = reportEntry.focus | ||
|
||
switch (status) { | ||
case ShexStatus.conformant : | ||
println " {\n \"class\": \"${focusNode}\",\n \"status\": \"${status}\"\n }," | ||
} | ||
} | ||
println " {}" | ||
println " ]," | ||
nonconformantCounter = 0 | ||
println " \"nonconformant\": [" | ||
report.forEachReport { reportEntry -> | ||
status = reportEntry.status | ||
reason = reportEntry.reason | ||
focusNode = reportEntry.focus | ||
|
||
switch (status) { | ||
case ShexStatus.nonconformant : | ||
nonconformantCounter = nonconformantCounter + 1 | ||
println " {\n \"class\": \"${focusNode}\",\n \"status\": \"${status}\",\n \"reason\": \"${reason}\"\n }," | ||
} | ||
} | ||
println " {}" | ||
println " ]" | ||
println "}" | ||
|
||
if (nonconformantCounter > 0) System.exit(1) |