virtuoso.jena.driver是否有可用的依赖项? [英] Is there any usable dependency for virtuoso.jena.driver?
问题描述
我要做的是将数据从芝麻传递到专家.
What I want to do is passing data from sesame to virtuoso.
这是我的代码:
public static void sesame2virtuoso(String server, String repo, String graphName) throws IOException, RepositoryException {
//connect sesame
HTTPRepository repository = new HTTPRepository(server, repo);
repository.setUsernameAndPassword(PropertiesUtil.PropValues("user"), PropertiesUtil.PropValues("password"));
repository.initialize();
RepositoryConnection connection = repository.getConnection();
ValueFactory factory = connection.getValueFactory();
try {
RepositoryResult<Statement> statements = connection.getStatements(null, null, null, false);
Statement statement;
String sub, pre, obj;
VirtGraph graph = new VirtGraph(graphName, URL, "dba", "dba");
int count = 0;
while (statements.hasNext()) {
statement = statements.next();
sub = statement.getSubject().stringValue();
pre = statement.getPredicate().stringValue();
obj = statement.getObject().stringValue();
Node sub1 = Node.createURI(sub);
Node pre1 = Node.createURI(pre);
Node obj1 = Node.createURI(obj);
try {
graph.add(new Triple(sub1, pre1, obj1)); } catch (Exception e) {
continue;
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
我在maven项目中使用了它.因此,我为此搜索了一些pom,但它们都无法正常工作.
I used it in a maven project. So I searched some poms for that, but all of them can't work.
我认为原因是依赖版本错误或我的IDE发生了问题.我该怎么办?
I think the reason is the dependencies versions are wrong or something wrong happened with my idea IDE. What should I do?
谢谢您的帮助.
推荐答案
这些库(virt_jena3.jar
和virtjdbc4.jar
)在任何公共Maven存储库中都不存在.
These libraries ( virt_jena3.jar
and virtjdbc4.jar
) do not exist in any public maven repository.
这不是您的错,是Openlink员工的错.
It's not your fault, is the Openlink people's fault.
如果需要它们,请按以下步骤操作.
If you want them, here are the steps.
wget http://download3.openlinksw.com/uda/virtuoso/rdfproviders/jena/30/virt_jena3.jar -P /tmp/
wget http://download3.openlinksw.com/uda/virtuoso/jdbc/virtjdbc4.jar -P /tmp/
2.将它们安装在本地Maven存储库中
mvn install:install-file -q \
-Dfile=/tmp/virt_jena3.jar \
-DgroupId=com.openlink.virtuoso \
-DartifactId=virt_jena3 \
-Dversion=3.0 \
-Dpackaging=jar \
-DgeneratePom=true
mvn install:install-file -q \
-Dfile=/tmp/virtjdbc4.jar \
-DgroupId=com.openlink.virtuoso \
-DartifactId=virtjdbc4 \
-Dversion=4.0 \
-Dpackaging=jar \
-DgeneratePom=true
3.将依赖项添加到您的pom
<!-- These do not have a Maven repository -->
<dependency>
<groupId>com.openlink.virtuoso</groupId>
<artifactId>virtjdbc4</artifactId>
<version>4.0</version>
</dependency>
<dependency>
<groupId>com.openlink.virtuoso</groupId>
<artifactId>virt_jena3</artifactId>
<version>3.0</version>
</dependency>
4.将有关步骤的信息添加到您的文档中
或者,您可以使用<system>
范围指向jar,但是如果要创建uber-jar,这会产生问题.如果您仍然想尝试,请在以下片段中添加<dependency>
标记
Alternatively you could use the <system>
scope to point to the jars, but this will generate problems if you want to create an uber-jar. If you still want to try, here is the fragment to add in the <dependency>
tag
<scope>system</scope>
<systemPath>/path/to/jar/virtjdbc4.jar</systemPath>
这篇关于virtuoso.jena.driver是否有可用的依赖项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!