If I use RDF4J with just Maven (no OSGi container), I'm able to utilize all the classes provided by RDF4J. But when I use RDF4J with OpenDaylight, the bundle in which I have used RDF4J classes does not start because of unsatisfied requirements. I'm using IntelliJ Idea and I created a new project with OpenDaylight archetype with groupId:org.opendaylight.controller, artifactId:opendaylight-startup-archetype, version:1.4.0-SNAPSHOT and repository:https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/archetype-catalog.xml
My package's group ID:org.exmaple, Artifact ID: rdfTest, version: 1.0-SNAPSHOT, I'm using maven 3.3.9
The archetype compiles successfully and I'm able to install all the features. (./karaf/target/assembly/bin/karaf and then installing features by feature:install command)
But when I add RDF4J dependency in pom.xml in impl folder
<dependency>
<groupId>org.eclipse.rdf4j</groupId>
<artifactId>rdf4j-runtime-osgi</artifactId>
<version>2.2.2</version>
</dependency>
and add the following in RdfTestProvider.java in impl/src/main/java/org/example/impl, the feature does not install.
public void init() {
LOG.info("RdfTestProvider Session Initiated");
Repository rep = new SailRepository(new MemoryStore());
rep.initialize();
LOG.info("Repo successfully initialized");
}
I think the problem is that the RDF4J bundle is not getting installed. I tried different methods to install it, but none worked (installing 3rd party non-osgi bundles)
Is there any way to use RDF4J with OpenDaylight?
Okay, I have got it working for now. I manually installed the rdf4j-runtime-osgi bundle and other required dependencies. These are the bundles I installed:
bundle:install -s mvn:org.mapdb/mapdb/1.0.8
bundle:install -s mvn:com.spatial4j/spatial4j/0.4.1
bundle:install -s mvn:com.opencsv/opencsv/3.2
bundle:install -s mvn:org.apache.httpcomponents/httpcore-osgi/4.4.6
bundle:install -s mvn:org.apache.httpcomponents/httpclient-osgi/4.5.3
bundle:install -s mvn:com.fasterxml.jackson.core/jackson-annotations/2.9.0
bundle:install -s mvn:com.fasterxml.jackson.core/jackson-core/2.9.0
bundle:install -s mvn:com.fasterxml.jackson.core/jackson-databind/2.9.0
bundle:install -s mvn:ch.qos.logback/logback-core/1.2.2
bundle:install -s mvn:org.slf4j/slf4j-api/1.7.25
bundle:install -s mvn:ch.qos.logback/logback-classic/1.2.2
bundle:install -s mvn:com.github.jsonld-java/jsonld-java/0.11.1
bundle:install -s mvn:org.eclipse.rdf4j/rdf4j-runtime-osgi/2.2.2
And then started bundle in which I had used RDF4J with bundle:start. Later, I included all these install instructions in features.xml file in features folder under the feature I'm developing so that I don't have to install them manually every time.
<bundle><![CDATA[wrap:mvn:org.mapdb/mapdb/1.0.8$Bundle-Version=1.0.8&Bundle-SymbolicName=mapdb]]></bundle>
<bundle><![CDATA[wrap:mvn:com.spatial4j/spatial4j/0.4.1$Bundle-Version=0.4.1&Bundle-SymbolicName=spatial4j]]></bundle>
<bundle><![CDATA[wrap:mvn:com.opencsv/opencsv/3.2$Bundle-Version=3.2&Bundle-SymbolicName=opencsv]]></bundle>
<bundle><![CDATA[wrap:mvn:org.apache.httpcomponents/httpcore-osgi/4.4.6$Bundle-Version=4.4.6&Bundle-SymbolicName=httpcore-osgi]]></bundle>
<bundle><![CDATA[wrap:mvn:org.apache.httpcomponents/httpclient-osgi/4.5.3$Bundle-Version=4.5.3&Bundle-SymbolicName=httpclient-osgi]]></bundle>
<bundle><![CDATA[wrap:mvn:com.fasterxml.jackson.core/jackson-annotations/2.9.0$Bundle-Version=2.9.0&Bundle-SymbolicName=jackson-annotations]]></bundle>
<bundle><![CDATA[wrap:mvn:com.fasterxml.jackson.core/jackson-core/2.9.0$Bundle-Version=2.9.0&Bundle-SymbolicName=jackson-core]]></bundle>
<bundle><![CDATA[wrap:mvn:com.fasterxml.jackson.core/jackson-databind/2.9.0$Bundle-Version=2.9.0&Bundle-SymbolicName=jackson-databind]]></bundle>
<bundle><![CDATA[wrap:mvn:ch.qos.logback/logback-core/1.2.2$Bundle-Version=1.2.2&Bundle-SymbolicName=logback-core]]></bundle>
<bundle><![CDATA[wrap:mvn:org.slf4j/slf4j-api/1.7.25$Bundle-Version=1.7.25&Bundle-SymbolicName=slf4j-api]]></bundle>
<bundle><![CDATA[wrap:mvn:ch.qos.logback/logback-classic/1.2.2$Bundle-Version=1.2.2&Bundle-SymbolicName=logback-classic]]></bundle>
<bundle><![CDATA[wrap:mvn:com.github.jsonld-java/jsonld-java/0.11.1$Bundle-Version=0.11.1&Bundle-SymbolicName=jsonld-java]]></bundle>
<bundle><![CDATA[wrap:mvn:org.eclipse.rdf4j/rdf4j-runtime-osgi/2.2.2$Bundle-Version=2.2.2&Bundle-SymbolicName=rdf4j-runtime]]></bundle>