public static void main(String[] args) throws Exception {
    // The label passed to the constructor does not affect the webapp
    final AttributeValueSet attributeValueSet = new AttributeValueSet("Example set");

    // Add all the attributes you want to change to a non-default value.
    // You can use attribute keys from Workbench Attribute Info view or the manuals.
    Map<String, Object> attributes = new HashMap<String, Object>();

    LingoClusteringAlgorithmDescriptor.attributeBuilder(attributes)
        .desiredClusterCountBase(20)
        .matrixReducer()
        .factorizationQuality(FactorizationQuality.MEDIUM)
        .factorizationFactory(LocalNonnegativeMatrixFactorizationFactory.class);

    CompletePreprocessingPipelineDescriptor.attributeBuilder(attributes)
        .documentAssigner()
        .exactPhraseAssignment(true);

    TermDocumentMatrixBuilderDescriptor.attributeBuilder(attributes).titleWordsBoost(2.5);

    attributeValueSet.setAttributeValues(attributes);

    // We'll need to wrap the exported attribute values in a AttributeValueSets,
    // even if we want to export just one set.
    final AttributeValueSets attributeValueSets = new AttributeValueSets();
    attributeValueSets.addAttributeValueSet("example-id", attributeValueSet);

    attributeValueSets.serialize(System.out);
  }
  /**
   * Creates an {@link AttributeValueSets} for saving as XML. The result contains two sets:
   * components defaults and the overriding values the user changed using the editor. Additionally,
   * {@link Internal} non-configuration and a number of special attributes are removed.
   */
  private AttributeValueSets createAttributeValueSetsToSave(Map<String, Object> overrides) {
    final String componentId = getComponentId();
    assert componentId != null;

    final AttributeValueSet defaults = getDefaultAttributeValueSet(componentId);

    /*
     * Create an AVS for the default values and a based-on AVS with overridden values.
     */
    final AttributeValueSet overridenAvs = new AttributeValueSet("overridden-attributes", defaults);
    removeSpecialKeys(overrides);
    removeInternalNonConfigurationAttributes(overrides, componentId);
    removeKeysWithDefaultValues(overrides, defaults);
    overrides.keySet().retainAll(defaults.getAttributeValues().keySet());
    overridenAvs.setAttributeValues(overrides);

    // Flatten and save.
    final AttributeValueSets merged = new AttributeValueSets();
    merged.addAttributeValueSet(overridenAvs.label, overridenAvs);
    merged.addAttributeValueSet(defaults.label, defaults);
    merged.setDefaultAttributeValueSetId(overridenAvs.label);
    return merged;
  }
 /**
  * Creates a map of attributes to apply on load. Removes {@link Internal} non-configuration
  * attributes from the map so that we don't overwrite certain Workbench-specific attributes, such
  * as resource lookup.
  */
 private Map<String, Object> createAttributeMapToApply(AttributeValueSets attrs) {
   final Map<String, Object> map =
       Maps.newHashMap(attrs.getDefaultAttributeValueSet().getAttributeValues());
   removeInternalNonConfigurationAttributes(map, getComponentId());
   return map;
 }