Пример #1
0
 @Override
 public void visit(OWLLiteral node) {
   node.getDatatype().accept(this);
   OWLDatatype dt = (OWLDatatype) obj;
   if (node.hasLang()) {
     obj = dataFactory.getOWLLiteral(node.getLiteral(), node.getLang());
   } else {
     obj = dataFactory.getOWLLiteral(node.getLiteral(), dt);
   }
 }
Пример #2
0
 public boolean equals(Object obj) {
   if (super.equals(obj)) {
     if (!(obj instanceof OWLLiteral)) {
       return false;
     }
     OWLLiteral other = (OWLLiteral) obj;
     return literal.equals(other.getLiteral())
         && datatype.equals(other.getDatatype())
         && lang.equals(other.getLang());
   }
   return false;
 }
Пример #3
0
 @Override
 protected int compareObjectOfSameType(OWLObject object) {
   OWLLiteral other = (OWLLiteral) object;
   int diff = literal.compareTo(other.getLiteral());
   if (diff != 0) {
     return diff;
   }
   diff = datatype.compareTo(other.getDatatype());
   if (diff != 0) {
     return diff;
   }
   return lang.compareTo(other.getLang());
 }
 public void visit(OWLLiteral node) {
   if (preferredLanguages == null
       || preferredLanguages.isEmpty()) { // if there are no languages just match the first thing
     lastLangMatchIndex = 0;
     candidateValue = node;
   } else {
     final int index = preferredLanguages.indexOf(node.getLang());
     if (index >= 0 && index < lastLangMatchIndex) {
       lastLangMatchIndex = index;
       candidateValue = node;
     }
   }
 }
 private void appendTag(
     Paragraph tagParagraph, OWLLiteral literal, Color foreground, boolean isSelected) {
   Color tagColor = isSelected ? foreground : Color.GRAY;
   Color tagValueColor = isSelected ? foreground : Color.GRAY;
   if (literal.hasLang()) {
     tagParagraph.append("[language: ", tagColor);
     tagParagraph.append(literal.getLang(), tagValueColor);
     tagParagraph.append("]", tagColor);
   } else if (datatypeRendering == RENDER_DATATYPE_INLINE && !literal.isRDFPlainLiteral()) {
     tagParagraph.append("[type: ", tagColor);
     tagParagraph.append(
         editorKit.getOWLModelManager().getRendering(literal.getDatatype()), tagValueColor);
     tagParagraph.append("]", tagColor);
   }
   //        if (ontology != null) {
   //            tagParagraph.append("    ", foreground);
   //            tagParagraph.append("[in: ", tagColor);
   //            String ontologyRendering = editorKit.getOWLModelManager().getRendering(ontology);
   //            tagParagraph.append(ontologyRendering, tagColor);
   //            tagParagraph.append("]", tagColor);
   //        }
 }