用于连接的代码如下
DigestAuthContext dcf= new DatabaseClientFactory.DigestAuthContext("admin", "admin");
DatabaseClient client = DatabaseClientFactory.newClient(
"localhost", 8000, "GraphTest",dcf);
MarkLogicDatasetGraph dg = MarkLogicDatasetGraphFactory.createDatasetGraph(client);
String queryString = "SELECT ?person " +
"WHERE { ?person <http://schema.test.com/ns/place#livesin> < https://data.test.com/loc-structure/London#this>}";
QueryExecution eq = QueryExecutionFactory.create(queryString,dg.toDataset());
ResultSet results = eq.execSelect();
while(results.hasNext()) {
QuerySolution qs = results.next();
}
使用的罐子:marklogic-client-api-4.0.3 和 marklogic-jena-3.0.5 错误:
- org.apache.jena.query.Dataset 类型无法解析。它是从所需的 .class 文件中间接引用的
- MarkLogicDatasetGraph 类型中的方法 toDataset() 指的是缺少的类型 Dataset