Search in sources :

Example 6 with PropertyKeyMaker

use of org.janusgraph.core.schema.PropertyKeyMaker in project atlas by apache.

the class AtlasJanusGraphManagement method makePropertyKey.

@Override
public AtlasPropertyKey makePropertyKey(String propertyName, Class propertyClass, AtlasCardinality cardinality) {
    if (cardinality.isMany()) {
        newMultProperties.add(propertyName);
    }
    PropertyKeyMaker propertyKeyBuilder = management.makePropertyKey(propertyName).dataType(propertyClass);
    if (cardinality != null) {
        Cardinality janusCardinality = AtlasJanusObjectFactory.createCardinality(cardinality);
        propertyKeyBuilder.cardinality(janusCardinality);
    }
    PropertyKey propertyKey = propertyKeyBuilder.make();
    return GraphDbObjectFactory.createPropertyKey(propertyKey);
}
Also used : PropertyKeyMaker(org.janusgraph.core.schema.PropertyKeyMaker) Cardinality(org.janusgraph.core.Cardinality) AtlasCardinality(org.apache.atlas.repository.graphdb.AtlasCardinality) AtlasPropertyKey(org.apache.atlas.repository.graphdb.AtlasPropertyKey) PropertyKey(org.janusgraph.core.PropertyKey)

Aggregations

PropertyKeyMaker (org.janusgraph.core.schema.PropertyKeyMaker)6 PropertyKey (org.janusgraph.core.PropertyKey)5 Test (org.junit.Test)4 HashMap (java.util.HashMap)3 CredentialGraph (org.apache.tinkerpop.gremlin.groovy.jsr223.dsl.credential.CredentialGraph)3 Transaction (org.apache.tinkerpop.gremlin.structure.Transaction)3 Vertex (org.apache.tinkerpop.gremlin.structure.Vertex)3 JanusGraph (org.janusgraph.core.JanusGraph)3 JanusGraphIndex (org.janusgraph.core.schema.JanusGraphIndex)3 JanusGraphManagement (org.janusgraph.core.schema.JanusGraphManagement)3 ManagementSystem (org.janusgraph.graphdb.database.management.ManagementSystem)3 SimpleAuthenticator (org.apache.tinkerpop.gremlin.server.auth.SimpleAuthenticator)2 Date (java.util.Date)1 AtlasCardinality (org.apache.atlas.repository.graphdb.AtlasCardinality)1 AtlasPropertyKey (org.apache.atlas.repository.graphdb.AtlasPropertyKey)1 Cardinality (org.janusgraph.core.Cardinality)1 DefaultSchemaMaker (org.janusgraph.core.schema.DefaultSchemaMaker)1