Skip to content

Commit

Permalink
Improved fuseki support for Gradle 7.5.1 and Apache Jena Fuseki 4.5.0 (
Browse files Browse the repository at this point in the history
…#34)

* Improved fuseki support for Gradle 7.5.1 and Apache Jena Fuseki 4.5.0

* Deleted debug logs.

* Updated for Fuseki 4.6.0
4.6 changed the handling of logging where the -Dlog4j.configurationFile argument caused a conflict with the manifest.

* Updated wrapper for JDK17 compatibility.

* Fixed windows-specific file path calculation

* Updated major version for jdk17

* source and target compatibility

* Use the Apache Maven Resolver libraries to find the Apache Fuseki dependencies from Maven Central and download them to the user's .m2/repository.

* Use the Apache Maven Resolver libraries to find the Apache Fuseki dependencies from Maven Central and download them to the user's .m2/repository.

* Build with 17 but keep source/target to 11.

* Fuseki update

* fuseki port is 3030 by default

* Optional settings.

* Checking port param before setting

* Fixing some warnings

Co-authored-by: NicolasRouquette <[email protected]>
Co-authored-by: Maged Elaasar <[email protected]>
  • Loading branch information
3 people authored Nov 8, 2022
1 parent 6c1dd48 commit d0da802
Show file tree
Hide file tree
Showing 25 changed files with 847 additions and 255 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ language: java
install: true

jdk:
- openjdk11
- openjdk17

cache:
directories:
Expand Down
11 changes: 7 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
subprojects {
group = 'io.opencaesar.owl'
version = '1.0.11'
version = '1.1.0'

ext.versions = [
owl: '5.1.17',
openllet: '2.6.5',
jena: '4.2.0', // cannot update to 4.3.+, see OwlLoadApp.
jena: '4.6.1',
jgrapht: '1.1.0',
xmlcatalog: '1.0.4',
xmlresolver: '1.2',
commonsIo: '2.11.0',
jcommander: '1.82',
log4j: '1.2.17',
slf4j: '1.7.33',
junit: '4.13.2'
junit: '4.13.2',
mavenResolver: '1.8.2',
mavenProvider: '3.8.4'
]

repositories {
Expand All @@ -27,6 +29,7 @@ subprojects {
apply from: "${rootDir}/gradle/maven-deployment.gradle"

sourceCompatibility = '11'
targetCompatibility = '11'

java {
withJavadocJar()
Expand All @@ -40,4 +43,4 @@ subprojects {
}
}

}
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
7 changes: 1 addition & 6 deletions owl-close-world/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=11
6 changes: 6 additions & 0 deletions owl-diff/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=11
6 changes: 6 additions & 0 deletions owl-fuseki-gradle/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=11
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@

import org.gradle.api.DefaultTask;
import org.gradle.api.GradleException;
import org.gradle.api.file.DirectoryProperty;
import org.gradle.api.file.RegularFile;
import org.gradle.api.file.RegularFileProperty;
import org.gradle.api.file.*;
import org.gradle.api.provider.Property;
import org.gradle.api.provider.Provider;
import org.gradle.api.tasks.Input;
Expand All @@ -19,6 +17,13 @@
import org.gradle.api.tasks.TaskAction;

public abstract class StartFusekiTask extends DefaultTask {
@Optional
@Input
public abstract Property<String> getFusekiVersion();

@Optional
@Input
public abstract Property<String> getRemoteRepositoryURL();

@InputFile
public abstract RegularFileProperty getConfigurationPath();
Expand All @@ -30,6 +35,10 @@ public abstract class StartFusekiTask extends DefaultTask {
@Input
public abstract Property<Boolean> getWebUI();

@Optional
@Input
public abstract Property<Integer> getPort();

@Optional
@Input
public abstract Property<Integer> getMaxPings();
Expand Down Expand Up @@ -60,8 +69,15 @@ protected Provider<RegularFile> getOutputFile() throws IOException {
@TaskAction
public void run() {
final ArrayList<String> args = new ArrayList<>();
args.add("-c");
args.add(FusekiApp.Command.start.toString());
if (getFusekiVersion().isPresent()) {
args.add("--fuseki-version");
args.add(getFusekiVersion().get());
}
if (getRemoteRepositoryURL().isPresent()) {
args.add("-url");
args.add(getRemoteRepositoryURL().get());
}
if (getConfigurationPath().isPresent()) {
args.add("-g");
args.add(getConfigurationPath().get().getAsFile().getAbsolutePath());
Expand All @@ -70,9 +86,14 @@ public void run() {
args.add("-o");
args.add(getOutputFolderPath().get().getAsFile().getAbsolutePath());
}
if (getPort().isPresent()) {
args.add("--port");
args.add(getPort().get().toString());
}
if (getWebUI().isPresent()) {
if (getWebUI().get())
args.add("-ui");
if (getWebUI().get()) {
args.add("-ui");
}
}
if (getMaxPings().isPresent()) {
args.add("-p");
Expand All @@ -82,7 +103,8 @@ public void run() {
args.add("-d");
}
try {
FusekiApp.main(args.toArray(new String[0]));
String[] a = args.toArray(new String[0]);
FusekiApp.main(a);

// Delete the 'fuseki.stopped' file to enable stopFuseki again.
if (getOutputFolderPath().isPresent()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public abstract class StopFusekiTask extends DefaultTask {
@TaskAction
public void run() {
final ArrayList<String> args = new ArrayList<>();
args.add("-c");
args.add(FusekiApp.Command.stop.toString());
if (getOutputFolderPath().isPresent()) {
args.add("-o");
Expand Down
6 changes: 6 additions & 0 deletions owl-fuseki/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=11
61 changes: 43 additions & 18 deletions owl-fuseki/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,32 +27,57 @@ Args:
This is an incremental task; Gradle will determine whether to run this task
if any of the properties changed in values.

Example usage:

```
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'io.opencaesar.owl:owl-fuseki-gradle:+'
}
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath 'io.opencaesar.owl:owl-fuseki-gradle:3.+'
}
task startFuseki(type: io.opencaesar.owl.fuseki.StartFusekiTask) {
configurationPath = file('path/to/.fuseki.ttl')
outputFolderPath = file('path/to/output/folder') // with webui, there must be a 'webapp' subfolder for the Fuseki UI
webui = true // optional
port = 3030
outputFolderPath = file('path/to/output/folder') // with webui, a 'webapp' subfolder will be created
webUI = true // optional, default is false.
maxPings = 10 // optional
remoteRepositoryURL = 'https://internal/artifactory/maven-remote-virtual' // if unset, defaults to https://repo.maven.apache.org/maven2/
}
task stopFuseki(type: io.opencaesar.owl.fuseki.StopFusekiTask) {
outputFolderPath = file('path/to/output/folder')
}
```

## Important
* To start Fuseki with the UI, the output folder must have a `webapp` subfolder. The simplest way to get such a folder is to download the [`apache-jena-fuseki-version>.zip`](https://jena.apache.org/download/) file, unzip it, and copy its 'webapp' folder to the output folder.
* When choosing the output folder to be in the same project folder managed in github, you can put the following rules in the `.gitignore` file:
```
path/to/output/folder/run
path/to/output/folder/fuseki.pid
path/to/output/folder/fuseki.log
```
Example of `.fuseki.ttl`:

```turtle
@prefix fuseki: <http://jena.apache.org/fuseki#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> .
@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .
@prefix : <#> .
[] rdf:type fuseki:Server .
<#service> rdf:type fuseki:Service ;
rdfs:label "Oml Template" ; # Human readable label for dataset
fuseki:name "oml-template" ; # Name of the dataset in the endpoint url
fuseki:serviceReadWriteGraphStore "data" ; # SPARQL Graph store protocol (read and write)
fuseki:endpoint [ fuseki:operation fuseki:query ; fuseki:name "sparql" ] ; # SPARQL query service
fuseki:endpoint [ fuseki:operation fuseki:shacl ; fuseki:name "shacl" ] ; # SHACL query service
fuseki:dataset <#dataset> .
# In memory TDB with union graph.
<#dataset> rdf:type tdb:DatasetTDB ;
tdb:location "--mem--" ;
# Query timeout on this dataset (1s, 1000 milliseconds)
ja:context [ ja:cxtName "arq:queryTimeout" ; ja:cxtValue "1000" ] ;
# Make the default graph be the union of all named graphs.
tdb:unionDefaultGraph true .
```
18 changes: 14 additions & 4 deletions owl-fuseki/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,22 @@ mainClassName = 'io.opencaesar.owl.fuseki.OwlFusekiApp'
applicationName = 'owl-fuseki'

dependencies {
// Note: In principle, this dependency should suffice because it declares dependencies to the libraries below.
// Unfortunately, this dependency alone is not sufficient to resolve the source code dependencies.
//
// implementation "org.apache.maven:maven-resolver:${versions.mavenProvider}"
//
// Below are the dependencies required to properly resolve the fuseki-related jars.
implementation "org.apache.maven:maven-resolver-provider:${versions.mavenProvider}"
implementation "org.apache.maven.resolver:maven-resolver-api:${versions.mavenResolver}"
implementation "org.apache.maven.resolver:maven-resolver-connector-basic:${versions.mavenResolver}"
implementation "org.apache.maven.resolver:maven-resolver-impl:${versions.mavenResolver}"
implementation "org.apache.maven.resolver:maven-resolver-transport-file:${versions.mavenResolver}"
implementation "org.apache.maven.resolver:maven-resolver-transport-http:${versions.mavenResolver}"
implementation "org.apache.maven.resolver:maven-resolver-util:${versions.mavenResolver}"

implementation "com.beust:jcommander:${versions.jcommander}"
implementation "log4j:log4j:${versions.log4j}"
implementation "org.slf4j:slf4j-simple:${versions.slf4j}"
testImplementation "junit:junit:${versions.junit}"

implementation "org.apache.jena:jena-fuseki-server:${versions.jena}"
implementation "org.apache.jena:jena-fuseki-fulljar:${versions.jena}"
implementation "org.apache.jena:jena-fuseki-war:${versions.jena}@war"
}
Loading

0 comments on commit d0da802

Please sign in to comment.