Search in sources :

Example 41 with AtlasPropertyKey

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

the class Titan0GraphManagement method createExactMatchIndex.

@Override
public void createExactMatchIndex(String propertyName, boolean enforceUniqueness, List<AtlasPropertyKey> propertyKeys) {
    TitanManagement.IndexBuilder indexBuilder = management.buildIndex(propertyName, Vertex.class);
    for (AtlasPropertyKey key : propertyKeys) {
        PropertyKey titanKey = TitanObjectFactory.createPropertyKey(key);
        indexBuilder.addKey(titanKey);
    }
    if (enforceUniqueness) {
        indexBuilder.unique();
    }
    indexBuilder.buildCompositeIndex();
}
Also used : AtlasPropertyKey(org.apache.atlas.repository.graphdb.AtlasPropertyKey) TitanManagement(com.thinkaurelius.titan.core.schema.TitanManagement) AtlasPropertyKey(org.apache.atlas.repository.graphdb.AtlasPropertyKey) PropertyKey(com.thinkaurelius.titan.core.PropertyKey)

Example 42 with AtlasPropertyKey

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

the class Titan0GraphManagement method createFullTextIndex.

@Override
public void createFullTextIndex(String indexName, AtlasPropertyKey propertyKey, String backingIndex) {
    PropertyKey fullText = TitanObjectFactory.createPropertyKey(propertyKey);
    management.buildIndex(indexName, Vertex.class).addKey(fullText, com.thinkaurelius.titan.core.schema.Parameter.of("mapping", Mapping.TEXT)).buildMixedIndex(backingIndex);
}
Also used : AtlasPropertyKey(org.apache.atlas.repository.graphdb.AtlasPropertyKey) PropertyKey(com.thinkaurelius.titan.core.PropertyKey)

Example 43 with AtlasPropertyKey

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

the class Titan1GraphManagement 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 titanCardinality = TitanObjectFactory.createCardinality(cardinality);
        propertyKeyBuilder.cardinality(titanCardinality);
    }
    PropertyKey propertyKey = propertyKeyBuilder.make();
    return GraphDbObjectFactory.createPropertyKey(propertyKey);
}
Also used : PropertyKeyMaker(com.thinkaurelius.titan.core.schema.PropertyKeyMaker) Cardinality(com.thinkaurelius.titan.core.Cardinality) AtlasCardinality(org.apache.atlas.repository.graphdb.AtlasCardinality) AtlasPropertyKey(org.apache.atlas.repository.graphdb.AtlasPropertyKey) PropertyKey(com.thinkaurelius.titan.core.PropertyKey)

Example 44 with AtlasPropertyKey

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

the class Titan1GraphManagement method createExactMatchVertexIndex.

public void createExactMatchVertexIndex(String propertyName, boolean enforceUniqueness, List<AtlasPropertyKey> propertyKeys) {
    TitanManagement.IndexBuilder indexBuilder = management.buildIndex(propertyName, Vertex.class);
    for (AtlasPropertyKey key : propertyKeys) {
        PropertyKey titanKey = TitanObjectFactory.createPropertyKey(key);
        indexBuilder.addKey(titanKey);
    }
    if (enforceUniqueness) {
        indexBuilder.unique();
    }
    indexBuilder.buildCompositeIndex();
}
Also used : AtlasPropertyKey(org.apache.atlas.repository.graphdb.AtlasPropertyKey) TitanManagement(com.thinkaurelius.titan.core.schema.TitanManagement) AtlasPropertyKey(org.apache.atlas.repository.graphdb.AtlasPropertyKey) PropertyKey(com.thinkaurelius.titan.core.PropertyKey)

Example 45 with AtlasPropertyKey

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

the class Titan1GraphManagement method createFullTextIndex.

@Override
public void createFullTextIndex(String indexName, AtlasPropertyKey propertyKey, String backingIndex) {
    PropertyKey fullText = TitanObjectFactory.createPropertyKey(propertyKey);
    management.buildIndex(indexName, Vertex.class).addKey(fullText, com.thinkaurelius.titan.core.schema.Parameter.of("mapping", Mapping.TEXT)).buildMixedIndex(backingIndex);
}
Also used : AtlasPropertyKey(org.apache.atlas.repository.graphdb.AtlasPropertyKey) PropertyKey(com.thinkaurelius.titan.core.PropertyKey)

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