How to make schema less titan graph?How to set schema-default propery? -
how make schema less titan graph?how set schema-default propery ? please suggest way?here code :
try{ //timestamp,1416375283,ipaddress,2097152002,mobilenumber,966566564213,eventname,1000 // todo auto-generated method stub fileinputstream fstream = new fileinputstream("/root/edges_sorted.txt"); datainputstream in = new datainputstream(fstream); bufferedreader br = new bufferedreader(new inputstreamreader(in)); string csv = "/root/log.csv"; filewriter writer = new filewriter(csv); configuration conf = new baseconfiguration(); conf.setproperty("storage.backend","hbase"); conf.setproperty("storage.hostname","192.168.51.98"); conf.setproperty("storage.batch-loading","true"); conf.setproperty("storage.batch-loading",true); conf.setproperty("storage.buffer-size",3024000); conf.setproperty("storage.tablename",graphname); conf.setproperty("ids.block-size", 1000000); conf.setproperty("ids.flush ", true); //set db cache conf.setproperty("cache.db-cache",true); //set cache size conf.setproperty("cache.db-cache-size",0.5); conf.setproperty("storage.hbase.region-count",3); conf.setproperty("storage.hbase.skip-schema-check", false); conf.setproperty("storage.index.titan5.backend","elasticsearch"); conf.setproperty("storage.index.titan5.hostname", "192.168.51.95"); conf.setproperty("storage.index.titan5.client-only", false); conf.setproperty("storage.index.titan5.cluster-name","titancluster"); conf.setproperty("storage.index.titan5.index-name", indexname); conf.setproperty("graph.set-vertex-id",true); conf.setproperty("attributes.allow-all",true); conf.setproperty("schema.default",false); titangraph titangraph = titanfactory.open(conf); titangraph.makelabel("reason").manytomany().make(); titangraph.makelabel("many").manytomany().make(); batchgraph<titangraph> titanbatchgraph=new batchgraph<titangraph>(titangraph,vertexidtype.number,batchsize); titanbatchgraph.setloadingfromscratch(true); string locations[]=createdummy1.getcirclelist(); string strline1=""; int circleindex=0; int count=0; vertex vertex; vertex vertex2; count ++; if(circleindex==locations.length) circleindex=0; vertex=titanbatchgraph.getvertex(1); if(vertex==null){ vertex = titanbatchgraph.addvertex(1); vertex.setproperty("n",1); vertex.setproperty("a",100); } vertex2=titanbatchgraph.getvertex(2); if(vertex2==null){ count++; vertex2 = titanbatchgraph.addvertex(2); vertex2.setproperty("n",2); vertex2.setproperty("a", 10000); } edge edge= titanbatchgraph.addedge(1,vertex,vertex2,"reason"); edge.setproperty("ti",1); edge.setproperty("s", 5); //second edge vertex=titanbatchgraph.getvertex(1); if(vertex==null){ vertex = titanbatchgraph.addvertex(1); vertex.setproperty("n",1); vertex.setproperty("a",100); } else { vertex.setproperty("n1", 45); } vertex2=titanbatchgraph.getvertex(2); if(vertex2==null){ count++; vertex2 = titanbatchgraph.addvertex(2); vertex2.setproperty("n",2); vertex2.setproperty("a", 10000); } edge edge1= titanbatchgraph.addedge(2,vertex,vertex2,"reason"); edge1.setproperty("ti",2); edge1.setproperty("s",6); titanbatchgraph.commit(); titanbatchgraph.shutdown(); } catch(exception e) { e.printstacktrace(); } }
how set scheme-default configuration? how set default automatic schemas generated?please suggest way or alternative ?
titan set in configuration default. elaborate, settings schema.default
set blueprints
automatically. force schema definition, need set value none
. docs read:
configures defaultschemamaker used graph. if set none, automatic schema creation disabled. defaults blueprints compatible schema maker multi edge labels , single property keys
to enforce schema need this:
conf.setproperty("schema.default","none");
and use "default" schema creation system should do:
conf.setproperty("schema.default","blueprints");
all said, bad idea allow titan create schema except simple cases. if don't provide titan schema, lose many optimizations , features titan provides , therefore performance may not possible be.
Comments
Post a Comment