Writing the model to file
- Last Updated: May 29, 2026
- 1 minute read
- Semaphore
- Documentation
If you wish to write the model to file (e.g. for import to a external system) you can use the Model Velocity Writer
<bean class="com.smartlogic.publisher.velocity.ModelLevelVelocityWriter">
<property name="templateDirectory" value="${config.directory}/${model.name}/templates" />
<property name="modelTemplate" value="model.vm" />
<property name="prettyPrint" value="true" />
<property name="exposedObjects" >
<map>
<entry key="currentDate">
<bean class="java.util.Date" />
</entry>
<entry key="dateFormat" >
<bean class="java.text.SimpleDateFormat" >
<constructor-arg value="EEEE, d MMM yyyy"/>
</bean>
</entry>
</map>
</property>
<property name="outputFile" value="${results.directory}/${model.name}/ModelDump.${start.date}.xml" />
</bean>
This will generate an XML from the template specified in the configuration (located in the specified templates directory).
Note, we have added a date and a data formatter object to the velocity writer so that the file can be timestamped with the export date.
The template itself is generated in the same way as for the rulebase velocity writer - it’s probably easiest to contact you Smartlogic technical consultant to get you a first draft from which you can work.