Model Beans
- Last Updated: May 29, 2026
- 3 minute read
- Semaphore
- Documentation
The model bean is the object that will fetch the data for publisher to use.
SPARQL Endpoint
In the default Publisher configuration, the model is set to use the included bean “SparqlEndpoint”. If the Publisher is being run from the KMM user interface, then this is instantiated as a reader within Knowledge Model Management that reads the underlying triplestore directly. When the Publisher is run in standalone mode, it is instantiated as an object that loads the model over HTTP from the SPARQL endpoint supplied by the Knowledge Model Management application. Usually it will not be necessary to change this.
For standalone Publisher, provide the endpoint at runtime using --sparql-endpoint.
By default, the SPARQL endpoint client uses synchronous calls. If required, you can enable asynchronous calls by setting useAsync to true on the SparqlEndpoint bean. Consider asynchronous mode for large models, where SPARQL requests can take longer and synchronous calls can fail because of timeouts.
<bean class="com.smartlogic.publisher.Publisher">
<property name="model">
<bean parent="SparqlEndpoint" />
</property>
</bean>
The SparqlEndpoint bean configured for asynchronous calls:
<bean class="com.smartlogic.publisher.Publisher">
<property name="model">
<bean parent="SparqlEndpoint">
<property name="useAsync" value="true" />
</bean>
</property>
</bean>
Local triple files
Another class of model bean that can be used instead of the SparqlEndpointClient looks like:
<bean id="LocalTTL" class="com.smartlogic.publisher.model.LocalJenaModel" parent="modelInterface">
<property name="modelFilePaths" >
<list>
<value>src/test/resources/Model.ttl</value>
<value>resources/CoreTTLFiles/semaphore-core.ttl</value>
<value>resources/CoreTTLFiles/skos-core.ttl</value>
<value>resources/CoreTTLFiles/skos-xl.ttl</value>
</list>
</property>
</bean>
This bean will read the model from the listed ttl files. (The LocalJenaModel can read from any of N3, TTL or RDF files.) Note, the model data and the included core files must be presented in the list. These core files are provided as part of the Publisher installation (in resources/CoreTTLFiles).
This bean can be used if you wish to publish offline from a model that has been exported. If you want to use it, then create the bean definition in your configuration files, update the list of model file paths, then change the reference in the top level Publisher bean to point to the id of this new bean.
Altering the model for publishing
All the supplied model definitions have as a parent “modelInterface”. This is a bean defined in the imported file resources/import/ModelInterface.xml. In this file are all the SPARQL commands used to construct the Semaphore model from the triples. It is possible to override any of these SPARQL commands so that different data is populated in the Semaphore model. This is highly inadvisable without the help of a Progress consultant, but it can be done to create non-standard identifiers in the Publisher output or to add in metadata that would not normally be added.
To override any SPARQL commands from the ModelInterface.xml for a given model, the Publisher config for that model can be modified, adding just the modified commands. This will run all the SPARQL commands from ModelInterface.xml replacing any commands with those specified in the Publisher config.
For example, if you have multiple identifiers in your model, the out-of-the-box publish will fail since only one identifier is allowed. But, you can alter the SPARQL command where the identifier is set and instead, ‘hard code’ a single property to be used as the ID. In ModelInterface.xml the identifier is set by the SPARQL command in the property “getIdentifierRelationshipSparql”. The out-of-the-box command can be overridden in the Publisher config by modifying it like this:
<bean class="com.smartlogic.publisher.Publisher">
<property name="model" >
<bean parent="SparqlEndpoint" >
<property name="getIdentifierRelationshipSparql">
<value><![CDATA[
SELECT ?relationshipUri
WHERE {
BIND (<https://example.com/myID> AS ?relationshipUri)
}
]]></value>
</property>
</bean>
</property>
The other SPARQL commands can be overridden in the same manner. However, if not done properly, Publisher may fail, or you may get unusable results in your SES index and/or break any code written against the SES API.