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:1.+" classpath "io.opencaesar.oml:oml-merge-gradle:1.+" classpath "io.opencaesar.adapters:oml2owl-gradle:1.+" } } plugins { id "java" id "maven-publish" id "eclipse" id "signing" } ext.title = "System Design Ontology - 2 Layers" description = "System design ontology considering only 2 layers (types and instances)." group = "be.ua" version = "1.0.0" ext { dataset = "SystemDesignOntology2Layers" rootIri = "http://ua.be/sdo2l/description/bundle" url = "" bikeshed = "build/bikeshed" } repositories { mavenLocal() mavenCentral() maven { //url "https://git.rys.one/api/v4/groups/dtdesign/-/packages/maven" url "https://git.rys.one/api/v4/projects/${System.getenv('CI_PROJECT_ID')}/packages/maven" name "Gitlab" credentials(HttpHeaderCredentials) { name = "Job-Token" value = System.getenv("CI_JOB_TOKEN") } authentication { header(HttpHeaderAuthentication) } } } configurations { oml } ext { //coreVersion = "3.+" metrologyVersion = "+" } dependencies { //oml "io.opencaesar.ontologies:core-vocabularies:$coreVersion" oml "io.opencaesar.ontologies:metrology-vocabularies:$metrologyVersion" } task downloadDependencies(type:io.opencaesar.oml.merge.OmlMergeTask, group:"oml") { inputZipPaths = configurations.oml.files outputCatalogFolder = file("build/oml") } task omlToBikeshed(type: io.opencaesar.oml.bikeshed.Oml2BikeshedTask, group:"oml", dependsOn: downloadDependencies) { inputCatalogPath = file("catalog.xml") inputCatalogTitle = project.title inputCatalogVersion = project.version rootOntologyIri = "$rootIri".toString() outputFolderPath = file("$bikeshed") publishUrl = "$url".toString() } task generateDocs(type: Exec, dependsOn: omlToBikeshed) { inputs.files(fileTree("$bikeshed").include("**/*.bs")) outputs.files(fileTree("$bikeshed").include("**/*.html")) if (org.gradle.internal.os.OperatingSystem.current().isWindows()) { commandLine "$bikeshed/publish.bat" } else { commandLine "$bikeshed/publish.sh" } } 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 = "$rootIri".toString() // Entailment statements to generate and the ontologies to persist them in specs = [ "$rootIri/classes = ALL_SUBCLASS".toString(), "$rootIri/properties = INVERSE_PROPERTY | ALL_SUBPROPERTY".toString(), "$rootIri/individuals = ALL_INSTANCE | DATA_PROPERTY_VALUE | OBJECT_PROPERTY_VALUE | SAME_AS".toString() ] // Junit error report reportPath = file("build/reports/reasoning.xml") } task startFuseki(type: io.opencaesar.owl.fuseki.StartFusekiTask, group:"oml") { configurationPath = file(".fuseki.ttl") outputFolderPath = file(".fuseki") webUI = true } task stopFuseki(type: io.opencaesar.owl.fuseki.StopFusekiTask, group:"oml") { outputFolderPath = file(".fuseki") } task owlLoad(type:io.opencaesar.owl.load.OwlLoadTask, group:"oml", dependsOn: owlReason) { inputs.files(startFuseki.outputFolderPath) // rerun when fuseki restarts catalogPath = file("build/owl/catalog.xml") endpointURL = "https://fuseki.rys.app/$dataset".toString() fileExtensions = ["owl", "ttl"] iris = [ "$rootIri/classes".toString(), "$rootIri/properties".toString(), "$rootIri/individuals".toString() ] } task owlQuery(type:io.opencaesar.owl.query.OwlQueryTask, group:"oml", dependsOn: owlLoad) { inputs.files(owlLoad.inputs.files) // rerun when the dataset changes endpointURL = "https://fuseki.rys.app/$dataset".toString() queryPath = file("src/sparql") resultPath = file("build/results") format = "json" } task owlShacl(type:io.opencaesar.owl.shacl.fuseki.OwlShaclFusekiTask, group:"oml", dependsOn: owlLoad) { inputs.files(owlLoad.inputs.files) // rerun when the dataset changes endpointURL = "https://fuseki.rys.app/$dataset".toString() queryPath = file("src/shacl") resultPath = file("build/reports") } build { group "oml" dependsOn owlReason } tasks.named("clean") { group "oml" } task omlZip(type: Zip, group:"oml") { from file("src/oml") include "**/*.oml" destinationDirectory = file("build/libs") archiveBaseName = project.name archiveVersion = project.version } def pomConfig = { licenses { license { name "The Apache Software License, Version 2.0" url "http://www.apache.org/licenses/LICENSE-2.0.txt" distribution "repo" } } developers { developer { id "uantwerp" name "University of Antwerp" email "" } } scm { url "https://msdl.uantwerpen.be/git/lucasalbertins/DTDesign/" } } publishing { publications { maven(MavenPublication) { groupId project.group artifactId project.name version project.version artifact omlZip pom { packaging = "zip" withXml { def root = asNode() if (configurations.find { it.name == "oml" }) { def dependencies = root.appendNode("dependencies") configurations.oml.resolvedConfiguration.resolvedArtifacts.each { def dependency = dependencies.appendNode("dependency") dependency.appendNode("groupId", it.moduleVersion.id.group) dependency.appendNode("artifactId", it.moduleVersion.id.name) dependency.appendNode("version", it.moduleVersion.id.version) if (it.classifier != null) { dependency.appendNode("classifier", it.classifier) dependency.appendNode("type", it.extension) } } } root.appendNode("name", project.ext.title) root.appendNode("description", project.description) root.appendNode("url", "https://msdl.uantwerpen.be/git/lucasalbertins/DTDesign/") root.children().last() + pomConfig } } } } repositories { maven { //url "https://git.rys.one/api/v4/groups/dtdesign/-/packages/maven" url "https://git.rys.one/api/v4/projects/${System.getenv('CI_PROJECT_ID')}/packages/maven" name "Gitlab" credentials(HttpHeaderCredentials) { name = "Job-Token" value = System.getenv("CI_JOB_TOKEN") } authentication { header(HttpHeaderAuthentication) } } } } //signing { // def pgpSigningKey = project.findProperty("pgpSigningKey") // if (pgpSigningKey != null) { pgpSigningKey = new String(pgpSigningKey.decodeBase64()) } // def pgpSigningPassword = project.findProperty("pgpSigningPassword") // useInMemoryPgpKeys(pgpSigningKey, pgpSigningPassword) // sign publishing.publications.maven //} //gradle.taskGraph.whenReady { taskGraph -> // signMavenPublication.onlyIf { taskGraph.allTasks.any{it.name == "publishMavenPublicationToGitlabRepository"} } //} eclipse { synchronizationTasks downloadDependencies }