Configuring a category graph writer

Configure a category graph writer to assign a category to a document based on a predicate.

In the following steps you will be creating and/or configuring Spring beans in a Spring context file. A basic knowledge of Spring and the Spring Framework is required.

  1. Open or create a new Spring context file.
  2. Create a Category Graph Writer bean.
    The following example will tag documents with the value of the ts:tsResponseRoleLabel metadata that is extracted from the XML content.
    <bean id="samples.categoryGraphWriter.mappings" parent="alfresco.rdf.categoryGraphWriter.mappings.abstract">
      <property name="mappings">
        <map>
          <entry key="{http://www.componize.com/model/samples/troubleshooting/1.0/}tsResponseRoleLabel" value="{http://www.alfresco.org/model/content/1.0}categories" />
        </map>
      </property>
    </bean>
    Note: The document will only be categorized if the extracted value corresponds to an existing Category in Alfresco.
  3. Restart the application server for your changes to take effect.