Skip to content

Commit

Permalink
update example
Browse files Browse the repository at this point in the history
include a subgraph of the LUBM data for one university to not overwhelm the user with thousands of validation results
  • Loading branch information
prohde committed Sep 19, 2023
1 parent 9c9b934 commit 4a623ce
Show file tree
Hide file tree
Showing 11 changed files with 204 additions and 117,769 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ venv/
output/

example/output/
example/data/virtuoso

17 changes: 9 additions & 8 deletions example/README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
# Trav-SHACL Example

The example data was generated using the LUBM data generator to create data for one university.
Additionally, we provide some SHACL shapes (in JSON format) for validating the data.
In order to provide a good example, i.e., containing only a few entities, only a subset of the generated data is included.
Additionally, we provide some example SHACL shapes for validating the data.

Extract the pre-loaded data
```bash
tar -zxf data/pre-loaded.tar.gz -C data/
```

Start the SPARQL endpoint and Trav-SHACL docker container with
Start the SPARQL endpoint and Trav-SHACL Docker container with
```bash
docker-compose up -d --build
```

> [!NOTE]
> The SPARQL endpoint needs some time to load the data.
> Usually, it should be fast.
> You can check if the data is loaded by trying to access `http://localhost:9090/sparql`.
In order to validate the shape schema over the knowledge graph, run
```bash
./validate.sh
```

If you want to try different parameters, please check the README of the main directory of the repository for a detailed description of all possibilities.
If you want to try different parameters, please check the README of the main directory of the repository for a detailed description of all possibilities.
Binary file removed example/data/pre-loaded.tar.gz
Binary file not shown.
117,720 changes: 0 additions & 117,720 deletions example/data/raw/LUBM-univ1.nt

This file was deleted.

162 changes: 162 additions & 0 deletions example/data/raw/LUBM.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
@prefix ub: <http://swat.cse.lehigh.edu/onto/univ-bench.owl#> .

<http://www.Department0.University0.edu/FullProfessor9> a ub:FullProfessor ;
ub:doctoralDegreeFrom <http://www.University730.edu> ;
ub:emailAddress "[email protected]" ;
ub:mastersDegreeFrom <http://www.University963.edu> ;
ub:name "FullProfessor9" ;
ub:researchInterest "Research5" ;
ub:teacherOf <http://www.Department0.University0.edu/Course13>,
<http://www.Department0.University0.edu/Course14>,
<http://www.Department0.University0.edu/GraduateCourse15>,
<http://www.Department0.University0.edu/GraduateCourse16> ;
ub:telephone "xxx-xxx-xxxx" ;
ub:undergraduateDegreeFrom <http://www.University688.edu> ;
ub:worksFor <http://www.Department0.University0.edu> .

<http://www.Department0.University0.edu/GraduateCourse33> a ub:GraduateCourse ;
ub:name "GraduateCourse33" .

<http://www.Department0.University0.edu/GraduateCourse42> a ub:GraduateCourse ;
ub:name "GraduateCourse42" .

<http://www.Department0.University0.edu/GraduateStudent0> a ub:GraduateStudent,
ub:ResearchAssistant ;
ub:advisor <http://www.Department0.University0.edu/AssistantProfessor3> ;
ub:emailAddress "[email protected]" ;
ub:memberOf <http://www.Department0.University0.edu> ;
ub:name "GraduateStudent0" ;
ub:takesCourse <http://www.Department0.University0.edu/GraduateCourse16>,
<http://www.Department0.University0.edu/GraduateCourse50>,
<http://www.Department0.University0.edu/GraduateCourse64> ;
ub:telephone "xxx-xxx-xxxx" ;
ub:undergraduateDegreeFrom <http://www.University358.edu> .

