本文整理了Java中org.eclipse.rdf4j.query.BooleanQuery.setBinding()
方法的一些代码示例,展示了BooleanQuery.setBinding()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BooleanQuery.setBinding()
方法的具体详情如下:
包路径:org.eclipse.rdf4j.query.BooleanQuery
类名称:BooleanQuery
方法名:setBinding
暂无
代码示例来源:origin: eclipse/rdf4j
/**
* Evaluate the provided sparqlQueryString at the initialized {@link Repository} of this
* {@link FederatedService}. Insert bindings, send ask query and return final result
*/
@Override
public boolean ask(Service service, BindingSet bindings, String baseUri)
throws QueryEvaluationException
{
try {
String sparqlQueryString = service.getAskQueryString();
BooleanQuery query = getConnection().prepareBooleanQuery(QueryLanguage.SPARQL, sparqlQueryString,
baseUri);
Iterator<Binding> bIter = bindings.iterator();
while (bIter.hasNext()) {
Binding b = bIter.next();
if (service.getServiceVars().contains(b.getName()))
query.setBinding(b.getName(), b.getValue());
}
return query.evaluate();
}
catch (MalformedQueryException e) {
throw new QueryEvaluationException(e);
}
catch (RepositoryException e) {
throw new QueryEvaluationException(
"Repository for endpoint " + rep.toString() + " could not be initialized.", e);
}
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-repository-sparql
/**
* Evaluate the provided sparqlQueryString at the initialized {@link Repository} of this
* {@link FederatedService}. Insert bindings, send ask query and return final result
*/
@Override
public boolean ask(Service service, BindingSet bindings, String baseUri)
throws QueryEvaluationException
{
try {
String sparqlQueryString = service.getAskQueryString();
BooleanQuery query = getConnection().prepareBooleanQuery(QueryLanguage.SPARQL, sparqlQueryString,
baseUri);
Iterator<Binding> bIter = bindings.iterator();
while (bIter.hasNext()) {
Binding b = bIter.next();
if (service.getServiceVars().contains(b.getName()))
query.setBinding(b.getName(), b.getValue());
}
return query.evaluate();
}
catch (MalformedQueryException e) {
throw new QueryEvaluationException(e);
}
catch (RepositoryException e) {
throw new QueryEvaluationException(
"Repository for endpoint " + rep.toString() + " could not be initialized.", e);
}
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client
/**
* Evaluate the provided sparqlQueryString at the initialized {@link Repository} of this
* {@link FederatedService}. Insert bindings, send ask query and return final result
*/
@Override
public boolean ask(Service service, BindingSet bindings, String baseUri)
throws QueryEvaluationException
{
try {
String sparqlQueryString = service.getAskQueryString();
BooleanQuery query = getConnection().prepareBooleanQuery(QueryLanguage.SPARQL, sparqlQueryString,
baseUri);
Iterator<Binding> bIter = bindings.iterator();
while (bIter.hasNext()) {
Binding b = bIter.next();
if (service.getServiceVars().contains(b.getName()))
query.setBinding(b.getName(), b.getValue());
}
return query.evaluate();
}
catch (MalformedQueryException e) {
throw new QueryEvaluationException(e);
}
catch (RepositoryException e) {
throw new QueryEvaluationException(
"Repository for endpoint " + rep.toString() + " could not be initialized.", e);
}
}
代码示例来源:origin: franzinc/agraph-java-client
@Test
public void testPreparedBooleanQuery()
throws Exception {
testCon.add(alice, name, nameAlice, context2);
testCon.add(alice, mbox, mboxAlice, context2);
testCon.add(context2, publisher, nameAlice);
testCon.add(bob, name, nameBob, context1);
testCon.add(bob, mbox, mboxBob, context1);
testCon.add(context1, publisher, nameBob);
StringBuilder queryBuilder = new StringBuilder();
queryBuilder.append("PREFIX foaf: <" + FOAF_NS + "> ");
queryBuilder.append("ASK ");
queryBuilder.append("{ ?p foaf:name ?name }");
BooleanQuery query = testCon.prepareBooleanQuery(QueryLanguage.SPARQL, queryBuilder.toString());
query.setBinding("name", nameBob);
assertTrue(query.evaluate());
}
代码示例来源:origin: franzinc/agraph-java-client
query.setBinding("name", nameBob);
query.setBinding("name", nameBob);
内容来源于网络,如有侵权,请联系作者删除!