use of au.gov.asd.tac.constellation.graph.schema.Schema in project constellation by constellation-app.
the class DefaultQualityControlAutoButtonNGTest method setUpMethod.
@BeforeMethod
public void setUpMethod() throws Exception {
final Schema schema = SchemaFactoryUtilities.getSchemaFactory(AnalyticSchemaFactory.ANALYTIC_SCHEMA_ID).createSchema();
graph = new StoreGraph(schema);
rules = new ArrayList<>();
events = new ArrayList<>();
// mock QualityControlEvent
qualityControlEvent = mock(QualityControlEvent.class);
when(qualityControlEvent.getCategory()).thenReturn(QualityCategory.CRITICAL);
when(qualityControlEvent.getReasons()).thenReturn("Reason 1, Reason2");
events.add(qualityControlEvent);
}
use of au.gov.asd.tac.constellation.graph.schema.Schema in project constellation by constellation-app.
the class QualityControlViewPaneNGTest method setUpMethod.
@BeforeMethod
public void setUpMethod() throws Exception {
// create an analytic graph
final Schema schema = SchemaFactoryUtilities.getSchemaFactory(AnalyticSchemaFactory.ANALYTIC_SCHEMA_ID).createSchema();
graph = new StoreGraph(schema);
// add attributes
vertexIdentifierAttribute = VisualConcept.VertexAttribute.IDENTIFIER.ensure(graph);
vertexTypeAttribute = AnalyticConcept.VertexAttribute.TYPE.ensure(graph);
vertexSelectedAttribute = VisualConcept.VertexAttribute.SELECTED.ensure(graph);
// add vertices
vxId1 = graph.addVertex();
vxId2 = graph.addVertex();
vxId3 = graph.addVertex();
// set all vertices to be selected
graph.setBooleanValue(vertexSelectedAttribute, vxId1, true);
graph.setBooleanValue(vertexSelectedAttribute, vxId2, true);
graph.setBooleanValue(vertexSelectedAttribute, vxId3, false);
rules = new ArrayList<>(Lookup.getDefault().lookupAll(QualityControlRule.class));
vertices = Arrays.asList(vxId1, vxId2);
for (final QualityControlRule rule : rules) {
rule.executeRule(graph, vertices);
}
events = new ArrayList<>();
for (final int vertexId : vertices) {
final String type = graph.getStringValue(vertexTypeAttribute, vertexId);
events.add(new QualityControlEvent(vertexId, graph.getStringValue(vertexIdentifierAttribute, vertexId), SchemaVertexTypeUtilities.getType(type), rules));
}
}
use of au.gov.asd.tac.constellation.graph.schema.Schema in project constellation by constellation-app.
the class AttributeNodeProvider method getSchemaInfo.
private List<AttributeEntry> getSchemaInfo(final Graph graph) {
final List<AttributeEntry> attrs = new ArrayList<>();
final Schema schema = graph.getSchema();
final SchemaFactory factory = schema.getFactory();
// Get the keys for each element type.
final Map<GraphElementType, List<String>> elementKeys = new HashMap<>();
for (final GraphElementType et : new GraphElementType[] { GraphElementType.VERTEX, GraphElementType.TRANSACTION }) {
final List<SchemaAttribute> keys = factory.getKeyAttributes(et);
final List<String> keyLabels = keys.stream().map(key -> key.getName()).collect(Collectors.toList());
elementKeys.put(et, keyLabels);
}
for (final GraphElementType et : GraphElementType.values()) {
final Map<String, SchemaAttribute> attrsMap = factory.getRegisteredAttributes(et);
attrsMap.values().stream().forEach(schemaAttribute -> {
final int keyIx = elementKeys.containsKey(schemaAttribute.getElementType()) ? elementKeys.get(schemaAttribute.getElementType()).indexOf(schemaAttribute.getName()) : -1;
final Collection<SchemaConcept> concepts = SchemaConceptUtilities.getAttributeConcepts(schemaAttribute);
final StringBuilder categories = new StringBuilder();
for (SchemaConcept concept : concepts) {
categories.append(concept.getName()).append(",");
}
if (categories.length() > 0) {
categories.deleteCharAt(categories.length() - 1);
}
attrs.add(new AttributeEntry(schemaAttribute, categories.toString(), keyIx));
});
}
return attrs;
}
use of au.gov.asd.tac.constellation.graph.schema.Schema in project constellation by constellation-app.
the class PreferentialAttachmentGraphBuilderPluginNGTest method setUpMethod.
@BeforeMethod
public void setUpMethod() throws Exception {
final Schema schema = SchemaFactoryUtilities.getSchemaFactory(AnalyticSchemaFactory.ANALYTIC_SCHEMA_ID).createSchema();
graph = new StoreGraph(schema);
}
use of au.gov.asd.tac.constellation.graph.schema.Schema in project constellation by constellation-app.
the class SmallWorldGraphBuilderPluginNGTest method setUpMethod.
@BeforeMethod
public void setUpMethod() throws Exception {
final Schema schema = SchemaFactoryUtilities.getSchemaFactory(AnalyticSchemaFactory.ANALYTIC_SCHEMA_ID).createSchema();
graph = new StoreGraph(schema);
}
Aggregations