<http://www.Department0.University0.edu/GraduateStudent91> a ub:GraduateStudent,
ub:ResearchAssistant ;
ub:advisor <http://www.Department0.University0.edu/FullProfessor6> ;
ub:emailAddress "[email protected]" ;
ub:memberOf <http://www.Department0.University0.edu> ;
ub:name "GraduateStudent91" ;
ub:takesCourse <http://www.Department0.University0.edu/GraduateCourse3>,
<http://www.Department0.University0.edu/GraduateCourse49> ;
ub:telephone "xxx-xxx-xxxx" ;
ub:undergraduateDegreeFrom <http://www.University708.edu> .

<http://www.Department1.University0.edu/FullProfessor0> a ub:FullProfessor ;
ub:doctoralDegreeFrom <http://www.University963.edu> ;
ub:emailAddress "[email protected]" ;
ub:mastersDegreeFrom <http://www.University509.edu> ;
ub:name "FullProfessor0" ;
ub:researchInterest "Research19" ;
ub:teacherOf <http://www.Department1.University0.edu/Course0>,
<http://www.Department1.University0.edu/Course1>,
<http://www.Department1.University0.edu/GraduateCourse0>,
<http://www.Department1.University0.edu/GraduateCourse1> ;
ub:telephone "xxx-xxx-xxxx" ;
ub:undergraduateDegreeFrom <http://www.University512.edu> ;
ub:worksFor <http://www.Department1.University0.edu> .

<http://www.Department2.University0.edu/FullProfessor2> a ub:FullProfessor ;
ub:doctoralDegreeFrom <http://www.University415.edu> ;
ub:emailAddress "[email protected]" ;
ub:mastersDegreeFrom <http://www.University434.edu> ;
ub:name "FullProfessor2" ;
ub:researchInterest "Research11" ;
ub:teacherOf <http://www.Department2.University0.edu/Course3>,
<http://www.Department2.University0.edu/Course4>,
<http://www.Department2.University0.edu/GraduateCourse3> ;
ub:telephone "xxx-xxx-xxxx" ;
ub:undergraduateDegreeFrom <http://www.University605.edu> ;
ub:worksFor <http://www.Department2.University0.edu> .

<http://www.Department2.University0.edu/GraduateStudent7> a ub:GraduateStudent,
ub:ResearchAssistant ;
ub:advisor <http://www.Department2.University0.edu/FullProfessor6> ;
ub:emailAddress "[email protected]" ;
ub:memberOf <http://www.Department2.University0.edu> ;
ub:name "GraduateStudent7" ;
ub:takesCourse <http://www.Department2.University0.edu/GraduateCourse20> ;
ub:telephone "xxx-xxx-xxxx" ;
ub:undergraduateDegreeFrom <http://www.University377.edu> .

<http://www.Department5.University0.edu/FullProfessor3> a ub:FullProfessor ;
ub:doctoralDegreeFrom <http://www.University33.edu> ;
ub:emailAddress "[email protected]" ;
ub:mastersDegreeFrom <http://www.University828.edu> ;
ub:name "FullProfessor3" ;
ub:researchInterest "Research22" ;
ub:teacherOf <http://www.Department5.University0.edu/Course5>,
<http://www.Department5.University0.edu/Course6>,
<http://www.Department5.University0.edu/GraduateCourse4> ;
ub:telephone "xxx-xxx-xxxx" ;
ub:undergraduateDegreeFrom <http://www.University958.edu> ;
ub:worksFor <http://www.Department5.University0.edu> .

<http://www.Department9.University0.edu/FullProfessor1> a ub:FullProfessor ;
ub:doctoralDegreeFrom <http://www.University927.edu> ;
ub:emailAddress "[email protected]" ;
ub:mastersDegreeFrom <http://www.University995.edu> ;
ub:name "FullProfessor1" ;
ub:researchInterest "Research1" ;
ub:teacherOf <http://www.Department9.University0.edu/Course1>,
<http://www.Department9.University0.edu/Course2>,
<http://www.Department9.University0.edu/GraduateCourse1> ;
ub:telephone "xxx-xxx-xxxx" ;
ub:undergraduateDegreeFrom <http://www.University392.edu> ;
ub:worksFor <http://www.Department9.University0.edu> .

