:remote connect tinkerpop.server conf/remote.yaml script = """ mgmt = graph.openManagement() person = mgmt.makeVertexLabel('person').make() category = mgmt.makeVertexLabel('category').make() vote = mgmt.makeEdgeLabel('vote').multiplicity(MULTI).make() user_id = mgmt.makePropertyKey('user_id').dataType(Integer.class).cardinality(Cardinality.SINGLE).make() mgmt.buildIndex('byPersonUserIdUnique', Vertex.class).addKey(user_id).indexOnly(person).unique().buildCompositeIndex() mgmt.setConsistency(user_id, ConsistencyModifier.LOCK) category_name = mgmt.makePropertyKey('category_name').dataType(String.class).cardinality(Cardinality.SINGLE).make() category_name = mgmt.getPropertyKey('category_name') mgmt.buildIndex('byCategoryNameUnique', Vertex.class).addKey(category_name = mgmt.getPropertyKey('category_name')).indexOnly(category).unique().buildCompositeIndex() mgmt.setConsistency(category_name, ConsistencyModifier.LOCK) votes = mgmt.makePropertyKey('votes').dataType(String.class).cardinality(Cardinality.SET).make() votes = mgmt.getPropertyKey('votes') mgmt.buildIndex('byEdgeVoteUnique', Vertex.class).addKey(votes).unique().buildCompositeIndex() mgmt.setConsistency(votes, ConsistencyModifier.LOCK) mgmt.commit() vp1 = graph.addVertex(T.label, "person", "user_id", 1, "name", "Jared", "age", 29) vp2 = graph.addVertex(T.label, "person", "user_id", 2, "name", "Brad", "age", 3000) vc3 = graph.addVertex(T.label, "category", "category_name", "dog") vc4 = graph.addVertex(T.label, "category", "category_name", "cat") vc5 = graph.addVertex(T.label, "category", "category_name", "fur") vp1.addEdge("vote", vc3, "votes", "'cat','fur'") vp2.addEdge("vote", vc3, "votes", "'fur','cat'") vp1.addEdge("vote", vc4, "votes", "'fur','dog'") vp2.addEdge("vote", vc4, "votes", "'dog','fur'") vp1.addEdge("vote", vc5, "votes", "'dog','cat'") vp2.addEdge("vote", vc5, "votes", "'cat','dog'") """ :> @script