Java Code Examples for org.janusgraph.core.Cardinality#SINGLE

The following examples show how to use org.janusgraph.core.Cardinality#SINGLE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AtlasJanusGraph.java    From atlas with Apache License 2.0 6 votes vote down vote up
public AtlasJanusGraph(JanusGraph graphInstance) {
    //determine multi-properties once at startup
    JanusGraphManagement mgmt = null;

    try {
        mgmt = graphInstance.openManagement();

        Iterable<PropertyKey> keys = mgmt.getRelationTypes(PropertyKey.class);

        for (PropertyKey key : keys) {
            if (key.cardinality() != Cardinality.SINGLE) {
                multiProperties.add(key.name());
            }
        }
    } finally {
        if (mgmt != null) {
            mgmt.rollback();
        }
    }

    janusGraph = (StandardJanusGraph) graphInstance;
}
 
Example 2
Source File: AtlasJanusObjectFactory.java    From atlas with Apache License 2.0 5 votes vote down vote up
/**
 * Converts a Multiplicity to a Cardinality.
 *
 * @param cardinality
 * @return
 */
public static Cardinality createCardinality(AtlasCardinality cardinality) {
    switch(cardinality) {

    case SINGLE:
        return Cardinality.SINGLE;
    case LIST:
        return Cardinality.LIST;
    case SET:
        return Cardinality.SET;
    default:
        throw new IllegalStateException("Unrecognized cardinality: " + cardinality);
    }
}
 
Example 3
Source File: GraphDbObjectFactory.java    From atlas with Apache License 2.0 5 votes vote down vote up
/**
 * Converts a Multiplicity to a Cardinality.
 *
 * @param cardinality
 * @return
 */
public static AtlasCardinality createCardinality(Cardinality cardinality) {

    if (cardinality == Cardinality.SINGLE) {
        return AtlasCardinality.SINGLE;
    } else if (cardinality == Cardinality.LIST) {
        return AtlasCardinality.LIST;
    }
    return AtlasCardinality.SET;
}