Setup GRAKN on JanusGraph


#1

Hi,

after https://github.com/graknlabs/grakn/pull/1875 has been merged and since Filipe mentioned in Slack to me that it should now be possible to use JanusGraph (“Yes you can use it but you will need to clone the repo and build the stack. We can guide you through this.”): Could someone help me with setting up GRAKN on JanusGraph?

I’m on Ubuntu 16.04 LTS and have successfully used both JanusGraph and GRAKN in isolation. Could someone give me a few pointers on how to proceed from here?

Thank you in advance.

Best wishes,
fpollok


#2

Hi @fpollok,

So just a quick disclaimer, what I am going to run through will get you working on the development branch of Grakn where things are in constant flux so be aware that there may be bugs or performance issues we have not ironed out yet.

With that out of the way lets begin:

  1. Ensure you have Oracle JDK 8 installed and JAVA is on your path.
  2. Ensure you have Maven installed
  3. Ensure you have Git installed

With the prerequisites out of the way you going to want to do the following:

  1. From terminal clone the repo with: git clone https://github.com/graknlabs/grakn
  2. Navigate into the directory grakn with cd grakn
  3. Compile and package the repo mvn clean package -DskipTests
  4. Navigate into cd grakn-dist/target/ in there you will see a zip and a tar of the grakn distribution. Copy that, unzip it somewhere and you can start using grakn as normal.

Hope that helps!


#3

Cannot compile:

npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
/home/fpollok/GRAKN/grakn/grakn-engine/npm/bin/raml2html -> /home/fpollok/GRAKN/grakn/grakn-engine/npm/lib/node_modules/raml2html/bin/raml2html
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.2 (node_modules/raml2html/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

+ raml2html@3.0.1
added 293 packages in 17.206s
[INFO] 
[INFO] --- exec-maven-plugin:1.5.0:exec (raml2html) @ grakn-engine ---
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building grakn-dashboard 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ grakn-dashboard ---
[INFO] 
[INFO] --- maven-checkstyle-plugin:2.17:check (validate) @ grakn-dashboard ---
[INFO] Starting audit...
Audit done.
[INFO] 
[INFO] --- jacoco-maven-plugin:0.7.6.201602180812:prepare-agent (prepare-agent) @ grakn-dashboard ---
[INFO] argLine set to -javaagent:/home/fpollok/.m2/repository/org/jacoco/org.jacoco.agent/0.7.6.201602180812/org.jacoco.agent-0.7.6.201602180812-runtime.jar=destfile=/home/fpollok/GRAKN/grakn/grakn-dashboard/target/jacoco.exec,excludes=**/antlr/**
[INFO] 
[INFO] --- exec-maven-plugin:1.5.0:exec (yarn install) @ grakn-dashboard ---
[ERROR] Command execution failed.
java.io.IOException: Cannot run program "yarn" (in directory "/home/fpollok/GRAKN/grakn/grakn-dashboard"): error=2, No such file or directory
	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
	at java.lang.Runtime.exec(Runtime.java:620)
	at org.apache.commons.exec.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:61)
	at org.apache.commons.exec.DefaultExecutor.launch(DefaultExecutor.java:279)
	at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:336)
	at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
	at org.codehaus.mojo.exec.ExecMojo.executeCommandLine(ExecMojo.java:764)
	at org.codehaus.mojo.exec.ExecMojo.executeCommandLine(ExecMojo.java:711)
	at org.codehaus.mojo.exec.ExecMojo.execute(ExecMojo.java:289)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
	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:289)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: java.io.IOException: error=2, No such file or directory
	at java.lang.UNIXProcess.forkAndExec(Native Method)
	at java.lang.UNIXProcess.<init>(UNIXProcess.java:247)
	at java.lang.ProcessImpl.start(ProcessImpl.java:134)
	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
	... 30 more
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] Grakn .............................................. SUCCESS [02:11 min]
[INFO] grakn-core ......................................... SUCCESS [ 21.347 s]
[INFO] grakn-kb ........................................... SUCCESS [02:18 min]
[INFO] grakn-test-tools ................................... SUCCESS [01:06 min]
[INFO] grakn-test-profiles ................................ SUCCESS [  0.072 s]
[INFO] grakn-graql ........................................ SUCCESS [ 26.882 s]
[INFO] grakn-client ....................................... SUCCESS [  5.734 s]
[INFO] grakn-graql-shell .................................. SUCCESS [  2.498 s]
[INFO] grakn-module-sdk ................................... SUCCESS [  0.882 s]
[INFO] grakn-engine ....................................... SUCCESS [01:33 min]
[INFO] grakn-dashboard .................................... FAILURE [  0.059 s]
[INFO] grakn-migration .................................... SKIPPED
[INFO] migration-base ..................................... SKIPPED
[INFO] migration-owl ...................................... SKIPPED
[INFO] migration-csv ...................................... SKIPPED
[INFO] migration-json ..................................... SKIPPED
[INFO] migration-export ................................... SKIPPED
[INFO] migration-sql ...................................... SKIPPED
[INFO] migration-xml ...................................... SKIPPED
[INFO] grakn-factory ...................................... SKIPPED
[INFO] janus-factory ...................................... SKIPPED
[INFO] grakn-dist ......................................... SKIPPED
[INFO] grakn-test ......................................... SKIPPED
[INFO] test-integration ................................... SKIPPED
[INFO] test-snb ........................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 08:12 min
[INFO] Finished at: 2017-10-02T08:00:39-04:00
[INFO] Final Memory: 145M/2217M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.5.0:exec (yarn install) on project grakn-dashboard: Command execution failed. Cannot run program "yarn" (in directory "/home/fpollok/GRAKN/grakn/grakn-dashboard"): error=2, No such file or directory -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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/MojoExecutionException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :grakn-dashboard

Any suggestions? Thanks in advance.

PS:
Does it make sense to wait for the 0.17 release?


#4

You need to install yarn. With mac that is:

brew install yarn

and linux as defined here

Does it make sense to wait for the 0.17 release?

What are you trying to do?


#5

Strange. Even with 0.16 I run into problems when running the SQL world migration example. There are lines

Grakn.session(Grakn.DEFAULT_URI, keyspace).open(GraknTxType.WRITE);

that will throw NullPointerExceptions for me, e.g. in printInformationAboutWorld(). It’s the open(GraknTxType.WRITE) part that causes it. Any ideas?

Example output:

Exception in thread "main" java.lang.NullPointerException
	at ai.grakn.factory.GraknSessionImpl.configureGraphFactoryRemote(GraknSessionImpl.java:151)
	at ai.grakn.factory.GraknSessionImpl.configureGraphFactory(GraknSessionImpl.java:134)
	at ai.grakn.factory.GraknSessionImpl.getConfiguredFactory(GraknSessionImpl.java:90)
	at ai.grakn.factory.GraknSessionImpl.open(GraknSessionImpl.java:79)
	at ai.grakn.example.SQLWorldMigrator.printInformationAboutWorld(SQLWorldMigrator.java:76)
	at ai.grakn.example.Main.main(Main.java:50)

Note: I added debug statements, so 76 is not an accurate line number. It’s the first line inside printInformationAboutWorld().

Thanks in advance.