Search in sources :

Example 26 with AtlasPropertyKey

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

the class GraphBackedSearchIndexer method createFullTextIndex.

private void createFullTextIndex(AtlasGraphManagement management) {
    AtlasPropertyKey fullText = management.makePropertyKey(Constants.ENTITY_TEXT_PROPERTY_KEY, String.class, AtlasCardinality.SINGLE);
    management.createFullTextIndex(Constants.FULLTEXT_INDEX, fullText, Constants.BACKING_INDEX);
}
Also used : AtlasPropertyKey(org.apache.atlas.repository.graphdb.AtlasPropertyKey)

Example 27 with AtlasPropertyKey

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

the class GraphBackedSearchIndexer method createIndexes.

private AtlasPropertyKey createIndexes(AtlasGraphManagement management, String propertyName, Class propertyClass, boolean isUnique, AtlasCardinality cardinality, boolean createCompositeForAttribute, boolean createCompositeWithTypeandSuperTypes) {
    AtlasPropertyKey propertyKey = management.getPropertyKey(propertyName);
    if (propertyKey == null) {
        propertyKey = management.makePropertyKey(propertyName, propertyClass, cardinality);
        updateVertexIndex(management, propertyName, propertyClass, cardinality, propertyKey);
    }
    if (createCompositeForAttribute) {
        createExactMatchIndex(management, propertyClass, propertyKey, isUnique);
    } else if (createCompositeWithTypeandSuperTypes) {
        // Index with typename since typename+property key queries need to
        // speed up
        createExactMatchIndexWithTypeName(management, propertyClass, propertyKey);
        createExactMatchIndexWithSuperTypeName(management, propertyClass, propertyKey);
    }
    return propertyKey;
}
Also used : AtlasPropertyKey(org.apache.atlas.repository.graphdb.AtlasPropertyKey)

Example 28 with AtlasPropertyKey

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

the class GraphBackedSearchIndexer method getVertexIndexKeys.

public Set<String> getVertexIndexKeys() {
    if (recomputeIndexedKeys) {
        AtlasGraphManagement management = null;
        try {
            management = provider.get().getManagementSystem();
        } catch (RepositoryException excp) {
            LOG.error("failed to get indexedKeys from graph", excp);
        }
        if (management != null) {
            recomputeIndexedKeys = false;
            AtlasGraphIndex vertexIndex = management.getGraphIndex(Constants.VERTEX_INDEX);
            Set<String> indexKeys = new HashSet<>();
            for (AtlasPropertyKey fieldKey : vertexIndex.getFieldKeys()) {
                indexKeys.add(fieldKey.getName());
            }
            vertexIndexKeys = indexKeys;
        }
    }
    return vertexIndexKeys;
}
Also used : AtlasGraphManagement(org.apache.atlas.repository.graphdb.AtlasGraphManagement) AtlasPropertyKey(org.apache.atlas.repository.graphdb.AtlasPropertyKey) AtlasGraphIndex(org.apache.atlas.repository.graphdb.AtlasGraphIndex) RepositoryException(org.apache.atlas.repository.RepositoryException) HashSet(java.util.HashSet)

Example 29 with AtlasPropertyKey

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

the class AtlasJanusGraphManagement method addMixedIndex.

@Override
public void addMixedIndex(String indexName, AtlasPropertyKey propertyKey) {
    PropertyKey janusKey = AtlasJanusObjectFactory.createPropertyKey(propertyKey);
    JanusGraphIndex vertexIndex = management.getGraphIndex(indexName);
    management.addIndexKey(vertexIndex, janusKey);
}
Also used : JanusGraphIndex(org.janusgraph.core.schema.JanusGraphIndex) AtlasPropertyKey(org.apache.atlas.repository.graphdb.AtlasPropertyKey) PropertyKey(org.janusgraph.core.PropertyKey)

Example 30 with AtlasPropertyKey

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

the class AtlasJanusGraphManagement method createEdgeCompositeIndex.

@Override
public void createEdgeCompositeIndex(String propertyName, boolean isUnique, List<AtlasPropertyKey> propertyKeys) {
    IndexBuilder indexBuilder = management.buildIndex(propertyName, Edge.class);
    for (AtlasPropertyKey key : propertyKeys) {
        PropertyKey janusKey = AtlasJanusObjectFactory.createPropertyKey(key);
        indexBuilder.addKey(janusKey);
    }
    if (isUnique) {
        indexBuilder.unique();
    }
    indexBuilder.buildCompositeIndex();
}
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