本文整理了Java中org.eclipse.rdf4j.query.BooleanQuery
类的一些代码示例,展示了BooleanQuery
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BooleanQuery
类的具体详情如下:
包路径:org.eclipse.rdf4j.query.BooleanQuery
类名称:BooleanQuery
暂无
代码示例来源:origin: de.tudarmstadt.ukp.inception.rdf4j/rdf4j-repository-dataset
public boolean evaluate()
throws QueryEvaluationException
{
con.loadDataset(sailQuery.getActiveDataset());
return ((BooleanQuery)sailQuery).evaluate();
}
}
代码示例来源: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-sail-spin
@Override
public BooleanQuery prepare(ParsedBooleanQuery askQuery) {
BooleanQuery query = new SailConnectionBooleanQuery(askQuery, con);
query.setIncludeInferred(includeInferred);
return query;
}
代码示例来源:origin: franzinc/agraph-java-client
query.setBinding("name", nameBob);
assertTrue(query.evaluate());
query.setDataset(dataset);
assertTrue(query.evaluate());
query.setDataset(dataset);
assertTrue(query.evaluate());
query.setDataset(dataset);
assertFalse(query.evaluate());
query.setBinding("name", nameBob);
query.setDataset(dataset);
assertFalse(query.evaluate());
query.setDataset(dataset);
assertFalse(query.evaluate());
query.setDataset(dataset);
assertTrue(query.evaluate());
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-repository-dataset
public boolean evaluate()
throws QueryEvaluationException
{
con.loadDataset(sailQuery.getActiveDataset());
return ((BooleanQuery)sailQuery).evaluate();
}
}
代码示例来源: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: org.eclipse.rdf4j/rdf4j-repository-sail
@Override
public BooleanQuery prepare(ParsedBooleanQuery askQuery) {
BooleanQuery query = new SailBooleanQuery(askQuery, con);
query.setIncludeInferred(includeInferred);
return query;
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-http-server-spring
/**
* Evaluate a {@link BooleanQuery} in this transaction and return the result.
*
* @param bQuery
* a {@link BooleanQuery} prepared on this transaction.
* @return the query result as a boolean
* @throws InterruptedException
* if the transaction thread is interrupted
* @throws ExecutionException
* if an error occurs while executing the operation.
*/
boolean evaluate(BooleanQuery bQuery)
throws InterruptedException, ExecutionException
{
Future<Boolean> result = submit(() -> bQuery.evaluate());
return getFromFuture(result);
}
代码示例来源: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: de.tudarmstadt.ukp.inception.rdf4j/rdf4j-sail-spin
@Override
public BooleanQuery prepare(ParsedBooleanQuery askQuery) {
BooleanQuery query = new SailConnectionBooleanQuery(askQuery, con);
query.setIncludeInferred(includeInferred);
return query;
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client
public boolean hasStatement(Resource subj, IRI pred, Value obj, boolean includeInferred,
Resource... contexts)
throws RepositoryException
{
try {
BooleanQuery query = prepareBooleanQuery(SPARQL, SOMETHING, "");
setBindings(query, subj, pred, obj, contexts);
return query.evaluate();
}
catch (MalformedQueryException e) {
throw new RepositoryException(e);
}
catch (QueryEvaluationException e) {
throw new RepositoryException(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: org.eclipse.rdf4j/rdf4j-repository-sparql
public boolean hasStatement(Resource subj, IRI pred, Value obj, boolean includeInferred,
Resource... contexts)
throws RepositoryException
{
try {
BooleanQuery query = prepareBooleanQuery(SPARQL, SOMETHING, "");
setBindings(query, subj, pred, obj, contexts);
return query.evaluate();
}
catch (MalformedQueryException e) {
throw new RepositoryException(e);
}
catch (QueryEvaluationException e) {
throw new RepositoryException(e);
}
}
代码示例来源:origin: ontop/ontop
boolean b = askQuery.evaluate();
代码示例来源:origin: eclipse/rdf4j
@Override
public boolean hasStatement(Resource subj, IRI pred, Value obj, boolean includeInferred,
Resource... contexts)
throws RepositoryException
{
try {
BooleanQuery query = prepareBooleanQuery(SPARQL, SOMETHING, "");
setBindings(query, subj, pred, obj, contexts);
return query.evaluate();
}
catch (MalformedQueryException e) {
throw new RepositoryException(e);
}
catch (QueryEvaluationException e) {
throw new RepositoryException(e);
}
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client
public boolean isEmpty()
throws RepositoryException
{
try {
BooleanQuery query;
if (isQuadMode()) {
query = prepareBooleanQuery(SPARQL, SOMETHING_WITH_GRAPH);
}
else {
query = prepareBooleanQuery(SPARQL, SOMETHING);
}
return !query.evaluate();
}
catch (MalformedQueryException e) {
throw new RepositoryException(e);
}
catch (QueryEvaluationException e) {
throw new RepositoryException(e);
}
}
代码示例来源:origin: eclipse/rdf4j
@Override
public boolean isEmpty()
throws RepositoryException
{
try {
BooleanQuery query;
if (isQuadMode()) {
query = prepareBooleanQuery(SPARQL, SOMETHING_WITH_GRAPH);
}
else {
query = prepareBooleanQuery(SPARQL, SOMETHING);
}
return !query.evaluate();
}
catch (MalformedQueryException e) {
throw new RepositoryException(e);
}
catch (QueryEvaluationException e) {
throw new RepositoryException(e);
}
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-repository-sparql
public boolean isEmpty()
throws RepositoryException
{
try {
BooleanQuery query;
if (isQuadMode()) {
query = prepareBooleanQuery(SPARQL, SOMETHING_WITH_GRAPH);
}
else {
query = prepareBooleanQuery(SPARQL, SOMETHING);
}
return !query.evaluate();
}
catch (MalformedQueryException e) {
throw new RepositoryException(e);
}
catch (QueryEvaluationException e) {
throw new RepositoryException(e);
}
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-http-server-spring
BooleanQuery bQuery = (BooleanQuery)query;
queryResult = headersOnly ? null : bQuery.evaluate();
registry = BooleanQueryResultWriterRegistry.getInstance();
view = BooleanQueryResultView.getInstance();
代码示例来源:origin: Merck/Halyard
SailQuery q = repo.getConnection().prepareQuery(QueryLanguage.SPARQL, cmd.getOptionValue('q'), null);
if (q instanceof BooleanQuery) {
((BooleanQuery)q).evaluate();
} else if (q instanceof TupleQuery) {
((TupleQuery)q).evaluate();
内容来源于网络,如有侵权,请联系作者删除!