<http://www.Department9.University0.edu/GraduateStudent28> a ub:GraduateStudent,
ub:TeachingAssistant ;
ub:advisor <http://www.Department9.University0.edu/AssistantProfessor10> ;
ub:emailAddress "[email protected]" ;
ub:memberOf <http://www.Department9.University0.edu> ;
ub:name "GraduateStudent28" ;
ub:takesCourse <http://www.Department9.University0.edu/GraduateCourse1>,
<http://www.Department9.University0.edu/GraduateCourse21>,
<http://www.Department9.University0.edu/GraduateCourse38> ;
ub:teachingAssistantOf <http://www.Department9.University0.edu/Course27> ;
ub:telephone "xxx-xxx-xxxx" ;
ub:undergraduateDegreeFrom <http://www.University68.edu> .

<http://www.Department9.University0.edu/GraduateStudent5> a ub:GraduateStudent ;
ub:advisor <http://www.Department9.University0.edu/AssistantProfessor8> ;
ub:emailAddress "[email protected]" ;
ub:memberOf <http://www.Department9.University0.edu> ;
ub:name "GraduateStudent5" ;
ub:takesCourse <http://www.Department9.University0.edu/GraduateCourse12> ;
ub:telephone "xxx-xxx-xxxx" ;
ub:undergraduateDegreeFrom <http://www.University596.edu> .

<http://www.University1.edu> a ub:University .

<http://www.University2.edu> a ub:University .

<http://www.University3.edu> a ub:University .

<http://www.University4.edu> a ub:University .

<http://www.Department0.University0.edu/GraduateCourse3> a ub:GraduateCourse ;
ub:name "GraduateCourse3" .

<http://www.Department1.University0.edu> a ub:Department ;
ub:name "Department1" ;
ub:subOrganizationOf <http://www.University0.edu> .

<http://www.Department0.University0.edu/GraduateCourse16> a ub:GraduateCourse ;
ub:name "GraduateCourse16" .

<http://www.Department9.University0.edu/GraduateCourse1> a ub:GraduateCourse ;
ub:name "GraduateCourse1" .

<http://www.Department0.University0.edu> a ub:Department ;
ub:name "Department0" ;
ub:subOrganizationOf <http://www.University0.edu> .

<http://www.Department9.University0.edu> a ub:Department ;
ub:name "Department9" ;
ub:subOrganizationOf <http://www.University0.edu> .

<http://www.University0.edu> a ub:University ;
ub:name "University0" .

7 changes: 5 additions & 2 deletions example/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ version: '2'
services:
example_data:
container_name: travshacl_example_data
image: prohde/virtuoso-opensource-7:7.2.6
image: prohde/virtuoso-opensource-7:7.2.10-alpine
volumes:
- ./data/pre-loaded:/database
- ./data/raw:/database/toLoad
- ./data/virtuoso:/database
mem_limit: 2g
ports:
- '9090:8890'
Expand All @@ -19,6 +20,8 @@ services:
- ./shapes:/shapes
- ./output:/output
mem_limit: 4g
ports:
- '9091:5000'
networks:
- travshacl
depends_on:
Expand Down
6 changes: 3 additions & 3 deletions example/shapes/LUBM/Department.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix : <http://example.org/> .

