2017-09-25 48 views
2

如果我只用Maven(无OSGi容器)使用RDF4J,我就可以利用RDF4J提供的所有类。但是当我在OpenDaylight中使用RDF4J时,由于未满足要求,使用RDF4J类的包不会启动。 我使用的IntelliJ IDEA和我创建了OpenDaylight原型用的groupId一个新项目:org.opendaylight.controller,artifactId的:opendaylight - 启动 - 原型,版本:1.4.0,快照和存储库:https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/archetype-catalog.xmlOpenDaylight OSGi即使在安装RDF4J软件包后也无法找到RDF4J类

我的包的组ID:org.exmaple, 神器ID:rdfTest, 版本:1.0快照 我使用maven 3.3.9

原型编译成功,我能够安装所有功能。 (./karaf/target/assembly/bin/karaf然后通过功能安装功能:安装命令)

但是,当我在IMPL文件夹

<dependency> 
     <groupId>org.eclipse.rdf4j</groupId> 
     <artifactId>rdf4j-runtime-osgi</artifactId> 
     <version>2.2.2</version> 
    </dependency> 

添加RDF4J依赖在pom.xml中并添加以下在impl/src/main/java/org/example/impl中的RdfTestProvider.java中,该功能不会安装。

public void init() { 
    LOG.info("RdfTestProvider Session Initiated"); 
    Repository rep = new SailRepository(new MemoryStore()); 
    rep.initialize(); 
    LOG.info("Repo successfully initialized"); 
} 

我认为问题在于没有安装RDF4J软件包。我尝试了不同的方法来安装它,但都没有工作(installing 3rd party non-osgi bundles

有什么办法可以用OpenDaylight来使用RDF4J吗?

+0

我尝试使用Apache Jena而不是RDF4J,但这里也遇到了同样的问题。这些功能可以安装,但捆绑软件不会安装,它们保持在resopled状态,并且bundle:headers会导致缺少导入(org.apache.jena.rdf.model)。如果有人能说出如何使用这些工具,这将是一个很大的帮助。 – Nitin

回答

1

好吧,我已经得到它现在的工作。我手动安装了rdf4j-runtime-osgi软件包和其他所需的依赖项。这些都是我安装包:

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 

然后开始束,其中我已经使用RDF4J与捆绑:开始。之后,我将这些安装说明包含在我正在开发的功能下的features文件夹中的features.xml文件中,这样我就不必每次都手动安装它们。

<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> 
相关问题