use of org.apache.atlas.repository.graphdb.AtlasPropertyKey in project atlas by apache.
the class AtlasJanusDatabaseTest method getGraph.
private <V, E> AtlasGraph<V, E> getGraph() {
GraphSandboxUtil.create();
if (atlasGraph == null) {
AtlasJanusGraphDatabase db = new AtlasJanusGraphDatabase();
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 atlas by apache.
the class Titan0GraphIndex method getFieldKeys.
/* (non-Javadoc)
* @see org.apache.atlas.repository.graphdb.AtlasGraphIndex#getFieldKeys()
*/
@Override
public Set<AtlasPropertyKey> getFieldKeys() {
PropertyKey[] keys = wrappedIndex.getFieldKeys();
Set<AtlasPropertyKey> result = new HashSet<>();
for (PropertyKey key : keys) {
result.add(GraphDbObjectFactory.createPropertyKey(key));
}
return result;
}
use of org.apache.atlas.repository.graphdb.AtlasPropertyKey in project atlas by apache.
the class Titan0GraphManagement method addMixedIndex.
@Override
public void addMixedIndex(String indexName, AtlasPropertyKey propertyKey) {
PropertyKey titanKey = TitanObjectFactory.createPropertyKey(propertyKey);
TitanGraphIndex vertexIndex = management.getGraphIndex(indexName);
management.addIndexKey(vertexIndex, titanKey);
}
use of org.apache.atlas.repository.graphdb.AtlasPropertyKey in project atlas by apache.
the class Titan0GraphManagement 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 = TitanObjectFactory.createDirection(edgeDirection);
PropertyKey[] keys = TitanObjectFactory.createPropertyKeys(propertyKeys);
management.buildEdgeIndex(edgeLabel, indexName, direction, keys);
}
use of org.apache.atlas.repository.graphdb.AtlasPropertyKey in project atlas by apache.
the class Titan0GraphManagement method createVertexCompositeIndex.
@Override
public void createVertexCompositeIndex(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();
}
Aggregations