janusgraph
janusgraph copied to clipboard
JG Schema - addConnection seem to create duplicate connections
- Version: 0.6
- Storage Backend: Cassandra v3.11.11
- Mixed Index Backend: none
- Link to discussed bug: https://lists.lfaidata.foundation/g/janusgraph-users/message/6334
- Expected Behavior: two connections should be created for "toEdge"
- Current Behavior: four connections are created for "toEdge"
- Steps to Reproduce:
- Creating dynamic graph and schema
map = new HashMap(); map.put("storage.backend","cql"); map.put("storage.hostname","cassandra"); map.put("query.force-index", "false"); map.put("schema.default", "default"); map.put("schema.constraints", "false"); map.put("graph.graphname", "transactionGraph") ConfiguredGraphFactory.createConfiguration(new MapConfiguration(map)); graph = ConfiguredGraphFactory.open("transactionGraph"); mgmt = graph.openManagement(); transaction = mgmt.makeVertexLabel('transaction').make(); person = mgmt.makeVertexLabel('person').make(); entity = mgmt.makeVertexLabel('entity').make(); fromEdge = mgmt.makeEdgeLabel('FROM').multiplicity(ONE2ONE).make() mgmt.addConnection(fromEdge, person, transaction) mgmt.addConnection(fromEdge, entity, transaction) toEdge = mgmt.makeEdgeLabel('TO').multiplicity(ONE2ONE).make() mgmt.addConnection(toEdge, transaction, person) mgmt.addConnection(toEdge, transaction, entity) mgmt.commit() - Checking connections of the schema
mgmt = graph.openManagement() edges = mgmt.getRelationTypes(EdgeLabel.class) fromEdge = edges[0] toEdge = edges[1] fromEdge.mappedConnections().size() // as I would expect, it has two connections toEdge.mappedConnections().size() // why 4 connections are here? I would expect only two connections similarly to the FROM edge - Note that Marc was able to reproduce the same issue also with inmemory backend (
graph = JanusGraphFactory.open('conf/janusgraph-inmemory.properties')). See the reply from Marc here https://lists.lfaidata.foundation/g/janusgraph-users/message/6348
- Creating dynamic graph and schema
It should be fixable by a basic check during the insert. For already inserted connections it will be more complicated.