Creating a Titan Graph from Java

237 views
Skip to first unread message

Kushal Datta

unread,
Sep 18, 2013, 4:30:15 PM9/18/13
to aureliu...@googlegroups.com
 
 Hi,
     I am trying to create a Titan Graph from a Java program. However I keep getting a GraphQuery Excepton. Here's the code snippet:
 
class CreateTitanGraph {
  TitanGraph graph;
  public static void main(String args[]) {
    Configuration config = new BaseConfiguration();
    config.setProperty("storage.backend", "hbase");
    graph = TitanFactory.open(config);

    String name = "Alice";
    Vertex vertex = graph.addVertex("id_001");
     vertex.setProperty("name", name);
     graph.commit();
     graph.shutdown();
  }
}

The exception messages look like:

13/09/18 13:24:52 INFO mapred.JobClient: Task Id : attempt_201308121113_0417_r_000009_0, Status : FAILED
Error: com.thinkaurelius.titan.graphdb.database.serialize.kryo.KryoSerializer.setRegistrationOptional(Z)V
13/09/18 13:24:53 INFO mapred.JobClient: Task Id : attempt_201308121113_0417_r_000020_0, Status : FAILED
Error: java.lang.ClassNotFoundException: com.tinkerpop.blueprints.GraphQuery
        at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
        at com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:40)

Harsh Kumar

unread,
Sep 19, 2013, 2:37:39 AM9/19/13
to aureliu...@googlegroups.com

Hi Kushal,

It appears to me that you have not really created your schema. You can use the makeType() method to create a schema.

e.g. graph.makeType().name("name").dataType(String.class).makePropertyKey();

Hope it helped

Regards
Harsh Kumar


--
You received this message because you are subscribed to the Google Groups "Aurelius" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aureliusgraph...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Stay Great

Harsh Kumar

David

unread,
Sep 19, 2013, 10:04:35 AM9/19/13
to aureliu...@googlegroups.com
Hi,

I just glanced at the exception, but I typically supply more information in my configuration when connecting to HBase:

        BaseConfiguration conf = new BaseConfiguration();
        conf.setProperty('storage.backend', 'hbase');
        conf.setProperty('storage.tablename',  'myhbasetable');
        conf.setProperty('storage.hostname',  'your.host.name.here');

Kushal Datta

unread,
Sep 19, 2013, 3:43:13 PM9/19/13
to aureliu...@googlegroups.com
what else should I supply to HBase configuration? Is there some documentation for this?

Daniel Kuppitz

unread,
Sep 19, 2013, 3:48:23 PM9/19/13
to aureliu...@googlegroups.com
Using HBase -- First result in Google when you search for Titan HBase.


2013/9/19 Kushal Datta <kushal...@gmail.com>

--

Kushal Datta

unread,
Sep 20, 2013, 12:41:06 PM9/20/13
to aureliu...@googlegroups.com
 Ok, finally got out of it. Changing to the latest 0.3.2 version of com.thinkaurelius.titan in maven fixed the bug. The "old" version I was using did not have the GraphQuery class in it.
Reply all
Reply to author
Forward
0 new messages