Package org.corrib.s3b.sscf.manage

Examples of org.corrib.s3b.sscf.manage.SscfDomain


   */
  @SuppressWarnings("unchecked")
  public DirectoryDescription getDirectoryDescriptionObject(String uri)
  {
    XfoafSscfResource xsscf = XfoafSscfResource.getXfoafSscfResource(uri);
    SscfDomain xsscfDom = SscfDomain.getSscfDomain(uri);
   
    List<ThesaurusEntry> thesClassList = xsscfDom.getWordNetClassification();
    //List<DdcClassification> ddcClassList = xsscfDom.getDdcClassification();
    List<TaxonomyEntry> taxClassList = xsscfDom.getClassification();
   
    if(xsscf!=null)
    {
      DirectoryDescription dd = new DirectoryDescription();
     
View Full Code Here


   
    Iterator<XfoafSscfResource> isIn = wbr.listIsIn();
    //go through all parent directories and get their domains
    while(isIn.hasNext()){
      XfoafSscfResource parent = isIn.next();
      SscfDomain domain = SscfDomain.getSscfDomain(parent.getURI().toString());
      if(domain != null){
        List<TaxonomyEntry> taxList = domain.getClassification();
        List<ThesaurusEntry> thesList = domain.getWordNetClassification();
 
        //add taxonomy description tags
        for(TaxonomyEntry taxEntry : taxList){
          String tagTx = TAXONOMY_PREFIX + taxEntry.getLabel().replaceAll(" ", "_");
          if(!tags.contains(tagTx))
View Full Code Here

          //first addIsIn!
          category.addIsIn(previ);
        }
      }*/
      //set word net
      SscfDomain domain = SscfDomain.getSscfDomain(category.getResource().toString());
      domain.setPersonInterest(person, 1);
     
      //Save wordnet and other thesauri
      if(thValues!=null&&thValues.size()>0)
      {
        Set<String> thesUris = thValues.keySet();
        for(String thesUri:thesUris)
        {
          Collection<String> thesList = thValues.get(thesUri);
          ThesaurusContext thesaurus = Thesauri.getInstance().getContext(thesUri);
            if (thesaurus!=null)
            {
              List<ThesaurusEntry> thesEntries = new ArrayList<ThesaurusEntry>();
              for(String entry:thesList)
            {
              ThesaurusEntry thEntry = thesaurus.getEntryByUri(entry,null);
                thesEntries.add(thEntry);
            }
              domain.setWordNetClassification(thesEntries);
            }
        }
      }
      /*if(wnValues!=null&&wnValues.size()>0)
      { 
        //currently only wordnet is supported on the client side
        ThesaurusContext wnContext = Thesauri.getInstance().getContext("http://www.w3.org/2006/03/wn/wn20/");
         
        List<ThesaurusEntry> chosenClassifications = new ArrayList<ThesaurusEntry>();
        for(String uri:wnValues) {
          //if (uri.startsWith(JOntoWordNetOntology.WNO_NS_WN_OFFSET.getUri()) ||
          //    uri.startsWith(JOntoWordNetOntology.WNO_NS_I18N_WORDNET.getUri())) {
          try
          {
            chosenClassifications.add(wnContext.getEntryByUri(uri));
          }
          catch (Exception e)
          {
             ignore
          } 
          //}
        }
        domain.setWordNetClassification(chosenClassifications);
      }*/
     
      //Save other classifications.
      if(taxValues!=null&&taxValues.size()>0)
      {
        Set<String> taxUris = taxValues.keySet();
        for(String taxUri:taxUris)
        {
          Collection<String> taxList = taxValues.get(taxUri);
          TaxonomyContext<TaxonomyEntry> taxonomy = Taxonomies.getInstance().getContext(taxUri);
            if (taxonomy!=null)
            {
              List<TaxonomyEntry> taxEntries = new ArrayList<TaxonomyEntry>();
              for(String entry:taxList)
            {
              TaxonomyEntry taxonomyEntry = taxonomy.getEntryByUri(entry,null);
                taxEntries.add(taxonomyEntry);
            }
              domain.setClassification(taxEntries);
            }
        }
      }
     
      //===== GENERATING NODE TO PUT INTO TREE =====
View Full Code Here

     
      if(dir.getComment()!=null||(dir.getComment()==null&&!"".equals(newDesc)))
        dir.setComment(newDesc);
 
      //set word net
      SscfDomain domain = SscfDomain.getSscfDomain(dir.getResource().toString());
     
      List<ThesaurusEntry> oldWnClass = domain.getWordNetClassification();
      List<ThesaurusEntry> finalWnClass = new ArrayList<ThesaurusEntry>();
      List<ThesaurusEntry> removedWnClass = new ArrayList<ThesaurusEntry>();
      //for future use
      //domain.setPersonInterest(person, 1);
     
      //Save wordnet
      if(thValues!=null&&thValues.size()>0)
      {
       
        List<ThesaurusEntry> chosenClassifications = new ArrayList<ThesaurusEntry>();
        //Currently we support only wordnet on the client side
        /*ThesaurusContext wnContext = Thesauri.getInstance().getContext("http://www.w3.org/2006/03/wn/wn20/");
       
       
        for(String wc:wnValues) {
          try
          {
            chosenClassifications.add(wnContext.getEntryByUri(wc));
          }
          catch (Exception e)
          {
            //ignore
          }
        }*/
        Set<String> thesUris = thValues.keySet();
        //List<ThesaurusEntry> taxEntries = new ArrayList<ThesaurusEntry>();
        for(String thesUri:thesUris)
        {
          Collection<String> thesList = thValues.get(thesUri);
          ThesaurusContext thesauri = Thesauri.getInstance().getContext(thesUri);
            if (thesauri!=null)
            {
              for(String entry:thesList)
            {
              ThesaurusEntry thEntry = thesauri.getEntryByUri(entry,null);
              chosenClassifications.add(thEntry);
            }
            }
        }
       
        //compare those two classifcations
        //removed old has it, new doesn't
        for(ThesaurusEntry cl:oldWnClass)
        {
          if(chosenClassifications.contains(cl)) { 
            finalWnClass.add(cl);
          }
          else {
            removedWnClass.add(cl);
          }
        }
       
        //remove things added to finalWnClass from choosenClass
        chosenClassifications.removeAll(finalWnClass);
       
        //generate changes information
        //removed are in removedWnClass
        //new are in choosenClassifications
        //others in finalWnClass
        if(removedWnClass.size()>0||chosenClassifications.size()>0)
        {
          change+=ChangeTypes.CHANGED_TEZ.getChangeType();
          if(changeValue.length()>0) changeValue.append("||");
          changeValue.append(ChangeTypes.CHANGED_TEZ.getChangeType()).append(':');
          for(ThesaurusEntry tmpcl:removedWnClass)
          {
            changeValue.append(tmpcl.getLabel()).append(',');
          }
          changeValue.append("::");
          for(ThesaurusEntry tmpcl:chosenClassifications)
          {
            changeValue.append(tmpcl.getLabel()).append(',');
            finalWnClass.add(tmpcl);
          }
        }
       
        domain.setWordNetClassification(finalWnClass);
      }
     
      //Save other classifications.
      if(taxValues!=null&&taxValues.size()>0)
      {
        List<TaxonomyEntry> oldEntries = domain.getClassification();
        List<TaxonomyEntry> finalList = new ArrayList<TaxonomyEntry>();
        List<TaxonomyEntry> removedList = new ArrayList<TaxonomyEntry>();
       
        Set<String> taxUris = taxValues.keySet();
        List<TaxonomyEntry> taxEntries = new ArrayList<TaxonomyEntry>();
        for(String taxUri:taxUris)
        {
          Collection<String> taxList = taxValues.get(taxUri);
          TaxonomyContext<TaxonomyEntry> taxonomy = Taxonomies.getInstance().getContext(taxUri);
            if (taxonomy!=null)
            {
              for(String entry:taxList)
            {
              TaxonomyEntry taxonomyEntry = taxonomy.getEntryByUri(entry,null);
                taxEntries.add(taxonomyEntry);
            }
            }
        }
       
        //compare those two classifcations
        //removed old has it, new doesn't
        for(TaxonomyEntry te:oldEntries)
        {
          if(taxEntries.contains(te)) { 
            finalList.add(te);
          }
          else {
            removedList.add(te);
          }
        }
       
        taxEntries.removeAll(finalList);
       
        //generate changes information
        //removed are in removedList
        //new are in taxEntries
        //others in finalList
        if(removedList.size()>0||taxEntries.size()>0)
        {
          change+=ChangeTypes.CHANGED_TAX.getChangeType();
          if(changeValue.length()>0) changeValue.append("||");
          changeValue.append(ChangeTypes.CHANGED_TAX.getChangeType()).append(':');
          for(TaxonomyEntry tmpte:removedList)
          {
            changeValue.append(tmpte.getContext().getLabel()).append(" - ").append(tmpte.getLabel()).append(';');
          }
          changeValue.append("::");
          for(TaxonomyEntry tmpte:taxEntries)
          {
            changeValue.append(tmpte.getContext().getLabel()).append(" - ").append(tmpte.getLabel()).append(';');
            finalList.add(tmpte);
          }
        }
       
        domain.setClassification(finalList);
      }
          //notify synchronization resource loader that resources of user were changed
        ResourcesLoader.setLastChangeDate(view, new Date())

     
View Full Code Here

TOP

Related Classes of org.corrib.s3b.sscf.manage.SscfDomain

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.