Package org.s3b.search.query

Examples of org.s3b.search.query.ResultObject


    m2resource = mresource;
    //mresource = m2resource;
    m2resource.person=user;
    if(query != null && !"".equals(query)){
      QueryObject queryObject = ObjectFactory.getInstance().getQueryObject(user, query, isConjunction, queryList);
      ResultObject resultObject = ObjectFactory.getInstance().getRdfResultObject(null,false);
      resultObject = processQuery(queryObject, resultObject, queryList);
      return resultObject.getSortedResults();
    }
    return null;
  }
View Full Code Here


 
 
  @SuppressWarnings("unchecked")
  protected ResultObject processQuery(QueryObject qo, ResultObject ro, List<QueryParameterEntry> queryList) {
    Boolean firsttime = true;
    ResultObject _ro = ro;
    try {
      //run Lucene for the first time to get initial results
      _ro = FulltextSearch.getInstance().processQuery(qo, _ro, firsttime,queryList,false);
      //queryList.clear();
      m2resource.wordnetBoost = BoostFactorKeeper.wordnetBoost;
      m2resource.taxBoost = BoostFactorKeeper.taxBoost;
      m2resource.foafBoost = BoostFactorKeeper.foafBoost;
      m2resource.oldVisitBoost = BoostFactorKeeper.oldHitBoost;
      m2resource.recentVisitBoost = BoostFactorKeeper.recentHitBoost;
      m2resource.resources = _ro.getResults();
      m2resource.done=true;
      m2resource.bookmarksBoost = 1;
      System.out.println("POCZ PETLI 1 !!!");
      if(Configuration.DEBUG)
      {
        System.out.println("SIEDZE W PETLI 1 !!!");
        int u=0;
        while(m2resource.ok!=true){
            try {
                 Thread.sleep(500);
                 //1000 millisecs
                 if(u>1)m2resource.iffurther=false;
                 u++;
            }
            catch(InterruptedException ex) {
            }
        }
        m2resource.iffurther=true;
        m2resource.status.clear();
      }
      System.out.println("KONIEC PETLI 1!!!");
      m2resource.done=false;
      m2resource.ok=false;
      //do semantic expansion
      _ro = this.semanticExpansion(qo, _ro, queryList, m2resource);
     
      m2resource.resources = _ro.getResults();
      m2resource.done=true;
     
     
      //      for(Resource qp : _ro.getResults())
      //        for(QueryParameterEntry qpe : qp.getValues())
View Full Code Here

    boolean prec2=false;
    boolean prec3=false;
    int rescount = ro.getResults().size();
    //logger.info("RESULTS SEMANTIC START: " + rescount);
    QueryObject _qo = qo;
    ResultObject _ro = ro;
    Boolean first = true;
//    if (_qo.getPostedBy() != null) {
//      min = _qo.getPostedBy().getMinResults();
//      max = _qo.getPostedBy().getMaxResults();
//    }else{ //TODO: REMOVE !!!!! --- for test purposes only
//      _qo.setPostedBy(PersonFactory.getPerson("mailto:admin@foafrealm.org"));
//    }
//    if (max == 0) {
//      max = 1000;
//    }
    min = Configuration.MinResultsNumber;
    max = Configuration.MaxResultsNumber;
    int counter = 6;
   
    SemanticQueryExpansion sqe = new SemanticQueryExpansion(_qo, _ro, queryList,m2resource);
    m2resource.foafBoost = BoostFactorKeeper.foafBoost;
   
   
    while (counter-- > 0) {
      if(prec2)prec3=true;
      else prec3= false;
     
     
     
     
      //logger.info("FIRST: " + first);
      sqe.processQuery(first,prec,m2resource.Visited);
      //m2resource.parameters = _qo.getParameters();
      m2resource.parameters = queryList;
      m2resource.done=true;
      System.out.println("POCZ PETLI 2 !!!");
      if(Configuration.DEBUG)
      {
        System.out.println("SIEDZE W PETLI 2 !!!");
        int u=0;
        while(m2resource.ok!=true){
          try {
               Thread.sleep(500);
               //1000 millisecs
               if(u>1)m2resource.iffurther=false;
               u++;
              
          }
          catch(InterruptedException ex) {
          }
        }
        System.out.println("KON PETLI 2 !!!");
        m2resource.iffurther=true;
        m2resource.status.clear();
      }
        queryList=m2resource.parameters;
        m2resource.done=false;
      m2resource.ok=false;
     
     
      /*
      if(m2resource.parameters.size()!=0)
      {
      _qo.clearParameters();
      for(QueryParameter pars : m2resource.parameters)
      _qo.addParameter(pars, true);
   
     
      }*/
     
     
      rescount = _ro.getResults().size();
     
      //logger.info("WYNIKI: " + m2resource.resources.toString());
     
      if (rescount >= max) {
        prec=true;
        prec2=true;
        //logger.info("RESULTS SEMANTIC END1: " + rescount);
        //return _ro;
        _ro = FulltextSearch.getInstance().processQuery(_qo, _ro, first, queryList, prec3);
        m2resource.resources = _ro.getResults();
        m2resource.done = true;
      }else if (rescount <= min){
        prec=false;
        //logger.info("RESULTS SEMANTIC END2: " + rescount);
         //this will allow query expansion in next run of the loop
        //run lucene again to get new results
       
        _ro = FulltextSearch.getInstance().processQuery(_qo, _ro, first, queryList, prec3);
      //  if(first)queryList.clear();
        first = false;
       
          m2resource.resources = _ro.getResults();
          m2resource.done = true;
       
       
        sqe.setResultObject(_ro);
      }else if (rescount > min && rescount < max){
        first = false;
        m2resource.resources = _ro.getResults();
        m2resource.done = true;
      }
      //logger.info("END RUN: " + (6-counter));
    }
   
View Full Code Here

    if (!(resultObject instanceof RdfResultObject)) {
      //logger.severe("Not using RDFResultObject");
      return resultObject;
    }
   
    ResultObject result = ObjectFactory.getInstance().getRdfResultObject((RdfResultObject) resultObject,queryObject.isConjunction());
   
    boolean ifuri=true;
    if(!first)
    {
    ifuri=true;
    }
 
    //String[] queries = queryObject.getLuceneQuery(ifuri);
    String[] queries = queryObject.getLuceneQuery2(ifuri, queryList);
    try{
      Map<String,Double> positiveQueries = new HashMap<String, Double>();
      positiveQueries = search(queries[0]);
     
      RdfResultObject positiveResults = ObjectFactory.getInstance().getRdfResultObject(positiveQueries);
//      //logger.info("positive queries: " + positiveQueries);
      if(queries[1] != null){ //if there exists a negative result set not to be included in final results
        Map<String,Double> negativeQueries = search(queries[0]);
        RdfResultObject negativeResults = ObjectFactory.getInstance().getRdfResultObject(negativeQueries);
//        //logger.info("negative queries: " + negativeQueries);
        positiveResults.removeResults(negativeResults);
      }
     
      if ((!result.isFresh() && queryObject.isConjunction())||(precise))
        result.intersectResults(positiveResults);
      else
        result.addResults(positiveResults);
   
    }catch (IOException e) {
      //logger.log(Level.SEVERE, "Error occured when processing simple query", e);
    } catch (ParseException e) {
      //logger.log(Level.SEVERE, "Error occured when processing simple query, query = "+queries[0], e);
View Full Code Here

TOP

Related Classes of org.s3b.search.query.ResultObject

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.