Posted on: January 19, 2015, by: Smartlogic
There are a few ways to be able to synchronize a model in Semaphore with MarkLogic depending on the use case, in this post I’ll cover a way of allowing anyone who has permission to publish to be able to do this. It assumes that the user has familiarity with MarkLogic so it doesn’t cover any of the MarkLogic setups.
It relies on a mechanism that was previously discussed in this post that allows external processes to be run as part of the publishing process Adding a custom action to the publishing process.
To synchronize the model we need to run some standard components to:
1. Generate RDF (SKOS) output for the model
2. Load the RDF into MarkLogic
Generating RDF from Ontology Manager
Firstly we need to decide what information from the model should be exported, the SKOS export option in Ontology Manager allows you to define what and how information will be exported full details can be found here if custom settings are used the configuration should be saved so that it can be used on each export.
Ontology Manager Administration Guide – Exporting a model in skos format
Loading the RDF into MarkLogic
To load the RDF into MarkLogic we can use the MarkLogic Content Pump (mlcp), this post assumes existing knowledge of MarkLogic setup and mlcp.
Creating the batch script to be run
As mentioned in the previous post about custom publisher actions a batch script can be created to run both the export of the model and the import into MarkLogic, this can be called as part of the publishing process.
In my setup, I used a base directory of C:\SyncronizeModelwithMarkLogic\, with sub-directories of Publisher_configuration for the publisher configuration and Model to store the SKOS export configuration and the export file.
Firstly the script calls the SkosImporter utility to export the model to the ExampleOutput.rdf, then it calls mlcp to load the export.
1. call “c:\Program Files (x86)\Smartlogic\Ontology Manager\SkosImporter.exe” export localhost:8900 -o “C:\SyncronizeModelwithMarkLogic\Model\ExampleOutput.rdf” -c “C:\SyncronizeModelwithMarkLogic\Model\SkosConfig.json” -u admin -p admin
2. call “C:\SyncronizeModelwithMarkLogic\mlcp\bin\mlcp.bat” -options_file “C:\SyncronizeModelwithMarkLogic\Publisher_configuration\mlcp-options.txt”
This can then be configured to be called as part of the publishing process using the same steps as in the previous article.
Attached is the sample publisher configuration and batch script that was used. It does not include mlcp as that can be downloaded separately.
These files can be copied to the publisher machine and then used to synchronize the model.
US: +1 408-213-9500
US Federal: +1 703-956-2600
UK: +44 203-176-4500
Copyright ©2022 MarkLogic Corporation