Search in sources :

Example 31 with AtlasPropertyKey

use of org.apache.atlas.repository.graphdb.AtlasPropertyKey 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)

Example 32 with AtlasPropertyKey

use of org.apache.atlas.repository.graphdb.AtlasPropertyKey in project atlas by apache.

the class AtlasJanusGraphManagement method createEdgeIndex.

@Override
public void createEdgeIndex(String label, String indexName, AtlasEdgeDirection edgeDirection, List<AtlasPropertyKey> propertyKeys) {
    EdgeLabel edgeLabel = management.getEdgeLabel(label);
    if (edgeLabel == null) {
        edgeLabel = management.makeEdgeLabel(label).make();
    }
    Direction direction = AtlasJanusObjectFactory.createDirection(edgeDirection);
    PropertyKey[] keys = AtlasJanusObjectFactory.createPropertyKeys(propertyKeys);
    if (management.getRelationIndex(edgeLabel, indexName) == null) {
        management.buildEdgeIndex(edgeLabel, indexName, direction, keys);
    }
}
Also used : EdgeLabel(org.janusgraph.core.EdgeLabel) AtlasEdgeLabel(org.apache.atlas.repository.graphdb.AtlasEdgeLabel) AtlasEdgeDirection(org.apache.atlas.repository.graphdb.AtlasEdgeDirection) Direction(org.apache.tinkerpop.gremlin.structure.Direction) AtlasPropertyKey(org.apache.atlas.repository.graphdb.AtlasPropertyKey) PropertyKey(org.janusgraph.core.PropertyKey)

Example 33 with AtlasPropertyKey

use of org.apache.atlas.repository.graphdb.AtlasPropertyKey in project atlas by apache.

the class AtlasJanusGraphManagement method createVertexMixedIndex.

@Override
public void createVertexMixedIndex(String indexName, String backingIndex, List<AtlasPropertyKey> propertyKeys) {
    IndexBuilder indexBuilder = management.buildIndex(indexName, Vertex.class);
    for (AtlasPropertyKey key : propertyKeys) {
        PropertyKey janusKey = AtlasJanusObjectFactory.createPropertyKey(key);
        indexBuilder.addKey(janusKey);
    }
    indexBuilder.buildMixedIndex(backingIndex);
}
Also used : AtlasPropertyKey(org.apache.atlas.repository.graphdb.AtlasPropertyKey) AtlasPropertyKey(org.apache.atlas.repository.graphdb.AtlasPropertyKey) PropertyKey(org.janusgraph.core.PropertyKey) IndexBuilder(org.janusgraph.core.schema.JanusGraphManagement.IndexBuilder)

Example 34 with AtlasPropertyKey

use of org.apache.atlas.repository.graphdb.AtlasPropertyKey in project atlas by apache.

the class AtlasJanusGraphManagement method createFullTextMixedIndex.

@Override
public void createFullTextMixedIndex(String indexName, String backingIndex, List<AtlasPropertyKey> propertyKeys) {
    IndexBuilder indexBuilder = management.buildIndex(indexName, Vertex.class);
    for (AtlasPropertyKey key : propertyKeys) {
        PropertyKey janusKey = AtlasJanusObjectFactory.createPropertyKey(key);
        indexBuilder.addKey(janusKey, org.janusgraph.core.schema.Parameter.of("mapping", Mapping.TEXT));
    }
    indexBuilder.buildMixedIndex(backingIndex);
}
Also used : AtlasPropertyKey(org.apache.atlas.repository.graphdb.AtlasPropertyKey) AtlasPropertyKey(org.apache.atlas.repository.graphdb.AtlasPropertyKey) PropertyKey(org.janusgraph.core.PropertyKey) IndexBuilder(org.janusgraph.core.schema.JanusGraphManagement.IndexBuilder)

Example 35 with AtlasPropertyKey

use of org.apache.atlas.repository.graphdb.AtlasPropertyKey in project atlas by apache.

the class AtlasJanusGraphManagement method createEdgeMixedIndex.

@Override
public void createEdgeMixedIndex(String indexName, String backingIndex, List<AtlasPropertyKey> propertyKeys) {
    IndexBuilder indexBuilder = management.buildIndex(indexName, Edge.class);
    for (AtlasPropertyKey key : propertyKeys) {
        PropertyKey janusKey = AtlasJanusObjectFactory.createPropertyKey(key);
        indexBuilder.addKey(janusKey);
    }
    indexBuilder.buildMixedIndex(backingIndex);
}
Also used : AtlasPropertyKey(org.apache.atlas.repository.graphdb.AtlasPropertyKey) AtlasPropertyKey(org.apache.atlas.repository.graphdb.AtlasPropertyKey) PropertyKey(org.janusgraph.core.PropertyKey) IndexBuilder(org.janusgraph.core.schema.JanusGraphManagement.IndexBuilder)

Aggregations

AtlasPropertyKey (org.apache.atlas.repository.graphdb.AtlasPropertyKey)46 PropertyKey (com.thinkaurelius.titan.core.PropertyKey)20 PropertyKey (org.janusgraph.core.PropertyKey)10 TitanManagement (com.thinkaurelius.titan.core.schema.TitanManagement)7 HashSet (java.util.HashSet)6 AtlasGraphManagement (org.apache.atlas.repository.graphdb.AtlasGraphManagement)6 AtlasGraphIndex (org.apache.atlas.repository.graphdb.AtlasGraphIndex)5 IndexBuilder (org.janusgraph.core.schema.JanusGraphManagement.IndexBuilder)5 AtlasCardinality (org.apache.atlas.repository.graphdb.AtlasCardinality)4 AtlasGraph (org.apache.atlas.repository.graphdb.AtlasGraph)4 Cardinality (com.thinkaurelius.titan.core.Cardinality)3 PropertyKeyMaker (com.thinkaurelius.titan.core.schema.PropertyKeyMaker)3 TitanGraphIndex (com.thinkaurelius.titan.core.schema.TitanGraphIndex)3 ArrayList (java.util.ArrayList)3 RepositoryException (org.apache.atlas.repository.RepositoryException)2 AtlasEdgeDirection (org.apache.atlas.repository.graphdb.AtlasEdgeDirection)2 AtlasEdgeLabel (org.apache.atlas.repository.graphdb.AtlasEdgeLabel)2 EdgeLabel (com.thinkaurelius.titan.core.EdgeLabel)1 Direction (com.tinkerpop.blueprints.Direction)1 AtlasException (org.apache.atlas.AtlasException)1