Skip to content

Instantly share code, notes, and snippets.

@fancyerii
fancyerii / gist:2057fa45eb49e50698ed
Last active August 29, 2015 14:05
Schema-define
public class CreateFreebaseGraph {
public static final String INDEX_NAME = "search";
public static void main(String[] args) {
TitanGraph graph=TitanFactory.open("/Users/lili/soft/titan-server-0.4.4/conf/titan-hbase-es.properties");
graph.shutdown();
TitanCleanup.clear(graph);
graph=TitanFactory.open("/Users/lili/soft/titan-server-0.4.4/conf/titan-hbase-es.properties");
@fancyerii
fancyerii / gist:99cb6395ceb5dc6d0277
Created August 13, 2014 11:05
Schema-define-log
0 [main] INFO com.thinkaurelius.titan.diskstorage.Backend - Configuring index [search] based on:
backend: elasticsearch
hostname: 127.0.0.1
client-only: true
cluster-name: mytestcluster
public class TestFreebaseGraph {
public static void main(String[] args) {
TitanGraph g=TitanFactory.open("/Users/lili/soft/titan-server-0.4.4/conf/titan-hbase-es.properties");
Vertex v1=g.addVertex(null);
String name="Jack Brown";
v1.setProperty("name", name);
v1.setProperty("l_name", name.toLowerCase());
v1.setProperty("f_name", name);
FileInputStream is = new FileInputStream("/Users/lili/Downloads/freebase-rdf-2014-08-03-00-00.gz");
GZIPInputStream gzis=new GZIPInputStream(is);
BufferedReader br=new BufferedReader(new InputStreamReader(gzis,"UTF8"));
int lineNum=0;
String line;
TitanGraph g=TitanFactory.open("/Users/lili/soft/titan-server-0.4.4/conf/titan-hbase-es.properties");
long total=0;
long start=System.currentTimeMillis();
int statSize=10_000;
class InsertThread extends Thread{
TitanGraph g=TitanFactory.open("/Users/lili/soft/titan-server-0.4.4/conf/titan-hbase-es.properties");
BlockingQueue<String> queue;
public InsertThread(BlockingQueue<String> queue){
this.queue=queue;
}
@Override
public void run(){
while(true){
try {
@fancyerii
fancyerii / gist:2cf070972886836eaae0
Created August 20, 2014 09:15
create graph and query with gremlin
public static void main(String[] args) {
TitanGraph g=TitanFactory.open("/Users/lili/soft/titan-server-0.4.4/conf/titan-hbase-es.properties");
{
Vertex mike=g.addVertex(null);
mike.setProperty("name", "Mike");
mike.setProperty("l_name", "mike");
mike.setProperty("v_type", 0);
Vertex automobile=g.addVertex(null);
automobile.setProperty("name", "Avalon");
public static void main(String[] args) {
TitanGraph graph=TitanFactory.open("/Users/lili/soft/titan-server-0.4.4/conf/titan-hbase-es.properties");
graph.shutdown();
TitanCleanup.clear(graph);
graph=TitanFactory.open("/Users/lili/soft/titan-server-0.4.4/conf/titan-hbase-es.properties");
graph.makeKey("name").dataType(String.class).make();
graph.makeKey("aliases").dataType(String.class).indexed(Vertex.class).list().make();
TestGremlin (1) [Java Application]
com.antbrains.graph.titan.TestGremlin at localhost:54499 (Suspended)
Daemon System Thread [Signal Dispatcher] (Suspended)
Daemon System Thread [Finalizer] (Suspended)
Daemon System Thread [Reference Handler] (Suspended)
Daemon Thread [main-SendThread(127.0.0.1:2181)] (Suspended)
Daemon Thread [main-EventThread] (Suspended)
Daemon Thread [elasticsearch[Leech][[timer]]] (Suspended)
Daemon Thread [elasticsearch[Leech][scheduler][T#1]] (Suspended)
Daemon Thread [elasticsearch[Leech][transport_client_worker][T#1]{New I/O worker #1}] (Suspended)
2014-08-25 12:56:56
Full thread dump Java HotSpot(TM) 64-Bit Server VM (24.65-b04 mixed mode):
"pool-4-thread-1-SendThread(127.0.0.1:2181)" daemon prio=5 tid=0x00007ff9be091000 nid=0x551f waiting on condition [0x00000001121a2000]
java.lang.Thread.State: TIMED_WAITING (sleeping)
at java.lang.Thread.sleep(Native Method)
at org.apache.zookeeper.ClientCnxnSocketNIO.cleanup(ClientCnxnSocketNIO.java:230)
at org.apache.zookeeper.ClientCnxn$SendThread.cleanup(ClientCnxn.java:1185)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1122)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.