:DepartmentShape a sh:NodeShape;
:DepartmentShape a sh:NodeShape ;
sh:targetClass ub:Department ;
sh:property [
sh:path ub:name;
sh:path ub:name ;
sh:minCount 1 ;
sh:maxCount 1
] ;
sh:property [
sh:path ub:subOrganizationOf;
sh:path ub:subOrganizationOf ;
sh:qualifiedValueShape [
sh:node :UniversityShape
] ;
Expand Down
40 changes: 15 additions & 25 deletions example/shapes/LUBM/FullProfessor.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,14 @@
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix : <http://example.org/> .

:FullProfessorShape a sh:NodeShape;
:FullProfessorShape a sh:NodeShape ;
sh:targetClass ub:FullProfessor ;
sh:property [
sh:path ub:doctoralDegreeFrom;
sh:qualifiedValueShape [
sh:node :UniversityShape
] ;
sh:qualifiedMinCount 1
sh:path ub:doctoralDegreeFrom ;
sh:minCount 1
] ;
sh:property [
sh:path ub:emailAddress;
sh:path ub:emailAddress ;
sh:minCount 1
] ;
sh:property [
Expand All @@ -23,42 +20,35 @@
sh:qualifiedMaxCount 1
] ;
sh:property [
sh:path ub:mastersDegreeFrom;
sh:qualifiedValueShape [
sh:node :UniversityShape
] ;
sh:qualifiedMinCount 1
sh:path ub:mastersDegreeFrom ;
sh:minCount 1
] ;
sh:property [
sh:path ub:name;
sh:minCount 1;
sh:path ub:name ;
sh:minCount 1 ;
sh:maxCount 1
] ;
sh:property [
sh:path ub:researchInterest;
sh:path ub:researchInterest ;
sh:minCount 1
] ;
sh:property [
sh:path ub:teacherOf;
sh:path ub:teacherOf ;
sh:qualifiedValueShape [
sh:node :GraduateCourseShape
] ;
sh:qualifiedMinCount 1 ;
sh:qualifiedMaxCount 2
sh:qualifiedMinCount 1
] ;
sh:property [
sh:path ub:telephone;
sh:path ub:telephone ;
sh:minCount 1
] ;
sh:property [
sh:path ub:undergraduateDegreeFrom;
sh:qualifiedValueShape [
sh:node :UniversityShape
] ;
sh:qualifiedMinCount 1
sh:path ub:undergraduateDegreeFrom ;
sh:minCount 1
] ;
sh:property [
sh:path ub:worksFor;
sh:path ub:worksFor ;
sh:qualifiedValueShape [
sh:node :DepartmentShape
] ;
Expand Down
2 changes: 1 addition & 1 deletion example/shapes/LUBM/GraduateCourse.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix : <http://example.org/> .

:GraduateCourseShape a sh:NodeShape;
:GraduateCourseShape a sh:NodeShape ;
sh:targetClass ub:GraduateCourse ;
sh:property [
sh:path ub:name ;
Expand Down
15 changes: 6 additions & 9 deletions example/shapes/LUBM/GraduateStudent.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix : <http://example.org/> .

:GraduateStudentShape a sh:NodeShape;
:GraduateStudentShape a sh:NodeShape ;
sh:targetClass ub:GraduateStudent ;
sh:property [
sh:path ub:advisor ;
Expand All @@ -14,7 +14,7 @@
sh:minCount 1
] ;
sh:property [
sh:path ub:memberOf;
sh:path ub:memberOf ;
sh:qualifiedValueShape [
sh:node :DepartmentShape
] ;
Expand All @@ -26,21 +26,18 @@
sh:maxCount 1
] ;
sh:property [
sh:path ub:takesCourse;
sh:path ub:takesCourse ;
sh:qualifiedValueShape [
sh:node :GraduateCourseShape
] ;
sh:qualifiedMinCount 1 ;
sh:qualifiedMaxCount 3
] ;
sh:property [
sh:path ub:telephone;
sh:path ub:telephone ;
sh:minCount 1
] ;
sh:property [
sh:path ub:undergraduateDegreeFrom;
sh:qualifiedValueShape [
sh:node :UniversityShape
] ;
sh:qualifiedMinCount 1
sh:path ub:undergraduateDegreeFrom ;
sh:minCount 1
] .
2 changes: 1 addition & 1 deletion example/shapes/LUBM/University.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix : <http://example.org/> .

:UniversityShape a sh:NodeShape;
:UniversityShape a sh:NodeShape ;
sh:targetClass ub:University ;
sh:property [
sh:path ub:name ;
Expand Down

0 comments on commit 4a623ce

Please sign in to comment.