@Override public boolean equals(Object o) { if (this == o) return true; if (o instanceof ConceptName) { ConceptName cn = (ConceptName) o; return this.name.equals(cn.getName()); } return false; }
private String getShortestPreferredConceptName(Set<ConceptName> conames) { String shortest_coname=" "; int length= 100000; for(ConceptName coname : conames) { if((coname.isPreferred()) && (coname.getName() != null)) { // if((coname.getName().trim().length() >= 3) && (coname.getName().trim().length() <= 6)) { if(coname.getName().trim().length() <= length) { shortest_coname= coname.getName().trim(); // use this preferred concept name instead. length= shortest_coname.length(); } } } return shortest_coname; }
private String getShortestPreferredConceptName(Set<ConceptName> conames) { String shortest_coname=" "; int length= 100000; for(ConceptName coname : conames) { if((coname.isPreferred()) && (coname.getName() != null)) { // if((coname.getName().trim().length() >= 3) && (coname.getName().trim().length() <= 6)) { if(coname.getName().trim().length() <= length) { shortest_coname= coname.getName().trim(); // use this preferred concept name instead. length= shortest_coname.length(); } } } return shortest_coname; }
private String getShortestPreferredConceptName(Set<ConceptName> conames) { String shortest_coname=" "; int length= 100000; for(ConceptName coname : conames) { // System.out.println("\t coname: "+ coname.getName().trim() +", isPreferred: "+ coname.isPreferred()); if((coname.isPreferred()) && (coname.getName() != null)) { // if((coname.getName().trim().length() >= 3) && (coname.getName().trim().length() <= 6)) { if(coname.getName().trim().length() <= length) { shortest_coname= coname.getName().trim(); // use this preferred concept name instead. length= shortest_coname.length(); } } } // System.out.println("\t shortest_coname: "+ shortest_coname); return shortest_coname; }
private String getShortestPreferredConceptName(Set<ConceptName> conames) { String shortest_coname=" "; int length= 100000; for(ConceptName coname : conames) { // System.out.println("\t coname: "+ coname.getName().trim() +", isPreferred: "+ coname.isPreferred()); if((coname.isPreferred()) && (coname.getName() != null)) { // if((coname.getName().trim().length() >= 3) && (coname.getName().trim().length() <= 6)) { if(coname.getName().trim().length() <= length) { shortest_coname= coname.getName().trim(); // use this preferred concept name instead. length= shortest_coname.length(); } } } // System.out.println("\t shortest_coname: "+ shortest_coname); return shortest_coname; }
/** * Generate metadata for Concept Name. * @param coname * A Concept Name (from the Ondex API). * @return JSONObject * JSONObject containing information about the Concept Name. */ private JSONObject buildConceptName(ConceptName coname) { JSONObject conameJson= new JSONObject(); conameJson.put(JSONAttributeNames.NAME, coname.getName()); conameJson.put(JSONAttributeNames.ISPREFERRED, String.valueOf(coname.isPreferred())); return conameJson; }
/** * Generate metadata for Concept Name. * @param coname * A Concept Name (from the Ondex API). * @return JSONObject * JSONObject containing information about the Concept Name. */ private JSONObject buildConceptName(ConceptName coname) { JSONObject conameJson= new JSONObject(); conameJson.put(JSONAttributeNames.NAME, coname.getName()); conameJson.put(JSONAttributeNames.ISPREFERRED, String.valueOf(coname.isPreferred())); return conameJson; }
/** * Creates a name on concept only if it does not already exists * * @param target * - relation * @param newName * - attribute to create * @throws AccessDeniedException * @throws EmptyStringException * @throws NullValueException */ public static void addNewName(ONDEXConcept target, ConceptName newName) throws NullValueException, EmptyStringException, AccessDeniedException { if (target.getConceptName(newName.getName()) == null) target.createConceptName(newName.getName(), false); }
@Override public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { // which concept we are working on concept = (ONDEXConcept) table.getValueAt(row, 0); // check for concept name values if (value instanceof ConceptName) { name = (ConceptName) value; value = name.getName(); } else { name = null; } // use default text field editor return super.getTableCellEditorComponent(table, value, isSelected, row, column); }
/** * helper method to extract a usable concept name. * * @param c * a concept. * @return a usable name. */ private String extractName(ONDEXConcept c) { String str = ""; if (c.getConceptName() != null) str = c.getConceptName().getName(); if (str.trim().length() == 0) str = c.getPID(); if (str.trim().length() == 0) str = c.getId() + ""; return str; }
public void filter(Set<ONDEXConcept> ov) throws NullValueException, EmptyStringException, AccessDeniedException{ for(ONDEXConcept c : ov){ boolean addToset = true; for(ConceptAttributeChecker chk :conditions.values()){ if(!chk.check(c)){ addToset = false; break; } } System.err.println("Deleted: "+c.getConceptName().getName()); if(addToset)graph.deleteConcept(c.getId()); } } }
public static String getName(ONDEXConcept c, String prefix){ String name; ConceptName cn = c.getConceptName(); if(cn != null ){ name = c.getConceptName().getName(); if(name == null || name.trim().equals("")){ name = prefix+c.getId(); } } else{ name = prefix+c.getId(); } return name; }
@Override public String toString(TableModel model, int row, int column) { Object o = model.getValueAt(row, column); if (o instanceof MetaData) return ((MetaData) o).getId(); else if (o instanceof ONDEXConcept) return String.valueOf(((ONDEXConcept) o).getId()); else if (o instanceof ONDEXRelation) return String.valueOf(((ONDEXRelation) o).getId()); else if (o instanceof ConceptName) return ((ConceptName) o).getName(); else if (o instanceof ConceptAccession) return ((ConceptAccession) o).getAccession(); else if (o instanceof Attribute) return ((Attribute) o).getValue().toString(); else if (o != null) return o.toString(); else return ""; }
/** * Copies all names from old concept to new concept. * * @param oldC * old ONDEXConcept * @param newC * new ONDEXConcept */ private void copyNames(ONDEXConcept oldC, ONDEXConcept newC) { // iterate over all old names for (ConceptName name : oldC.getConceptNames()) { // clone old name on new concept newC.createConceptName(name.getName(), name.isPreferred()); } }
/** * Returns a JLabel for the concept */ @Override public Object getElementAt(int index) { JLabel label = null; if (index > -1) { ONDEXConcept ac = concepts.get(index); String name = null; ConceptName cn = ac.getConceptName(); if (cn != null) name = cn.getName(); else name = String.valueOf(ac.getId()); label = new JLabel(name); label.setName(String.valueOf(ac.getId())); label.setToolTipText("(" + ac.getId() + ") " + ac.getDescription()); } return label; }
public static BerkeleyConceptName convert(ConceptName old) { long sid = old.getSID(); BerkeleyConceptName nu = new BerkeleyConceptName(sid, old.getOwnerId(), old.getName(), old.isPreferred()); return nu; }
/** * Constructs the local name of a given concept. * * @param c * ONDEXConcept * @return String */ private String getLocalName(ONDEXConcept c) { String local = String.valueOf(c.getId()); if (concat) { // check if preferred name is present ConceptName preferredName = c.getConceptName(); if (preferredName != null) { local = local + ": " + quote(preferredName.getName()); } else { // use PID as fall-back local = local + ": " + quote(c.getPID()); } } return local; }
/** * Tries to get the most worthwhile identifier for the concept * * @param c * - concept * @return - some id (in order of decreasing preference: name, pid, * description, concepts class+is) */ private static String getSomething(ONDEXConcept c) { if (c.getConceptName() != null) { return c.getConceptName().getName(); } if (c.getPID() != null && c.getPID().equals("")) { return c.getPID(); } if (c.getDescription() != null && c.getDescription().equals("")) { return c.getDescription(); } return "[" + c.getOfType().getId() + " " + c.getId() + "]"; }