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){