Skip to content

Instantly share code, notes, and snippets.

@fancyerii
Created August 20, 2014 09:16
Show Gist options
  • Save fancyerii/777b540f489e5e9e6b6c to your computer and use it in GitHub Desktop.
Save fancyerii/777b540f489e5e9e6b6c to your computer and use it in GitHub Desktop.
schema
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();
graph.makeKey("l_name").dataType(String.class).indexed(Vertex.class).indexed(Edge.class).make();
graph.makeKey("v_type").dataType(Integer.class).indexed(Vertex.class).make();
graph.makeLabel("predicate").oneToOne().make();
graph.makeLabel("meaning_to_word").manyToMany().make();
graph.makeLabel("toMeaning").manyToOne().unidirected().make();
graph.commit();
graph.shutdown();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment