Skip to content

Instantly share code, notes, and snippets.

@nickform-ost
Last active September 17, 2021 17:09
Show Gist options
  • Save nickform-ost/8ff6c3e34450d15f85413e3bd9384774 to your computer and use it in GitHub Desktop.
Save nickform-ost/8ff6c3e34450d15f85413e3bd9384774 to your computer and use it in GitHub Desktop.
Initializing an RDFox Server Directory with JRDFox
package org.example.jrdfox;
import java.util.HashMap;
import java.util.Map;
import tech.oxfordsemantic.jrdfox.client.ConnectionFactory;
public class ServerDirectoryInitializationDemo {
public static void main(String[] args) throws Exception {
Map<String,String> serverParameters = new HashMap<>();
serverParameters.put("persist-ds" , "file" );
serverParameters.put("persist-roles" , "file" );
serverParameters.put("server-directory", "/var/lib/RDFox/data" );
String[] warnings = ConnectionFactory.startLocalServer(serverParameters);
/* ... handle warnings ... */
if (ConnectionFactory.getNumberOfLocalServerRoles() == 0) {
System.out.println("Initializing server directory...");
ConnectionFactory.createFirstLocalServerRole("admin", "****");
}
else {
System.out.println("Server directory is already initialized!");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment