Search in sources :

Example 1 with Schema

use of au.gov.asd.tac.constellation.graph.schema.Schema in project constellation by constellation-app.

the class DirectedShortestPathsPluginNGTest method setUpMethod.

@BeforeMethod
public void setUpMethod() throws Exception {
    final Schema schema = SchemaFactoryUtilities.getSchemaFactory(VisualSchemaFactory.VISUAL_SCHEMA_ID).createSchema();
    graph = new StoreGraph(schema);
    vxId1 = graph.addVertex();
    vxId2 = graph.addVertex();
    vxId3 = graph.addVertex();
    vxId4 = graph.addVertex();
    vxId5 = graph.addVertex();
    tId1 = graph.addTransaction(vxId1, vxId2, false);
    tId2 = graph.addTransaction(vxId1, vxId3, true);
    tId3 = graph.addTransaction(vxId1, vxId4, true);
    tId4 = graph.addTransaction(vxId4, vxId2, true);
    tId5 = graph.addTransaction(vxId2, vxId5, true);
    tId6 = graph.addTransaction(vxId3, vxId5, true);
    vertexLabelAttribute = VisualConcept.VertexAttribute.LABEL.ensure(graph);
    vertexSelectedAttribute = VisualConcept.VertexAttribute.SELECTED.ensure(graph);
    graph.setStringValue(vertexLabelAttribute, vxId1, "Vertex 1");
    graph.setStringValue(vertexLabelAttribute, vxId2, "Vertex 2");
    graph.setStringValue(vertexLabelAttribute, vxId3, "Vertex 3");
    graph.setStringValue(vertexLabelAttribute, vxId4, "Vertex 4");
    graph.setStringValue(vertexLabelAttribute, vxId5, "Vertex 5");
    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);
}
Also used : Schema(au.gov.asd.tac.constellation.graph.schema.Schema) StoreGraph(au.gov.asd.tac.constellation.graph.StoreGraph) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 2 with Schema

use of au.gov.asd.tac.constellation.graph.schema.Schema in project constellation by constellation-app.

the class BetweennessCentralityPluginNGTest 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
    vertexBetweennessAttribute = SnaConcept.VertexAttribute.BETWEENNESS_CENTRALITY.ensure(graph);
    vertexInBetweennessAttribute = SnaConcept.VertexAttribute.IN_BETWEENNESS_CENTRALITY.ensure(graph);
    vertexOutBetweennessAttribute = SnaConcept.VertexAttribute.OUT_BETWEENNESS_CENTRALITY.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
    txId0 = graph.addTransaction(vxId0, vxId1, true);
    txId1 = graph.addTransaction(vxId1, vxId2, true);
    txId2 = graph.addTransaction(vxId1, vxId3, true);
    txId3 = graph.addTransaction(vxId2, vxId3, true);
    txId4 = graph.addTransaction(vxId3, vxId4, true);
}
Also used : Schema(au.gov.asd.tac.constellation.graph.schema.Schema) StoreGraph(au.gov.asd.tac.constellation.graph.StoreGraph) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 3 with Schema

use of au.gov.asd.tac.constellation.graph.schema.Schema in project constellation by constellation-app.

the class DegreeCentralityPluginNGTest 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
    vertexDegreeAttribute = SnaConcept.VertexAttribute.DEGREE_CENTRALITY.ensure(graph);
    vertexInDegreeAttribute = SnaConcept.VertexAttribute.IN_DEGREE_CENTRALITY.ensure(graph);
    vertexOutDegreeAttribute = SnaConcept.VertexAttribute.OUT_DEGREE_CENTRALITY.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
    txId0 = graph.addTransaction(vxId0, vxId1, true);
    txId1 = graph.addTransaction(vxId1, vxId2, true);
    txId2 = graph.addTransaction(vxId1, vxId3, true);
    txId3 = graph.addTransaction(vxId2, vxId3, true);
    txId4 = graph.addTransaction(vxId3, vxId4, true);
}
Also used : Schema(au.gov.asd.tac.constellation.graph.schema.Schema) StoreGraph(au.gov.asd.tac.constellation.graph.StoreGraph) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 4 with Schema

