The graal-backward-chaining provides implementation for query rewriting algorithms.
<dependency> <groupId>fr.lirmm.graphik</groupId> <artifactId>graal-backward-chaining</artifactId> <version>1.3.1</version> </dependency>