예제 #1
0
 @Override
 protected MetaData modifyMetaData(ExampleSetMetaData metaData) throws UndefinedParameterError {
   AttributeMetaData amd =
       metaData.getAttributeByName(getParameterAsString(PARAMETER_ATTRIBUTE_NAME));
   if (amd != null) {
     AttributeMetaData newAttribute = amd.clone();
     newAttribute.setType(Ontology.DATE_TIME);
     newAttribute.getMean().setUnkown();
     newAttribute.setValueSetRelation(SetRelation.UNKNOWN);
     if (!getParameterAsBoolean(PARAMETER_KEEP_OLD_ATTRIBUTE)) metaData.removeAttribute(amd);
     else newAttribute.setName(newAttribute.getName() + "_AS_DATE");
     metaData.addAttribute(newAttribute);
   }
   return metaData;
 }
 /**
  * Subclasses might override this method to define the meta data transformation performed by this
  * operator. The default implementation takes all attributes specified by the {@link
  * AttributeSubsetSelector} and passes them to {@link #modifyAttributeMetaData(ExampleSetMetaData,
  * AttributeMetaData)} and replaces them accordingly.
  *
  * @throws UndefinedParameterError
  */
 @Override
 protected ExampleSetMetaData modifyMetaData(ExampleSetMetaData exampleSetMetaData)
     throws UndefinedParameterError {
   ExampleSetMetaData subsetMetaData =
       attributeSelector.getMetaDataSubset(exampleSetMetaData, isSupportingAttributeRoles());
   checkSelectedSubsetMetaData(subsetMetaData);
   for (AttributeMetaData amd : subsetMetaData.getAllAttributes()) {
     Collection<AttributeMetaData> replacement = null;
     replacement = modifyAttributeMetaData(exampleSetMetaData, amd);
     if (replacement != null) {
       if (replacement.size() == 1) {
         AttributeMetaData replacementAttribute = replacement.iterator().next();
         replacementAttribute.setRole(
             exampleSetMetaData.getAttributeByName(amd.getName()).getRole());
       }
       exampleSetMetaData.removeAttribute(amd);
       exampleSetMetaData.addAllAttributes(replacement);
     }
   }
   return exampleSetMetaData;
 }