-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
231 lines (208 loc) · 6.34 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
/*
* Dataset maven coordinates
*/
ext.title = "OML Template"
description='The OML template project'
group = 'io.opencaesar.ontologies'
version = '0.1.0'
apply from: "${rootDir}/gradle/maven-deployment.gradle"
/*
* The Gradle task dependencies
*/
buildscript {
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath 'io.opencaesar.owl:owl-fuseki-gradle:+'
classpath 'io.opencaesar.owl:owl-shacl-fuseki-gradle:+'
classpath 'io.opencaesar.owl:owl-query-gradle:+'
classpath 'io.opencaesar.owl:owl-load-gradle:+'
classpath 'io.opencaesar.owl:owl-reason-gradle:+'
classpath 'io.opencaesar.oml:oml-bikeshed-gradle:0.9.+'
classpath 'io.opencaesar.oml:oml-merge-gradle:0.9.+'
classpath 'io.opencaesar.adapters:oml2owl-gradle:0.9.+'
}
}
// Dataset-specific variables
ext.dataset = [
// Name of dataset (matches one used in .fuseki.ttl file)
name: 'oml-template',
// Root ontology IRI of the dataset
rootOntologyIri: 'http://opencaesar.io/template/description/bundle',
// URL for publishing dataset documentation
publishUrl: 'https://opencaesar.github.io/oml-template'
]
/*
* The repositories to look up OML dependencies in
*/
repositories {
mavenLocal()
mavenCentral()
}
/*
* The configuration of OML dependencies
*/
configurations {
oml
}
/*
* Dependency versions
*/
ext {
coreVersion = '2.+'
imceVersion = '2.+'
}
/*
* The OML dependencies
*/
dependencies {
oml "io.opencaesar.ontologies:core-vocabularies:$coreVersion"
oml "io.opencaesar.ontologies:imce-vocabularies:$imceVersion"
}
/*
* A task to extract and merge the OML dependencies
*/
task downloadDependencies(type:io.opencaesar.oml.merge.OmlMergeTask, group:"oml") {
inputZipPaths = configurations.oml.files
outputCatalogFolder = file('build/oml')
}
/*
* A task to generate Bikeshed specification for the OML catalog
*/
task omlToBikeshed(type: io.opencaesar.oml.bikeshed.Oml2BikeshedTask, group:"oml", dependsOn: downloadDependencies) {
// OML catalog
inputCatalogPath = file('catalog.xml')
// OWL folder
outputFolderPath = file('build/bikeshed')
// Input Ontology Iri
rootOntologyIri = "$dataset.rootOntologyIri".toString()
// Publish URL
publishUrl = "$dataset.publishUrl".toString()
}
/*
* A task to generate the model documentation in HTML
*/
import org.gradle.internal.os.OperatingSystem
task generateDocs(dependsOn: omlToBikeshed, group:"oml") {
doLast {
if (OperatingSystem.current().isWindows()) {
exec {
if (project.hasProperty('BIKESHED')) {
environment 'PATH', "${environment.PATH}:${BIKESHED}"
}
commandLine 'build/bikeshed/publish.bat'
}
} else {
exec {
commandLine 'chmod', '+x', 'build/bikeshed/publish.sh'
}
exec {
if (project.hasProperty('BIKESHED')) {
environment 'PATH', "${environment.PATH}:${BIKESHED}"
}
commandLine 'build/bikeshed/publish.sh'
}
}
}
}
/*
* A task to convert the OML catalog to OWL catalog
*/
task omlToOwl(type:io.opencaesar.oml2owl.Oml2OwlTask, group:"oml", dependsOn: downloadDependencies) {
// OML catalog
inputCatalogPath = file('catalog.xml')
// OWL catalog
outputCatalogPath = file('build/owl/catalog.xml')
}
/*
* A task to run the Openllet reasoner on the OWL catalog
*/
task owlReason(type:io.opencaesar.owl.reason.OwlReasonTask, group:"oml", dependsOn: omlToOwl) {
// OWL catalog
catalogPath = file('build/owl/catalog.xml')
// Input ontology IRI to reason on
inputOntologyIri = "$dataset.rootOntologyIri".toString()
// Entailment statements to generate and the ontologies to persist them in
specs = [
"$dataset.rootOntologyIri/classes = ALL_SUBCLASS".toString(),
"$dataset.rootOntologyIri/properties = INVERSE_PROPERTY | ALL_SUBPROPERTY".toString(),
"$dataset.rootOntologyIri/individuals = ALL_INSTANCE | DATA_PROPERTY_VALUE | OBJECT_PROPERTY_VALUE | SAME_AS".toString()
]
// Junit error report
reportPath = file('build/reports/reasoning.xml')
}
/*
* Start the headless Fuseki server
*/
task startFuseki(type: io.opencaesar.owl.fuseki.StartFusekiTask, group:"oml") {
configurationPath = file('.fuseki.ttl')
outputFolderPath = file('.fuseki')
}
/*
* Stop the headless Fuseki server
*/
task stopFuseki(type: io.opencaesar.owl.fuseki.StopFusekiTask, group:"oml") {
outputFolderPath = file('.fuseki')
}
/*
* A task to load an OWL catalog to a Fuseki dataset endpoint
*/
task owlLoad(type:io.opencaesar.owl.load.OwlLoadTask, group:"oml", dependsOn: owlReason) {
catalogPath = file('build/owl/catalog.xml')
endpointURL = "http://localhost:3030/$dataset.name".toString()
fileExtensions = ['owl', 'ttl']
iris = [
"$dataset.rootOntologyIri/classes".toString(),
"$dataset.rootOntologyIri/properties".toString(),
"$dataset.rootOntologyIri/individuals".toString()
]
}
/*
* A task to run a set of SPARQL queries on a Fuseki dataset endpoint
*/
task owlQuery(type:io.opencaesar.owl.query.OwlQueryTask, group:"oml", dependsOn: owlLoad) {
endpointURL = "http://localhost:3030/$dataset.name".toString()
queryPath = file('src/sparql')
resultPath = file('build/frames')
}
/*
* A task to run a set of SHACL validation rules on a Fuseki dataset endpoint
*/
task owlShacl(type:io.opencaesar.owl.shacl.fuseki.OwlShaclFusekiTask, group:"oml", dependsOn: owlLoad) {
endpointURL = "http://localhost:3030/$dataset.name".toString()
queryPath = file('src/shacl')
resultPath = file('build/reports')
}
/*
* A task to build the project, which executes several tasks together
*/
tasks.named('build') {
group "oml"
dependsOn owlReason
}
/*
* A task to delete the build artifacts
*/
tasks.named('clean') {
group "oml"
}
/*
* Publish artifact to maven
*/
task omlZip(type: Zip, group:"oml") {
from file('src/oml')
include "**/*.oml"
destinationDirectory = file('build/libs')
archiveBaseName = project.name
archiveVersion = project.version
}
publishing.publications.maven.artifact omlZip
/*
* Integration with the Eclipse IDE
*/
apply plugin: 'eclipse'
eclipse {
synchronizationTasks downloadDependencies
}