build.gradle 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. /*
  2. * The Maven coordinates for the project artifact
  3. */
  4. ext.title = 'System Design Ontology - 2 Layers'
  5. description = 'System design ontology considering only 2 layers (types and instances).'
  6. group = 'be.ua'
  7. version = '1.0.0'
  8. /*
  9. * The Gradle plugins
  10. */
  11. apply plugin: 'maven-publish'
  12. /*
  13. * The Gradle task dependencies
  14. */
  15. buildscript {
  16. repositories {
  17. mavenLocal()
  18. mavenCentral()
  19. }
  20. dependencies {
  21. classpath 'io.opencaesar.owl:owl-fuseki-gradle:+'
  22. classpath 'io.opencaesar.owl:owl-shacl-fuseki-gradle:+'
  23. classpath 'io.opencaesar.owl:owl-query-gradle:+'
  24. classpath 'io.opencaesar.owl:owl-load-gradle:+'
  25. classpath 'io.opencaesar.owl:owl-reason-gradle:+'
  26. classpath 'io.opencaesar.oml:oml-merge-gradle:+'
  27. classpath 'io.opencaesar.adapters:oml2owl-gradle:+'
  28. }
  29. }
  30. /*
  31. * Dataset-specific variables
  32. */
  33. ext.dataset = [
  34. // Name of dataset (matches one used in .fuseki.ttl file)
  35. name: 'SystemDesignOntology2Layers',
  36. // Root ontology IRI of the dataset
  37. rootOntologyIri: 'http://ua.be/sdo2l/description/bundle',
  38. ]
  39. /*
  40. * The repositories to look up OML dependencies in
  41. */
  42. repositories {
  43. mavenLocal()
  44. mavenCentral()
  45. }
  46. /*
  47. * The configuration of OML dependencies
  48. */
  49. configurations {
  50. oml
  51. }
  52. /*
  53. * Dependency versions
  54. */
  55. ext {
  56. //coreVersion = '+'
  57. metrologyVersion = '+'
  58. }
  59. /*
  60. * The OML dependencies
  61. */
  62. dependencies {
  63. //oml "io.opencaesar.ontologies:core-vocabularies:$coreVersion"
  64. oml "io.opencaesar.ontologies:metrology-vocabularies:$metrologyVersion"
  65. }
  66. /*
  67. * A task to extract and merge the OML dependencies
  68. */
  69. task omlDependencies(type:io.opencaesar.oml.merge.OmlMergeTask, group:"oml") {
  70. inputZipPaths = configurations.oml.files
  71. outputCatalogFolder = file('build/oml')
  72. }
  73. /*
  74. * A task to convert the OML catalog to OWL catalog
  75. */
  76. task omlToOwl(type:io.opencaesar.oml2owl.Oml2OwlTask, group:"oml", dependsOn: omlDependencies) {
  77. // OML catalog
  78. inputCatalogPath = file('catalog.xml')
  79. // OWL catalog
  80. outputCatalogPath = file('build/owl/catalog.xml')
  81. }
  82. /*
  83. * A task to run the Openllet reasoner on the OWL catalog
  84. */
  85. task owlReason(type:io.opencaesar.owl.reason.OwlReasonTask, group:"oml", dependsOn: omlToOwl) {
  86. // OWL catalog
  87. catalogPath = file('build/owl/catalog.xml')
  88. // Input ontology IRI to reason on
  89. inputOntologyIri = "$dataset.rootOntologyIri".toString()
  90. // Entailment statements to generate and the ontologies to persist them in
  91. specs = [
  92. "$dataset.rootOntologyIri/classes = ALL_SUBCLASS".toString(),
  93. "$dataset.rootOntologyIri/properties = INVERSE_PROPERTY | ALL_SUBPROPERTY".toString(),
  94. "$dataset.rootOntologyIri/individuals = ALL_INSTANCE | DATA_PROPERTY_VALUE | OBJECT_PROPERTY_VALUE | SAME_AS".toString()
  95. ]
  96. // Junit error report
  97. reportPath = file('build/reports/reasoning.xml')
  98. }
  99. /*
  100. * Start the headless Fuseki server
  101. */
  102. task startFuseki(type: io.opencaesar.owl.fuseki.StartFusekiTask, group:"oml") {
  103. configurationPath = file('.fuseki.ttl')
  104. outputFolderPath = file('.fuseki')
  105. webUI = true
  106. }
  107. /*
  108. * Stop the headless Fuseki server
  109. */
  110. task stopFuseki(type: io.opencaesar.owl.fuseki.StopFusekiTask, group:"oml") {
  111. outputFolderPath = file('.fuseki')
  112. }
  113. /*
  114. * A task to load an OWL catalog to a Fuseki dataset endpoint
  115. */
  116. task owlLoad(type:io.opencaesar.owl.load.OwlLoadTask, group:"oml", dependsOn: owlReason) {
  117. catalogPath = file('build/owl/catalog.xml')
  118. endpointURL = "http://localhost:3030/$dataset.name".toString()
  119. fileExtensions = ['owl', 'ttl']
  120. iris = [
  121. "$dataset.rootOntologyIri/classes".toString(),
  122. "$dataset.rootOntologyIri/properties".toString(),
  123. "$dataset.rootOntologyIri/individuals".toString()
  124. ]
  125. }
  126. /*
  127. * A task to run a set of SPARQL queries on a Fuseki dataset endpoint
  128. */
  129. task owlQuery(type:io.opencaesar.owl.query.OwlQueryTask, group:"oml", dependsOn: owlLoad) {
  130. endpointURL = "http://localhost:3030/$dataset.name".toString()
  131. queryPath = file('src/sparql')
  132. resultPath = file('build/results')
  133. format = 'json'
  134. }
  135. /*
  136. * A task to run a set of SHACL validation rules on a Fuseki dataset endpoint
  137. */
  138. task owlShacl(type:io.opencaesar.owl.shacl.fuseki.OwlShaclFusekiTask, group:"oml", dependsOn: owlLoad) {
  139. endpointURL = "http://localhost:3030/$dataset.name".toString()
  140. queryPath = file('src/shacl')
  141. resultPath = file('build/results')
  142. }
  143. /*
  144. * A task to build the project, which executes several tasks together
  145. */
  146. task build(group: "oml") {
  147. dependsOn owlReason
  148. }
  149. /*
  150. * A task to delete the build artifacts
  151. */
  152. task clean(type: Delete, group: "oml") {
  153. delete 'build'
  154. }
  155. /*
  156. * Publish artifact to maven
  157. */
  158. task omlZip(type: Zip, group:"oml") {
  159. from file('src/oml')
  160. include "**/*.oml"
  161. destinationDirectory = file('build/libs')
  162. archiveBaseName = project.name
  163. archiveVersion = project.version
  164. }
  165. def pomConfig = {
  166. licenses {
  167. license {
  168. name "The Apache Software License, Version 2.0"
  169. url "http://www.apache.org/licenses/LICENSE-2.0.txt"
  170. distribution "repo"
  171. }
  172. }
  173. developers {
  174. developer {
  175. id "uantwerp"
  176. name "University of Antwerp"
  177. email ""
  178. }
  179. }
  180. scm {
  181. url 'https://msdl.uantwerpen.be/git/lucasalbertins/DTDesign/'
  182. }
  183. }
  184. publishing {
  185. publications {
  186. maven(MavenPublication) {
  187. groupId project.group
  188. artifactId project.name
  189. version project.version
  190. artifact omlZip
  191. pom {
  192. packaging = 'zip'
  193. withXml {
  194. def root = asNode()
  195. if (configurations.find { it.name == 'oml' }) {
  196. def dependencies = root.appendNode('dependencies')
  197. configurations.oml.resolvedConfiguration.resolvedArtifacts.each {
  198. def dependency = dependencies.appendNode('dependency')
  199. dependency.appendNode('groupId', it.moduleVersion.id.group)
  200. dependency.appendNode('artifactId', it.moduleVersion.id.name)
  201. dependency.appendNode('version', it.moduleVersion.id.version)
  202. if (it.classifier != null) {
  203. dependency.appendNode('classifier', it.classifier)
  204. dependency.appendNode('type', it.extension)
  205. }
  206. }
  207. }
  208. root.appendNode('name', project.ext.title)
  209. root.appendNode('description', project.description)
  210. root.appendNode('url', 'https://msdl.uantwerpen.be/git/lucasalbertins/DTDesign/')
  211. root.children().last() + pomConfig
  212. }
  213. }
  214. }
  215. }
  216. }
  217. /*
  218. * Integration with the Eclipse IDE
  219. */
  220. apply plugin: 'eclipse'
  221. eclipse {
  222. synchronizationTasks omlDependencies
  223. }