how not to get it as data type "Memo"

hattanhattan Member Posts: 7 Contributor II
hi
Im writing my association rules output table in my access database for later processing
I used an "Execute Script" operator for getting Association rules as examples.

the problem is every time when overwrite the table in my database it change the value from
Text into Memo
how can I keep it as text type

here is my xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.1.014">
  <context>
    <input/>
    <output/>
    <macros/>
  </context>
  <operator activated="true" class="process" compatibility="5.1.014" expanded="true" name="Process">
    <process expanded="true" height="390" width="614">
      <operator activated="true" class="retrieve" compatibility="5.1.014" expanded="true" height="60" name="Retrieve" width="90" x="45" y="30">
        <parameter key="repository_entry" value="//NewLocalRepository_W7/final/Aggregation_output"/>
      </operator>
      <operator activated="true" class="select_attributes" compatibility="5.1.014" expanded="true" height="76" name="Select Attributes" width="90" x="45" y="120">
        <parameter key="attribute_filter_type" value="single"/>
        <parameter key="attribute" value="User_ID"/>
        <parameter key="invert_selection" value="true"/>
      </operator>
      <operator activated="true" class="rename_by_replacing" compatibility="5.1.014" expanded="true" height="76" name="Rename by Replacing" width="90" x="45" y="210">
        <parameter key="include_special_attributes" value="true"/>
        <parameter key="replace_what" value="count[(]Goal[_]ID[)][_]"/>
      </operator>
      <operator activated="true" class="fp_growth" compatibility="5.1.014" expanded="true" height="76" name="FP-Growth" width="90" x="179" y="210">
        <parameter key="min_support" value="0.5"/>
      </operator>
      <operator activated="true" class="create_association_rules" compatibility="5.1.014" expanded="true" height="76" name="Create Association Rules" width="90" x="179" y="120">
        <parameter key="min_confidence" value="0.5"/>
      </operator>
      <operator activated="true" class="execute_script" compatibility="5.1.014" expanded="true" height="76" name="Execute Script" width="90" x="179" y="30">
        <parameter key="script" value="import com.rapidminer.tools.Ontology;&#13;&#13;&#10;import com.rapidminer.operator.learner.associations.*;&#13;&#13;&#10;&#13;&#10;AssociationRules rules = input[0];&#13;&#13;&#10;&#10;&#13;// construct attribute set&#13;&#10;Attribute[] attributes= new Attribute[11];&#10;attributes[0] = AttributeFactory.createAttribute(&quot;Premise&quot;, Ontology.STRING);&#13;&#13;&#10;attributes[1] = AttributeFactory.createAttribute(&quot;Premise Items&quot;, Ontology.INTEGER);&#10;attributes[2] = AttributeFactory.createAttribute(&quot;Conclusion&quot;, Ontology.STRING);&#13;&#10;attributes[3] = AttributeFactory.createAttribute(&quot;Conclusion Items&quot;, Ontology.INTEGER);&#13;&#10;attributes[4] = AttributeFactory.createAttribute(&quot;Confidence&quot;, Ontology.REAL);&#13;&#10;attributes[5] = AttributeFactory.createAttribute(&quot;Conviction&quot;, Ontology.REAL);&#13;&#10;attributes[6] = AttributeFactory.createAttribute(&quot;Gain&quot;, Ontology.REAL);&#13;&#10;attributes[7] = AttributeFactory.createAttribute(&quot;Laplace&quot;, Ontology.REAL);&#13;&#13;&#10;attributes[8] = AttributeFactory.createAttribute(&quot;Lift&quot;, Ontology.REAL);&#13;&#10;attributes[9] = AttributeFactory.createAttribute(&quot;Ps&quot;, Ontology.REAL);&#10;&#13;&#13;attributes[10] = AttributeFactory.createAttribute(&quot;Total Support&quot;, Ontology.REAL);&#10;&#13;&#13;&#13;&#10;MemoryExampleTable table = new MemoryExampleTable(attributes);&#10;DataRowFactory ROW_FACTORY = new DataRowFactory(0);&#13;&#10;&#13;String[] strings= new String[11];&#13;&#10;&#10;for (AssociationRule rule : rules) {&#10;&#9;&#9;// construct example data&#10;        strings[0]=rule.toPremiseString();&#13;&#10;        strings[1]=rule.premise.size().toString();&#13;&#10;        strings[2]=rule.toConclusionString();&#13;&#10;        strings[3]=rule.conclusion.size().toString();&#13;&#10;        strings[4]=rule.getConfidence().toString();&#13;&#10;        strings[5]=rule.getConviction().toString();&#13;&#10;        strings[6]=rule.getGain().toString();&#13;&#10;        strings[7]=rule.getLaplace().toString();&#13;&#10;        strings[8]=rule.getLift().toString();&#13;&#10;&#13;        strings[9]=rule.getPs().toString();&#13;&#10;        strings[10]=rule.getTotalSupport().toString();&#13;&#13;&#10;        // make and add row&#13;&#10;        DataRow row = ROW_FACTORY.create(strings, attributes); &#13;&#10;        table.addDataRow(row);&#9;&#10;&#9;&#9;}&#10;&#13;&#10;ExampleSet exampleSet = table.createExampleSet();&#10;return exampleSet;&#10;"/>
      </operator>
      <operator activated="true" class="select_attributes" compatibility="5.1.014" expanded="true" height="76" name="Select Attributes (2)" width="90" x="313" y="120">
        <parameter key="attribute_filter_type" value="value_type"/>
        <parameter key="value_type" value="text"/>
        <parameter key="except_value_type" value="nominal"/>
        <parameter key="include_special_attributes" value="true"/>
      </operator>
      <operator activated="true" class="replace" compatibility="5.1.014" expanded="true" height="76" name="Replace" width="90" x="415" y="253">
        <parameter key="attribute" value="cluster"/>
        <parameter key="include_special_attributes" value="true"/>
        <parameter key="replace_what" value="[\[\\\]]"/>
      </operator>
      <operator activated="true" class="write_database" compatibility="5.1.014" expanded="true" height="60" name="Write Database" width="90" x="447" y="120">
        <parameter key="define_connection" value="url"/>
        <parameter key="database_system" value="ODBC Bridge (e.g. Access)"/>
        <parameter key="database_url" value="jdbc:odbc:myDB"/>
        <parameter key="username" value="tiger"/>
        <parameter key="password" value="npB+UJcuuIU="/>
        <parameter key="table_name" value="Rules"/>
        <parameter key="overwrite_mode" value="overwrite"/>
      </operator>
      <connect from_op="Retrieve" from_port="output" to_op="Select Attributes" to_port="example set input"/>
      <connect from_op="Select Attributes" from_port="example set output" to_op="Rename by Replacing" to_port="example set input"/>
      <connect from_op="Rename by Replacing" from_port="example set output" to_op="FP-Growth" to_port="example set"/>
      <connect from_op="FP-Growth" from_port="frequent sets" to_op="Create Association Rules" to_port="item sets"/>
      <connect from_op="Create Association Rules" from_port="rules" to_op="Execute Script" to_port="input 1"/>
      <connect from_op="Execute Script" from_port="output 1" to_op="Select Attributes (2)" to_port="example set input"/>
      <connect from_op="Select Attributes (2)" from_port="example set output" to_op="Replace" to_port="example set input"/>
      <connect from_op="Replace" from_port="example set output" to_op="Write Database" to_port="input"/>
      <connect from_op="Write Database" from_port="through" 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>

Answers

  • haddockhaddock Member Posts: 849  Guru
    Hi there,

    Perhaps you should try setting the 'varchar length' when you write the table. I think the memo data type in access is for longer texts, so perhaps it  reformats long rules. I don't use access so this could be non-sense!

    Just a thought though.
  • hattanhattan Member Posts: 7 Contributor II
    Thanks for replying
    even though it keep changing the type back! And my rules are not a longe text.
    I think I can Ignore this problem, I found that I can complete my process so far for now.

    regards
Sign In or Register to comment.