Search in sources :

Example 1 with Connection

use of org.janusgraph.core.Connection in project janusgraph by JanusGraph.

the class StandardJanusGraphTx method checkConnectionConstraintOrCreateConnectionConstraint.

private void checkConnectionConstraintOrCreateConnectionConstraint(JanusGraphVertex outVertex, JanusGraphVertex inVertex, EdgeLabel edgeLabel) {
    if (config.hasDisabledSchemaConstraints())
        return;
    VertexLabel outVertexLabel = outVertex.vertexLabel();
    if (outVertexLabel instanceof BaseVertexLabel)
        return;
    VertexLabel inVertexLabel = inVertex.vertexLabel();
    if (inVertexLabel instanceof BaseVertexLabel)
        return;
    Collection<Connection> connections = outVertexLabel.mappedConnections();
    for (Connection connection : connections) {
        if (connection.getIncomingVertexLabel() != inVertexLabel)
            continue;
        if (connection.getEdgeLabel().equals(edgeLabel.name()))
            return;
    }
    config.getAutoSchemaMaker().makeConnectionConstraint(edgeLabel, outVertexLabel, inVertexLabel, this);
}
Also used : InternalVertexLabel(org.janusgraph.graphdb.internal.InternalVertexLabel) VertexLabel(org.janusgraph.core.VertexLabel) BaseVertexLabel(org.janusgraph.graphdb.types.system.BaseVertexLabel) Connection(org.janusgraph.core.Connection) BaseVertexLabel(org.janusgraph.graphdb.types.system.BaseVertexLabel)

Aggregations

Connection (org.janusgraph.core.Connection)1 VertexLabel (org.janusgraph.core.VertexLabel)1 InternalVertexLabel (org.janusgraph.graphdb.internal.InternalVertexLabel)1 BaseVertexLabel (org.janusgraph.graphdb.types.system.BaseVertexLabel)1