Package org.s3b.search.query

Examples of org.s3b.search.query.QueryParameter


   

    for(QueryParameter qp : result.getParameters()){
      if(!(qp.getType().isPersonType() || qp.getType().isTaxonomyType())){
    //  if(!(qp.getType().isPersonType())){
        QueryParameter newqp = processParameter(qp,expand,precise);
      //  if (!expand)result.clearParameters();
        if (newqp != null){
          if (newqp.getType().equals(qp.getType())) { // extend existing QueryParameter of given type with new entries (here: QP.type = Author)
            intersectValues(qp,newqp);
          } else
            result.addParameter(newqp,false);
         
        }
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

   */
  public QueryObject processQuery(boolean expand,boolean generalize) {
    QueryObject result = queryObject;

    for (QueryParameter qp : result.getParameters()) {
      QueryParameter newqp = processParameter(qp, expand);
      if (newqp != null){
        if (newqp.getType().equals(qp.getType())) { // extend existing QueryParameter of given type with new entries (here: QP.type = Author)
          intersectValues(qp,newqp);
        } else
          result.addParameter(newqp,false);
      }
    }
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

  public QueryObject processQuery(boolean expand, boolean precise) {
    QueryObject result = queryObject;

    for (QueryParameter qp : result.getParameters()) {
      if(!qp.getType().isPersonType()){
        QueryParameter newqp = processParameter(qp,expand,precise);
        if (newqp != null){
          if (newqp.getType().equals(qp.getType())) { // extend existing QueryParameter of given type with new entries (here: QP.type = Author)
            intersectValues(qp,newqp);
           
          } else
            result.addParameter(newqp,false);
        }
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.QueryParameter

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.