Package edu.stanford.smi.protegex.owl.model

Examples of edu.stanford.smi.protegex.owl.model.RDFSNamedClass


   
   
    public static void getClamlRef() {
     
      //A51.0 / R75
        RDFSNamedClass category = icdContentModel.getICDCategory("http://who.int/icd#H34.2");
        System.out.println("\n" + category.getBrowserText());
        Collection<RDFResource> exclusionTerms = category.getPropertyValues(icdContentModel.getExclusionProperty());
        for (RDFResource exclusionTerm : exclusionTerms) {
            System.out.println("\tExclusion: " + exclusionTerm.getBrowserText());
            Collection<RDFResource> clamlRefs = exclusionTerm.getPropertyValues(icdContentModel.getClamlReferencesProperty());
            if (clamlRefs != null) {
                for (RDFResource clamlRef : clamlRefs) {
View Full Code Here


    }

    public static void getLinearizationInfo() {
     
      //A65-A69
        RDFSNamedClass category = icdContentModel.getICDCategory("http://who.int/icd#H34.2");
        System.out.println("\n" + category.getBrowserText());

       Collection<RDFResource> linearizationSpecs = icdContentModel.getLinearizationSpecifications(category);
       for (RDFResource linearizationSpec : linearizationSpecs) {
           RDFResource linearization = (RDFResource) linearizationSpec.getPropertyValue(icdContentModel.getLinearizationViewProperty());
           RDFSNamedClass linearizationParent = (RDFSNamedClass) linearizationSpec.getPropertyValue(icdContentModel.getLinearizationParentProperty());
           Boolean isIncludedInLinearization = (Boolean) linearizationSpec.getPropertyValue(icdContentModel.getIsIncludedInLinearizationProperty());
           String linSortingLabel = (String) linearizationSpec.getPropertyValue(icdContentModel.getLinearizationSortingLabelProperty());
          

          
          
           System.out.println("Linearization: " + linearization.getBrowserText() +
                   "; is included: " + (isIncludedInLinearization == null ? "(not specified)" : isIncludedInLinearization) +
                   "; linearization parent: " + linearizationParent.getBrowserText() +
                   "; linearization sorting label: " + (linSortingLabel == null ? "(not specified)" : linSortingLabel));
       }
    }
View Full Code Here

   

   
    public static void getSortingLabel(){
     
        RDFSNamedClass category = icdContentModel.getICDCategory("http://who.int/icd#M60");
        System.out.println("Displayed as in the tree: " + category.getBrowserText());
       
        String slabel = (String)category.getPropertyValue(icdContentModel.getSortingLabelProperty());

        //RDFResource defTerm = icdContentModel.getTerm(category, icdContentModel.getSortingLabelProperty());
        if (slabel != null) {
            //String sortingLabel = (String) slabel.getBrowserText();
View Full Code Here

    public static void linearizationParentTesting(){
      Collection<RDFSNamedClass> icdCategories = icdContentModel.getICDCategories();
        String linearizationType = "Morbidity";
       
      for(Iterator it = icdCategories.iterator(); it.hasNext();){
        RDFSNamedClass icdCategory = (RDFSNamedClass) it.next();
       
        if(hasMultipleParents(icdCategory)){
          RDFSNamedClass linearParent = getLinearizationParentForType(icdCategory, linearizationType);
          String slabel = (String)icdCategory.getPropertyValue(icdContentModel.getSortingLabelProperty());
          if(!icdCategories.contains(linearParent)){
            System.out.println("icdCategory=" + icdCategory.getBrowserText() + "|linearParent=" + linearParent.getBrowserText() + "|soringLabel=" + slabel);
          }
        }
       
       
      }
View Full Code Here

                    + e.getMessage(), e);
        }
    }

    private void parseElement(Element el) {
        RDFSNamedClass cls = parseSubclasses(el);
        parseRubrics(cls, el);
    }
View Full Code Here

        RDFSNamedClass cls = parseSubclasses(el);
        parseRubrics(cls, el);
    }

    private RDFSNamedClass parseSubclasses(Element el) {
        RDFSNamedClass cls = null;
        String code = el.getAttributeValue(ClamlConstants.CODE_ATTR);
        List classChildren = el.getChildren(ClamlConstants.SUPERCLASS_ELEMENT);
        if (classChildren.isEmpty()) {
            cls = icdContentModel.createICDCategory(code, (String)null);
            if (log.isLoggable(Level.FINE)) {
                log.fine("Created cls: " + cls.getBrowserText() + " superclass: " + cls.getSuperclasses(false));
            }
        } else {
            for (Iterator iterator = classChildren.iterator(); iterator.hasNext();) {
                Element classChild = (Element) iterator.next(); // TODO: treat
                // multiple
                // parents
                String supercls = classChild.getAttributeValue(ClamlConstants.CODE_ATTR);
                cls = icdContentModel.createICDCategory(code, supercls);
                if (log.isLoggable(Level.FINE)) {
                    log.fine("Created cls: " + cls.getBrowserText() + " superclass: " + cls.getSuperclasses(false));
                }
            }
        }
        if (cls != null) {
            icdContentModel.addClassMetadata(cls, code, el.getAttributeValue(ClamlConstants.KIND_ATTR), el
View Full Code Here

      int index = 0;
     
      try{
     
    for(Iterator it = icdChapterNodes.iterator(); it.hasNext(); ){
      RDFSNamedClass icdChaptetNode = (RDFSNamedClass) it.next();
      String chapterCode = this.getRDFSClassCode(icdChaptetNode);
     
      if(!chapterCode.equals("TBD")){
     
        String assignedChapterCode = this.getAssignedChapterCode(chapterCode);
View Full Code Here

    return (Object[]) this.mapLinearChildren.get(icdCategory);
  }
 
 
  public String getLinearParentCode(RDFSNamedClass icdCategory){   
    RDFSNamedClass linearParent = this.getLinearizationParentForType(icdCategory, linearType)
    return (String)this.mapGeneratedCodes.get(linearParent);
   
  }
View Full Code Here

  private void generateCodesFromSeed(RDFSNamedClass icdCategory, String seedCode, String linearType){
   
    Collection subclasses = icdCategory.getSubclasses(false);
    Collection linearSubclasses = new ArrayList();
    for(Iterator it = subclasses.iterator(); it.hasNext();){
      RDFSNamedClass subclass = (RDFSNamedClass) it.next();
      if(this.isLinearizationParent(subclass, icdCategory, linearType)){
        linearSubclasses.add(subclass);
      }else{
       
        //System.out.println("Is not linear parent:|" + icdCategory.getBrowserText() + "|" + icdCategory.getURI() + "|subclass:" + subclass.getBrowserText() + "|" + subclass.getURI());
       
      }
     
    }
    this.generatedSubclassCodesWithSortingLabels(icdCategory, linearSubclasses, seedCode);
   
   
    //recursive
    for(Iterator it1 = linearSubclasses.iterator(); it1.hasNext();){
     
      RDFSNamedClass linearSubcls = (RDFSNamedClass) it1.next();
      String seedSubcode = (String) this.mapGeneratedCodes.get(linearSubcls);
      generateCodesFromSeed(linearSubcls, seedSubcode, linearType);
   
       
  }
View Full Code Here

    private void generatedSubclassCodesWithSortingLabels(RDFSNamedClass icdCategory, Collection subclses, String seedCode){
     
      Map mapLabels = new HashMap();
      Collection colSortingLabels = new ArrayList();
      for(Iterator it = subclses.iterator(); it.hasNext();){
        RDFSNamedClass subcls = (RDFSNamedClass) it.next();
        //It seems that sorting label may duplicate, so we added additional text to keep it unique
        String sortingLabel = this.getSortingLabelForSubclass(subcls) + subcls.getBrowserText();
        colSortingLabels.add(sortingLabel);
        mapLabels.put(sortingLabel, subcls);

      }
   
        Object[] arraySortedCodes = new Object[colSortingLabels.size()]
      Object[] arraySortingLabels = colSortingLabels.toArray();
    Arrays.sort(arraySortingLabels);
   
   
    int arraySize = arraySortingLabels.length;
    if(arraySize > 26){
      System.out.println("too many|" + icdCategory.getBrowserText() + "|" + arraySize);
     
    }   
    for(int i = 0; i < arraySortingLabels.length; i++){
     
            if(i > 154){
              System.out.println("size>154, check please!");
              break;
            }
     
      String slabel = (String) arraySortingLabels[i];
      String scode = seedCode + this.tbdcodes[i];
     

     
      arraySortedCodes[i] = scode;
      RDFSNamedClass ssubcls = (RDFSNamedClass)mapLabels.get(slabel);
     
      //debug
      //if(this.isMissingCodes(scode)){
      //  System.out.println("Got the missing code:" + scode + "|" + ssubcls.getBrowserText());
      //  this.mapGeneratedCodes.put(ssubcls, scode);
      //}     
     
     
      //need debug, why ssubcls is the same
      if(!mapGeneratedCodes.containsKey(ssubcls)){
        this.mapGeneratedCodes.put(ssubcls, scode);
        //System.out.println(scode);
        //debug
        if(this.isMissingCodes(scode)){
          System.out.println("Not the missing code:" + scode + "|" + ssubcls.getBrowserText() + "|" + ssubcls.getURI());
         
        }         
       
      }else{
       
        String dupCode = (String) this.mapGeneratedCodes.get(ssubcls);
       
        System.out.println("duplicate code:" + dupCode + "|missing code:" + scode + "|" + ssubcls.getBrowserText());
       
       
      }
     
    }
View Full Code Here

TOP

Related Classes of edu.stanford.smi.protegex.owl.model.RDFSNamedClass

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.