use of org.apache.atlas.repository.graphdb.AtlasGraph in project incubator-atlas by apache.
the class AtlasDeleteHandlerV1Test method getVertices.
protected List<AtlasVertex> getVertices(String propertyName, Object value) {
AtlasGraph graph = TestUtils.getGraph();
Iterable<AtlasVertex> vertices = graph.getVertices(propertyName, value);
List<AtlasVertex> list = new ArrayList<>();
for (AtlasVertex vertex : vertices) {
list.add(vertex);
}
return list;
}
use of org.apache.atlas.repository.graphdb.AtlasGraph in project incubator-atlas by apache.
the class GraphRepoMapperScaleTest method searchWithIndex.
private void searchWithIndex(String key, String value) {
AtlasGraph graph = TestUtils.getGraph();
long start = System.currentTimeMillis();
int count = 0;
try {
String queryString = "v.\"" + key + "\":(" + value + ")";
AtlasIndexQuery query = graph.indexQuery(Constants.VERTEX_INDEX, queryString);
Iterator<AtlasIndexQuery.Result> result = query.vertices();
while (result.hasNext()) {
result.next();
count++;
}
} finally {
System.out.println("Search on [" + key + "=" + value + "] returned results: " + count + ", took " + (System.currentTimeMillis() - start) + " ms");
}
}
use of org.apache.atlas.repository.graphdb.AtlasGraph in project incubator-atlas by apache.
the class GraphBackedMetadataRepositoryTest method getTableEntityVertex.
@GraphTransaction
AtlasVertex getTableEntityVertex() {
AtlasGraph graph = TestUtils.getGraph();
AtlasGraphQuery query = graph.query().has(Constants.ENTITY_TYPE_PROPERTY_KEY, ComparisionOperator.EQUAL, TestUtils.TABLE_TYPE);
Iterator<AtlasVertex> results = query.vertices().iterator();
// returning one since guid should be unique
AtlasVertex tableVertex = results.hasNext() ? results.next() : null;
if (tableVertex == null) {
Assert.fail();
}
return tableVertex;
}
use of org.apache.atlas.repository.graphdb.AtlasGraph in project incubator-atlas by apache.
the class GraphBackedSearchIndexerTest method verifySystemCompositeIndexes.
@Test
public void verifySystemCompositeIndexes() {
AtlasGraph graph = TestUtils.getGraph();
AtlasGraphManagement managementSystem = graph.getManagementSystem();
try {
verifySystemCompositeIndex(managementSystem, Constants.GUID_PROPERTY_KEY, true);
verifyVertexIndexContains(managementSystem, Constants.GUID_PROPERTY_KEY);
verifySystemCompositeIndex(managementSystem, Constants.ENTITY_TYPE_PROPERTY_KEY, false);
verifyVertexIndexContains(managementSystem, Constants.ENTITY_TYPE_PROPERTY_KEY);
verifySystemCompositeIndex(managementSystem, Constants.SUPER_TYPES_PROPERTY_KEY, false);
verifyVertexIndexContains(managementSystem, Constants.SUPER_TYPES_PROPERTY_KEY);
verifySystemCompositeIndex(managementSystem, Constants.TRAIT_NAMES_PROPERTY_KEY, false);
verifyVertexIndexContains(managementSystem, Constants.TRAIT_NAMES_PROPERTY_KEY);
} finally {
managementSystem.rollback();
}
}
use of org.apache.atlas.repository.graphdb.AtlasGraph in project incubator-atlas by apache.
the class GraphBackedSearchIndexerTest method verifyFullTextIndex.
@Test
public void verifyFullTextIndex() {
AtlasGraph graph = TestUtils.getGraph();
AtlasGraphManagement managementSystem = graph.getManagementSystem();
try {
AtlasGraphIndex fullTextIndex = managementSystem.getGraphIndex(Constants.FULLTEXT_INDEX);
assertTrue(fullTextIndex.isMixedIndex());
Arrays.asList(fullTextIndex.getFieldKeys()).contains(managementSystem.getPropertyKey(Constants.ENTITY_TEXT_PROPERTY_KEY));
} finally {
managementSystem.rollback();
}
}
Aggregations