use of au.gov.asd.tac.constellation.graph.schema.Schema in project constellation by constellation-app.
the class ResourceAllocationIndexPluginNGTest 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
transactionRaiAttribute = SnaConcept.TransactionAttribute.RESOURCE_ALLOCATION_INDEX.ensure(graph);
vertexSelectedAttribute = VisualConcept.VertexAttribute.SELECTED.ensure(graph);
// add vertices
vxId0 = graph.addVertex();
vxId1 = graph.addVertex();
vxId2 = graph.addVertex();
vxId3 = graph.addVertex();
vxId4 = graph.addVertex();
// add transactions
graph.addTransaction(vxId0, vxId1, true);
graph.addTransaction(vxId0, vxId2, true);
graph.addTransaction(vxId0, vxId3, true);
graph.addTransaction(vxId0, vxId4, true);
graph.addTransaction(vxId1, vxId2, true);
graph.addTransaction(vxId1, vxId3, true);
graph.addTransaction(vxId1, vxId4, true);
graph.addTransaction(vxId2, vxId3, true);
graph.addTransaction(vxId2, vxId4, true);
graph.addTransaction(vxId3, vxId4, true);
}
use of au.gov.asd.tac.constellation.graph.schema.Schema in project constellation by constellation-app.
the class MergeNodesBySuffixNGTest 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);
vertexSelectedAttribute = VisualConcept.VertexAttribute.SELECTED.ensure(graph);
// add vertices
vxId1 = graph.addVertex();
vxId2 = graph.addVertex();
vxId3 = graph.addVertex();
vxId4 = graph.addVertex();
vxId5 = graph.addVertex();
vxId6 = graph.addVertex();
// set the identifier of each vertex to something unique
graph.setStringValue(vertexIdentifierAttribute, vxId1, "d1");
graph.setStringValue(vertexIdentifierAttribute, vxId2, "One Id1");
graph.setStringValue(vertexIdentifierAttribute, vxId3, "Id2");
graph.setStringValue(vertexIdentifierAttribute, vxId4, "One Id2");
graph.setStringValue(vertexIdentifierAttribute, vxId5, "Pine Id2");
graph.setStringValue(vertexIdentifierAttribute, vxId6, "Id3");
// select all
graph.setBooleanValue(vertexSelectedAttribute, vxId1, true);
graph.setBooleanValue(vertexSelectedAttribute, vxId2, true);
graph.setBooleanValue(vertexSelectedAttribute, vxId3, true);
graph.setBooleanValue(vertexSelectedAttribute, vxId4, true);
graph.setBooleanValue(vertexSelectedAttribute, vxId5, true);
graph.setBooleanValue(vertexSelectedAttribute, vxId6, true);
}
use of au.gov.asd.tac.constellation.graph.schema.Schema in project constellation by constellation-app.
the class MergeNodesByTypeNGTest 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();
vxId4 = graph.addVertex();
vxId5 = graph.addVertex();
vxId6 = graph.addVertex();
// set the identifier of each vertex to something unique
graph.setStringValue(vertexIdentifierAttribute, vxId1, "V1");
graph.setStringValue(vertexIdentifierAttribute, vxId2, "V2");
graph.setStringValue(vertexIdentifierAttribute, vxId3, "V2");
graph.setStringValue(vertexIdentifierAttribute, vxId4, "V3");
graph.setStringValue(vertexIdentifierAttribute, vxId5, "V3");
// add transactions
txId1 = graph.addTransaction(vxId1, vxId2, false);
txId2 = graph.addTransaction(vxId3, vxId4, false);
txId3 = graph.addTransaction(vxId5, vxId3, false);
txId4 = graph.addTransaction(vxId1, vxId3, false);
txId5 = graph.addTransaction(vxId4, vxId6, false);
// select all
graph.setBooleanValue(vertexSelectedAttribute, vxId1, true);
graph.setBooleanValue(vertexSelectedAttribute, vxId2, true);
graph.setBooleanValue(vertexSelectedAttribute, vxId3, true);
graph.setBooleanValue(vertexSelectedAttribute, vxId4, true);
graph.setBooleanValue(vertexSelectedAttribute, vxId5, true);
}
use of au.gov.asd.tac.constellation.graph.schema.Schema in project constellation by constellation-app.
the class MergeNodesByTypeNGTest method testGetNodesToMerge_NoIdentifierAttribute.
/**
* Test of getNodesToMerge method, of class MergeNodesByType, with no
* identifier Attribute
*/
@Test
public void testGetNodesToMerge_NoIdentifierAttribute() throws Exception {
System.out.println("testGetNodesToMerge_NoTypes");
Comparator<String> leadVertexChooser = null;
int threshold = 0;
boolean selectedOnly = false;
MergeNodesByType instance = new MergeNodesByType();
Map<Integer, Set<Integer>> expResult = new HashMap<>();
// create a new analytic graph
final Schema schema = SchemaFactoryUtilities.getSchemaFactory(AnalyticSchemaFactory.ANALYTIC_SCHEMA_ID).createSchema();
StoreGraph graph = new StoreGraph(schema);
// add attributes
int vertexTypeAttribute = AnalyticConcept.VertexAttribute.TYPE.ensure(graph);
// add vertices
int vxId1 = graph.addVertex();
int vxId2 = graph.addVertex();
int vxId3 = graph.addVertex();
// set the identifier of each vertex to something unique
graph.setStringValue(vertexTypeAttribute, vxId1, AnalyticConcept.VertexType.DOCUMENT.getName());
graph.setStringValue(vertexTypeAttribute, vxId2, AnalyticConcept.VertexType.DOCUMENT.getName());
graph.setStringValue(vertexTypeAttribute, vxId3, AnalyticConcept.VertexType.ONLINE_IDENTIFIER.getName());
Map<Integer, Set<Integer>> result = instance.getNodesToMerge(graph, leadVertexChooser, threshold, selectedOnly);
assertEquals(result, expResult);
}
use of au.gov.asd.tac.constellation.graph.schema.Schema in project constellation by constellation-app.
the class MergeNodesByTypeNGTest method testGetNodesToMerge_NoTypeAttribute.
/**
* Test of getNodesToMerge method, of class MergeNodesByType, with no types
* Attribute
*/
@Test
public void testGetNodesToMerge_NoTypeAttribute() throws Exception {
System.out.println("testGetNodesToMerge_NoTypes");
Comparator<String> leadVertexChooser = null;
int threshold = 0;
boolean selectedOnly = false;
MergeNodesByType instance = new MergeNodesByType();
Map<Integer, Set<Integer>> expResult = new HashMap<>();
// create a new analytic graph
final Schema schema = SchemaFactoryUtilities.getSchemaFactory(AnalyticSchemaFactory.ANALYTIC_SCHEMA_ID).createSchema();
StoreGraph graph = new StoreGraph(schema);
// add attributes
int vertexIdentifierAttribute = VisualConcept.VertexAttribute.IDENTIFIER.ensure(graph);
// add vertices
int vxId1 = graph.addVertex();
int vxId2 = graph.addVertex();
int vxId3 = graph.addVertex();
// set the identifier of each vertex to something unique
graph.setStringValue(vertexIdentifierAttribute, vxId1, "V1");
graph.setStringValue(vertexIdentifierAttribute, vxId2, "V2");
graph.setStringValue(vertexIdentifierAttribute, vxId3, "V2");
Map<Integer, Set<Integer>> result = instance.getNodesToMerge(graph, leadVertexChooser, threshold, selectedOnly);
assertEquals(result, expResult);
}
Aggregations