【发布时间】:2016-12-14 07:51:22
【问题描述】:
我想做的是将数据从芝麻传递给大师。
这是我的代码:
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,但它们都不起作用。
我认为原因是依赖版本错误或我的想法 IDE 出现问题。我该怎么办?
感谢您的帮助。
【问题讨论】:
-
您是如何找到大师级神器的?它们在 maven Central 上不可用,因此您必须添加外部工件存储库(在 github 中打开问题:github.com/openlink/virtuoso-opensource/issues/249)
-
我是从一些人的github上找到的。感谢您的回答。它帮助到我。 @colinaygalinc
-
此处仅包含文本的图像最好用该文本替换...对于您的问题,当然您的
<version>实体中的值不正确。我还想知道<groupId>和<artifactId>的一些值。