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

SHACL testing #13

Merged
merged 18 commits into from
Nov 22, 2016
Merged
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
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Mac files
.DS_Store

# IDE files
.project

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
22 changes: 14 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
# Our primary language is Python.
language: python
python:
- "2.7"
# command to install dependencies
#
# unfortunately needs to be custom because updating setuptools from within
# requirements.txt fails to be seen by the html5lib installation, and the
# version pre-installed on Travis is too low.

# We need Java 8 for SHACL testing.
addons:
apt:
packages:
- oracle-java8-set-default

# Install pip requirements.
install:
- "pip install -U setuptools"
- "pip install -r requirements.txt"
# command to run tests
- pip install --upgrade pip
- pip install -r requirements.txt
- pip install pytest

# Run the py.test suite.
script: py.test tests
17 changes: 17 additions & 0 deletions examples/trees/pg_2357.owl
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@

<owl:Thing rdf:about="&pg_2357;Node_1">
<rdf:type rdf:resource="&owl;NamedIndividual"/>
<rdf:type rdf:resource="&obo;CDAO_0000140" />
<obo:CDAO_0000149 rdf:resource="&pg_2357;Node_2"/>
<obo:CDAO_0000149 rdf:resource="&pg_2357;Alobevania_gattiae"/>
<obo:CDAO_0000149 rdf:resource="&pg_2357;Decevania_reticulata"/>
Expand All @@ -71,6 +72,7 @@

<owl:Thing rdf:about="&pg_2357;Node_2">
<rdf:type rdf:resource="&owl;NamedIndividual"/>
<rdf:type rdf:resource="&obo;CDAO_0000140" />
<obo:CDAO_0000149 rdf:resource="&pg_2357;Node_3"/>
<obo:CDAO_0000149 rdf:resource="&pg_2357;Rothevania_valdivianus"/>
<obo:CDAO_0000149 rdf:resource="&pg_2357;Hyptia_thoracica"/>
Expand All @@ -82,6 +84,7 @@

<owl:Thing rdf:about="&pg_2357;Node_3">
<rdf:type rdf:resource="&owl;NamedIndividual"/>
<rdf:type rdf:resource="&obo;CDAO_0000140" />
<obo:CDAO_0000149 rdf:resource="&pg_2357;Node_4"/>
<obo:CDAO_0000149 rdf:resource="&pg_2357;Node_7"/>
<phyloref:has_Sibling rdf:resource="&pg_2357;Rothevania_valdivianus"/>
Expand All @@ -92,6 +95,7 @@

<owl:Thing rdf:about="&pg_2357;Node_4">
<rdf:type rdf:resource="&owl;NamedIndividual"/>
<rdf:type rdf:resource="&obo;CDAO_0000140" />
<obo:CDAO_0000149 rdf:resource="&pg_2357;Node_5"/>
<obo:CDAO_0000149 rdf:resource="&pg_2357;Evaniscus_lansdownei"/>
<phyloref:has_Sibling rdf:resource="&pg_2357;Node_7"/>
Expand All @@ -101,6 +105,7 @@

<owl:Thing rdf:about="&pg_2357;Node_5">
<rdf:type rdf:resource="&owl;NamedIndividual"/>
<rdf:type rdf:resource="&obo;CDAO_0000140" />
<obo:CDAO_0000149 rdf:resource="&pg_2357;Node_6"/>
<obo:CDAO_0000149 rdf:resource="&pg_2357;Evaniscus_marginatus"/>
<phyloref:has_Sibling rdf:resource="&pg_2357;Evaniscus_lansdownei"/>
Expand All @@ -110,6 +115,7 @@

<owl:Thing rdf:about="&pg_2357;Node_6">
<rdf:type rdf:resource="&owl;NamedIndividual"/>
<rdf:type rdf:resource="&obo;CDAO_0000140" />
<obo:CDAO_0000149 rdf:resource="&pg_2357;Evaniscus_rufithorax"/>
<obo:CDAO_0000149 rdf:resource="&pg_2357;Evaniscus_sulcigenis"/>
<phyloref:has_Sibling rdf:resource="&pg_2357;Evaniscus_marginatus"/>
Expand All @@ -119,34 +125,39 @@

<owl:Thing rdf:about="&pg_2357;Evaniscus_rufithorax">
<rdf:type rdf:resource="&owl;NamedIndividual"/>
<rdf:type rdf:resource="&obo;CDAO_0000140" />
<phyloref:has_Sibling rdf:resource="&pg_2357;Evaniscus_sulcigenis"/>
</owl:Thing>

<!-- http://phyloinformatics.net/phylo/pg_2357#Evaniscus_sulcigenis -->

<owl:Thing rdf:about="&pg_2357;Evaniscus_sulcigenis">
<rdf:type rdf:resource="&owl;NamedIndividual"/>
<rdf:type rdf:resource="&obo;CDAO_0000140" />
<phyloref:has_Sibling rdf:resource="&pg_2357;Evaniscus_rufithorax"/>
</owl:Thing>

<!-- http://phyloinformatics.net/phylo/pg_2357#Evaniscus_marginatus -->

<owl:Thing rdf:about="&pg_2357;Evaniscus_marginatus">
<rdf:type rdf:resource="&owl;NamedIndividual"/>
<rdf:type rdf:resource="&obo;CDAO_0000140" />
<phyloref:has_Sibling rdf:resource="&pg_2357;Node_6"/>
</owl:Thing>

