Example #1
0
  public BufferModule(CallbackReceiver callbackReceiver, Properties properties) throws Exception {

    // Call parent constructor
    super(callbackReceiver, properties);

    // Add module description
    this.setDescription(
        "<html><h1>Buffer module</h1><p>Stores input until the pipe closes and only then writes it to the output.</p></html>");

    // Add module category
    this.setCategory("I/O");

    // Add property defaults (_should_ be provided for every property)
    this.getPropertyDefaultValues()
        .put(
            ModuleImpl.PROPERTYKEY_NAME,
            "Buffer Module"); // Property key for module name is defined in parent class

    // Define I/O
    /*
     * I/O is structured into separate ports (input~/output~).
     * Every port can support a range of pipe types (currently
     * byte or character pipes). Output ports can provide data
     * to multiple pipe instances at once, input ports can
     * in contrast only obtain data from one pipe instance.
     */
    InputPort inputPort1 = new InputPort(INPUT1ID, "Plain text character input.", this);
    inputPort1.addSupportedPipe(CharPipe.class);
    OutputPort outputPort = new OutputPort(OUTPUTNORMID, "Plain text character output.", this);
    outputPort.addSupportedPipe(CharPipe.class);

    // Add I/O ports to instance (don't forget...)
    super.addInputPort(inputPort1);
    super.addOutputPort(outputPort);
  }
  public SuffixNetBuilderModule(CallbackReceiver callbackReceiver, Properties properties)
      throws Exception {
    super(callbackReceiver, properties);

    // Define I/O
    InputPort inputPort =
        new InputPort(
            INPUTID,
            "JSON-encoded FileFinderModule-data, with the parsed contents of one source file per line.",
            this);
    inputPort.addSupportedPipe(CharPipe.class);
    OutputPort outputPort = new OutputPort(OUTPUTID, "Suffix net in binary object form.", this);
    outputPort.addSupportedPipe(BytePipe.class);
    super.addInputPort(inputPort);
    super.addOutputPort(outputPort);

    // Add description for properties
    this.getPropertyDescriptions().put(PROPERTYKEY_NEO4JURI, "URI of the Neo4j DB.");
    this.getPropertyDescriptions().put(PROPERTYKEY_NEO4JUSR, "Username for Neo4J access.");
    this.getPropertyDescriptions().put(PROPERTYKEY_NEO4JPWD, "Password for Neo4J access.");
    this.getPropertyDescriptions()
        .put(PROPERTYKEY_USENEO4J, "Write nodes and edges to Neo4J upon creation.");
    this.getPropertyDescriptions()
        .put(PROPERTYKEY_INDIVIDUALBRANCHES, "Creates individual branches for each sentence.");
    this.getPropertyDescriptions()
        .put(PROPERTYKEY_INDIVIDUALROOTNODES, "Creates individual root nodes for each sentence.");

    // Add default values
    this.getPropertyDefaultValues().put(ModuleImpl.PROPERTYKEY_NAME, "SuffixNetBuilder");
    this.getPropertyDefaultValues().put(PROPERTYKEY_NEO4JURI, "http://127.0.0.1:7474/db/data/");
    this.getPropertyDefaultValues().put(PROPERTYKEY_USENEO4J, "true");
    this.getPropertyDefaultValues().put(PROPERTYKEY_INDIVIDUALBRANCHES, "false");
    this.getPropertyDefaultValues().put(PROPERTYKEY_INDIVIDUALROOTNODES, "false");

    // Add module description
    this.setDescription(
        "Builds a suffix net from the annotated JSON output of OANCXMLParser (expects one JSON object per line).");
    // Add module category
    this.setCategory("Experimental/WiP");
  }