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

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


           

    private String getClassPreferredLabel(RDFSNamedClass icdCategory){
     
      String ret = "";
      RDFResource term = icdContentModel.getTerm(icdCategory, icdContentModel.getIcdTitleProperty());
      if(term != null)
        ret = term.getBrowserText();
      else
        ret = "TBD";
         
      return ret;
     
View Full Code Here


    }
   
    private String getClassPreferredLabelRubricID(RDFSNamedClass icdCategory){
     
      String ret = "";
      RDFResource term = icdContentModel.getTerm(icdCategory, icdContentModel.getIcdTitleProperty());
      if(term != null){
        ret = (String) term.getPropertyValue(icdContentModel.getIdProperty());
      }else{
        ret = "TBD";
          System.out.println("preferred term id:TBD" + icdCategory.getBrowserText());
      }
         
View Full Code Here

    }   
   
    private String getClassDefinition(RDFSNamedClass icdCategory){
     
      String ret = "TBD";
      RDFResource term = icdContentModel.getTerm(icdCategory, icdContentModel.getDefinitionProperty());
      if(term != null){
        //ret = term.getBrowserText();
        String definition = (String) term.getPropertyValue(icdContentModel.getLabelProperty());
        if(definition != null) ret = definition;
        //System.out.println("definition id:" + definition);
      }else{
        ret = "TBD";
      }
View Full Code Here

    }   

    private String getClassDefinitionRubricID(RDFSNamedClass icdCategory){
     
      String ret = "";
      RDFResource term = icdContentModel.getTerm(icdCategory, icdContentModel.getDefinitionProperty());
      if(term != null){
        ret = (String) term.getPropertyValue(icdContentModel.getIdProperty());
        //System.out.println("definition id:" + term.getURI());
      }else
        ret = "TBD";
         
      return ret;
View Full Code Here

      Collection ret = new ArrayList();
     
      Collection pdefinitions = icdContentModel.getTerms(icdCategory, icdContentModel.getPrefilledDefinitionProperty());
      if(pdefinitions != null){
        for(Iterator it = pdefinitions.iterator(); it.hasNext();){
          RDFResource pdefinition = (RDFResource) it.next();
          ret.add(pdefinition.getPropertyValue(icdContentModel.getPrefilledDefinitionProperty()));
       
        }
      }
     
      return ret;   
View Full Code Here

             
              Collection definitions = this.getClassDefinitions(icdCategory);
              if(definitions != null){
             
                for(Iterator itdef = definitions.iterator(); itdef.hasNext();){
                  RDFResource defTerm = (RDFResource) itdef.next();
                 
                  String defText = this.getDefinitionTermText(defTerm);
                  String defRubricID = this.getTermRubricID(defTerm);
                 
                  if(definitions.size() > 1){
                    //System.out.println(classCode + "|" + defRubricID + "|" + defText);
                  }
                 
                  //if(defText != null){
                 
                      Rubric rubricDefinition = factory.createRubric();
                      rubricDefinition.setId(defRubricID);
                      ClassKind cKindDefinition = factory.createClassKind();
                      cKindDefinition.setName(icdContentModel.getDefinitionProperty().getBrowserText());
                      rubricDefinition.setKind(cKindDefinition);
                      Label labelDefinition = factory.createLabel();
                  labelDefinition.setLang("en");
                  labelDefinition.setSpace("default");
                  labelDefinition.getContent().add(defText);
                  rubricDefinition.getLabel().add(labelDefinition);
                  cls.getRubric().add(rubricDefinition);  
                  //}// not null
                }


              }
             

          //prefilled definitions
          /*
          Collection colPrefilledDefinitions = this.getPrefilledDefinitions(icdCategory);
          if(colPrefilledDefinitions != null){
            for(Iterator itpd = colPrefilledDefinitions.iterator(); itpd.hasNext();){
           
              String pdefinition = (String) itpd.next();
              if(pdefinition != null){
              Rubric rubricpDefinition = factory.createRubric();
              rubricpDefinition.setId("id-to-be-added-later-" + rubricIndex++);
              ClassKind cKindpDefinition = factory.createClassKind();
              cKindpDefinition.setName(icdContentModel.getPrefilledDefinitionProperty().getBrowserText());
              rubricpDefinition.setKind(cKindpDefinition);
              Label labelpDefinition = factory.createLabel();
              labelpDefinition.setLang("en");
              labelpDefinition.setSpace("default");
              labelpDefinition.getContent().add(definition);
              rubricpDefinition.getLabel().add(labelpDefinition);
              cls.getRubric().add(rubricpDefinition);
              }
           
            }
          }
          */
             
                
              //inclusion terms
              Collection colInclusions = this.getInclusionTerms(icdCategory);
             
              Collection colSortedInclusions = new ArrayList();
              Map mapSortedInclusions = new HashMap();

              if(colInclusions != null){
                for(Iterator it3 = colInclusions.iterator(); it3.hasNext();){
                  RDFResource inclusion = (RDFResource) it3.next();
                 
                        String inclusionLabel = this.getInclusionTermText(inclusion);
                        String inclusionId = this.getTermRubricID(inclusion);
                       
                        String inclusionLabelId = inclusionLabel + "|" + inclusionId;
                        colSortedInclusions.add(inclusionLabelId);
                        mapSortedInclusions.put(inclusionLabelId, inclusion);
                }
               
                    //alphabetically sort the rubrics
                        Object[] arraySortedInclusions = colSortedInclusions.toArray();
                        List listSortedInclusions = Arrays.asList(arraySortedInclusions);
                        Collections.sort(listSortedInclusions, String.CASE_INSENSITIVE_ORDER);
                        for(ListIterator li0 = listSortedInclusions.listIterator(); li0.hasNext();){
                          String sortedInclusionLabelId = (String)li0.next();
                          String[] labelId = sortedInclusionLabelId.split("\\|");
                          RDFResource sortedInclusion = (RDFResource)mapSortedInclusions.get(sortedInclusionLabelId);
                 
                          Rubric rubricInclusion = factory.createRubric();
                      if(!labelId[1].equals("null")) //if null, do nothing
                        rubricInclusion.setId(labelId[1]);
                          ClassKind cKindInclusion = factory.createClassKind();
                          cKindInclusion.setName("inclusion");
                          rubricInclusion.setKind(cKindInclusion);
                          Label labelInclusion = factory.createLabel();
                          labelInclusion.setLang("en");
                          labelInclusion.setSpace("default");
                          labelInclusion.getContent().add(labelId[0]);
                          Collection<RDFResource> clamlRefCodes = this.getTermClaMLReferences(sortedInclusion);

                     try{
                  if(clamlRefCodes != null){
                    for (RDFResource clamlRefCode : clamlRefCodes) {

                      Reference refCode = factory.createReference();
                          refCode.setClazz("in brackets");
                      String thisCode = (String)clamlRefCode.getPropertyValue(icdContentModel.getTextProperty());
                      if(thisCode.indexOf("-") >= 0){
                        thisCode = this.getCodeFromLabel(thisCode);
                      }
                     
                      String thisGeneratedCode = this.getGeneratedCodeForICDCategoryCode(thisCode);
                        if(thisGeneratedCode == null){
                          thisGeneratedCode = thisCode;
                        }
                         
                         
                         
                      refCode.setContent(thisGeneratedCode);
                      //String refCodeText = ((RDFResource)clamlRefCode.getPropertyValue(icdContentModel.getIcdRefProperty())).getBrowserText();
                     
                      refCode.setCode(thisGeneratedCode);
                      labelInclusion.getContent().add(refCode);                   
                   
                      }
                  }
                  }catch(Exception e){
                    e.printStackTrace();
                          System.out.println("inclusion" + "|" + icdCategory.getBrowserText());
                            continue;
                  }
                 
                 
                  rubricInclusion.getLabel().add(labelInclusion);
                  cls.getRubric().add(rubricInclusion);
               

                }
              }             

              //exclusion terms
              Collection colExclusions = this.getExclusionTerms(icdCategory);

              Collection<String> colSortedExclusions = new ArrayList();
              Map<String, RDFResource> mapSortedExclusions = new HashMap();
             
             
             
              if(colExclusions != null){
                for(Iterator it4 = colExclusions.iterator(); it4.hasNext();){
                  RDFResource exclusion = (RDFResource) it4.next();
                        String exclusionLabel = this.getExclusionTermText(exclusion);
                        String exclusionId = this.getTermRubricID(exclusion);
                        //Collection<RDFResource> clamlRefCodes = this.getTermClaMLReferences(exclusion);
                       
                        String exclusionLabelId = exclusionLabel + "|" + exclusionId;
                        colSortedExclusions.add(exclusionLabelId);
                        mapSortedExclusions.put(exclusionLabelId, exclusion);
                       

                }
                        //alphabetically sort the rubrics
                        Object[] arraySortedExclusions = colSortedExclusions.toArray();
                        List listSortedExclusions = Arrays.asList(arraySortedExclusions);
                        Collections.sort(listSortedExclusions, String.CASE_INSENSITIVE_ORDER);
                        for(ListIterator li1 = listSortedExclusions.listIterator(); li1.hasNext();){
                        //for(int jj = 0; jj < arraySortedExclusions.length; jj++){
                          String sortedExclusionLabelId = (String)li1.next();
                       
                         
                          String[] labelId = sortedExclusionLabelId.split("\\|");
                          RDFResource sortedExclusion = (RDFResource)mapSortedExclusions.get(sortedExclusionLabelId);
                 
                  //System.out.println(icdCategory.getBrowserText() + "|" + sortedExclusionLabelId);
                         
                  Rubric rubricInclusion = factory.createRubric();
                  if(!labelId[1].equals("null")) //if null, do nothing
                    rubricInclusion.setId(labelId[1]);
                  ClassKind cKindInclusion = factory.createClassKind();
                  cKindInclusion.setName("exclusion");
                  rubricInclusion.setKind(cKindInclusion);
                  Label labelInclusion = factory.createLabel();
                  labelInclusion.setLang("en");
                  labelInclusion.setSpace("default");
                  labelInclusion.getContent().add(labelId[0]);
                 
                  Collection<RDFResource> clamlRefCodes = this.getTermClaMLReferences(sortedExclusion);
                 
                 
                  //if(sortedExclusion.getPropertyValues(icdContentModel.getClamlReferencesProperty()) != null){
                  //Collection<RDFResource> clamlRefCodes = sortedExclusion.getPropertyValues(icdContentModel.getClamlReferencesProperty());
                 
                  try{
                  if(clamlRefCodes != null){
                   
                   
                    for (RDFResource clamlRefCode : clamlRefCodes) {
                   
                          Reference refCode = factory.createReference();
                          refCode.setClazz("in brackets");
                         
                      String thisCode = (String)clamlRefCode.getPropertyValue(icdContentModel.getTextProperty());
                      if(thisCode.indexOf("-") >= 0){
                        thisCode = this.getCodeFromLabel(thisCode);
                      }
                     
                      String thisGeneratedCode = this.getGeneratedCodeForICDCategoryCode(thisCode);
                        if(thisGeneratedCode == null){
                          thisGeneratedCode = thisCode;
                        }
                         
                         
                      refCode.setContent(thisGeneratedCode);
                      //String refCodeText = ((RDFResource)clamlRefCode.getPropertyValue(icdContentModel.getIcdRefProperty())).getBrowserText();

                     
                      refCode.setCode(thisGeneratedCode);
                      labelInclusion.getContent().add(refCode);                   
                   
                      }
                  }
                  }catch(Exception e){
                    e.printStackTrace();
                          System.out.println("exclusion" + "|" + icdCategory.getBrowserText());
                    continue;
                  }
                 
                  //}
                 

                  rubricInclusion.getLabel().add(labelInclusion);
                 
                  cls.getRubric().add(rubricInclusion);

                }
              } 
             
              //notes term
              Collection colNotes = this.getNoteTerms(icdCategory);
              if(colNotes != null){
                for(Iterator it6 = colNotes.iterator(); it6.hasNext();){
                  RDFResource note = (RDFResource) it6.next();

                        String noteLabel = this.getNoteTermText(note);
                        String noteId = this.getTermRubricID(note);
                 
                  Rubric rubricNote = factory.createRubric();
                  rubricNote.setId(noteId);
                  ClassKind cKindNote = factory.createClassKind();
                  cKindNote.setName("note");
                  rubricNote.setKind(cKindNote);
                  Label labelNote = factory.createLabel();
                  labelNote.setLang("en");
                  labelNote.setSpace("default");
                  labelNote.getContent().add(noteLabel);
                  rubricNote.getLabel().add(labelNote);
                  cls.getRubric().add(rubricNote);
                 
               
                }
             
              }
             
              //codinghint term
              Collection colCodingHints = this.getCodingHintTerms(icdCategory);
              if(colCodingHints != null){
                for(Iterator it7 = colCodingHints.iterator(); it7.hasNext();){
                  RDFResource note = (RDFResource) it7.next();

                        String noteLabel = this.getCodingHintTermText(note);
                        String noteId = this.getTermRubricID(note);
                 
                  Rubric rubricNote = factory.createRubric();
View Full Code Here

TOP

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

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.