Package org.openrdf.query

Examples of org.openrdf.query.BooleanQuery.ask()


    queryBuilder.append("{ ?p foaf:name ?name }");

    BooleanQuery query = testCon.prepareBooleanQuery(QueryLanguage.SPARQL, queryBuilder.toString());
    query.setBinding("name", nameBob);

    assertTrue(query.ask());
  }

  public void testDataset()
    throws Exception
  {
View Full Code Here


    queryBuilder.append("{ ?p foaf:name ?name }");

    BooleanQuery query = testCon.prepareBooleanQuery(QueryLanguage.SPARQL, queryBuilder.toString());
    query.setBinding("name", nameBob);

    assertTrue(query.ask());

    DatasetImpl dataset = new DatasetImpl();

    // default graph: {context1}
    dataset.addDefaultGraph(context1);
View Full Code Here

    DatasetImpl dataset = new DatasetImpl();

    // default graph: {context1}
    dataset.addDefaultGraph(context1);
    query.setDataset(dataset);
    assertTrue(query.ask());

    // default graph: {context1, context2}
    dataset.addDefaultGraph(context2);
    query.setDataset(dataset);
    assertTrue(query.ask());
View Full Code Here

    assertTrue(query.ask());

    // default graph: {context1, context2}
    dataset.addDefaultGraph(context2);
    query.setDataset(dataset);
    assertTrue(query.ask());

    // default graph: {context2}
    dataset.removeDefaultGraph(context1);
    query.setDataset(dataset);
    assertFalse(query.ask());
View Full Code Here

    assertTrue(query.ask());

    // default graph: {context2}
    dataset.removeDefaultGraph(context1);
    query.setDataset(dataset);
    assertFalse(query.ask());

    queryBuilder.setLength(0);
    queryBuilder.append("PREFIX foaf: <" + FOAF_NS + "> ");
    queryBuilder.append("ASK ");
    queryBuilder.append("{ GRAPH ?g { ?p foaf:name ?name } }");
View Full Code Here

    query = testCon.prepareBooleanQuery(QueryLanguage.SPARQL, queryBuilder.toString());
    query.setBinding("name", nameBob);

    // default graph: {context2}; named graph: {}
    query.setDataset(dataset);
    assertFalse(query.ask());

    // default graph: {context1, context2}; named graph: {context2}
    dataset.addDefaultGraph(context1);
    dataset.addNamedGraph(context2);
    query.setDataset(dataset);
View Full Code Here

    // default graph: {context1, context2}; named graph: {context2}
    dataset.addDefaultGraph(context1);
    dataset.addNamedGraph(context2);
    query.setDataset(dataset);
    assertFalse(query.ask());

    // default graph: {context1, context2}; named graph: {context1, context2}
    dataset.addNamedGraph(context1);
    query.setDataset(dataset);
    assertTrue(query.ask());
View Full Code Here

    assertFalse(query.ask());

    // default graph: {context1, context2}; named graph: {context1, context2}
    dataset.addNamedGraph(context1);
    query.setDataset(dataset);
    assertTrue(query.ask());
  }

  public void testGetStatements()
    throws Exception
  {
View Full Code Here

    }
  }

  private static boolean doBooleanQuery(RepositoryConnection con, String query) throws RepositoryException, MalformedQueryException, QueryEvaluationException {
    BooleanQuery resultsTable = con.prepareBooleanQuery(QueryLanguage.SPARQL, query);
    return resultsTable.ask();
 
 
  private static Value[][] doTupleQuery(RepositoryConnection con, String query) throws RepositoryException, MalformedQueryException, QueryEvaluationException {
    TupleQuery resultsTable = con.prepareTupleQuery(QueryLanguage.SPARQL, query);
    TupleQueryResult bindings = resultsTable.evaluate();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.