Package org.s3b.search.query.impl

Examples of org.s3b.search.query.impl.QueryParameterImpl


    }
   
    public void reloadParameters(){
      queryParameters.clear();
      for(QueryParameterType type : mapParameters.keySet()){
        queryParameters.add(new QueryParameterImpl(type,mapParameters.get(type)));
      }
    }
View Full Code Here


    // detecting phrases by mariusz
    List<String> lstValues = new ArrayList<String>();
    lstValues.addAll(this.dectedPhrase(asQ));

    if (lstValues.size() > 0) {
      QueryParameter qp = new QueryParameterImpl();
      //use simple type for Lucene search in first step of SQE alg
      qp.setType(SIMPLE);
      for (String sQ : lstValues) {
        lstFullTextEntries = this.parseQueryParameter(sQ);
        //int iter=0;
        boolean enter=true;
        for(QueryParameterEntry tlst: lstFullTextEntries)
        {
          if ((tlst.getStringValue().equals("AND"))||(tlst.getStringValue().equals("OR"))||(tlst.getStringValue().equals("("))||(tlst.getStringValue().equals(")")))
          {
           queryList.add(new QueryParameterEntryImpl(tlst.getStringValue()));
           enter=true;
          }
          else
          {
            templstFullTextEntries.add(tlst);
            if(enter==false)
            {
              queryList.add(new QueryParameterEntryImpl("AND"));
            }
            enter=false;
            queryList.add(new QueryParameterEntryImpl("("));
            queryList.add(new QueryParameterEntryImpl(tlst.getStringValue()));
            queryList.add(new QueryParameterEntryImpl(")"));
            //iter++;
          }
        }
       
        qp.addValues(templstFullTextEntries);
      }
      result.addParameter(qp,true);
    }       
    // --- getting the user that has posted the query
   
