Created
November 14, 2018 17:26
-
-
Save benoitguigal/8b205215bdd36c7a4aa4feb75576fa71 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.janusgraph.core.JanusGraphFactory | |
import org.janusgraph.core.Cardinality | |
import org.apache.tinkerpop.gremlin.structure.Vertex | |
// define the schema | |
graph = JanusGraphFactory.open('conf/janusgraph-cassandra-es.properties') | |
mgmt = graph.openManagement() | |
mgmt.makeVertexLabel('person').make() | |
mgmt.makeEdgeLabel('is_linked_to').make() | |
entity = mgmt.makePropertyKey('entity').dataType(String.class).cardinality(Cardinality.SINGLE).make() | |
prenom = mgmt.makePropertyKey('prenom').dataType(String.class).cardinality(Cardinality.SINGLE).make() | |
nom = mgmt.makePropertyKey('nom').dataType(String.class).cardinality(Cardinality.SINGLE).make() | |
date_operation = mgmt.makePropertyKey('date_operation').dataType(String.class).cardinality(Cardinality.SINGLE).make() | |
valeur_euro = mgmt.makePropertyKey('valeur_euro').dataType(Double.class).cardinality(Cardinality.SINGLE).make() | |
mgmt.buildIndex('vertexByPrenomNom', Vertex.class).addKey(mgmt.getPropertyKey('prenomnom')).buildMixedIndex('search') | |
mgmt.buildIndex('vertexByEntity', Vertex.class).addKey(entity).buildCompositeIndex() | |
mgmt.commit() | |
graph.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment