Search in sources :

Example 41 with PluginParameters

use of au.gov.asd.tac.constellation.plugins.parameters.PluginParameters in project constellation by constellation-app.

the class JaccardIndexPluginNGTest method testDirectedJaccard.

@Test
public void testDirectedJaccard() throws Exception {
    final JaccardIndexPlugin instance = new JaccardIndexPlugin();
    final PluginParameters parameters = instance.createParameters();
    parameters.setBooleanValue(JaccardIndexPlugin.INCLUDE_CONNECTIONS_IN_PARAMETER_ID, false);
    parameters.setBooleanValue(JaccardIndexPlugin.INCLUDE_CONNECTIONS_OUT_PARAMETER_ID, true);
    parameters.setBooleanValue(JaccardIndexPlugin.TREAT_UNDIRECTED_BIDIRECTIONAL_PARAMETER_ID, true);
    parameters.setIntegerValue(JaccardIndexPlugin.MINIMUM_COMMON_FEATURES_PARAMETER_ID, 1);
    parameters.setBooleanValue(JaccardIndexPlugin.SELECTED_ONLY_PARAMETER_ID, false);
    PluginExecution.withPlugin(instance).withParameters(parameters).executeNow(graph);
    int transactionCount = graph.getTransactionCount();
    for (int transactionId = 0; transactionId < transactionCount; transactionId++) {
        int transaction = graph.getTransaction(transactionId);
        String identifier = graph.getStringValue(transactionIdentifier, transactionId);
        if ("2 == similarity == 3".equals(identifier)) {
            assertEquals(graph.getFloatValue(transactionJaccardAttribute, transactionId), 1f);
        }
        if ("0 == similarity == 2".equals(identifier)) {
            assertEquals(graph.getFloatValue(transactionJaccardAttribute, transactionId), 0.5f);
        }
        if ("2 == similarity == 4".equals(identifier)) {
            assertEquals(graph.getFloatValue(transactionJaccardAttribute, transactionId), 0.5f);
        }
        if ("1 == similarity == 2".equals(identifier)) {
            assertEquals(graph.getFloatValue(transactionJaccardAttribute, transactionId), 0.5f);
        }
        if ("0 == similarity == 3".equals(identifier)) {
            assertEquals(graph.getFloatValue(transactionJaccardAttribute, transactionId), 0.33333334f);
        }
        if ("1 == similarity == 4".equals(identifier)) {
            assertEquals(graph.getFloatValue(transactionJaccardAttribute, transactionId), 0.33333334f);
        }
        if ("1 == similarity == 3".equals(identifier)) {
            assertEquals(graph.getFloatValue(transactionJaccardAttribute, transactionId), 0.33333334f);
        }
    }
}
Also used : PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) Test(org.testng.annotations.Test)

Example 42 with PluginParameters

use of au.gov.asd.tac.constellation.plugins.parameters.PluginParameters in project constellation by constellation-app.

the class CreateVertexTypePlugin method createParameters.

@Override
public PluginParameters createParameters() {
    final PluginParameters params = new PluginParameters();
    final PluginParameter<StringParameterValue> nameParam = StringParameterType.build(NAME_PARAMETER_ID);
    nameParam.setName("Name");
    nameParam.setDescription("The name of the new vertex type");
    nameParam.setStringValue(null);
    params.addParameter(nameParam);
    final PluginParameter<StringParameterValue> descriptionParam = StringParameterType.build(DESCRIPTION_PARAMETER_ID);
    descriptionParam.setName("Description");
    descriptionParam.setDescription("The description of the new vertex type");
    descriptionParam.setStringValue(null);
    params.addParameter(descriptionParam);
    final PluginParameter<ColorParameterValue> colorParam = ColorParameterType.build(COLOR_PARAMETER_ID);
    colorParam.setName("Color");
    colorParam.setDescription("The color of the new vertex type");
    colorParam.setStringValue(ConstellationColor.GREY.getName());
    params.addParameter(colorParam);
    final PluginParameter<StringParameterValue> fgIconParam = StringParameterType.build(FG_ICON_PARAMETER_ID);
    fgIconParam.setName("Foreground Icon");
    fgIconParam.setDescription("The name of the foreground icon of the new vertex type");
    fgIconParam.setStringValue(CharacterIconProvider.CHAR_003F.getExtendedName());
    params.addParameter(fgIconParam);
    final PluginParameter<StringParameterValue> bgIconParam = StringParameterType.build(BG_ICON_PARAMETER_ID);
    bgIconParam.setName("Background Icon");
    bgIconParam.setDescription("The name of the background icon of the new vertex type");
    bgIconParam.setStringValue(DefaultIconProvider.FLAT_SQUARE.getExtendedName());
    params.addParameter(bgIconParam);
    final PluginParameter<StringParameterValue> detectionRegexParam = StringParameterType.build(DETECTION_REGEX_PARAMETER_ID);
    detectionRegexParam.setName("Detection Regular Expression");
    detectionRegexParam.setDescription("The detection regular expression (case of the new vertex type");
    detectionRegexParam.setStringValue(null);
    params.addParameter(detectionRegexParam);
    final PluginParameter<StringParameterValue> validationRegexParam = StringParameterType.build(VALIDATION_REGEX_PARAMETER_ID);
    validationRegexParam.setName("Validation Regular Expression");
    validationRegexParam.setDescription("The detection regular expression of the new vertex type");
    validationRegexParam.setStringValue(null);
    params.addParameter(validationRegexParam);
    final PluginParameter<StringParameterValue> superTypeParam = StringParameterType.build(SUPER_TYPE_PARAMETER_ID);
    superTypeParam.setName("Super Type");
    superTypeParam.setDescription("The name of the super type of the new vertex type");
    superTypeParam.setStringValue(null);
    params.addParameter(superTypeParam);
    final PluginParameter<StringParameterValue> overriddenTypeParam = StringParameterType.build(OVERRIDDEN_TYPE_PARAMETER_ID);
    overriddenTypeParam.setName("Overridden Type");
    overriddenTypeParam.setDescription("The name of the overridden type of the new vertex type");
    overriddenTypeParam.setStringValue(null);
    params.addParameter(overriddenTypeParam);
    final PluginParameter<BooleanParameterValue> incompleteParam = BooleanParameterType.build(INCOMPLETE_PARAMETER_ID);
    incompleteParam.setName("Incomplete");
    incompleteParam.setDescription("Is the new vertex type incomplete?");
    incompleteParam.setBooleanValue(false);
    params.addParameter(incompleteParam);
    return params;
}
Also used : BooleanParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.BooleanParameterType.BooleanParameterValue) StringParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.StringParameterValue) ColorParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.ColorParameterType.ColorParameterValue) PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters)

