Package org.foafrealm.manage

Examples of org.foafrealm.manage.Person


    float result = Float.NaN;
    int cnt = 0;
    synchronized (this) {
      Iterator<Person> it = this.listEvaluators();
      while (it.hasNext()) {
        Person p = it.next();
        Float f = this.mapIsEvaluated.get(p);
        if (f != null) {
          if (Float.isNaN(result)) {
            result = 0.0F;
          }
View Full Code Here


    int cnt = 0;
    synchronized (this) {
      Iterator<Person> it = this.listEvaluators();

      while (it.hasNext()) {
        Person p = it.next();
        boolean approved = false;
        Distance distance = Distance.getInstance(p);

        if (maxDist > 0) {
          approved = distance.isCloserThan(person, maxDist);
View Full Code Here

    processRequest(req, resp);
  }

  public void processRequest(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException {
   
    Person person = FoafManageHelper.getFMHInstance().getLoggedPerson(req);
     
    //first case - getting to RecommendationsPrefs site from outside (we have to fill the form appropriately)
    if(req.getParameter("changed") == null) {
       
      UserRecommendationPrefs[] urp = RecommendationUtils.getUserRecommendationPrefs(person.getMbox().toString());
     
      for(int i=0; i<urp.length; i++){
        req.setAttribute("chb_"+urp[i].getName().getAbbrName(), "checked");
        req.setAttribute("sel1_"+urp[i].getName().getAbbrName(), String.valueOf(urp[i].getLimit()));
        if(!urp[i].getName().getAbbrName().equals(RecommendationName.OVERALL.getAbbrName()))
          req.setAttribute("sel2_"+urp[i].getName().getAbbrName(), String.valueOf(urp[i].getWeight()));
      }
     
      req.getRequestDispatcher("profile/recommendationsPrefs.jsp").forward(req, resp);
    }
    //second case - the user changed his preferences
    else {
      //firstly, we remove user's old preferences (if he had one of course)
      RecommendationUtils.removeUserRecommendationPrefs(person.getMbox().toString());
     
      RecommendationName[] names = RecommendationName.values();
     
      for(int i =0; i<names.length; i++) {
        if(req.getParameter("chb_"+names[i].getAbbrName()) != null) {  //this particular recommendation type was checked
          int limit = Integer.parseInt(req.getParameter("sel1_"+names[i].getAbbrName()));
          int weight = 0;
          if(!names[i].getAbbrName().equals(RecommendationName.OVERALL.getAbbrName()))
            weight = Integer.parseInt(req.getParameter("sel2_"+names[i].getAbbrName()));
         
          UserRecommendationPrefs urp = new UserRecommendationPrefs(names[i], limit, weight);
          urp.saveUserRecommendationPrefs(person.getMbox().toString());
        }
      }
     
      resp.sendRedirect(((req.getContextPath() != null)?req.getContextPath():"")+"/profile/"); //maybe some parameter saying that data have changed?
    }
View Full Code Here

   *            <tt>QueryParameterEntry</tt> to be expanded
   * @return List of expanded <tt>QueryParameterEntries</tt> according to FOAF profile of person set for the entry
   */
  private List<QueryParameterEntry> processEntry(QueryParameterEntry qpe) {
    List<QueryParameterEntry> result = new ArrayList<QueryParameterEntry>();
    Person author = qpe.getPerson();
    Double rank = qpe.getRanking();
    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);
View Full Code Here

   */
  @SuppressWarnings("unchecked")
  public Map<URI, Double> doSemanticSearch(URI mbox, String query, Boolean isConjunction){
    Map<URI,Double> result = new HashMap<URI, Double>();
   
    Person principal = PersonFactory.getPerson(mbox);
    List<IndexResource> resources = SemanticSearch.getInstance().search(principal, query, isConjunction, mresource, queryList);
    for(IndexResource res : resources){
      result.put(new URIImpl(res.getURIAsString()), res.getRank());
    }
    return result;
View Full Code Here

    return result;
  }
  public Map<URI, Double> doSemanticSearch(String mbox, String query, Boolean isConjunction){
    Map<URI,Double> result = new HashMap<URI, Double>();
   
    Person principal = PersonFactory.getPerson(mbox);
    List<IndexResource> resources = SemanticSearch.getInstance().search(principal, query, isConjunction, mresource, queryList);
    for(IndexResource res : resources){
      result.put(new URIImpl(res.getURIAsString()), res.getRank());
    }
    return result;
View Full Code Here

      else sb.append(String.format(rb.getString("feed_message_added_p2_levels"),changeName,mainDirName,depth,changedRes.getLabel()));
     
      //display owner
      if(changeRes.getIssuedBy()!=null)
      {
        Person p = PersonFactory.findPerson(changeRes.getIssuedBy().getStringURI());
        if(p!=null)
        {
          if(p.getName()!=null&&!"".equals(p.getName()))
          {
            sb.append("<BR><BR>");
            sb.append(String.format(rb.getString("feed_message_added_owner"),p.getName()));
          }
          else
          {
            String name = p.getGivenname()+" "+p.getFamily_name();
            if(!" ".equals(name))
            {
              sb.append("<BR><br>");
              sb.append(String.format(rb.getString("feed_message_added_owner"),name));
            }
          }
        }
      }
     
      sb.append("<Br><br>");
     
      StringBuilder tags = new StringBuilder();
      StringBuilder tax = new StringBuilder();
     
      //tags
      List<String> tagsTab = changeRes.getTags();
      if(tagsTab!=null&&tagsTab.size()>0)
      {
        for(String tag:tagsTab)
        {
          tags.append(tag);
          tags.append(", ");
        }
        if(tags.length()>2)
          tags.delete(tags.length()-2, tags.length());
      }
     
      //taxonomies
      if(changeRes.isDirectory())
      {
        DirectoryDescription dd = SscfHelper2.getInstance().getDirectoryDescriptionObject(changedRes.getStringURI());
       
        for(String taxonomy : dd.getTaxonomies().keySet())
        {
          Map<String,String> list = dd.getTaxonomyValues().get(taxonomy);
          if(list!=null&&!list.isEmpty())
          {
            tax.append("<li>");
            tax.append("<B>").append(taxonomy).append(": </B>");
            for(String item : list.keySet())
            {
              tax.append(list.get(item)).append(", ");
            }
            if(tax.length()>2)
              tax.delete(tax.length()-2, tax.length());
           
            tax.append("</li>");
          }
        }
       
      }
     
      //put it into string
      if(tags.length()>0||tax.length()>0)
      {
        sb.append(rb.getString("feed_message_added_annotations"));
        sb.append("<ul>");
     
        if(tags.length()>0)
        {
          sb.append("<li><b>").append(rb.getString("feed_message_added_annotations_tags")).append(": </b>");
          sb.append(tags).append("</li>");
        }
        sb.append(tax);
   
        sb.append("</ul>");
      }
     
      sb.append("<Br><br>");
     
      String resUri = changeRes.getURI().toString();
      if(changeRes.isDirectory())
        sb.append(String.format(rb.getString("feed_message_added_link"),resUri));
      else
        sb.append(String.format(rb.getString("feed_message_added_link"),resUri.substring(0,resUri.lastIndexOf("__"))));
    }
    //removed - TODO: write support for suggestion rejection.
    else if(type==2||type==ChangeTypes.SUG_REJECTED.getChangeType()) {
     
      sb.append(String.format(rb.getString("feed_message_removed_p1"),changeName,mainDirName)).append("<br><Br>");
     
      if(depth==0)
        sb.append(String.format(rb.getString("feed_message_removed_p2"),changeName,mainDirName));
      else if(depth==1)
        sb.append(String.format(rb.getString("feed_message_removed_p2_level"),changeName,mainDirName,changedRes.getLabel()));
      else sb.append(String.format(rb.getString("feed_message_removed_p2_levels"),changeName,mainDirName,depth,changedRes.getLabel()));
     
      sb.append("<Br><br>");
    }
    //changed
    else {
      String chName = changedRes.getLabel();
      sb.append(String.format(rb.getString("feed_message_changed_p1"),chName)).append("<br><Br>");
     
      if(depth>0)
      {
        if(depth==1)
          sb.append(String.format(rb.getString("feed_message_changed_p2"),chName,mainDirName));
        else if(depth==2)
          sb.append(String.format(rb.getString("feed_message_changed_p2_level"),chName,mainDirName));
        else sb.append(String.format(rb.getString("feed_message_changed_p2_levels"),chName,mainDirName,depth));
       
        //display owner
        if(changedRes.getIssuedBy()!=null)
        {
          Person p = PersonFactory.findPerson(changedRes.getIssuedBy().getStringURI());
          if(p!=null)
          {
            if(p.getName()!=null&&!"".equals(p.getName()))
            {
              sb.append("<BR><br>");
              sb.append(String.format(rb.getString("feed_message_changed_owner"),p.getName()));
            }
            else
            {
              String name = p.getGivenname()+" "+p.getFamily_name();
              if(!" ".equals(name))
              {
                sb.append("<BR><br>");
                sb.append(String.format(rb.getString("feed_message_changed_owner"),name));
              }
View Full Code Here

      System.out.println(resUri);
     
      //in case we have top-level - user feed
      if(xfsr.getId().length()<=8)
      {
        Person p = PersonFactory.findPerson(resUri);
        if(p!=null) {
          System.out.println(p.getName());
          labelOfFeed = p.getName();
          type = 1;
        }
      }
     
      feed.setTitle(getFeedTitle(labelOfFeed, req.getLocalName(), rb, type));
View Full Code Here

      // ignore
    }
   
    // if the dir does not exist, create it
    //XXX:fix foafrealm!!
    Person person = null;//PersonFactory.getPersonIfExists(new URIImpl(ownerMbox), null,innerModel);
    //if (person == null) {
    //  person = PersonFactory.createPerson(ownerMbox, null,innerModel);
    //}
    BookmarksHelper bh = new BookmarksHelper(dirUri);
    String uri = bh.createResource(dirUri, dirLabel, dirComment, person,true);
View Full Code Here

    }
   
    //TODO:chang numbers of parameters to names
    for(QueryRow qr:results) {
     
      Person i_person = PersonFactory.findPerson(qr.getValue(results.getVariables().get(3)).toString());
      if (i_person == null) {
        i_person = PersonFactory.createPerson(qr.getValue(results.getVariables().get(3)).toString(), null, false);
      }
      String i_postUri = qr.getValue(results.getVariables().get(0)).toString();
      String i_createdAt = qr.getLiteralValue(results.getVariables().get(2));
View Full Code Here

TOP

Related Classes of org.foafrealm.manage.Person

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.