use of nl.knaw.huygens.timbuctoo.core.dto.dataset.Collection.HAS_DISPLAY_NAME_RELATION_NAME in project timbuctoo by HuygensING.
the class TinkerPopOperationsTest method deleteVreRemovesAllTheVresCollectionsFromDatabase.
@Test
public void deleteVreRemovesAllTheVresCollectionsFromDatabase() {
TinkerPopGraphManager graphManager = newGraph().withVertex("vreName", v -> v.withLabel("VRE").withProperty(Vre.VRE_NAME_PROPERTY_NAME, "vreName").withOutgoingRelation(HAS_COLLECTION_RELATION_NAME, "collection1").withOutgoingRelation(HAS_COLLECTION_RELATION_NAME, "collection2")).withVertex("collection1", v -> v.withProperty(COLLECTION_NAME_PROPERTY_NAME, "collection1").withProperty(ENTITY_TYPE_NAME_PROPERTY_NAME, "entityType1").withProperty(IS_RELATION_COLLECTION_PROPERTY_NAME, true).withOutgoingRelation(HAS_DISPLAY_NAME_RELATION_NAME, "displayName").withOutgoingRelation(HAS_PROPERTY_RELATION_NAME, "property").withOutgoingRelation(HAS_ENTITY_NODE_RELATION_NAME, "entityNode")).withVertex("displayName", v -> v.withProperty("displayName", true).withProperty("propertyType", "string")).withVertex("property", v -> v.withProperty("property", true).withProperty("propertyType", "string")).withVertex("entityNode", v -> v.withOutgoingRelation(HAS_ENTITY_RELATION_NAME, "entity")).withVertex("entity", v -> v.withProperty("entity", true)).withVertex("collection2", v -> v.withProperty(COLLECTION_NAME_PROPERTY_NAME, "collection2").withProperty(ENTITY_TYPE_NAME_PROPERTY_NAME, "entityType2").withProperty(IS_RELATION_COLLECTION_PROPERTY_NAME, false)).withVertex("otherVreCollection", v -> v.withProperty(COLLECTION_NAME_PROPERTY_NAME, "otherVreCollection").withProperty(ENTITY_TYPE_NAME_PROPERTY_NAME, "entityType3").withProperty(IS_RELATION_COLLECTION_PROPERTY_NAME, false)).wrap();
TinkerPopOperations instance = forGraphWrapper(graphManager);
instance.deleteVre("vreName");
Graph graph = graphManager.getGraph();
assertThat(graph.traversal().V().has(Vre.VRE_NAME_PROPERTY_NAME, "vreName").hasNext(), equalTo(false));
assertThat(graph.traversal().V().has(COLLECTION_NAME_PROPERTY_NAME, "collection1").hasNext(), equalTo(false));
assertThat(graph.traversal().V().has(COLLECTION_NAME_PROPERTY_NAME, "collection2").hasNext(), equalTo(false));
assertThat(graph.traversal().V().has(COLLECTION_NAME_PROPERTY_NAME, "otherVreCollection").hasNext(), equalTo(true));
assertThat(graph.traversal().V().has("entity").hasNext(), equalTo(false));
assertThat(graph.traversal().V().has("displayName").hasNext(), equalTo(false));
}
Aggregations