Package lupos.datastructures.queryresult

Examples of lupos.datastructures.queryresult.BooleanResult


        this.handleGraphResult(res, (GraphResult) resQueryResult);
      } else if (resQueryResult instanceof BooleanResult) {
        if (this.br_list == null) {
          this.br_list = new LinkedList<BooleanResult>();
        }
        final BooleanResult br = new BooleanResult();
        this.br_list.add(br);
        final Iterator<Bindings> itb = res.oneTimeIterator();
        if (!itb.hasNext()) {
          this.updateCommentPanel();
        } else {
View Full Code Here


public class MakeBooleanResult extends SingleInputOperator {

  @Override
  public QueryResult process(QueryResult qr, final int operandID) {
    final BooleanResult br = new BooleanResult();
    if (!qr.isEmpty())
      br.add(qr.oneTimeIterator().next());
    qr.release();
    qr = null;
    return br;
  }
View Full Code Here

          br_list = new LinkedList<BooleanResult>();
        }
        if(oneTime){
          br_list.add((BooleanResult)res);
        } else {
          final BooleanResult br = new BooleanResult();
          br.addAll(res);
          br_list.add(br);
        }
      } else {
        if(oneTime){
          if (qr == null){
View Full Code Here

    if (result == null) {
      if (type == null)
        return null;
      switch (type) {
      case ASK:
        return new BooleanResult();
      case CONSTRUCT:
        return new GraphResult();
      default:
        return QueryResult.createInstance();
      }
View Full Code Here

  public QueryResult getResult() throws Exception {
    final QueryExecution qe = QueryExecutionFactory.create(query, model);
    if (query.isAskType()) {
      if (qe.execAsk()) {
        // unempty => true
        final QueryResult qr = new BooleanResult();
        qr.add(new BindingsCollection());
        return qr;
      } else {
        final QueryResult qr = new BooleanResult();
        qe.close();
        return qr;
      }
    } else if (query.isSelectType()) {
      final ResultSet results = qe.execSelect();
View Full Code Here

    } finally {
      this.lock.unlock();
    }

    if(this.booleanResult){
      final BooleanResult result = new BooleanResult();
      if(this.resultOfBooleanResult){
        result.add(bindingsFactory.createInstance());
      }
      return result;
    } else {
      // This allows to follow the iterator concept also here:
      // the XML is parsed whenever the iterator is asked for the next element (method next).
View Full Code Here

  public QueryResult getQueryResult(final InputStream inputStream, final BindingsFactory bindingsFactory) {
    try {
      final JSONObject object = new JSONObject(new JSONTokener(new InputStreamReader(inputStream)));
      if(object.has("boolean")){
        final boolean b=object.getBoolean("boolean");
        final BooleanResult br = new BooleanResult();
        if(b){
          br.add(bindingsFactory.createInstance());
        }
        return br;
      } else {
        return QueryResult.createInstance(new ImmutableIterator<Bindings>(){
View Full Code Here

   */
  public ArrayList<DBAnswer> detectType() {
    Iterator<String> it = this.tokens.iterator();
    QueryBuilder builder = new QueryBuilder();
    ArrayList<DBAnswer> types = new ArrayList<DBAnswer>();
    BooleanResult askpersonresult = new BooleanResult();
    BooleanResult askplaceresult = new BooleanResult();
    QueryResult result = new QueryResult();
    while (it.hasNext()) {
      String toCheck = it.next();

      /** Try if person or place with name (token substring) exists in DB */
      askpersonresult = (BooleanResult) builder.query(toCheck,
          "askperson");
      System.out.println(askpersonresult);
      askplaceresult = (BooleanResult) builder.query(toCheck, "askplace");
      System.out.println(askplaceresult);

      /**
       * If results for askpersonresult & askplaceresult are both true,
       * prefer the person result, else choose the one whose QueryResult
       * contains true
       */
      if (askpersonresult.isTrue() && !(askplaceresult.isTrue())) {
        result = builder.query(toCheck, "person");
      } else if (!(askpersonresult.isTrue()) && askplaceresult.isTrue()) {
        result = builder.query(toCheck, "place");
      } else if (!(askpersonresult.isTrue())
          && !(askplaceresult.isTrue()))
        continue;
      else {
        result = builder.query(toCheck, "place");
        if(result.isEmpty()){
          result = builder.query(toCheck, "person");
View Full Code Here

  @Override
  public QueryResult getResult() throws Exception {
    evaluateQuery();
    QueryResult qr = null;
    if (result instanceof Boolean) {
      qr = new BooleanResult();
      if ((Boolean) result)
        qr.add(new BindingsCollection());
    } else if (result instanceof TupleQueryResult) {
      qr = QueryResult.createInstance();
      while (((TupleQueryResult) result).hasNext()) {
View Full Code Here

TOP

Related Classes of lupos.datastructures.queryresult.BooleanResult

Copyright © 2018 www.massapicom. 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.