use of org.apache.atlas.repository.graphdb.AtlasPropertyKey in project atlas by apache.
the class GraphBackedSearchIndexer method createEdgeIndex.
private AtlasPropertyKey createEdgeIndex(AtlasGraphManagement management, String propertyName, Class propertyClass, AtlasCardinality cardinality, boolean createCompositeIndex) {
AtlasPropertyKey propertyKey = management.getPropertyKey(propertyName);
if (propertyKey == null) {
propertyKey = management.makePropertyKey(propertyName, propertyClass, cardinality);
if (isIndexApplicable(propertyClass, cardinality)) {
if (LOG.isDebugEnabled()) {
LOG.debug("Creating backing index for edge property {} of type {} ", propertyName, propertyClass.getName());
}
management.addMixedIndex(EDGE_INDEX, propertyKey);
LOG.info("Created backing index for edge property {} of type {} ", propertyName, propertyClass.getName());
}
}
if (propertyKey != null) {
if (createCompositeIndex) {
createEdgeCompositeIndex(management, propertyClass, propertyKey);
}
} else {
LOG.warn("Index not created for {}: propertyKey is null", propertyName);
}
return propertyKey;
}
use of org.apache.atlas.repository.graphdb.AtlasPropertyKey in project atlas by apache.
the class GraphBackedSearchIndexer method createFullTextIndex.
private AtlasPropertyKey createFullTextIndex(AtlasGraphManagement management, String propertyName, Class propertyClass, AtlasCardinality cardinality) {
AtlasPropertyKey propertyKey = management.getPropertyKey(propertyName);
if (propertyKey == null) {
propertyKey = management.makePropertyKey(propertyName, propertyClass, cardinality);
if (isIndexApplicable(propertyClass, cardinality)) {
if (LOG.isDebugEnabled()) {
LOG.debug("Creating backing index for vertex property {} of type {} ", propertyName, propertyClass.getName());
}
management.addMixedIndex(FULLTEXT_INDEX, propertyKey);
LOG.info("Created backing index for vertex property {} of type {} ", propertyName, propertyClass.getName());
}
LOG.info("Created index {}", FULLTEXT_INDEX);
}
return propertyKey;
}
use of org.apache.atlas.repository.graphdb.AtlasPropertyKey in project atlas by apache.
the class Titan0GraphManagement method createVertexMixedIndex.
@Override
public void createVertexMixedIndex(String propertyName, String backingIndex, List<AtlasPropertyKey> propertyKeys) {
TitanManagement.IndexBuilder indexBuilder = management.buildIndex(propertyName, Vertex.class);
for (AtlasPropertyKey key : propertyKeys) {
PropertyKey titanKey = TitanObjectFactory.createPropertyKey(key);
indexBuilder.addKey(titanKey);
}
indexBuilder.buildMixedIndex(backingIndex);
}
use of org.apache.atlas.repository.graphdb.AtlasPropertyKey in project atlas by apache.
the class Titan0DatabaseTest method getGraph.
private <V, E> AtlasGraph<V, E> getGraph() {
GraphSandboxUtil.create();
if (atlasGraph == null) {
Titan0GraphDatabase db = new Titan0GraphDatabase();
atlasGraph = db.getGraph();
AtlasGraphManagement mgmt = atlasGraph.getManagementSystem();
// many)
for (String propertyName : new String[] { "__superTypeNames", "__traitNames" }) {
AtlasPropertyKey propertyKey = mgmt.getPropertyKey(propertyName);
if (propertyKey == null) {
propertyKey = mgmt.makePropertyKey(propertyName, String.class, AtlasCardinality.SET);
mgmt.createVertexCompositeIndex(propertyName, false, Collections.singletonList(propertyKey));
}
}
mgmt.commit();
}
return (AtlasGraph<V, E>) atlasGraph;
}
use of org.apache.atlas.repository.graphdb.AtlasPropertyKey in project incubator-atlas by apache.
the class Titan1GraphIndex method getFieldKeys.
@Override
public Set<AtlasPropertyKey> getFieldKeys() {
PropertyKey[] keys = wrapped.getFieldKeys();
Set<AtlasPropertyKey> result = new HashSet<AtlasPropertyKey>();
for (PropertyKey key : keys) {
result.add(GraphDbObjectFactory.createPropertyKey(key));
}
return result;
}
Aggregations