Package org.s3b.search.query

Examples of org.s3b.search.query.QueryParameterEntry


  public void modifyQueryOverwrite(List<QueryParameterEntry> queryList, List<QueryParameterEntry> expansion,
      QueryParameterEntry entry,boolean wordnet) {
    //sbQuery.add(entry);
    List<QueryParameterEntry> tempqueryList = new ArrayList<QueryParameterEntry>();
    int entryIndex= queryList.indexOf(entry);
    QueryParameterEntry temp = queryList.get(entryIndex);
    temp.setRanking(0);
    int localIndex=0;
   
    if(entryIndex!=-1)
    {
     
View Full Code Here


    /*
     * create new entries all like: value - meaning
     * as they're different meanings for the given word in WordNet
     */
    for(Synset synset: entryMeanings){
      QueryParameterEntry newqpe = new QueryParameterEntryImpl(value);
      newqpe.setMeaning(synset);
      double ttt = m2resource.wordnetBoost;
      newqpe.setRanking(m2resource.wordnetBoost);
      String newInfo = qpe.TellMeAbout()+synset.getLabel()+" - " +synset.getGlossaryDescription() +" has been retrieved as a meaning of "+qpe.getStringValue()+" using Wordnet ";
      newqpe.AddInfo(newInfo);
      result.add(newqpe);
      ////logger.info("wynik31:" + newqpe.getMeaning().getGlossaryDescription());
    }
    queryObject.modifyQueryAppend(queryList, result, qpe, true);
    return result;
View Full Code Here

     
      for(Synset sens : entryMeanings){
        //for (ThesaurusEntry word : sens.getWordSenses()){
          Synset tempword = new Synset(wordcontext, sens.getURI(),null);
          if(!temp.containsKey(tempword)){
            QueryParameterEntry newqpe = new QueryParameterEntryImpl(sens.getLabel());
           
           
            newqpe.setMeaning(tempword);
            newqpe.setRanking((rank == 0 ) ? m2resource.wordnetBoost : m2resource.wordnetBoost * rank);
            ////logger.info("wynik33"+newqpe.getMeaning().getGlossaryDescription()+ " rank: " + newqpe.getRanking());
            if (newqpe.getMeaning()!=qpe.getMeaning())
            {
            result.add(newqpe);
            temp.put(tempword, sens.getLabel());
            }
          }else if (!temp.get(tempword).equals(sens.getLabel())){
            QueryParameterEntry newqpe = new QueryParameterEntryImpl(sens.getLabel());
           
           
            newqpe.setMeaning(tempword);
            newqpe.setRanking((rank == 0 ) ? m2resource.wordnetBoost : m2resource.wordnetBoost * rank);
            ////logger.info("wynik33"+newqpe.getMeaning().getGlossaryDescription() + " rank: " + newqpe.getRanking());
            if (newqpe.getMeaning()!=qpe.getMeaning())
            {
            result.add(newqpe);
            temp.put(tempword, sens.getLabel());
            }
          }
         
//        }
        //extend each meaning with some *NYM
//        targets.addAll(new ExpandSynset(sens).getTargets(pointer));
        //Synset tempword2 = new Synset(wordcontext, sens.getURI());
        //ttempsens.addAll(tempword2.getAntonyms());
        //sens.getAntonyms();
       
        try{
         
         
         
         
         
        if(precise)
        {
         
          if((Configuration.PrecisionAntonyms))
          {
          ttempsens.addAll(sens.getAntonyms()); //No sense ?
          }
          if((Configuration.PrecisionHypernyms))
          {
          ttempsens.addAll(sens.getHypernyms());
          }
          if((Configuration.PrecisionHyponyms))
          {
          ttempsens.addAll(sens.getHyponyms());
          }
          if((Configuration.PrecisionSynonyms))
          {
          ttempsens.addAll(sens.getSynonyms());
          }
        }
        else
        {
          if((Configuration.RecallAntonyms))
          {
          ttempsens.addAll(sens.getAntonyms()); //No sense ?
          }
          if((Configuration.RecallHypernyms))
          {
          ttempsens.addAll(sens.getHypernyms());
          }
          if((Configuration.RecallHyponyms))
          {
          ttempsens.addAll(sens.getHyponyms());
          }
          if((Configuration.RecallSynonyms))
          {
          ttempsens.addAll(sens.getSynonyms());
          }
       
        }
        }catch (Exception e){
          //logger.severe("Can not expand meanings with some *NYMs");
        }
       
        Collection<Synset> tempsens = new HashSet<Synset>();
        for(ThesaurusEntry tt : ttempsens)
        {

          tempsens.add(new Synset (wordcontext, tt.getURI(), null));
         
        }
        targets.addAll(tempsens);
       
         
      }
     
//    }catch (JWNLException e){
//      //logger.severe("Error getting expanded synset for meaning");
    }catch (Exception e){
      //logger.severe("Problems with getting expanded synset for meaning :  "+e);
    }
   
    /*
     * add *NYM synsets to the query
     */
   
    WordNetContext wordcontext;
    try {
      wordcontext = WordNetContext.getContext();
   
    for(Synset newSynset: targets){
//      for(ThesaurusEntry word : newSynset.getWordSenses()){
     
        Synset tempword = new Synset(wordcontext, newSynset.getURI(), null);
        if(!temp.containsKey(tempword)){
          QueryParameterEntry newqpe = new QueryParameterEntryImpl(newSynset.getLabel());
         
          newqpe.setMeaning(tempword);
          newqpe.setRanking((rank == 0 ) ? m2resource.wordnetBoost : m2resource.wordnetBoost * rank);
      //    //logger.info(newqpe.getMeaning().getGloss() + " rank: " + newqpe.getRanking());
          if (newqpe.getMeaning()!=qpe.getMeaning())
          {
          String newInfo = qpe.TellMeAbout()+tempword.getLabel()+ " - " +tempword.getGlossaryDescription() +" has been retrieved as a expansion of "+qpe.getMeaning().getLabel()+" using Wordnet ";
          newqpe.AddInfo(newInfo);
          result.add(newqpe);
          temp.put(tempword, newSynset.getLabel());
          }
        }else if (!temp.get(tempword).equals(newSynset.getLabel())){
          QueryParameterEntry newqpe = new QueryParameterEntryImpl(newSynset.getLabel());
         
          newqpe.setMeaning(tempword);
          newqpe.setRanking((rank == 0 ) ? m2resource.wordnetBoost : m2resource.wordnetBoost * rank);
      //    //logger.info(newqpe.getMeaning().getGloss() + " rank: " + newqpe.getRanking());
          if (newqpe.getMeaning()!=qpe.getMeaning())
          {
          String newInfo = qpe.TellMeAbout()+tempword.getLabel()+ " - " +tempword.getGlossaryDescription() +" has been retrieved as a expansion of "+qpe.getMeaning().getLabel()+" using Wordnet ";
          newqpe.AddInfo(newInfo);
          result.add(newqpe);
          temp.put(tempword, newSynset.getLabel());
          }
        }
//      }
View Full Code Here

    if(rank == Double.NaN || rank == null)
      rank = 0.0D;
   
    for (Person p : author.getKnown()) {
      if (!result.contains(p)) {
        QueryParameterEntry newqpe = new QueryParameterEntryImpl(p
            .getName());
        newqpe.setPerson(p);
        newqpe.setRanking((rank == 0) ? m2resource.foafBoost*author.getKnownLevel(p) : rank * m2resource.foafBoost * author.getKnownLevel(p)); // TODO maybe some different rank:
        //logger.info(newqpe.getPerson().getName() + " rank: " + newqpe.getRanking());
        String newInfo = qpe.TellMeAbout()+p.getName()+" has been retrieved as a friend of "+author.getName()+" using Taxonomies within JONTO ";
        newqpe.AddInfo(newInfo);
        result.add(newqpe);
      }
    }
    queryObject.modifyQueryAppend(queryList, result, qpe, true);
    return result;
View Full Code Here

   
   
       
    for (Person author : matchingAuthors) {
      if (!result.contains(author)) {
        QueryParameterEntry newqpe = new QueryParameterEntryImpl(author.getName());
        newqpe.setPerson(author);
        newqpe.setRanking(m2resource.foafBoost);
        String newInfo = qpe.TellMeAbout()+author.getName()+" has been retrieved as FOAF instance of "+name+" using Taxonomies within JONTO ";
        newqpe.AddInfo(newInfo);
        result.add(newqpe);
        //logger.info(newqpe.getPerson().getName());
       
      }
    }
View Full Code Here

     
    }
    /*find all matching taxonomies for the given word*/
    /*create query parameter entries for found taxonomies*/
    for(TaxonomyEntry taxEntry : taxEntries){
      QueryParameterEntry newqpe = new QueryParameterEntryImpl(value);
      newqpe.setTaxonomy(taxEntry);
      newqpe.setRanking((rank == 0) ? m2resource.taxBoost : rank * m2resource.taxBoost);
      String newInfo = qpe.TellMeAbout()+taxEntry.getLabel()+" has been retrieved as classification of "+value+" using Taxonomies within JONTO ";
      newqpe.AddInfo(newInfo);
      result.add(newqpe);
      ////logger.info("Taxonomy found:" + newqpe.getTaxonomy().getLabel());
     
    }
    queryObject.modifyQueryAppend(queryList, result, qpe, false);
View Full Code Here

    //use generalization of the given entry
    //possibly to find more results
    if((getDirection() == UP)||(precise)){
      TaxonomyEntry parent = TaxonomyStorage.getInstance().getParent(taxEntry);
      if(parent != null){
        QueryParameterEntry newqpe = new QueryParameterEntryImpl(parent.getLabel());
        newqpe.setRanking((rank == 0) ? m2resource.taxBoost : m2resource.taxBoost*rank);
        newqpe.setTaxonomy(parent);
        String newInfo = qpe.TellMeAbout()+parent.getLabel()+" has been retrieved as parent of "+taxEntry.getLabel()+" using Taxonomies within JONTO ";
        newqpe.AddInfo(newInfo);
        result.add(newqpe);
    //    //logger.info("wynik:" + newqpe.getTaxonomy().getLabel());
      }
    }else if ((getDirection() == DOWN)||(!precise)){
      /*
       * syncChildren() throws NullPointerException if there are no children for the given taxEntry ?
       */
      try{
        List<TaxonomyEntry> taxChildren = TaxonomyStorage.getInstance().syncChildren(taxEntry);
        for(TaxonomyEntry taxChild : taxChildren){
          QueryParameterEntry newqpe = new QueryParameterEntryImpl(taxChild.getLabel());
          newqpe.setRanking((rank == 0) ? m2resource.taxBoost : m2resource.taxBoost*rank);
          newqpe.setTaxonomy(taxChild);
          String newInfo = qpe.TellMeAbout()+taxChild.getLabel()+" has been retrieved as child of "+taxEntry.getLabel()+" using Taxonomies within JONTO ";
          newqpe.AddInfo(newInfo);
          result.add(newqpe);
      //    //logger.info("wynik:" + newqpe.getTaxonomy().getLabel());
        }
      }catch(NullPointerException e){
      }
View Full Code Here

TOP

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

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.