use of au.gov.asd.tac.constellation.graph.schema.Schema in project constellation by constellation-app.

the class EigenvectorCentralityPluginNGTest 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
    vertexEigenvectorAttribute = SnaConcept.VertexAttribute.EIGENVECTOR_CENTRALITY.ensure(graph);
    // add vertices
    vxId0 = graph.addVertex();
    vxId1 = graph.addVertex();
    vxId2 = graph.addVertex();
    vxId3 = graph.addVertex();
    vxId4 = graph.addVertex();
    // add transactions
    txId0 = graph.addTransaction(vxId0, vxId1, true);
    txId1 = graph.addTransaction(vxId1, vxId2, true);
    txId2 = graph.addTransaction(vxId1, vxId3, true);
    txId3 = graph.addTransaction(vxId2, vxId3, true);
    txId4 = graph.addTransaction(vxId3, vxId4, true);
}
Also used : Schema(au.gov.asd.tac.constellation.graph.schema.Schema) StoreGraph(au.gov.asd.tac.constellation.graph.StoreGraph) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 5 with Schema

use of au.gov.asd.tac.constellation.graph.schema.Schema in project constellation by constellation-app.

the class HitsCentralityPluginNGTest 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
    vertexHitsAuthorityAttribute = SnaConcept.VertexAttribute.HITS_CENTRALITY_AUTHORITY.ensure(graph);
    vertexHitsHubAttribute = SnaConcept.VertexAttribute.HITS_CENTRALITY_HUB.ensure(graph);
    // add vertices
    vxId0 = graph.addVertex();
    vxId1 = graph.addVertex();
    vxId2 = graph.addVertex();
    vxId3 = graph.addVertex();
    vxId4 = graph.addVertex();
    // add transactions
    txId0 = graph.addTransaction(vxId0, vxId1, true);
    txId1 = graph.addTransaction(vxId1, vxId2, true);
    txId2 = graph.addTransaction(vxId1, vxId3, true);
    txId3 = graph.addTransaction(vxId2, vxId3, true);
    txId4 = graph.addTransaction(vxId3, vxId4, true);
}
Also used : Schema(au.gov.asd.tac.constellation.graph.schema.Schema) StoreGraph(au.gov.asd.tac.constellation.graph.StoreGraph) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

Schema (au.gov.asd.tac.constellation.graph.schema.Schema)74 StoreGraph (au.gov.asd.tac.constellation.graph.StoreGraph)63 BeforeMethod (org.testng.annotations.BeforeMethod)50 DualGraph (au.gov.asd.tac.constellation.graph.locking.DualGraph)17 Graph (au.gov.asd.tac.constellation.graph.Graph)15 Test (org.testng.annotations.Test)13 WritableGraph (au.gov.asd.tac.constellation.graph.WritableGraph)10 ReadableGraph (au.gov.asd.tac.constellation.graph.ReadableGraph)8 ArrayList (java.util.ArrayList)8 GraphRecordStore (au.gov.asd.tac.constellation.graph.processing.GraphRecordStore)7 IOException (java.io.IOException)6 PluginException (au.gov.asd.tac.constellation.plugins.PluginException)5 PluginParameters (au.gov.asd.tac.constellation.plugins.parameters.PluginParameters)5 HashMap (java.util.HashMap)5 HashSet (java.util.HashSet)4 Set (java.util.Set)4 GraphElementType (au.gov.asd.tac.constellation.graph.GraphElementType)3 SchemaFactory (au.gov.asd.tac.constellation.graph.schema.SchemaFactory)3 CopyToNewGraphPlugin (au.gov.asd.tac.constellation.graph.interaction.plugins.clipboard.CopyToNewGraphPlugin)2 SchemaAttribute (au.gov.asd.tac.constellation.graph.schema.attribute.SchemaAttribute)2