Example 43 with PluginParameters

use of au.gov.asd.tac.constellation.plugins.parameters.PluginParameters in project constellation by constellation-app.

the class FactAnalyticPlugin method createParameters.

@Override
public final PluginParameters createParameters() {
    final PluginParameters parameters = new PluginParameters();
    final PluginParameter<MultiChoiceParameterType.MultiChoiceParameterValue> transactionTypeParameter = MultiChoiceParameterType.build(TRANSACTION_TYPES_PARAMETER_ID, TransactionTypeParameterValue.class);
    transactionTypeParameter.setName("Transaction Types");
    transactionTypeParameter.setDescription("Calculate analytic only on the subgraph of transactions of these types");
    MultiChoiceParameterType.setOptionsData(transactionTypeParameter, new ArrayList<>());
    MultiChoiceParameterType.setChoicesData(transactionTypeParameter, new ArrayList<>());
    parameters.addParameter(transactionTypeParameter);
    final PluginParameters analyticPluginParameters = PluginRegistry.get(getAnalyticPlugin().getName()).createParameters();
    if (analyticPluginParameters != null) {
        analyticPluginParameters.getParameters().values().forEach(parameter -> parameters.addParameter(parameter));
    }
    updateParameters(parameters);
    return parameters;
}
Also used : MultiChoiceParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.MultiChoiceParameterType.MultiChoiceParameterValue) PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters)

Example 44 with PluginParameters

use of au.gov.asd.tac.constellation.plugins.parameters.PluginParameters in project constellation by constellation-app.

the class GatherNodesInGraphPlugin method createParameters.

@Override
public PluginParameters createParameters() {
    final PluginParameters parameters = new PluginParameters();
    final PluginParameter<ObjectParameterValue> xParam = ObjectParameterType.build(XYZ_PARAMETER_ID);
    xParam.setName("XYZ Position");
    xParam.setDescription("The x,y,z position to gather around");
    parameters.addParameter(xParam);
    final PluginParameter<ObjectParameterValue> gathersParam = ObjectParameterType.build(GATHERS_PARAMETER_ID);
    gathersParam.setName("Gather Vertex Ids");
    gathersParam.setDescription("A set of vertex ids to gather");
    parameters.addParameter(gathersParam);
    return parameters;
}
Also used : PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) ObjectParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.ObjectParameterType.ObjectParameterValue)

Example 45 with PluginParameters

use of au.gov.asd.tac.constellation.plugins.parameters.PluginParameters in project constellation by constellation-app.

the class GatherNodesPlugin method createParameters.

@Override
public PluginParameters createParameters() {
    final PluginParameters parameters = new PluginParameters();
    final PluginParameter<IntegerParameterValue> vxIdParam = IntegerParameterType.build(VXID_PARAMETER_ID);
    vxIdParam.setName("Vertex Id");
    vxIdParam.setDescription("The vertex id to gather around");
    parameters.addParameter(vxIdParam);
    final PluginParameter<ObjectParameterValue> gathersParam = ObjectParameterType.build(GATHERS_PARAMETER_ID);
    gathersParam.setName("Gather Vertex Ids");
    gathersParam.setDescription("A set of vertex ids to gather");
    parameters.addParameter(gathersParam);
    return parameters;
}
Also used : IntegerParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.IntegerParameterType.IntegerParameterValue) PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) ObjectParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.ObjectParameterType.ObjectParameterValue)

Aggregations

PluginParameters (au.gov.asd.tac.constellation.plugins.parameters.PluginParameters)377 Test (org.testng.annotations.Test)185 Plugin (au.gov.asd.tac.constellation.plugins.Plugin)60 BooleanParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.BooleanParameterType.BooleanParameterValue)60 PluginInteraction (au.gov.asd.tac.constellation.plugins.PluginInteraction)58 PluginParameter (au.gov.asd.tac.constellation.plugins.parameters.PluginParameter)58 StringParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.StringParameterValue)52 IntegerParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.IntegerParameterType.IntegerParameterValue)48 ArrayList (java.util.ArrayList)47 Graph (au.gov.asd.tac.constellation.graph.Graph)37 SingleChoiceParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.SingleChoiceParameterType.SingleChoiceParameterValue)34 PluginException (au.gov.asd.tac.constellation.plugins.PluginException)32 MultiChoiceParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.MultiChoiceParameterType.MultiChoiceParameterValue)24 List (java.util.List)20 Map (java.util.Map)20 GraphWriteMethods (au.gov.asd.tac.constellation.graph.GraphWriteMethods)19 GraphRecordStore (au.gov.asd.tac.constellation.graph.processing.GraphRecordStore)19 ObjectParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.ObjectParameterType.ObjectParameterValue)19 ReadableGraph (au.gov.asd.tac.constellation.graph.ReadableGraph)17 IOException (java.io.IOException)17