org.openrdf.query.BooleanQuery.evaluate()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(122)

本文整理了Java中org.openrdf.query.BooleanQuery.evaluate()方法的一些代码示例,展示了BooleanQuery.evaluate()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BooleanQuery.evaluate()方法的具体详情如下:
包路径:org.openrdf.query.BooleanQuery
类名称:BooleanQuery
方法名:evaluate

BooleanQuery.evaluate介绍

暂无

代码示例

代码示例来源:origin: org.apache.marmotta/marmotta-sesame-matchers

@Override
protected boolean matchesSPARQL(RepositoryConnection con) throws MalformedQueryException, RepositoryException, QueryEvaluationException {
  final BooleanQuery booleanQuery = con.prepareBooleanQuery(QueryLanguage.SPARQL, query, baseUri);
  return booleanQuery.evaluate();
}

代码示例来源:origin: com.mysema.rdf/rdfbean-sesame2

@Override
public boolean getBoolean() {
  try {
    return booleanQuery.evaluate();
  } catch (QueryEvaluationException e) {
    throw new RepositoryException(e);
  }
}

代码示例来源:origin: apache/marmotta

@Override
protected boolean matchesSPARQL(RepositoryConnection con) throws MalformedQueryException, RepositoryException, QueryEvaluationException {
  final BooleanQuery booleanQuery = con.prepareBooleanQuery(QueryLanguage.SPARQL, query, baseUri);
  return booleanQuery.evaluate();
}

代码示例来源:origin: blazegraph/database

/**
 * "ASK" query with an empty KB.
 */
public void test_ASK() throws Exception {
  
  final String queryStr = "ASK where {?s ?p ?o}";
  
  final BooleanQuery query = cxn.prepareBooleanQuery(QueryLanguage.SPARQL, queryStr);
  assertEquals(false, query.evaluate());
  
}

代码示例来源:origin: org.apache.marmotta/marmotta-sparql

private void query(BooleanQuery query, BooleanQueryResultWriter writer) throws QueryEvaluationException {
  try {
    writer.handleBoolean(query.evaluate());
  } catch (QueryResultHandlerException e) {
    throw new QueryEvaluationException("error while writing query boolean result: ",e);
  }
}

代码示例来源:origin: apache/marmotta

private void query(BooleanQuery query, BooleanQueryResultWriter writer) throws QueryEvaluationException {
  try {
    writer.handleBoolean(query.evaluate());
  } catch (QueryResultHandlerException e) {
    throw new QueryEvaluationException("error while writing query boolean result: ",e);
  }
}

代码示例来源:origin: blazegraph/database

public void test1000()
  throws Exception
{
  populate(1000);
  String sparql = "ASK { <urn:test:root> <urn:test:hasChild>* <urn:test:node-end> }";
  assertTrue(con.prepareBooleanQuery(QueryLanguage.SPARQL, sparql).evaluate());
}

代码示例来源:origin: blazegraph/database

public void test100000()
  throws Exception
{
  populate(100000);
  String sparql = "ASK { <urn:test:root> <urn:test:hasChild>* <urn:test:node-end> }";
  assertTrue(con.prepareBooleanQuery(QueryLanguage.SPARQL, sparql).evaluate());
}

代码示例来源:origin: blazegraph/database

public void test10000()
  throws Exception
{
  populate(10000);
  String sparql = "ASK { <urn:test:root> <urn:test:hasChild>* <urn:test:node-end> }";
  assertTrue(con.prepareBooleanQuery(QueryLanguage.SPARQL, sparql).evaluate());
}

代码示例来源:origin: blazegraph/database

public void test10()
  throws Exception
{
  populate(10);
  String sparql = "ASK { <urn:test:root> <urn:test:hasChild>* <urn:test:node-end> }";
  assertTrue(con.prepareBooleanQuery(QueryLanguage.SPARQL, sparql).evaluate());
}

代码示例来源:origin: blazegraph/database

public void test100()
  throws Exception
{
  populate(100);
  String sparql = "ASK { <urn:test:root> <urn:test:hasChild>* <urn:test:node-end> }";
  assertTrue(con.prepareBooleanQuery(QueryLanguage.SPARQL, sparql).evaluate());
}

代码示例来源:origin: org.openrdf.alibaba/alibaba-repository-object

public boolean asBoolean() throws OpenRDFException {
  if (query.isBooleanQuery())
    return prepareBooleanQuery().evaluate();
  return asResult(Boolean.class).singleResult().booleanValue();
}

代码示例来源:origin: org.semweb4j/rdf2go.impl.sesame

@Override
public boolean sparqlAsk(String queryString) throws ModelRuntimeException {
  this.assertModel();
  BooleanQuery booleanQuery;
  try {
    booleanQuery = this.connection.prepareBooleanQuery(QueryLanguage.SPARQL, queryString);
    boolean result = booleanQuery.evaluate();
    return result;
  } catch(OpenRDFException e) {
    throw new ModelRuntimeException(e);
  }
}

代码示例来源:origin: org.semweb4j/rdf2go.impl.sesame20

@Override
public boolean sparqlAsk(String queryString) throws ModelRuntimeException {
  this.assertModel();
  BooleanQuery booleanQuery;
  try {
    booleanQuery = this.connection.prepareBooleanQuery(
        QueryLanguage.SPARQL, queryString);
    boolean result = booleanQuery.evaluate();
    return result;
  } catch (OpenRDFException e) {
    throw new ModelRuntimeException(e);
  }
}

代码示例来源:origin: blazegraph/database

/**
 * "ASK" query with an empty KB.
 */
public void test_ASK() throws Exception {
  
  final String queryStr = "ASK where {?s ?p ?o}";
  
  final BooleanQuery query = cxn.prepareBooleanQuery(QueryLanguage.SPARQL, queryStr);
  assertEquals(false, query.evaluate());
  
}

代码示例来源:origin: blazegraph/database

public void test1000()
  throws Exception
{
  populate(1000);
  String sparql = "ASK { <urn:test:root> <urn:test:hasChild>* <urn:test:node-end> }";
  assertTrue(con.prepareBooleanQuery(QueryLanguage.SPARQL, sparql).evaluate());
}

代码示例来源:origin: blazegraph/database

public void test100000()
  throws Exception
{
  populate(100000);
  String sparql = "ASK { <urn:test:root> <urn:test:hasChild>* <urn:test:node-end> }";
  assertTrue(con.prepareBooleanQuery(QueryLanguage.SPARQL, sparql).evaluate());
}

代码示例来源:origin: blazegraph/database

public void test10()
  throws Exception
{
  populate(10);
  String sparql = "ASK { <urn:test:root> <urn:test:hasChild>* <urn:test:node-end> }";
  assertTrue(con.prepareBooleanQuery(QueryLanguage.SPARQL, sparql).evaluate());
}

代码示例来源:origin: blazegraph/database

public void test100()
  throws Exception
{
  populate(100);
  String sparql = "ASK { <urn:test:root> <urn:test:hasChild>* <urn:test:node-end> }";
  assertTrue(con.prepareBooleanQuery(QueryLanguage.SPARQL, sparql).evaluate());
}

代码示例来源:origin: blazegraph/database

public void test10000()
  throws Exception
{
  populate(10000);
  String sparql = "ASK { <urn:test:root> <urn:test:hasChild>* <urn:test:node-end> }";
  assertTrue(con.prepareBooleanQuery(QueryLanguage.SPARQL, sparql).evaluate());
}

相关文章