View Full Code Here

   * @param expand <tt>true</true> if the given query should be expanded using wordnet, <tt>false</tt> if just the
   * meaning of query parameters should be assigned to them (for eg. wordnet synset, taxonomy, author etc )
   */
  private QueryParameter processParameter(QueryParameter qp,boolean expand, boolean precise) {
    List<QueryParameterEntry> newqpes = new ArrayList<QueryParameterEntry>();
    QueryParameter newqp = new QueryParameterImpl();
    newqp.setType(QueryParameterType.SIMPLE);
    List <QueryParameterEntry> valuesToRemove =  new ArrayList<QueryParameterEntry>();
    if(expand){
      if(!m2resource.status.contains("<br />Expanding meanings using Thesauri..."))
      m2resource.status.add("<br />Expanding meanings using Thesauri...");
      for(QueryParameterEntry qpe : qp.getValues())
      {
       
       
        List<QueryParameterEntry> tmppE = processEntry(qpe,qp,precise);
        if (!newqpes.containsAll(tmppE))
        {
          newqpes.addAll(tmppE);
        }
        //valuesToRemove.add(qpe);
     
    }else{
      if(!m2resource.status.contains("<br />Matching meanings using Thesauri..."))
      m2resource.status.add("<br />Matching meanings using Thesauri...");
      for(QueryParameterEntry qpe : qp.getValues())
      {
       
        newqpes.addAll(giveMeaning(qpe));
        //valuesToRemove.add(qpe);
       
      }
     
      /*
      List<QueryParameterEntry> toDelete = new ArrayList<QueryParameterEntry>();
      for(QueryParameterEntry qpt : newqpes)
      {
        if(qpt.getMeaning()!=null)toDelete.add(qpt);
      }*/
     
     
    }
    /*for(QueryParameterEntry qpr : valuesToRemove)
    {
      qp.removeValue(qpr);
      newqpes.remove(qpr);
    }*/
   
    if(newqpes.size() > 0){
      //notify history
      ExpandedHistoryInfo ehi = new ExpandedHistoryInfo(qp.getValues(),newqpes,newqp.getType());
      newqp.clearValues();
      newqp.addValues(newqpes);
      resultObject.addHistoryInfo(ehi);
      return newqp;
    }else{
      return null;
    }
View Full Code Here

   * @return New <tt>QueryParameter</code> of person type  if the query asks for author found in FOAF
   * or <tt>null</tt> where no matching author(s) where found
   */
  private QueryParameter processParameter(QueryParameter qp, boolean expand) {
    List<QueryParameterEntry> newqpes = new ArrayList<QueryParameterEntry>();
    QueryParameter newqp = new QueryParameterImpl();
    newqp.setType(QueryParameterType.PERSON);
    if (expand) {
      if(!m2resource.status.contains("<br />Expanding person list looking for contriubutors using FOAFRealm..."))
      m2resource.status.add("<br />Expanding person list looking for contriubutors using FOAFRealm...");
      /*
       * expand iff QueryParameter is a person type
       */
      if (qp.getType().isPersonType())
        for (QueryParameterEntry qpe : qp.getValues())
          newqpes.addAll(processEntry(qpe));
    } else
    {
      if(!m2resource.status.contains("<br />Matching people using FOAFRealm..."))
      m2resource.status.add("<br />Matching people using FOAFRealm...");
      for (QueryParameterEntry qpe : qp.getValues())
        newqpes.addAll(matchPerson(qpe));
    }
    newqp.clearValues();
    newqp.addValues(newqpes);
    if (newqp.getValues().size() > 0){
      //notify history, RELATION_POINTER_TYPE = null, as this is not wordnet expansion
      ExpandedHistoryInfo ehi = new ExpandedHistoryInfo(qp.getValues(),newqpes,newqp.getType());
      resultObject.addHistoryInfo(ehi);
      return newqp;
    }
    else
      return null;
View Full Code Here

   */
  private QueryParameter processParameter(QueryParameter qp, boolean expand,boolean precise) {
    List<QueryParameterEntry> newqpes = new ArrayList<QueryParameterEntry>();
    boolean found=false;
   
    QueryParameter newqp = new QueryParameterImpl();
    newqp.setType(QueryParameterType.TAXONOMY);
    List <QueryParameterEntry> valuesToRemove =  new ArrayList<QueryParameterEntry>();
    if(expand){
      if(!m2resource.status.contains("<br />Expanding classes using Control Vocabulary..."))
      m2resource.status.add("<br />Expanding classes using Control Vocabulary...");
      if(qp.getType().isTaxonomyType()){
        for(QueryParameterEntry qpe : qp.getValues())
        {
          newqpes.addAll(processEntry(qpe,precise));
          valuesToRemove.add(qpe);
        }
      }
    }else{
      if(!m2resource.status.contains("<br />Matching classes using Control Vocabulary..."))
      m2resource.status.add("<br />Matching classes using Control Vocabulary...");
      for(QueryParameterEntry qpe : qp.getValues())
      {
        List<QueryParameterEntry> tempQpe = matchTaxonomy(qpe);
       
        //Iterator<QueryParameterEntry> it = tempQpe.iterator();
        //Iterator<QueryParameterEntry> it2 = newqpes.iterator();
       
       
       
        for(QueryParameterEntry qpe2 : tempQpe)
        { 
          //QueryParameterEntry tempel= (QueryParameterEntry)it.next();
         
          if(newqpes.size()!=0)
          {
            found=false;
            for(QueryParameterEntry qpe3 : newqpes)
            { 
             
          //    QueryParameterEntry tempel2= (QueryParameterEntry)it2.next();
              if(qpe2.getTaxonomy().getLabel()==qpe3.getTaxonomy().getLabel())
                found=true;
               
            }
            if(found!=true)
            {
            newqpes.add(qpe2);
            }
           
          }
          else
          {
            newqpes.add(qpe2);
          }
         
          //if(!newqpes.contains(tempel))
         
         
        }
       
       
      }
      for(QueryParameterEntry qpr : valuesToRemove)
      {
        qp.removeValue(qpr);
        newqpes.remove(qpr);
      }
    }
    newqp.clearValues();
    newqp.addValues(newqpes);
    if (newqp.getValues().size() > 0){
      //notify history, RELATION_POINTER_TYPE = null, as this is not wordnet expansion
      ExpandedHistoryInfo ehi = new ExpandedHistoryInfo(qp.getValues(),newqpes,newqp.getType());
      resultObject.addHistoryInfo(ehi);
      return newqp;
    }
    else
      return null;
View Full Code Here

TOP

Related Classes of org.s3b.search.query.impl.QueryParameterImpl

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.