Lab 4 - Configure an XML schema predicate mapping

During the lab, you will be configuring a XML schema predicate mapping to automatically add the cm:effectivity aspect to content with a Troubleshooting DTD.

  1. In the lab folder, create a new Spring context file named context.xml.
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.springframework.org/schema/beans
      http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
    
    </beans>
  2. Open the context.xml file in your favorite editor.
  3. Create a new XML schema Predicate Mapping bean.
  4. Add the following properties to the XML schema Predicate Mapping bean as required:
    Property Type Mandatory Description
    xmlSchemaFilter XmlSchemaFilter Required A filter for which the bean applies.
    predicate QName Required The predicate to add when the XML schema filter matches. Use a fully-qualified name with Clark notation as the key of the entry.
    <bean id="samples.xmlSchemaPredicateMapping.troubleshooting" parent="rdf.xmlSchemaPredicateMapping.abstract">
      <property name="xmlSchemaFilter" ref="samples.dtd.troubleshooting" />
      <property name="predicate" value="{http://www.alfresco.org/model/content/1.0}effectivity" />
    </bean>
  5. Save your changes.
  6. Test your XML schema Predicate Mapping with the com.componize.samples.lab04.MetadataExtractorTest unit test.
  7. Deploy your files to the application server.
  8. Once the application server has started, connect to the Alfresco Share interface.
  9. Remove the Metadata & Link Management aspect from the troubleshooting-sample.dita file and then add it back again.
    Note: Metadata and links are extracted from files each time they are updated or when the Metadata & Link Management aspect is added. By removing and then adding the aspect back again, the metadata and links will be reextracted even though the content hasn't been changed.
The cm:effectivity aspect should be added automatically.