<!-- http://phyloinformatics.net/phylo/pg_2357#Evaniscus_lansdownei -->

<owl:Thing rdf:about="&pg_2357;Evaniscus_lansdownei">
<rdf:type rdf:resource="&owl;NamedIndividual"/>
<rdf:type rdf:resource="&obo;CDAO_0000140" />
<phyloref:has_Sibling rdf:resource="&pg_2357;Node_5"/>
</owl:Thing>

<!-- http://phyloinformatics.net/phylo/pg_2357#Node_7 -->

<owl:Thing rdf:about="&pg_2357;Node_7">
<rdf:type rdf:resource="&owl;NamedIndividual"/>
<rdf:type rdf:resource="&obo;CDAO_0000140" />
<obo:CDAO_0000149 rdf:resource="&pg_2357;Evaniscus_tibialis"/>
<obo:CDAO_0000149 rdf:resource="&pg_2357;Evaniscus_rafaeli"/>
<phyloref:has_Sibling rdf:resource="&pg_2357;Node_4"/>
Expand All @@ -156,20 +167,23 @@

<owl:Thing rdf:about="&pg_2357;Evaniscus_tibialis">
<rdf:type rdf:resource="&owl;NamedIndividual"/>
<rdf:type rdf:resource="&obo;CDAO_0000140" />
<phyloref:has_Sibling rdf:resource="&pg_2357;Evaniscus_rafaeli"/>
</owl:Thing>

<!-- http://phyloinformatics.net/phylo/pg_2357#Evaniscus_rafaeli -->

<owl:Thing rdf:about="&pg_2357;Evaniscus_rafaeli">
<rdf:type rdf:resource="&owl;NamedIndividual"/>
<rdf:type rdf:resource="&obo;CDAO_0000140" />
<phyloref:has_Sibling rdf:resource="&pg_2357;Evaniscus_tibialis"/>
</owl:Thing>

<!-- http://phyloinformatics.net/phylo/pg_2357#Rothevania_valdivianus -->

<owl:Thing rdf:about="&pg_2357;Rothevania_valdivianus">
<rdf:type rdf:resource="&owl;NamedIndividual"/>
<rdf:type rdf:resource="&obo;CDAO_0000140" />
<phyloref:has_Sibling rdf:resource="&pg_2357;Node_3"/>
<phyloref:has_Sibling rdf:resource="&pg_2357;Hyptia_thoracica"/>
</owl:Thing>
Expand All @@ -178,6 +192,7 @@

<owl:Thing rdf:about="&pg_2357;Hyptia_thoracica">
<rdf:type rdf:resource="&owl;NamedIndividual"/>
<rdf:type rdf:resource="&obo;CDAO_0000140" />
<phyloref:has_Sibling rdf:resource="&pg_2357;Node_3"/>
<phyloref:has_Sibling rdf:resource="&pg_2357;Rothevania_valdivianus"/>
</owl:Thing>
Expand All @@ -186,6 +201,7 @@

<owl:Thing rdf:about="&pg_2357;Alobevania_gattiae">
<rdf:type rdf:resource="&owl;NamedIndividual"/>
<rdf:type rdf:resource="&obo;CDAO_0000140" />
<phyloref:has_Sibling rdf:resource="&pg_2357;Node_2"/>
<phyloref:has_Sibling rdf:resource="&pg_2357;Decevania_reticulata"/>
</owl:Thing>
Expand All @@ -194,6 +210,7 @@

<owl:Thing rdf:about="&pg_2357;Decevania_reticulata">
<rdf:type rdf:resource="&owl;NamedIndividual"/>
<rdf:type rdf:resource="&obo;CDAO_0000140" />
<phyloref:has_Sibling rdf:resource="&pg_2357;Node_2"/>
<phyloref:has_Sibling rdf:resource="&pg_2357;Alobevania_gattiae"/>
</owl:Thing>
Expand Down
1 change: 1 addition & 0 deletions templates/individual.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<owl:Thing rdf:about="&{{name}};{{term}}">
<rdf:type rdf:resource="&owl;NamedIndividual"/>
<rdf:type rdf:resource="&obo;CDAO_0000140" />
{{#children}}
<obo:CDAO_0000149 rdf:resource="&{{name}};{{child}}"/>
{{/children}}
Expand Down
37 changes: 37 additions & 0 deletions tests/ValidationShapes.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
@prefix ex: <http://phyloref.org/example/test_shacl.ttl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix obo: <http://purl.obolibrary.org/obo/> .
@prefix phyloref: <http://phyloinformatics.net/phyloref.owl#> .
@prefix dash: <http://datashapes.org/dash#> .
@prefix rdf: <http://www.w3.org/2002/07/owl#> .

#
# ex:Node
# A node in a phylogeny.
#

ex:Node a sh:Shape;
# Matches all nodes.
sh:targetClass obo:CDAO_0000140;

# Every node must either have:
sh:or (
[
# 1. A CDAO:hasChild relationship with another node.
sh:property [
sh:predicate obo:CDAO_0000149;
sh:class obo:CDAO_0000140;
sh:minCount 1;
];
]
[
# 2. A phyloref:has_Sibling relationship with another node.
sh:property [
sh:predicate phyloref:has_Sibling;
sh:class obo:CDAO_0000140;
sh:minCount 1;
];
]
);
.
Loading