/** * Generate metadata for Concept Class. * @param cc * A Concept Class (from the Ondex API). * @return String * String containing full name or id. */ private String/*JSONObject*/ buildConceptClass(ConceptClass cc) { String ofType; /* JSONObject ccJson= new JSONObject(); ccJson.put(JSONAttributeNames.ID, cc.getId()); ccJson.put(JSONAttributeNames.FULLNAME, cc.getFullname()); ccJson.put(JSONAttributeNames.DESCRIPTION, cc.getDescription()); // ConceptClass SpecialisationOf (optional). ConceptClass spec= cc.getSpecialisationOf(); if(spec != null) { ccJson.put(JSONAttributeNames.SPECIALISATIONOF, buildConceptClass(spec)); } */ if(cc.getFullname().equals("")) { ofType= cc.getId(); } else { ofType= cc.getFullname(); } return ofType/*ccJson*/; }
/** * Generate metadata for Concept Class. * @param cc * A Concept Class (from the Ondex API). * @return JSONObject * JSONObject containing information about the Concept Class. */ private String/*JSONObject*/ buildConceptClass(ConceptClass cc) { String ofType; /* JSONObject ccJson= new JSONObject(); ccJson.put(JSONAttributeNames.ID, cc.getId()); ccJson.put(JSONAttributeNames.FULLNAME, cc.getFullname()); ccJson.put(JSONAttributeNames.DESCRIPTION, cc.getDescription()); // ConceptClass SpecialisationOf (optional). ConceptClass spec= cc.getSpecialisationOf(); if(spec != null) { ccJson.put(JSONAttributeNames.SPECIALISATIONOF, buildConceptClass(spec)); } */ if(cc.getFullname().equals("")) { ofType= cc.getId(); } else { ofType= cc.getFullname(); } return ofType/*ccJson*/; }
/** * Extracts the label from a given ConceptClass. * * @param cc * ConceptClass * @return String */ private String getLabel(ConceptClass cc) { String label = null; // first try fullname of cc label = cc.getFullname(); // else take id of cc if (label.trim().length() == 0) { label = cc.getId(); } return label; }
/** * returns the name of the current variable. */ public String getVariableName() { if (variable instanceof AttributeName) return ((AttributeName) variable).getFullname(); else if (variable instanceof ConceptClass) return ((ConceptClass) variable).getFullname(); else if (variable instanceof RelationType) return ((RelationType) variable).getFullname(); else if (variable instanceof String) return (String) variable; else return null; }
/** * Returns a JLabel for the concept class */ @Override public Object getElementAt(int index) { JLabel label = null; if (index > -1) { ConceptClass cc = conceptClasses.get(index); String name = cc.getFullname(); if (name.trim().length() == 0) name = cc.getId(); label = new JLabel(name); label.setName(cc.getId()); label.setToolTipText("(" + cc.getId() + ") " + cc.getDescription()); } return label; }
/** * Return all concept classes from meta data either indexed by full name or * id. * * @param meta * ONDEXGraphMetaData * @return all concept classes indexed */ private Map<String, ConceptClass> getConceptClasses(ONDEXGraphMetaData meta) { Map<String, ConceptClass> conceptClasses = new HashMap<String, ConceptClass>(); for (ConceptClass cc : meta.getConceptClasses()) { String name = cc.getFullname(); if (name == null || name.trim().length() == 0) name = cc.getId(); name = Export.makeLower(name); if (conceptClasses.containsKey(name)) { errorReport.append("\n"); errorReport .append("getConceptClasses: Lower case concept class id already exists: "); errorReport.append(name); } conceptClasses.put(name, cc); conceptClasses.put(Export.makeLower(cc.getId()), cc); } return conceptClasses; }
/** * returns the value that is stored in the table for the given * coordinates (row and column). * * @see javax.swing.table.TableModel#getValueAt(int, int) */ public Object getValueAt(int row, int col) { Object o = rowData[row][col]; if (o instanceof AttributeName) { AttributeName an = (AttributeName) o; if (an.getFullname() == null || an.getFullname().trim().equals("")) return an.getId(); else return an.getFullname(); } else if (o instanceof ConceptClass) { ConceptClass cc = (ConceptClass) o; if (cc.getFullname() == null || cc.getFullname().trim().equals("")) return cc.getId(); else return cc.getFullname(); } else if (o instanceof RelationType) { RelationType rt = (RelationType) o; if (rt.getFullname() == null || rt.getFullname().trim().equals("")) return rt.getId(); else return rt.getFullname(); } else return o; }
public void start() { ONDEXGraphMetaData metadata = graph.getMetaData(); for (ConceptClass cc : metadata.getConceptClasses()) { System.out.println("ConceptClass " + cc.getId() + " " + cc.getFullname()); System.out.println("\tConcepts = " + graph.getConceptsOfConceptClass(cc).size()); } for (DataSource dataSource : metadata.getDataSources()) { System.out.println("DataSource " + dataSource.getId() + " " + dataSource.getFullname()); System.out.println("\tConcepts = " + graph.getConceptsOfDataSource(dataSource).size()); } for (AttributeName att : metadata.getAttributeNames()) { System.out.println("AttributeName " + att.getId() + " " + att.getFullname()); System.out.println("\tConcepts = " + graph.getConceptsOfAttributeName(att).size()); System.out.println("\tRelations = " + graph.getRelationsOfAttributeName(att).size()); } for (RelationType rt : metadata.getRelationTypes()) { System.out.println("RelationType " + rt.getId() + " " + rt.getFullname()); System.out.println("\tRelations = " + graph.getRelationsOfRelationType(rt).size()); } }
} else if (o instanceof ConceptClass) { ConceptClass cc = (ConceptClass) o; if (cc.getFullname() == null || cc.getFullname().equals("")) variable.setText(cc.getId()); else variable.setText(cc.getFullname()); variable.setName(cc.getId()); variable.setToolTipText("Concept class");
/** * Constructs user input to add a ConceptClass. * * @param aog * AbstractONDEXGraph to add to * @param conceptClass * Concept Class to use */ public DialogConceptClass(ONDEXGraph aog, ConceptClass conceptClass) { super("Dialog.ConceptClass.Title", "Properties16.gif"); this.aog = aog; initSpecialisationOf(); // set existing information id.setText(conceptClass.getId()); fullname.setText(conceptClass.getFullname()); description.setText(conceptClass.getDescription()); ConceptClass specialisation = conceptClass.getSpecialisationOf(); if (specialisation != null) specialisationOf.setSelectedItem(specialisation.getId()); // set everything to disabled id.setEditable(false); fullname.setEditable(false); description.setEnabled(false); specialisationOf.setEnabled(false); this.getContentPane().setLayout(new BorderLayout()); this.getContentPane().add(makeProperties(), BorderLayout.CENTER); this.getContentPane().add(makeButtonsPanel(null, "Dialog.ConceptClass.Cancel"), BorderLayout.SOUTH); this.pack(); }
/** * Counts how many relations which are modifiers exist for a given concept. * * @param c * ONDEXConcept with relations * @return number of modifier relations */ private int getModifierRelationsCout(ONDEXConcept c) { Set<ONDEXRelation> output = new HashSet<ONDEXRelation>(); for (ONDEXRelation r : graph.getRelationsOfConcept(c)) { if (!proc_subset || sourceRelations.contains(r)) { String relationType = r.getOfType().getFullname(); if (relationType == null) relationType = r.getOfType().getId(); String targetRelationType = getTarget(r).getOfType().getFullname(); if (targetRelationType == null) targetRelationType = getTarget(r).getOfType().getId(); if (relationTypeToRegArc.contains(relationType) && !relationTypeToAnnotation.contains(relationType) && !getTarget(r).equals(c) && !conceptClassToReaction.contains(targetRelationType)) { output.add(r); } } } return output.size(); }
label.setToolTipText(cc.getFullname()); contentPane.add(label); labelsSecondStep.add(label); String ccid = cc.getFullname(); if (ccid == null || ccid.trim().length() == 0) ccid = cc.getId();
/** * Cast a given ConceptClass into a BerkeleyConceptClass. * * @param old * ConceptClass * @return BerkeleyConceptClass */ protected static BerkeleyConceptClass convert(ConceptClass old) { BerkeleyConceptClass nu = new BerkeleyConceptClass(old.getSID(), old.getId(), old.getFullname(), old.getDescription(), old.getSpecialisationOf()); return nu; }
String conceptClass = c.getOfType().getFullname(); if (conceptClass == null) conceptClass = c.getOfType().getId();
/** * @param ccs * @param omd * copy from MetaData * @param nomd * copy to MetaData */ private void copyConceptClasses(Iterable<ConceptClass> ccs, ONDEXGraphMetaData omd, ONDEXGraphMetaData nomd) { // "specializations_of"s that occur before there specialization HashSet<ConceptClass> ccDependencyNotResolved = new HashSet<ConceptClass>(); for (ConceptClass cc : ccs) { ConceptClass ccSpec = cc.getSpecialisationOf(); ConceptClass newCCSpec = null; if (ccSpec != null) { newCCSpec = nomd.getConceptClass(ccSpec.getId()); if (newCCSpec == null) { ccDependencyNotResolved.add(cc); continue; } } if (!nomd.checkConceptClass(cc.getId())) nomd.createConceptClass(cc.getId(), cc.getFullname(), cc .getDescription(), newCCSpec); } // recursively resolve specialisations if (ccDependencyNotResolved.size() > 0) { copyConceptClasses(ccDependencyNotResolved, omd, nomd); } }
String conceptType= con.getOfType().getFullname(); // conceptType. if(conceptType.equals("")) {
writer.write("label=\"" + trimString(cn.getName()) + "\""); } else { String name = c.getOfType().getFullname(); if (name == null || name.trim().length() == 0) name = c.getOfType().getId();
else name = concept.getOfType().getFullname();
xmlw.writeCharacters(cc.getFullname()); xmlw.writeEndElement();
rdfsClass.addLabel(cc.getFullname(), "en"); rdfsClass.addComment(cc.getDescription(), "en");