Package org.corrib.s3b.sscf.tools.sscf2js

Examples of org.corrib.s3b.sscf.tools.sscf2js.DirectoryDescription


    //List<DdcClassification> ddcClassList = xsscfDom.getDdcClassification();
    List<TaxonomyEntry> taxClassList = xsscfDom.getClassification();
   
    if(xsscf!=null)
    {
      DirectoryDescription dd = new DirectoryDescription();
     
      //Get name and description
      dd.setName(xsscf.getLabel());
      dd.setDescription(xsscf.getComment());
      XResource xfr = xsscf.getIssuedBy();
      if(xfr instanceof Person) {
        Person tmp = (Person)xfr;
        dd.setOwner(tmp.getName());
      }
     
      //list of avaliable taxonomies
      Map<String,String> taxonomies = new HashMap<String,String>();
     
      //List of taxonomy values
      Map<String,Map<String,String>> taxMap = new HashMap<String, Map<String,String>>();
     
      //list of avaliable thesauri
      Map<String,String> thesauri = new HashMap<String,String>();
     
      //List of theasourus values
      Map<String,Map<String,String>> thesMap = new HashMap<String, Map<String,String>>();
     
      //get all wordNet values
    /*  if(wordnetClassList!=null&&!wordnetClassList.isEmpty())
      {
         
        String tax1 = "WordNet";
        String tax_uri = "";
        taxonomies.put(tax1, tax_uri);
       
        Map<String,String> taxValues = new HashMap<String,String>();
        for(WordNetClassification wnc : wordnetClassList)
        {
          taxValues.put(wnc.getURI(),wnc.getName());
        }
     
        taxMap.put(tax1, taxValues);
      }*/
     
      if(thesClassList!=null&&!thesClassList.isEmpty())
      {
 
        Collection<String> contextNames = new ArrayList<String>();
        Map<String,Map<String,String>> tmpThesValues = new HashMap<String,Map<String,String>>();
        Map<String,String> tmpMapForThesUris = new HashMap<String, String>();
       
       
        for(ThesaurusEntry thesaurusEntry : thesClassList)
        {
          KOSContext context = thesaurusEntry.getContext();
          Map<String,String> mapToPut = null;
          if(!contextNames.contains(context.getLabel()))
          {
            contextNames.add(context.getLabel());
           
            mapToPut = new HashMap<String, String>();
          }
          else
          {
            mapToPut = tmpThesValues.get(context.getLabel());
          }
          mapToPut.put(thesaurusEntry.getURI().toString(),thesaurusEntry.getLabel());
          tmpThesValues.put(context.getLabel(),mapToPut);
          if(tmpMapForThesUris.get(context.getLabel())==null)
            tmpMapForThesUris.put(context.getLabel(), context.getNamespaceURI());
        }
     
        Set<String> thess= tmpThesValues.keySet();
        for(String thes:thess)
        {
          thesauri.put(thes,tmpMapForThesUris.get(thes));
          thesMap.put(thes, tmpThesValues.get(thes));
        }
      }
         
      dd.setThesauri(thesauri);
      dd.setThesaurusValues(thesMap);
     
      //old-style ddc classification description fetch.
      //TODO: check for DDC implementation
      /*if(ddcClassList!=null&&!ddcClassList.isEmpty())
      {
        String tax1 = "DDC";
        String tax_uri = "";
        try
        {
          tax_uri = DdcContext.getContext().getNamespaceURI();
        }
        catch (IOException e)
        {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }
        taxonomies.put(tax1, tax_uri);
       
        Map<String,String> taxValues = new HashMap<String, String>();
        for(DdcClassification ddcc : ddcClassList)
        {
          taxValues.put(ddcc.getURI(),ddcc.getName());
        }
     
        taxMap.put(tax1, taxValues);
      }*/
     
      //all taxonomies description fetch
      if(taxClassList!=null&&!taxClassList.isEmpty())
      {
 
        Collection<String> contextNames = new ArrayList<String>();
        Map<String,Map<String,String>> tmpTaxValues = new HashMap<String,Map<String,String>>();
        Map<String,String> tmpMapForTaxUris = new HashMap<String, String>();
       
       
        for(TaxonomyEntry taxonomyEntry : taxClassList)
        {
          KOSContext context = taxonomyEntry.getContext();
          Map<String,String> mapToPut = null;
          if(!contextNames.contains(context.getLabel()))
          {
            contextNames.add(context.getLabel());
           
            mapToPut = new HashMap<String, String>();
          }
          else
          {
            mapToPut = tmpTaxValues.get(context.getLabel());
          }
          mapToPut.put(taxonomyEntry.getURI().toString(),taxonomyEntry.getLabel());
          tmpTaxValues.put(context.getLabel(),mapToPut);
          if(tmpMapForTaxUris.get(context.getLabel())==null)
            tmpMapForTaxUris.put(context.getLabel(), context.getNamespaceURI());
        }
     
        Set<String> taxes = tmpTaxValues.keySet();
        for(String tax:taxes)
        {
          taxonomies.put(tax,tmpMapForTaxUris.get(tax));
          taxMap.put(tax, tmpTaxValues.get(tax));
        }
      }
         
      dd.setTaxonomies(taxonomies);
      dd.setTaxonomyValues(taxMap);
     
      return dd;
    }
    return null;
  }
View Full Code Here


   * @param uri of the directory
   * @return JSON representation of the directory description
   */
  public String getDirectoryDescription(String uri)
  {
    DirectoryDescription dd = new DirectoryDescription();
    dd = getDirectoryDescriptionObject(uri);
   
    if(dd!=null)
    {
      return dd.toJSON();
    }
    return null;
  }
View Full Code Here

      }
     
      //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())
View Full Code Here

TOP

Related Classes of org.corrib.s3b.sscf.tools.sscf2js.DirectoryDescription

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.