Independent distribution for RDF4J Console

72 views
Skip to first unread message

Jo-Jo

unread,
Mar 12, 2021, 4:18:59 PM3/12/21
to RDF4J Users
Hello, I am a new user of RDF4J and very impressed by it so far! I am trying to configure a Docker image based on the eclipse/rdf4j-workbench image to load some RDF data in the container via the RDF4J console utility before starting the RDF4J server. To do this, I believe I would need to copy the console utility into my container. I know the console utility is included in the SDK distribution, but that comes along with the server and workbench tools as well. I was wondering if I could download the console utility on its own, or somehow extricate it from the RDF4J SDK, so I wouldn't have to copy the entire SDK into my container. Does anyone have any ideas? Thank you!

bart.h...@bosa.fgov.be

unread,
Mar 12, 2021, 4:55:27 PM3/12/21
to RDF4J Users
Hi,

glad you like RDF4J :-)

I'm not entirely sure your setup will work in 1 step, since the Console needs to connect to a running server to create the repository and load the data...
And docker is actually meant for running 1 process.

(By the way, another way of creating a repository and loading data would be via the REST-API https://rdf4j.org/documentation/reference/rest-api/#repository-creation
E.g. via curl or wget)

Perhaps the easiest way would be to run a separate workbench, manually create a (e.g. nativestore) repository and load the data via the workbench web interface.
Then, make a copy of the newly created directories and files, and add these (COPY) to your docker image.

Best regards

Bart

Jo-Jo

unread,
Mar 12, 2021, 5:12:08 PM3/12/21
to RDF4J Users
Hello Bart,

Thanks for your helpful response!! That second suggestion you had is exactly what we were thinking to do hahah, but we were just concerned that it felt a bit brittle (e.g., if the RDF4J server updates and then expects a different repository directory data format, we would have to manually go through the entire process again to generate new data to COPY into the image). We noticed that the console has a default data directory that it puts data in (without requiring a server running); we suspect we can load the data via the Console into that default data directory, and then move the contents into the /var/rdf4j VOLUME created in the base image (where the RDF4J server reads data from). I believe we should be able to execute these data loading steps via the Console with RUN instructions when building the image, and will not require us to run multiple processes. 

bart.h...@bosa.fgov.be

unread,
Mar 14, 2021, 8:28:11 AM3/14/21
to RDF4J Users
Hmz, sounds like we could actually introduce two new feature requests: 

- a separate distribution of the Console (as you suggested), e.g as a "fat/uber" jar
- and a new server feature, which would just load a repository config and data from a predefined directory on startup

Bart

Jeen Broekstra

unread,
Mar 15, 2021, 6:54:19 PM3/15/21
to RDF4J Users


On Sat, 13 Mar 2021, at 09:12, Jo-Jo wrote:
Hello Bart,

Thanks for your helpful response!! That second suggestion you had is exactly what we were thinking to do hahah, but we were just concerned that it felt a bit brittle (e.g., if the RDF4J server updates and then expects a different repository directory data format, we would have to manually go through the entire process again to generate new data to COPY into the image).

For what it's worth, we wouldn't change that format lightly, and certainly not without offering an automated migration path (we've done some updates to the directory structure in the past, and always made sure the server can recognize an older format and automatically update at startup).

As for a separate distribution of the Console tool: we have no official distro channel for that use case (yet) but using Maven it should not be too hard to set something up yourself. One way would be to create a maven project, add a dependency on artifact rdf4j-console (and probably a logger implementation, like logback). Then you can run the console by just executing it as a Java program, for example like this:

mvn exec:java -Djava.mainClass="org.eclipse.rdf4j.console.Console"

A bit low-level perhaps, but basically workable I think.

Cheers,

Jeen

Jo-Jo

unread,
Mar 17, 2021, 9:32:31 PM3/17/21
to RDF4J Users
Thank you so much for your help! I really appreciate the prompt and thoughtful responses. I would love to submit a feature request for the separate Console distribution and the new server feature to load repository data from a predefined directory :)

I have attempted the Maven-project method described by @Jeen but unfortunately am running into an error when trying to run the command you provided. I have to admit I am new to Maven/Java in general so I might be missing something very obvious! All I did was create a new Maven project and I added the rdf4j-console dependency to the pom.xml file:

```
<dependency>
    <groupId>org.eclipse.rdf4j</groupId>
    <artifactId>rdf4j-console</artifactId>
    <version>3.3.1</version>
</dependency>
```

I have attached the full traceback below. Please let me know if you can help me debug this!

```
/usr/local/tomcat/rdf4jConsole # mvn exec:java -Djava.mainClass="org.eclipse.rdf4j.console.Console" -e

[INFO] Error stacktraces are turned on.

[INFO] Scanning for projects...

[INFO

[INFO] ------------------< curai.kb.alexandria:rdf4jConsole >------------------

[INFO] Building rdf4jConsole 1.0-SNAPSHOT

[INFO] --------------------------------[ jar ]---------------------------------

[INFO

[INFO] --- exec-maven-plugin:3.0.0:java (default-cli) @ rdf4jConsole ---

[INFO] ------------------------------------------------------------------------

[INFO] BUILD FAILURE

[INFO] ------------------------------------------------------------------------

[INFO] Total time:  0.803 s

[INFO] Finished at: 2021-03-18T01:25:36Z

[INFO] ------------------------------------------------------------------------

[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.0.0:java (default-cli) on project rdf4jConsole: The parameters 'mainClass' for goal org.codehaus.mojo:exec-maven-plugin:3.0.0:java are missing or invalid -> [Help 1]

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.0.0:java (default-cli) on project rdf4jConsole: The parameters 'mainClass' for goal org.codehaus.mojo:exec-maven-plugin:3.0.0:java are missing or invalid

    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)

    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)

    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)

    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)

    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)

    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)

    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)

    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)

    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)

    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)

    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)

    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)

    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)

    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)

    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)

    at java.lang.reflect.Method.invoke (Method.java:498)

    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)

    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)

    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)

    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)

Caused by: org.apache.maven.plugin.PluginParameterException: The parameters 'mainClass' for goal org.codehaus.mojo:exec-maven-plugin:3.0.0:java are missing or invalid

    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.populatePluginFields (DefaultMavenPluginManager.java:644)

    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo (DefaultMavenPluginManager.java:597)

    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:124)

    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)

    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)

    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)

    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)

    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)

    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)

    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)

    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)

    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)

    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)

    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)

    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)

    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)

    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)

    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)

    at java.lang.reflect.Method.invoke (Method.java:498)

    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)

    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)

    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)

    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)

[ERROR

[ERROR] Re-run Maven using the -X switch to enable full debug logging.

[ERROR

[ERROR] For more information about the errors and possible solutions, please read the following articles:

[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginParameterException
```


Jo-Jo

unread,
Mar 17, 2021, 9:45:25 PM3/17/21
to RDF4J Users
Just kidding!! I got it, had to use `-Dexec.mainClass` not `-Djava.mainClass` :)
Reply all
Reply to author
Forward
0 new messages