build.gradle 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. buildscript {
  2. repositories {
  3. mavenLocal()
  4. mavenCentral()
  5. }
  6. dependencies {
  7. classpath "io.opencaesar.owl:owl-fuseki-gradle:[2.0,3.0)"
  8. classpath "io.opencaesar.owl:owl-shacl-fuseki-gradle:[2.0,3.0)"
  9. classpath "io.opencaesar.owl:owl-query-gradle:[2.0,3.0)"
  10. classpath "io.opencaesar.owl:owl-load-gradle:[2.0,3.0)"
  11. classpath "io.opencaesar.owl:owl-reason-gradle:[2.0,3.0)"
  12. classpath "io.opencaesar.owl:owl-doc-gradle:[2.0,3.0)"
  13. //classpath "io.opencaesar.oml:oml-bikeshed-gradle:[2.0,3.0)"
  14. classpath "io.opencaesar.oml:oml-merge-gradle:[2.0,3.0)"
  15. classpath "io.opencaesar.adapters:oml2owl-gradle:[2.0,3.0)"
  16. }
  17. }
  18. plugins {
  19. id "java"
  20. id "maven-publish"
  21. id "eclipse"
  22. id "signing"
  23. }
  24. ext.title = "System Design Ontology - 2 Layers"
  25. description = "System design ontology considering only 2 layers (types and instances)."
  26. group = "be.ua"
  27. version = "1.0.0"
  28. ext {
  29. dataset = "SystemDesignOntology2Layers"
  30. rootIri = "http://ua.be/sdo2l/description/bundle"
  31. //url = ""
  32. //bikeshed = "build/bikeshed"
  33. }
  34. repositories {
  35. mavenLocal()
  36. mavenCentral()
  37. maven {
  38. //url "https://git.rys.one/api/v4/groups/dtdesign/-/packages/maven"
  39. url "https://git.rys.one/api/v4/projects/${System.getenv('CI_PROJECT_ID')}/packages/maven"
  40. name "Gitlab"
  41. credentials(HttpHeaderCredentials) {
  42. name = "Job-Token"
  43. value = System.getenv("CI_JOB_TOKEN")
  44. }
  45. authentication {
  46. header(HttpHeaderAuthentication)
  47. }
  48. }
  49. }
  50. configurations {
  51. oml
  52. }
  53. dependencies {
  54. //oml "io.opencaesar.ontologies:core-vocabularies:[4.0,5.0)"
  55. oml "io.opencaesar.ontologies:metrology-vocabularies:[6.0,7.0)"
  56. }
  57. task downloadDependencies(type: io.opencaesar.oml.merge.OmlMergeTask) {
  58. inputZipPaths = configurations.oml.files
  59. outputCatalogFolder = file("build/oml")
  60. }
  61. //task omlToBikeshed(type: io.opencaesar.oml.bikeshed.Oml2BikeshedTask, dependsOn: downloadDependencies) {
  62. // inputCatalogPath = file("catalog.xml")
  63. // inputCatalogTitle = project.title
  64. // inputCatalogVersion = project.version
  65. // rootOntologyIri = "$rootIri".toString()
  66. // outputFolderPath = file("$bikeshed")
  67. // publishUrl = "$url".toString()
  68. //}
  69. //task generateDocs(type: Exec, dependsOn: omlToBikeshed) {
  70. // inputs.files(fileTree("$bikeshed").include("**/*.bs"))
  71. // outputs.files(fileTree("$bikeshed").include("**/*.html"))
  72. // if (org.gradle.internal.os.OperatingSystem.current().isWindows()) {
  73. // commandLine "$bikeshed/publish.bat"
  74. // } else {
  75. // commandLine "$bikeshed/publish.sh"
  76. // }
  77. //}
  78. task omlToOwl(type: io.opencaesar.oml2owl.Oml2OwlTask, dependsOn: downloadDependencies) {
  79. inputCatalogPath = file("catalog.xml")
  80. outputCatalogPath = file("build/owl/catalog.xml")
  81. }
  82. // A task to run the Openllet reasoner on the OWL catalog
  83. task owlReason(type: io.opencaesar.owl.reason.OwlReasonTask, dependsOn: omlToOwl) {
  84. // OWL catalog
  85. catalogPath = file("build/owl/catalog.xml")
  86. // Input ontology IRI to reason on
  87. inputOntologyIri = "$rootIri".toString()
  88. // Entailment statements to generate and the ontologies to persist them in
  89. specs = [
  90. "$rootIri/classes = ALL_SUBCLASS".toString(),
  91. "$rootIri/properties = INVERSE_PROPERTY | ALL_SUBPROPERTY".toString(),
  92. "$rootIri/individuals = ALL_INSTANCE | DATA_PROPERTY_VALUE | OBJECT_PROPERTY_VALUE | SAME_AS".toString()
  93. ]
  94. // Junit error report
  95. reportPath = file("build/reports/reasoning.xml")
  96. }
  97. task generateDocs(type: io.opencaesar.owl.doc.OwlDocTask, dependsOn: owlReason) {
  98. inputCatalogPath = file("build/owl/catalog.xml")
  99. inputCatalogTitle = project.title
  100. inputCatalogVersion = project.version
  101. inputOntologyIris = ["$rootIri/classes", "$rootIri/properties", "$rootIri/individuals"]
  102. outputFolderPath = file("build/docs")
  103. outputCaseSensitive = org.gradle.internal.os.OperatingSystem.current().isLinux()
  104. }
  105. task startFuseki(type: io.opencaesar.owl.fuseki.StartFusekiTask) {
  106. configurationPath = file(".fuseki.ttl")
  107. outputFolderPath = file(".fuseki")
  108. webUI = true
  109. }
  110. task stopFuseki(type: io.opencaesar.owl.fuseki.StopFusekiTask) {
  111. outputFolderPath = file(".fuseki")
  112. }
  113. task owlLoad(type: io.opencaesar.owl.load.OwlLoadTask, dependsOn: owlReason) {
  114. inputs.files(startFuseki.outputFolderPath) // rerun when fuseki restarts
  115. catalogPath = file("build/owl/catalog.xml")
  116. endpointURL = "http://localhost:3030/$dataset".toString()
  117. fileExtensions = ["owl", "ttl"]
  118. iris = [
  119. "$rootIri/classes".toString(),
  120. "$rootIri/properties".toString(),
  121. "$rootIri/individuals".toString()
  122. ]
  123. }
  124. task owlQuery(type: io.opencaesar.owl.query.OwlQueryTask, dependsOn: owlLoad) {
  125. inputs.files(owlLoad.inputs.files) // rerun when the dataset changes
  126. endpointURL = "http://localhost:3030/$dataset".toString()
  127. queryPath = file("src/sparql")
  128. resultPath = file("build/results")
  129. format = "json"
  130. }
  131. task owlShacl(type: io.opencaesar.owl.shacl.fuseki.OwlShaclFusekiTask, dependsOn: owlLoad) {
  132. inputs.files(owlLoad.inputs.files) // rerun when the dataset changes
  133. endpointURL = "http://localhost:3030/$dataset".toString()
  134. queryPath = file("src/shacl")
  135. resultPath = file("build/reports")
  136. }
  137. build {
  138. dependsOn owlReason
  139. }
  140. tasks.named("clean") {
  141. }
  142. task omlZip(type: Zip) {
  143. from file("src/oml")
  144. include "**/*.oml"
  145. destinationDirectory = file("build/libs")
  146. archiveBaseName = project.name
  147. archiveVersion = project.version
  148. }
  149. def pomConfig = {
  150. licenses {
  151. license {
  152. name "The Apache Software License, Version 2.0"
  153. url "http://www.apache.org/licenses/LICENSE-2.0.txt"
  154. distribution "repo"
  155. }
  156. }
  157. developers {
  158. developer {
  159. id "uantwerp"
  160. name "University of Antwerp"
  161. email ""
  162. }
  163. }
  164. scm {
  165. url "https://msdl.uantwerpen.be/git/lucasalbertins/DTDesign/"
  166. }
  167. }
  168. publishing {
  169. publications {
  170. maven(MavenPublication) {
  171. groupId project.group
  172. artifactId project.name
  173. version project.version
  174. artifact omlZip
  175. pom {
  176. packaging = "zip"
  177. withXml {
  178. def root = asNode()
  179. if (configurations.find { it.name == "oml" }) {
  180. def dependencies = root.appendNode("dependencies")
  181. configurations.oml.resolvedConfiguration.resolvedArtifacts.each {
  182. def dependency = dependencies.appendNode("dependency")
  183. dependency.appendNode("groupId", it.moduleVersion.id.group)
  184. dependency.appendNode("artifactId", it.moduleVersion.id.name)
  185. dependency.appendNode("version", it.moduleVersion.id.version)
  186. if (it.classifier != null) {
  187. dependency.appendNode("classifier", it.classifier)
  188. dependency.appendNode("type", it.extension)
  189. }
  190. }
  191. }
  192. root.appendNode("name", project.ext.title)
  193. root.appendNode("description", project.description)
  194. root.appendNode("url", "https://msdl.uantwerpen.be/git/lucasalbertins/DTDesign/")
  195. root.children().last() + pomConfig
  196. }
  197. }
  198. }
  199. }
  200. repositories {
  201. maven {
  202. //url "https://git.rys.one/api/v4/groups/dtdesign/-/packages/maven"
  203. url "https://git.rys.one/api/v4/projects/${System.getenv('CI_PROJECT_ID')}/packages/maven"
  204. name "Gitlab"
  205. credentials(HttpHeaderCredentials) {
  206. name = "Job-Token"
  207. value = System.getenv("CI_JOB_TOKEN")
  208. }
  209. authentication {
  210. header(HttpHeaderAuthentication)
  211. }
  212. }
  213. }
  214. }
  215. //signing {
  216. // def pgpSigningKey = project.findProperty("pgpSigningKey")
  217. // if (pgpSigningKey != null) { pgpSigningKey = new String(pgpSigningKey.decodeBase64()) }
  218. // def pgpSigningPassword = project.findProperty("pgpSigningPassword")
  219. // useInMemoryPgpKeys(pgpSigningKey, pgpSigningPassword)
  220. // sign publishing.publications.maven
  221. //}
  222. //gradle.taskGraph.whenReady { taskGraph ->
  223. // signMavenPublication.onlyIf { taskGraph.allTasks.any{it.name == "publishMavenPublicationToGitlabRepository"} }
  224. //}
  225. eclipse {
  226. synchronizationTasks downloadDependencies
  227. }