The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here

outport API for sharing attribute names

owenowen Member Posts: 22 Contributor II
edited September 2019 in Help
Hello all,
I have an new file reading operator "Read GDF" that is sort of working, but there is an issue with attribute names that I am having.
I think this operator should be able to communicate its attribute names to subsequent operators, but I do not have that part working yet.

Read GDF has an output attribute called "0_ECG" (for example):

Role    Name      Type
id      timestamp  real
regular    0_ECG    real

Consider "Read GDF" connected to "Replace Missing Values". Operator Replace Missing Values has a drop-down menu "attribute name" to select an attribute from the incoming port. When I connect Read GDF to Replace Missing Values, I hoped to see the menu populated with one item "0_ECG", but it did not happen.

I think perhaps I have not done a complete implementation; is there some interface that I need to implement to make this work? I read about nameprovider in the code but had difficulty understanding what is the API needed on the output side of a new operator. For this GDF file reader, the attribute names are not known until after the GDF file is opened, i.e. it is not known at constructor time for Read GDF. I think there are hooks for deferred evaluation. I would appreciate advice or an example.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.3.009">
  <context>
    <input/>
    <output/>
    <macros/>
  </context>
  <operator activated="true" class="process" compatibility="5.3.009" expanded="true" name="Process">
    <parameter key="logverbosity" value="init"/>
    <parameter key="random_seed" value="2001"/>
    <parameter key="send_mail" value="never"/>
    <parameter key="notification_email" value=""/>
    <parameter key="process_duration_for_mail" value="30"/>
    <parameter key="encoding" value="SYSTEM"/>
    <process expanded="true">
      <operator activated="true" class="biopeak:read_gdf" compatibility="0.1.000" expanded="true" height="60" name="Read GDF" width="90" x="45" y="30">
        <parameter key="filename" value="C:\Users\Owen\workspace18\sample\3MinutesSched2.gdf"/>
        <parameter key="datamanagement" value="float_array"/>
        <parameter key="channel_number" value="0"/>
      </operator>
      <operator activated="true" class="series:replace_missing_series_values" compatibility="5.3.000" expanded="true" height="76" name="Replace Missing Values (Series)" width="90" x="246" y="30">
        <parameter key="attribute_name" value="0_ECG"/>
        <parameter key="replacement" value="previous value"/>
      </operator>
      <connect from_op="Read GDF" from_port="output" to_op="Replace Missing Values (Series)" to_port="example set input"/>
      <connect from_op="Replace Missing Values (Series)" from_port="example set output" to_port="result 1"/>
      <portSpacing port="source_input 1" spacing="0"/>
      <portSpacing port="sink_result 1" spacing="0"/>
      <portSpacing port="sink_result 2" spacing="0"/>
    </process>
  </operator>
</process>
Thank you for any suggestions.

Regards,

Owen

Answers

  • Marco_BoeckMarco_Boeck Administrator, Moderator, Employee-RapidMiner, Member, University Professor Posts: 1,996 RM Engineering
    Hi,

    depends on what class your operator extends. If it is AbstractDataResultSetReader or AbstractExampleSource you can have a look at the "getGeneratedMetaData()" method.
    To just add an attribute which is always created, you could then add the following line:

    ExampleSetMetaData result;
    ...
    result.addAttribute(new AttributeMetaData("0_ECG", Ontology.REAL));
    Regards,
    Marco
  • owenowen Member Posts: 22 Contributor II
    Hello
    Thank you for that suggestion. I need to do more work on this part of the project. For now I am working on other aspects.
    Owen
Sign In or Register to comment.