Powered by Zoomin Software. For more details please contactZoomin

Semaphore Publisher

Publishing Versioned Model Instances

  • Last Updated: May 13, 2026
  • 3 minute read
    • Semaphore
    • Documentation

Sometimes it is necessary to make available to downstream systems multiple instances of a particular model. Therefore we have made it possible since version Semaphore 4.1.24 to read a version number from the model and use this information at publish time - the version number will be available to the Velocity Writer so that it can be used there in generation of rulebases. The SES index generated will be specific to that version so that a SES request can include at request time a version number - or if no version is presented at request time, then the latest version of the SES index will be used. (The latest version being the version with the highest version number, not necessarily the last version published. The sorting for the version number can either be of the form “n”, “n.m”, “x.y.z” in which case the numerical ordering will be respected, or of any other form, in which case the default case sensitive alphabetical sorting will be used.)

If no versioning information is required (which will be the usual case) then just don’t define the version extraction query and SES will behave as it ever has.

To use the version information, add to the model definition bean in the publisher configuration a new property “getModelVersionSparql” e.g.

      <property name="getModelVersionSparql">
          <value><![CDATA[select ?modelVersion where { ?concept <http://example.com/Playpen#hasVersionNumber> ?modelVersion . }]]></value>
      </property>

The value of this property should be a SPARQL query that returns to the variable ?modelVersion the version string to be used. In this case we have defined the version number to be a property of one of the concepts. In this use case, because of governance on the model, we know that only one concept in the model will have this property and so the model will have one version. If this SPARQL returns multiple values, then any of these values could be used. If this property is defined and returns a value then this version is attached to the model internally, so that it is available to the velocity as ${model.version}.

The SES writer will automatically generate the versioned index if the version is set on the model. Note, if you are generating multiple SES indexes for the same model, then it is up to the system administrator to delete redundant versions of the index using the SOLR administration interface.

If you want your SES request to be run against the latest version of the model, then you do not need to specify any version with that request. However, if you wish to run against a particular version then present that version as the value of the “version” parameter in your request, e.g.

http://localhost:8983/ses/Playpen/hints/T?version=6

If you want to know what versions of SES models are available, you can run the request

http://localhost:8983/ses/modelversions

This will list for all models the versions available (as usual http://localhost:8983/ses/modelversions.json will return the JSON version).

The request can be made for a particular model in the form http://localhost:8983/ses/Playpen/versions.

Note, SES has to maintain in memory the set of latest versions for all of its indexes. This will be loaded on SES startup but will need to be updated whenever a new version is created. To do this request, we need to add to the index creator bean a list of all the SES instances that should be updated. Each SES server in use (including each instance within a cloud) should be be listed here.

For instance

  <bean id="indexCreator2" parent="indexCreator">
      <property name="solrURL" value="http://localhost:28983/solr" />
      <property name="sesModelsVersionsURLs" >
          <list>
              <value>http://localhost:28983/ses/modelversions</value>
          </list>
      </property>
  </bean>
TitleResults for “How to create a CRG?”Also Available inAlert