final PropertyKey name = mgmt.makePropertyKey("name").dataType(String.class).make(); TitanManagement.IndexBuilder nameIndexBuilder = mgmt.buildIndex("name", Vertex.class).addKey(name); if (uniqueNameCompositeIndex) nameIndexBuilder.unique(); TitanGraphIndex namei = nameIndexBuilder.buildCompositeIndex(); mgmt.setConsistency(namei, ConsistencyModifier.LOCK); final PropertyKey age = mgmt.makePropertyKey("age").dataType(Integer.class).make(); if (null != mixedIndexName) mgmt.buildIndex("vertices", Vertex.class).addKey(age).buildMixedIndex(mixedIndexName); final PropertyKey time = mgmt.makePropertyKey("time").dataType(Integer.class).make(); final PropertyKey reason = mgmt.makePropertyKey("reason").dataType(String.class).make(); final PropertyKey place = mgmt.makePropertyKey("place").dataType(Geoshape.class).make(); if (null != mixedIndexName) mgmt.buildIndex("edges", Edge.class).addKey(reason).addKey(place).buildMixedIndex(mixedIndexName); mgmt.makeEdgeLabel("father").multiplicity(Multiplicity.MANY2ONE).make(); mgmt.makeEdgeLabel("mother").multiplicity(Multiplicity.MANY2ONE).make(); EdgeLabel battled = mgmt.makeEdgeLabel("battled").signature(time).make(); mgmt.buildEdgeIndex(battled, "battlesByTime", Direction.BOTH, Order.decr, time); mgmt.makeEdgeLabel("lives").signature(reason).make(); mgmt.makeEdgeLabel("pet").make(); mgmt.makeEdgeLabel("brother").make(); mgmt.makeVertexLabel("titan").make(); mgmt.makeVertexLabel("location").make(); mgmt.makeVertexLabel("god").make(); mgmt.makeVertexLabel("demigod").make(); mgmt.makeVertexLabel("human").make();
@Test public void testSchemaNameChange() { PropertyKey time = mgmt.makePropertyKey("time").dataType(Integer.class).cardinality(Cardinality.SINGLE).make(); EdgeLabel knows = mgmt.makeEdgeLabel("knows").multiplicity(Multiplicity.MULTI).make(); mgmt.buildEdgeIndex(knows, "byTime", Direction.BOTH, time); mgmt.buildIndex("timeIndex", Vertex.class).addKey(time).buildCompositeIndex(); mgmt.makeVertexLabel("people").make(); finishSchema(); assertTrue(mgmt.containsRelationType("knows")); knows = mgmt.getEdgeLabel("knows"); mgmt.changeName(knows, "know"); assertEquals("know", knows.name()); assertTrue(mgmt.containsRelationIndex(knows, "byTime")); RelationTypeIndex rindex = mgmt.getRelationIndex(knows, "byTime"); assertEquals("byTime", rindex.name()); mgmt.changeName(rindex, "overTime"); assertEquals("overTime", rindex.name()); assertTrue(mgmt.containsVertexLabel("people")); VertexLabel vl = mgmt.getVertexLabel("people"); mgmt.changeName(vl, "person"); assertEquals("person", vl.name()); assertTrue(mgmt.containsGraphIndex("timeIndex")); TitanGraphIndex gindex = mgmt.getGraphIndex("timeIndex"); mgmt.changeName(gindex, "byTime"); assertEquals("byTime", gindex.name());
initializeGraph(); mgmt.getPropertyKey("uid"); makeVertexIndexedUniqueKey("dummyProperty",String.class); makeLabel("dummyRelationship");
public TitanGraphIndex getExternalIndex(Class<? extends Element> clazz, String backingIndex) { String prefix; if (Vertex.class.isAssignableFrom(clazz)) prefix = "v"; else if (Edge.class.isAssignableFrom(clazz)) prefix = "e"; else if (TitanVertexProperty.class.isAssignableFrom(clazz)) prefix = "p"; else throw new AssertionError(clazz.toString()); String indexName = prefix+backingIndex; TitanGraphIndex index = mgmt.getGraphIndex(indexName); if (index==null) { index = mgmt.buildIndex(indexName,clazz).buildMixedIndex(backingIndex); } return index; }
@Test(expected = IllegalArgumentException.class) public void testSettingTTLOnNonStaticVertexLabel() throws Exception { if (!features.hasCellTTL()) { throw new IllegalArgumentException(); } VertexLabel label1 = mgmt.makeVertexLabel("event").make(); mgmt.setTTL(label1, Duration.ofSeconds(42)); }
@Test public void testGettingUndefinedEdgeLabelTTL() { if (!features.hasCellTTL()) { return; } // getTTL should return a null duration on an extant type without a TTL mgmt.makeEdgeLabel("likes").make(); mgmt.commit(); graph.tx().rollback(); // Check getTTL on edge label mgmt = graph.openManagement(); assertEquals(Duration.ZERO, mgmt.getTTL(mgmt.getEdgeLabel("likes"))); mgmt.rollback(); }
PropertyKey time = mgmt.makePropertyKey("time").dataType(Integer.class).make(); PropertyKey name = mgmt.makePropertyKey("name").dataType(String.class).cardinality(Cardinality.SET).make(); EdgeLabel friend = mgmt.makeEdgeLabel("friend").multiplicity(Multiplicity.MULTI).make(); PropertyKey sensor = mgmt.makePropertyKey("sensor").dataType(Double.class).cardinality(Cardinality.LIST).make(); finishSchema(); sensor = mgmt.getPropertyKey("sensor"); time = mgmt.getPropertyKey("time"); name = mgmt.getPropertyKey("name"); friend = mgmt.getEdgeLabel("friend"); mgmt.buildPropertyIndex(sensor, "byTime", decr, time); mgmt.buildEdgeIndex(friend, "byTime", Direction.OUT, decr, time); mgmt.buildIndex("bySensorReading", Vertex.class).addKey(name).buildCompositeIndex(); finishSchema(); newTx(); pindex = mgmt.getRelationIndex(mgmt.getRelationType("sensor"), "byTime"); eindex = mgmt.getRelationIndex(mgmt.getRelationType("friend"), "byTime"); gindex = mgmt.getGraphIndex("bySensorReading"); try { mgmt.updateIndex(pindex, SchemaAction.ENABLE_INDEX); fail(); } catch (IllegalArgumentException e) { mgmt.updateIndex(eindex, SchemaAction.ENABLE_INDEX); fail(); } catch (IllegalArgumentException e) { mgmt.updateIndex(gindex, SchemaAction.ENABLE_INDEX);
PropertyKey name = mgmt.makePropertyKey("name").dataType(String.class).cardinality(Cardinality.SET).make(); PropertyKey value = mgmt.makePropertyKey("value").dataType(Double.class).signature(weight).cardinality(Cardinality.LIST).make(); EdgeLabel friend = mgmt.makeEdgeLabel("friend").make(); EdgeLabel link = mgmt.makeEdgeLabel("link").unidirected().multiplicity(Multiplicity.MANY2ONE).make(); EdgeLabel connect = mgmt.makeEdgeLabel("connect").signature(uid).multiplicity(Multiplicity.SIMPLE).make(); EdgeLabel parent = mgmt.makeEdgeLabel("parent").multiplicity(Multiplicity.MANY2ONE).make(); EdgeLabel child = mgmt.makeEdgeLabel("child").multiplicity(Multiplicity.ONE2MANY).make(); EdgeLabel spouse = mgmt.makeEdgeLabel("spouse").multiplicity(Multiplicity.ONE2ONE).make(); VertexLabel person = mgmt.makeVertexLabel("person").make(); VertexLabel tag = mgmt.makeVertexLabel("tag").make(); VertexLabel tweet = mgmt.makeVertexLabel("tweet").setStatic().make(); assertTrue(mgmt.isOpen()); assertEquals("weight", weight.toString()); assertTrue(mgmt.containsRelationType("weight")); assertTrue(mgmt.containsPropertyKey("weight")); assertFalse(mgmt.containsEdgeLabel("weight")); assertTrue(mgmt.containsEdgeLabel("connect")); assertFalse(mgmt.containsPropertyKey("connect")); assertFalse(mgmt.containsRelationType("bla")); assertNull(mgmt.getPropertyKey("bla")); assertNull(mgmt.getEdgeLabel("bla")); assertNotNull(mgmt.getPropertyKey("weight"));
PropertyKey name = mgmt.makePropertyKey("name").dataType(String.class).cardinality(Cardinality.LIST).make(); EdgeLabel connect = mgmt.makeEdgeLabel("connect").signature(time).make(); EdgeLabel child = mgmt.makeEdgeLabel("child").multiplicity(Multiplicity.ONE2MANY).make(); EdgeLabel link = mgmt.makeEdgeLabel("link").unidirected().make(); RelationTypeIndex name1 = mgmt.buildPropertyIndex(name, "weightDesc", weight); RelationTypeIndex connect1 = mgmt.buildEdgeIndex(connect, "weightAsc", Direction.BOTH, incr, weight); RelationTypeIndex connect2 = mgmt.buildEdgeIndex(connect, "weightDesc", Direction.OUT, decr, weight); RelationTypeIndex connect3 = mgmt.buildEdgeIndex(connect, "time+weight", Direction.OUT, decr, time, weight); RelationTypeIndex child1 = mgmt.buildEdgeIndex(child, "time", Direction.OUT, time); RelationTypeIndex link1 = mgmt.buildEdgeIndex(link, "time", Direction.OUT, time); assertTrue(mgmt.containsRelationIndex(name, "weightDesc")); assertTrue(mgmt.containsRelationIndex(connect, "weightDesc")); assertFalse(mgmt.containsRelationIndex(child, "weightDesc")); assertEquals("time+weight", mgmt.getRelationIndex(connect, "time+weight").name()); assertNotNull(mgmt.getRelationIndex(link, "time")); assertNull(mgmt.getRelationIndex(name, "time")); assertEquals(1, size(mgmt.getRelationIndexes(child))); assertEquals(3, size(mgmt.getRelationIndexes(connect))); assertEquals(0, size(mgmt.getRelationIndexes(weight))); try { mgmt.buildEdgeIndex(connect, "weightAsc", Direction.OUT, time); fail(); } catch (SchemaViolationException e) {
final PropertyKey time = mgmt.makePropertyKey("time").dataType(Integer.class).make(); EdgeLabel wavedAt = mgmt.makeEdgeLabel("wavedAt").signature(time).make(); mgmt.buildEdgeIndex(wavedAt, "timeindex", Direction.BOTH, decr, time); mgmt.buildIndex("edge-time", Edge.class).addKey(time).buildCompositeIndex(); mgmt.setTTL(wavedAt, Duration.ofSeconds(ttl)); assertEquals(Duration.ZERO, mgmt.getTTL(time)); assertEquals(Duration.ofSeconds(ttl), mgmt.getTTL(wavedAt)); mgmt.commit();
TitanTransaction tx2; PropertyKey name = mgmt.makePropertyKey("name").dataType(String.class).make(); finishSchema(); mgmt.buildIndex("theIndex", Vertex.class).addKey(mgmt.getPropertyKey("name")).buildCompositeIndex(); mgmt.commit(); finishSchema(); try { mgmt.updateIndex(mgmt.getGraphIndex("theIndex"), SchemaAction.ENABLE_INDEX); mgmt.rollback(); assertTrue(ManagementSystem.awaitGraphIndexStatus(graph, "theIndex").status(SchemaStatus.REGISTERED) .timeout(TestGraphConfigs.getSchemaConvergenceTime(ChronoUnit.SECONDS), ChronoUnit.SECONDS) .call().getSucceeded()); finishSchema(); mgmt.updateIndex(mgmt.getGraphIndex("theIndex"), SchemaAction.ENABLE_INDEX); finishSchema(); Set<String> openInstances = mgmt.getOpenInstances(); assertEquals(2, openInstances.size()); assertTrue(openInstances.contains(graph.getConfiguration().getUniqueGraphId() + "(current)")); assertTrue(openInstances.contains(graph2.getConfiguration().getUniqueGraphId())); try { mgmt.forceCloseInstance(graph.getConfiguration().getUniqueGraphId()); mgmt.forceCloseInstance(graph2.getConfiguration().getUniqueGraphId());
@Test public void testVertexTTLWithCompositeIndex() throws Exception { if (!features.hasCellTTL()) { return; } PropertyKey name = mgmt.makePropertyKey("name").dataType(String.class).make(); PropertyKey time = mgmt.makePropertyKey("time").dataType(Long.class).make(); TitanGraphIndex index1 = mgmt.buildIndex("index1", Vertex.class).addKey(name).buildCompositeIndex(); TitanGraphIndex index2 = mgmt.buildIndex("index2", Vertex.class).addKey(name).addKey(time).buildCompositeIndex(); VertexLabel label1 = mgmt.makeVertexLabel("event").setStatic().make(); mgmt.setTTL(label1, Duration.ofSeconds(1)); assertEquals(Duration.ZERO, mgmt.getTTL(name)); assertEquals(Duration.ZERO, mgmt.getTTL(time)); assertEquals(Duration.ofSeconds(1), mgmt.getTTL(label1)); mgmt.commit(); TitanVertex v1 = tx.addVertex(T.label, "event", "name", "some event", "time", System.currentTimeMillis()); tx.commit(); Object id = v1.id(); v1 = getV(graph, id); assertNotNull(v1); assertNotEmpty(graph.query().has("name", "some event").vertices()); Thread.sleep(1001); graph.tx().rollback(); v1 = getV(graph, id); assertNull(v1); assertEmpty(graph.query().has("name", "some event").vertices()); }
PropertyKey name = mgmt.makePropertyKey("name").dataType(String.class).cardinality(Cardinality.LIST).make(); EdgeLabel connect = mgmt.makeEdgeLabel("connect").signature(weight).make(); EdgeLabel related = mgmt.makeEdgeLabel("related").signature(time).make(); VertexLabel person = mgmt.makeVertexLabel("person").make(); VertexLabel organization = mgmt.makeVertexLabel("organization").make(); TitanGraphIndex edge1 = mgmt.buildIndex("edge1", Edge.class).addKey(time).addKey(weight).buildCompositeIndex(); TitanGraphIndex edge2 = mgmt.buildIndex("edge2", Edge.class).indexOnly(connect).addKey(text).buildCompositeIndex(); TitanGraphIndex prop1 = mgmt.buildIndex("prop1", TitanVertexProperty.class).addKey(time).buildCompositeIndex(); TitanGraphIndex prop2 = mgmt.buildIndex("prop2", TitanVertexProperty.class).addKey(weight).addKey(text).buildCompositeIndex(); TitanGraphIndex vertex1 = mgmt.buildIndex("vertex1", Vertex.class).addKey(time).indexOnly(person).unique().buildCompositeIndex(); TitanGraphIndex vertex12 = mgmt.buildIndex("vertex12", Vertex.class).addKey(text).indexOnly(person).buildCompositeIndex(); TitanGraphIndex vertex2 = mgmt.buildIndex("vertex2", Vertex.class).addKey(time).addKey(name).indexOnly(organization).buildCompositeIndex(); TitanGraphIndex vertex3 = mgmt.buildIndex("vertex3", Vertex.class).addKey(name).buildCompositeIndex(); assertTrue(mgmt.containsRelationType("name")); assertTrue(mgmt.containsGraphIndex("prop1")); assertFalse(mgmt.containsGraphIndex("prop3")); assertEquals(2, Iterables.size(mgmt.getGraphIndexes(Edge.class))); assertEquals(2, Iterables.size(mgmt.getGraphIndexes(TitanVertexProperty.class))); assertEquals(4, Iterables.size(mgmt.getGraphIndexes(Vertex.class))); assertNull(mgmt.getGraphIndex("balblub")); edge1 = mgmt.getGraphIndex("edge1"); edge2 = mgmt.getGraphIndex("edge2"); prop1 = mgmt.getGraphIndex("prop1");
mgmt.makePropertyKey("time").dataType(Integer.class).make(); PropertyKey text = mgmt.makePropertyKey("text").dataType(String.class).make(); mgmt.makePropertyKey("height").dataType(Double.class).make(); if (indexFeatures.supportsCardinality(Cardinality.LIST)) { mgmt.makePropertyKey("phone").dataType(String.class).cardinality(Cardinality.LIST).make(); mgmt.buildIndex("theIndex", Vertex.class).addKey(text, getTextMapping(), getFieldMap(text)).buildMixedIndex(INDEX); finishSchema(); PropertyKey time = mgmt.getPropertyKey("time"); mgmt.addIndexKey(mgmt.getGraphIndex("theIndex"), time, getFieldMap(time)); finishSchema(); newTx(); assertNull(mgmt.updateIndex(mgmt.getGraphIndex("theIndex"), SchemaAction.ENABLE_INDEX)); mgmt.updateIndex(mgmt.getGraphIndex("theIndex"), SchemaAction.REGISTER_INDEX).get(); mgmt.commit(); mgmt.updateIndex(mgmt.getGraphIndex("theIndex"), SchemaAction.ENABLE_INDEX).get(); finishSchema(); PropertyKey height = mgmt.getPropertyKey("height"); mgmt.addIndexKey(mgmt.getGraphIndex("theIndex"), height); if (indexFeatures.supportsCardinality(Cardinality.LIST)) { PropertyKey phone = mgmt.getPropertyKey("phone"); mgmt.addIndexKey(mgmt.getGraphIndex("theIndex"), phone, new Parameter("mapping", Mapping.STRING));
if (mgmt.getGraphIndex(RESTAURANT_ID) == null) { final PropertyKey RESTAURANTIdKey = mgmt.makePropertyKey(RESTAURANT_ID).dataType(Integer.class).make(); mgmt.buildIndex(RESTAURANT_ID, Vertex.class).addKey(RESTAURANTIdKey).unique().buildCompositeIndex(); mgmt.makePropertyKey(PROP_RESTAURANT_NAME).dataType(String.class).make(); mgmt.makePropertyKey(PROP_RESTAURANT_LATITUDE).dataType(Double.class).make(); mgmt.makePropertyKey(PROP_RESTAURANT_LONGITUDE).dataType(Double.class).make(); mgmt.makePropertyKey(PROP_RESTAURANT_PLACE).dataType(Geoshape.class).make(); mgmt.makePropertyKey(PROP_RESTAURANT_ALCOHOL).dataType(String.class).make(); mgmt.makePropertyKey(PROP_RESTAURANT_DRESSCODE).dataType(String.class).make(); mgmt.makePropertyKey(PROP_RESTAURANT_ACCESSIBILITY).dataType(String.class).make(); mgmt.makePropertyKey(PROP_RESTAURANT_PRICE).dataType(String.class).make(); mgmt.makePropertyKey(PROP_RESTAURANT_AMBIENCE).dataType(String.class).make(); mgmt.makePropertyKey(PROP_RESTAURANT_FRANCHISE).dataType(String.class).make(); mgmt.makePropertyKey(PROP_RESTAURANT_SERVICES).dataType(String.class).make(); if (mgmt.getGraphIndex(USER_ID) == null) { final PropertyKey userKey = mgmt.makePropertyKey(USER_ID).dataType(String.class).make(); mgmt.buildIndex(USER_ID, Vertex.class).addKey(userKey).unique().buildCompositeIndex(); mgmt.makePropertyKey(PROP_USER_DRESSPREFERENCE).dataType(String.class).make(); mgmt.makePropertyKey(PROP_USER_BUDGET).dataType(String.class).make(); if (mgmt.getGraphIndex(GENRE) == null) { final PropertyKey genreKey = mgmt.makePropertyKey(GENRE).dataType(String.class).make(); mgmt.buildIndex(GENRE, Vertex.class).addKey(genreKey).unique().buildCompositeIndex(); mgmt.makeVertexLabel("restaurant").make(); mgmt.makeVertexLabel("genre").make(); mgmt.makeVertexLabel("user").make();
public PropertyKey makeVertexIndexedKey(String name, Class datatype) { PropertyKey key = mgmt.makePropertyKey(name).dataType(datatype).cardinality(Cardinality.SINGLE).make(); mgmt.buildIndex(name,Vertex.class).addKey(key).buildCompositeIndex(); return key; }
VertexLabel person = mgmt.makeVertexLabel("person").make(); VertexLabel org = mgmt.makeVertexLabel("org").make(); TitanGraphIndex index1 = mgmt.buildIndex("index1", Vertex.class). addKey(name, getStringMapping()).buildMixedIndex(INDEX); TitanGraphIndex index2 = mgmt.buildIndex("index2", Vertex.class).indexOnly(person). addKey(text, getTextMapping()).addKey(weight).buildMixedIndex(INDEX); TitanGraphIndex index3 = mgmt.buildIndex("index3", Vertex.class).indexOnly(org). addKey(text, getTextMapping()).addKey(weight).buildMixedIndex(INDEX); assertTrue(mgmt.containsGraphIndex("index1")); assertFalse(mgmt.containsGraphIndex("index")); assertCount(3, mgmt.getGraphIndexes(Vertex.class)); assertNull(mgmt.getGraphIndex("indexx")); name = mgmt.getPropertyKey("name"); weight = mgmt.getPropertyKey("weight"); text = mgmt.getPropertyKey("text"); person = mgmt.getVertexLabel("person"); org = mgmt.getVertexLabel("org"); index1 = mgmt.getGraphIndex("index1"); index2 = mgmt.getGraphIndex("index2"); index3 = mgmt.getGraphIndex("index3"); mgmt.buildIndex("index2", Vertex.class).addKey(weight).buildMixedIndex(INDEX); fail(); } catch (IllegalArgumentException e) { mgmt.buildIndex("index2", Vertex.class).addKey(weight).buildCompositeIndex();
private void createSchema() { final TitanManagement mgmt = titanGraph.getManagementSystem(); if (!titanGraph.getIndexedKeys(Vertex.class).contains(NODE_ID)) { final PropertyKey key = mgmt.makePropertyKey(NODE_ID).dataType(Integer.class).make(); mgmt.buildIndex(NODE_ID, Vertex.class).addKey(key).unique().buildCompositeIndex(); } if (!titanGraph.getIndexedKeys(Vertex.class).contains(COMMUNITY)) { final PropertyKey key = mgmt.makePropertyKey(COMMUNITY).dataType(Integer.class).make(); mgmt.buildIndex(COMMUNITY, Vertex.class).addKey(key).buildCompositeIndex(); } if (!titanGraph.getIndexedKeys(Vertex.class).contains(NODE_COMMUNITY)) { final PropertyKey key = mgmt.makePropertyKey(NODE_COMMUNITY).dataType(Integer.class).make(); mgmt.buildIndex(NODE_COMMUNITY, Vertex.class).addKey(key).buildCompositeIndex(); } if (mgmt.getEdgeLabel(SIMILAR) == null) { mgmt.makeEdgeLabel(SIMILAR).multiplicity(Multiplicity.MULTI).directed().make(); } mgmt.commit(); }
private void createIndices(final TitanGraph g, final LoadGraphWith.GraphData graphData) { TitanManagement mgmt = g.openManagement(); if (graphData.equals(LoadGraphWith.GraphData.GRATEFUL)) { VertexLabel artist = mgmt.makeVertexLabel("artist").make(); VertexLabel song = mgmt.makeVertexLabel("song").make(); PropertyKey name = mgmt.makePropertyKey("name").cardinality(Cardinality.LIST).dataType(String.class).make(); PropertyKey songType = mgmt.makePropertyKey("songType").cardinality(Cardinality.LIST).dataType(String.class).make(); PropertyKey performances = mgmt.makePropertyKey("performances").cardinality(Cardinality.LIST).dataType(Integer.class).make(); mgmt.buildIndex("artistByName", Vertex.class).addKey(name).indexOnly(artist).buildCompositeIndex(); mgmt.buildIndex("songByName", Vertex.class).addKey(name).indexOnly(song).buildCompositeIndex(); mgmt.buildIndex("songByType", Vertex.class).addKey(songType).indexOnly(song).buildCompositeIndex(); mgmt.buildIndex("songByPerformances", Vertex.class).addKey(performances).indexOnly(song).buildCompositeIndex(); VertexLabel person = mgmt.makeVertexLabel("person").make(); VertexLabel software = mgmt.makeVertexLabel("software").make(); PropertyKey name = mgmt.makePropertyKey("name").cardinality(Cardinality.LIST).dataType(String.class).make(); PropertyKey lang = mgmt.makePropertyKey("lang").cardinality(Cardinality.LIST).dataType(String.class).make(); PropertyKey age = mgmt.makePropertyKey("age").cardinality(Cardinality.LIST).dataType(Integer.class).make(); mgmt.buildIndex("personByName", Vertex.class).addKey(name).indexOnly(person).buildCompositeIndex(); mgmt.buildIndex("softwareByName", Vertex.class).addKey(name).indexOnly(software).buildCompositeIndex(); mgmt.buildIndex("personByAge", Vertex.class).addKey(age).indexOnly(person).buildCompositeIndex(); mgmt.buildIndex("softwareByLang", Vertex.class).addKey(lang).indexOnly(software).buildCompositeIndex(); PropertyKey name = mgmt.makePropertyKey("name").cardinality(Cardinality.LIST).dataType(String.class).make(); PropertyKey lang = mgmt.makePropertyKey("lang").cardinality(Cardinality.LIST).dataType(String.class).make(); PropertyKey age = mgmt.makePropertyKey("age").cardinality(Cardinality.LIST).dataType(Integer.class).make();
@Test public void testRepairRelationIndex() throws InterruptedException, BackendException, ExecutionException { tx.commit(); mgmt.commit(); PropertyKey reason = m.getPropertyKey("reason"); EdgeLabel lives = m.getEdgeLabel("lives"); m.buildEdgeIndex(lives, "livesByReason", Direction.BOTH, Order.decr, reason); m.commit(); graph.tx().commit(); RelationTypeIndex index = m.getRelationIndex(m.getRelationType("lives"), "livesByReason"); m.updateIndex(index, SchemaAction.ENABLE_INDEX); m.commit(); graph.tx().commit(); index = m.getRelationIndex(m.getRelationType("lives"), "livesByReason"); ScanMetrics metrics = mri.updateIndex(index, SchemaAction.REINDEX).get(); assertEquals(8, metrics.getCustom(IndexRepairJob.ADDED_RECORDS_COUNT));