0

スキーマレスタイタングラフを作成するには?スキーマデフォルトプロパティを設定するには? 方法を提案してください?これが私のコードです:

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 the db cache
    conf.setProperty("cache.db-cache",true);
    //set the 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();
    }
    }

スキームのデフォルト構成を設定するには? 自動スキーマが生成されるようにデフォルトに設定する方法は?方法または代替案を提案してください。

4

1 に答える 1