Search in sources :

Example 71 with Schema

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

the class GetGraph method callService.

@Override
public void callService(final PluginParameters parameters, final InputStream in, final OutputStream out) throws IOException {
    final Graph graph = GraphManager.getDefault().getActiveGraph();
    final ObjectMapper mapper = new ObjectMapper();
    final ObjectNode root = mapper.createObjectNode();
    String name = null;
    String schemaName = null;
    final String id = graph != null ? graph.getId() : null;
    if (graph != null) {
        name = GraphNode.getGraphNode(id).getDisplayName();
        final Schema schema = graph.getSchema();
        if (schema != null) {
            schemaName = schema.getFactory().getName();
        }
    }
    root.put("id", id);
    root.put("name", name);
    root.put("schema", schemaName);
    mapper.writeValue(out, root);
}
Also used : Graph(au.gov.asd.tac.constellation.graph.Graph) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) Schema(au.gov.asd.tac.constellation.graph.schema.Schema) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Example 72 with Schema

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

the class AddModeWelcomePlugin method run.

/**
 * This method describes what action should be taken when the link is
 * clicked on the Welcome Page
 */
@Override
public void run() {
    final Schema schema = SchemaFactoryUtilities.getSchemaFactory(AnalyticSchemaFactory.ANALYTIC_SCHEMA_ID).createSchema();
    final StoreGraph sg = new StoreGraph(schema);
    schema.newGraph(sg);
    final int drawModeAttribute = VisualConcept.GraphAttribute.DRAWING_MODE.ensure(sg);
    sg.setBooleanValue(drawModeAttribute, 0, true);
    final Graph dualGraph = new DualGraph(sg, false);
    final String graphName = SchemaFactoryUtilities.getSchemaFactory(AnalyticSchemaFactory.ANALYTIC_SCHEMA_ID).getLabel().trim().toLowerCase();
    GraphOpener.getDefault().openGraph(dualGraph, graphName);
}
Also used : StoreGraph(au.gov.asd.tac.constellation.graph.StoreGraph) Graph(au.gov.asd.tac.constellation.graph.Graph) DualGraph(au.gov.asd.tac.constellation.graph.locking.DualGraph) Schema(au.gov.asd.tac.constellation.graph.schema.Schema) DualGraph(au.gov.asd.tac.constellation.graph.locking.DualGraph) StoreGraph(au.gov.asd.tac.constellation.graph.StoreGraph)

Example 73 with Schema

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

the class SelectionModeWelcomePlugin method run.

/**
 * This method describes what action should be taken when the link is
 * clicked on the Welcome Page
 */
@Override
public void run() {
    final Schema schema = SchemaFactoryUtilities.getSchemaFactory(AnalyticSchemaFactory.ANALYTIC_SCHEMA_ID).createSchema();
    final StoreGraph sg = new StoreGraph(schema);
    schema.newGraph(sg);
    final Graph dualGraph = new DualGraph(sg, false);
    final String graphName = SchemaFactoryUtilities.getSchemaFactory(AnalyticSchemaFactory.ANALYTIC_SCHEMA_ID).getLabel().trim().toLowerCase();
    GraphOpener.getDefault().openGraph(dualGraph, graphName);
}
Also used : StoreGraph(au.gov.asd.tac.constellation.graph.StoreGraph) Graph(au.gov.asd.tac.constellation.graph.Graph) DualGraph(au.gov.asd.tac.constellation.graph.locking.DualGraph) Schema(au.gov.asd.tac.constellation.graph.schema.Schema) DualGraph(au.gov.asd.tac.constellation.graph.locking.DualGraph) StoreGraph(au.gov.asd.tac.constellation.graph.StoreGraph)

Example 74 with Schema

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

the class SelectBlazesPluginNGTest method setUpMethod.

@BeforeMethod
public void setUpMethod() {
    // create an analytic graph
    final Schema schema = SchemaFactoryUtilities.getDefaultSchemaFactory().createSchema();
    graph = new StoreGraph(schema);
}
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