Install the Expressional Inference Rule Engine Add-on
Prerequisites
To be able to use the Expressional Inference Rule Engine add-on, your implementation project must be set up as a Bloomreach Experience Manager project.
Instructions
Installing Expressional Inference Rule Engine Addon module requires to install the hippo-addon-inference-engine-api-x.x.x.jar module onto the shared classpath (e.g, $CATALINA_BASE/shared/lib/) like hippo-services-x.x.x.jar or hippo-repository-api-x.x.jar since both content delivery application (e.g, "/site" war) and content authoring application (e.g, "/cms" war) are accessing the shared API of the Expressional Inference Rule Engine.
Add Maven Dependency
In the main pom.xml of your project, add a new property in the properties section. For the correct version number for your project, check the Release Notes page.
<hippo-addon-inference-engine.version>version-number</hippo-addon-inference-engine.version>
In the root pom.xml, add the following dependencies in the <dependencyManagement> section:
<dependencyManagement> <dependencies> <!-- SNIP --> <dependency> <groupId>com.onehippo.cms7</groupId> <artifactId>hippo-addon-inference-engine-api</artifactId> <version>${hippo-addon-inference-engine.version}</version> </dependency> <dependency> <groupId>com.onehippo.cms7</groupId> <artifactId>hippo-addon-inference-engine-core</artifactId> <version>${hippo-addon-inference-engine.version}</version> <scope>runtime</scope> </dependency> <dependency> <groupId>com.onehippo.cms7</groupId> <artifactId>hippo-addon-inference-engine-plugin</artifactId> <version>${hippo-addon-inference-engine.version}</version> <scope>runtime</scope> </dependency> <dependency> <groupId>com.onehippo.cms7</groupId> <artifactId>hippo-addon-inference-engine-repository</artifactId> <version>${hippo-addon-inference-engine.version}</version> <scope>runtime</scope> </dependency> <dependency> <groupId>com.onehippo.cms7</groupId> <artifactId>hippo-addon-inference-engine-data-collector</artifactId> <version>${hippo-addon-inference-engine.version}</version> <scope>runtime</scope> </dependency> <dependency> <groupId>com.onehippo.cms7</groupId> <artifactId>hippo-addon-inference-engine-collector-plugin</artifactId> <version>${hippo-addon-inference-engine.version}</version> <scope>runtime</scope> </dependency> <!-- SNIP --> </dependencies> </dependencyManagement>
In the site module of your project, add the following dependencies in the pom.xml:
<dependencies> <!-- SNIP --> <dependency> <groupId>com.onehippo.cms7</groupId> <artifactId>hippo-addon-inference-engine-api</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>com.onehippo.cms7</groupId> <artifactId>hippo-addon-inference-engine-core</artifactId> <scope>runtime</scope> </dependency> <dependency> <groupId>com.onehippo.cms7</groupId> <artifactId>hippo-addon-inference-engine-data-collector</artifactId> <scope>runtime</scope> </dependency> <!-- SNIP --> </dependencies>
In the cms module of your project, add the following dependencies in the pom.xml:
<dependencies> <!-- SNIP --> <dependency> <groupId>com.onehippo.cms7</groupId> <artifactId>hippo-addon-inference-engine-api</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>com.onehippo.cms7</groupId> <artifactId>hippo-addon-inference-engine-repository</artifactId> <scope>runtime</scope> </dependency> <dependency> <groupId>com.onehippo.cms7</groupId> <artifactId>hippo-addon-inference-engine-plugin</artifactId> <scope>runtime</scope> </dependency> <dependency> <groupId>com.onehippo.cms7</groupId> <artifactId>hippo-addon-inference-engine-collector-plugin</artifactId> <scope>runtime</scope> </dependency> <!-- SNIP --> </dependencies>
Configure Shared Library in cargo.run profile
As mentioned earlier, since hippo-addon-inference-engine-api module must be loaded from the shared classpath, the dependency of the JAR module must be added into each web application submodule as provided scope, as described above.
Now, the hippo-addon-inference-engine-api JAR module must be added in the container's shared classpath even when running the embedded Tomcat server locally with cargo.run profile (i.e., mvn -P cargo.run).
To deploy the hippo-addon-inference-engine-api JAR module in local cargo.run profile, you should update the cargo.run Maven profile with hippo-addon-inference-engine-api JAR module dependency like the following example:
<profile> <id>cargo.run</id> <dependencies> <dependency> <groupId>com.onehippo.cms7</groupId> <artifactId>hippo-addon-inference-engine-api</artifactId> <scope>provided</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.codehaus.cargo</groupId> <artifactId>cargo-maven2-plugin</artifactId> <configuration> <configuration> <!-- SNIP --> </configuration> <deployables> <!-- SNIP --> </deployables> <container> <systemProperties> <!-- SNIP --> </systemProperties> <dependencies> <dependency> <groupId>com.onehippo.cms7</groupId> <artifactId>hippo-addon-inference-engine-api</artifactId> <classpath>shared</classpath> </dependency> </dependencies> </container> </configuration> </plugin> </plugins> </build> </profile>
Configure Shared Library in dist profile
Also, when you prepare a distributable artifact for deployment, you probably run mvn -P dist command, which generates a tar.gz file under the target/ folder. And the tar ball can be extracted onto $CATALINA_BASE folder to deploy, for example.
Now, the hippo-addon-inference-engine-api JAR module must be added into the proper location in the tar ball to be deployed onto the proper shared classpath in the end as well.
To add the hippo-addon-inference-engine-api JAR module to the shared classpath in the tar ball, please add the following dependency in the dist profile first:
<profile> <id>dist</id> <dependencies> <!-- SNIP --> <dependency> <groupId>com.onehippo.cms7</groupId> <artifactId>hippo-addon-inference-engine-api</artifactId> <scope>provided</scope> </dependency> <!-- SNIP --> </dependencies> <build> <!-- SNIP --> </build> </profile>
Now, to put the hippo-addon-inference-engine-api JAR module in the shared classpath folder (e.g, shared/lib/), you should update the src/main/assembly/shared-lib-component.xml file like the following as well:
<component xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/component/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/component/1.1.2 http://maven.apache.org/xsd/component-1.1.2.xsd"> <dependencySets> <dependencySet> <useProjectArtifact>false</useProjectArtifact> <outputDirectory>shared/lib</outputDirectory> <scope>provided</scope> <includes> <include>org.onehippo.cms7:hippo-cms7-commons</include> <include>org.onehippo.cms7:hippo-services</include> <!-- SNIP --> <include>com.onehippo.cms7:hippo-addon-inference-engine-api</include> </includes> </dependencySet> </dependencySets> </component>
That's it! You can now create "Inference Rules" documents through CMS UI to create inference rules and combine them with Relevance targeting collectors!