build.gradle 8.7 KB

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