String getAttributeName() { if (an.getFullname() != null) return an.getFullname(); else return an.getId(); }
/** * 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; }
/** * @see net.sourceforge.ondex.ovtk2.ui.contentsdisplay.AbstractContentDisplayPlugin#compileContent(net.sourceforge.ondex.core.AbstractONDEXEntity) */ @Override public String compileContent(ONDEXEntity e) { StringBuffer b = new StringBuffer(); // get attribute from concept and relation Attribute g = e.getAttribute(att); if (g != null && g.getValue() instanceof String) { String string = (String) g.getValue(); // make hyper-links explicit for PLUGINS-52 if (string.startsWith("http://") || string.startsWith("https://")) { string = "<a href=\"" + string + "\">" + string + "</a>"; } String name = att.getFullname(); if (name == null || name.trim().length() == 0) name = att.getId(); b.append("<h2>" + name + "</h2>"); b.append(string + "<br/>"); } return b.toString(); }
/** * @see net.sourceforge.ondex.ovtk2.ui.contentsdisplay.AbstractContentDisplayPlugin#compileContent(net.sourceforge.ondex.core.AbstractONDEXEntity) */ @Override public String compileContent(ONDEXEntity e) { StringBuffer b = new StringBuffer(); // get attribute from concept and relation Attribute g = e.getAttribute(att); if (g != null && g.getValue() instanceof Boolean) { String name = att.getFullname(); if (name == null || name.trim().length() == 0) name = att.getId(); b.append("<h2>" + name + "?</h2>"); b.append(g.getValue().toString() + "<br/>"); } return b.toString(); }
/** * @see net.sourceforge.ondex.ovtk2.ui.contentsdisplay.AbstractContentDisplayPlugin#compileContent(net.sourceforge.ondex.core.AbstractONDEXEntity) */ @Override public String compileContent(ONDEXEntity e) { StringBuffer b = new StringBuffer(); // get attribute from concept and relation Attribute g = e.getAttribute(att); if (g != null && g.getValue() instanceof Number) { Number number = (Number) g.getValue(); String name = att.getFullname(); if (name == null || name.trim().length() == 0) name = att.getId(); b.append("<h2>" + name + "</h2>"); b.append(number.toString() + "<br/>"); } return b.toString(); }
/** * Returns a JLabel for the attribute name */ @Override public Object getElementAt(int index) { JLabel label = null; if (attributeNames.size() == 0 && index == 0) { label = new JLabel("no attributes present!"); } else if (index > -1) { AttributeName an = attributeNames.get(index); String name = an.getFullname(); if (name.trim().length() == 0) name = an.getId(); label = new JLabel(name); label.setName(an.getId()); label.setToolTipText("(" + an.getId() + ") " + an.getDescription()); } return label; }
/** * Return all attribute names from meta data either indexed by full name or * id. * * @param meta * ONDEXGraphMetaData * @return all attribute names indexed */ private Map<String, AttributeName> getAttributeNames(ONDEXGraphMetaData meta) { Map<String, AttributeName> attributeNames = new HashMap<String, AttributeName>(); for (AttributeName an : meta.getAttributeNames()) { String name = an.getFullname(); if (name == null || name.trim().length() == 0) name = an.getId(); name = Export.makeLower(name); if (attributeNames.containsKey(name)) { errorReport.append("\n"); errorReport .append("getAttributeNames: Lower case attribute name id already exists: "); errorReport.append(name); } attributeNames.put(name, an); attributeNames.put(Export.makeLower(an.getId()), an); } return attributeNames; }
attribute= attrName.getFullname();
/** * 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; }
/** * Generate metadata for Attribute Name. * @param attr * An AttributeName (from the Ondex API). * @return JSONObject * JSONObject containing information about the Attribute. */ private JSONObject buildAttributeName(AttributeName attrName) { JSONObject attrNameJson= new JSONObject(); attrNameJson.put(JSONAttributeNames.ID, attrName.getId()); attrNameJson.put(JSONAttributeNames.FULLNAME, attrName.getFullname()); // Attribute Unit (optional). Unit attrUnit= attrName.getUnit(); if(attrUnit != null) { attrNameJson.put(JSONAttributeNames.UNIT, buildUnit(attrUnit)); } attrNameJson.put(JSONAttributeNames.DATATYPE, attrName.getDataTypeAsString()); attrNameJson.put(JSONAttributeNames.DESCRIPTION, attrName.getDescription()); // Attribute SpecialisationOf (optional). AttributeName spec= attrName.getSpecialisationOf(); if(spec != null) { attrNameJson.put(JSONAttributeNames.SPECIALISATIONOF, buildAttributeName(spec)); } return attrNameJson; }
if (o instanceof AttributeName) { AttributeName an = (AttributeName) o; if (an.getFullname() == null || an.getFullname().trim().equals("")) variable.setText(an.getId()); else variable.setText(an.getFullname()); variable.setName(an.getId()); variable.setToolTipText("Attribute");
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()); } }
attrID= attr.getOfType().getFullname();
/** * Checks for selections in AttributeName list. */ public void valueChanged(ListSelectionEvent e) { JList list = ((JList) e.getSource()); AttributeNameListModel model = (AttributeNameListModel) list.getModel(); int index = list.getSelectedIndex(); if (index > -1 && !model.isEmpty()) { goButton.setEnabled(true); targetAttributeName = model.getAttributeNameAt(index); chart.getXYPlot().setDataset(createDataset()); String label = targetAttributeName.getFullname(); if (label == null || label.trim().length() == 0) label = targetAttributeName.getId(); chart.getXYPlot().getDomainAxis().setLabel(label); chart.fireChartChanged(); } }
AttributeName attNew = ondexMetaData.getAttributeName(name); if (attNew == null) attNew = ondexMetaData.createAttributeName(name, att.getFullname(), att.getDescription(), att.getUnit(), att.getDataType(), att.getSpecialisationOf());
/** * Cast a given AttributeName into a BerkeleyAttributeName. * * @param old * AttributeName * @return BerkeleyAttributeName */ protected static BerkeleyAttributeName convert(AttributeName old) { BerkeleyAttributeName nu = new BerkeleyAttributeName(old.getSID(), old.getId(), old.getFullname(), old.getDescription(), old.getUnit(), old.getDataTypeAsString(), old.getSpecialisationOf()); return nu; }
/** * @param attNames * @param omd * copy from MetaData * @param nomd * copy to MetaData */ private void copyAttributeNames(Iterable<AttributeName> attNames, ONDEXGraphMetaData omd, ONDEXGraphMetaData nomd) { // "specializations_of"s that occur before there specialisation HashSet<AttributeName> atDependencyNotResolved = new HashSet<AttributeName>(); for (AttributeName att : attNames) { AttributeName spec = att.getSpecialisationOf(); AttributeName newSpec = null; if (spec != null) { newSpec = nomd.getAttributeName(spec.getId()); if (newSpec == null) { atDependencyNotResolved.add(att); continue; } } if (!nomd.checkAttributeName(att.getId())) nomd.createAttributeName(att.getId(), att.getFullname(), att .getDescription(), att.getUnit(), att.getDataType(), newSpec); } if (atDependencyNotResolved.size() > 0) { copyAttributeNames(atDependencyNotResolved, omd, nomd); } }
/** * Creates a chart. * * @param dataset * a dataset. * @return A chart. */ private JFreeChart createChart(SimpleHistogramDataset dataset) { String label = "Value"; if (targetAttributeName != null) { label = targetAttributeName.getFullname(); if (label == null || label.trim().length() == 0) label = targetAttributeName.getId(); } chart = ChartFactory.createHistogram(null, label, "Histogram", dataset, PlotOrientation.VERTICAL, false, true, false); chart.setBackgroundPaint(Color.white); XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.white); plot.getRenderer().setSeriesPaint(0, new Color(0x7f9f51)); plot.setDomainGridlinePaint(Color.lightGray); plot.setRangeGridlinePaint(Color.lightGray); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); return chart; }
if (an == null) { an = meta.getFactory().createAttributeName(id, anOriginal.getFullname(), anOriginal.getDataType(), anOriginal.getSpecialisationOf()); break;
if (an == null) { an = meta.getFactory().createAttributeName(id, anOriginal.getFullname(), anOriginal.getDataType(), anOriginal.getSpecialisationOf()); break;