@Override protected Set<RelationType> retrieveRelationTypeAll() { return parent.getRelationTypes(); }
Set<RelationType> loopsOver() { return metadata.getRelationTypes(); } int counting(RelationType rt) { return graph.getRelationsOfRelationType(rt).size(); }
/** * Update all labels from the graph. * */ public void updateAll() { for (RelationType rt : graph.getMetaData().getRelationTypes()) { labels.put(rt, getLabel(rt)); } }
/** * Loads available RelationTypes into ComboBox. * */ private void initSpecialisationOf() { // get list of available rts Vector<String> relationTypes = new Vector<String>(); relationTypes.add(""); RelationType[] sorted = aog.getMetaData().getRelationTypes().toArray(new RelationType[0]); Arrays.sort(sorted, new CaseInsensitiveMetaDataComparator()); for (RelationType rt : sorted) { relationTypes.add(rt.getId()); } specialisationOf = new JComboBox(relationTypes); }
private String[] getRelationTypeNames() { // only add non-empty relation types Set<RelationType> rts = new HashSet<RelationType>(); for (RelationType rt : graph.getMetaData().getRelationTypes()) { if (graph.getRelationsOfRelationType(rt).size() > 0) { rts.add(rt); } } String[] names = new String[rts.size()]; int i = 0; for (RelationType rt : rts) { names[i] = rt.getId(); i++; } Arrays.sort(names); return names; }
/** * Loads available RelationTypes into ComboBox. * */ protected void initRelationType(String selected) { // get list of available relation types Vector<String> relationTypes = new Vector<String>(); relationTypes.add(""); relationTypes.add(Config.language.getProperty("Dialog.Relation.CreateRelationType")); RelationType[] sorted = graph.getMetaData().getRelationTypes().toArray(new RelationType[0]); Arrays.sort(sorted, new CaseInsensitiveMetaDataComparator()); for (RelationType rt : sorted) { relationTypes.add(rt.getId()); } relationType.removeAllItems(); for (String rt : relationTypes) { relationType.addItem(rt); } if (selected != null) relationType.setSelectedItem(selected); relationType.revalidate(); }
/** * Fakes a table cell editor based around a JTextField. * */ public RelationTableCellEditor(ONDEXGraph g) { super(new JTextField()); // keep local graph reference graph = g; cloner = new RelationCloner(graph); updateConceptLists(); rtComboBox = new JComboBox(graph.getMetaData().getRelationTypes().toArray(new RelationType[0])); etComboBox = new JComboBox(graph.getMetaData().getEvidenceTypes().toArray(new EvidenceType[0])); }
/** * Initialises the table data for relation types with default size. * * @return table data */ private Object[][] extractRelationTypes() { // get all relation types and check for visible relations List<String> rts = new ArrayList<String>(); for (RelationType rt : graph.getMetaData().getRelationTypes()) { if (graph.getRelationsOfRelationType(rt).size() > 0) { rts.add(rt.getId()); } } // sort by relation type ids String[] rtsSorted = rts.toArray(new String[0]); Arrays.sort(rtsSorted, String.CASE_INSENSITIVE_ORDER); // initialise data with default size Object[][] rtData = new Object[rtsSorted.length][2]; for (int i = 0; i < rtsSorted.length; i++) { rtData[i][0] = rtsSorted[i]; rtData[i][1] = Config.defaultEdgeSize; } return rtData; }
/** * Return all relation types from meta data either indexed by full name or * id. * * @param meta * ONDEXGraphMetaData * @return all relation types indexed */ private Map<String, RelationType> getRelationTypes(ONDEXGraphMetaData meta) { Map<String, RelationType> relationTypes = new HashMap<String, RelationType>(); for (RelationType rt : meta.getRelationTypes()) { String name = rt.getFullname(); if (name == null || name.trim().length() == 0) name = rt.getId(); name = Export.makeLower(name); if (relationTypes.containsKey(name)) { errorReport.append("\n"); errorReport .append("getRelationTypes: Lower case relation type id already exists: "); errorReport.append(name); } relationTypes.put(name, rt); relationTypes.put(Export.makeLower(rt.getId()), rt); } return relationTypes; }
/** * Update all colours from the graph. * */ public void updateAll() { for (RelationType rt : graph.getMetaData().getRelationTypes()) { // update with a dummy edge updateColor(new ONDEXMetaRelation(graph, rt, null)); } }
/** * Creates a ComboBox which contains both concept classes and relation * types. * * @return ONDEX entity types ComboBox */ private JComboBox getEntityTypeComboBox() { JComboBox cb = new JComboBox(); // first add concept classes, sorted by ID Set<ConceptClass> ccs = graph.getMetaData().getConceptClasses(); ConceptClass[] arrayCC = ccs.toArray(new ConceptClass[0]); Arrays.sort(arrayCC); for (ConceptClass cc : arrayCC) { // only add meta data if used if (graph.getConceptsOfConceptClass(cc).size() > 0) cb.addItem(cc); } // second add relation types, sorted by ID Set<RelationType> rts = graph.getMetaData().getRelationTypes(); RelationType[] arrayRT = rts.toArray(new RelationType[0]); Arrays.sort(arrayRT); for (RelationType rt : arrayRT) { // only add meta data if used if (graph.getRelationsOfRelationType(rt).size() > 0) cb.addItem(rt); } return cb; }
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()); } }
rtList.addListSelectionListener(this); for (RelationType rt : aog.getMetaData().getRelationTypes()) { if (aog.getRelationsOfRelationType(rt).size() > 0) rtListModel.addRelationType(rt);
/** * Updates the current hold meta data * */ public void updateMetaData() { edges.clear(); vertices.clear(); // sync existing concept classes/relation types for (ConceptClass cc : graph.getMetaData().getConceptClasses()) { if (graph.getConceptsOfConceptClass(cc).size() > 0) createVertexForConceptClass(cc); } for (RelationType rt : graph.getMetaData().getRelationTypes()) { if (graph.getRelationsOfRelationType(rt).size() > 0) createEdgeForRelationType(rt); } // refresh possible meta data legend if (ViewMenuAction.isLegendShown()) ViewMenuAction.getLegend().actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, OVTK2Legend.REFRESH)); }
Stream.of ( metaData.getConceptClasses (), metaData.getRelationTypes (), metaData.getAttributeNames (), metaData.getEvidenceTypes (),
/** * Builds an XML ondex meta data XML Element. * * @param xmlw * xml stream to write in * @param graphdata * AbstractONDEXGraphMetaData * @throws XMLStreamException * if xml writing fails */ private void buildOndexMetaDataTag(XMLStreamWriter2 xmlw, ONDEXGraphMetaData graphdata) throws XMLStreamException { Set<DataSource> itDataSource = graphdata.getDataSources(); Set<Unit> itUnit = graphdata.getUnits(); Set<AttributeName> itAn = graphdata.getAttributeNames(); Set<EvidenceType> itEt = graphdata.getEvidenceTypes(); Set<ConceptClass> itCc = graphdata.getConceptClasses(); Set<RelationType> itRt = graphdata.getRelationTypes(); buildOndexMetaDataTag(xmlw, itDataSource, itUnit, itAn, itEt, itCc, itRt); }
for (RelationType rt : graph.getMetaData().getRelationTypes()) {
.getRelationTypes(); fireEventOccurred(new GeneralOutputEvent("\nRelationTypes: " + rtit.size(), getCurrentMethodName())); rtit = null;
for (RelationType rt : omd.getRelationTypes()) { ObjectProperty objectProperty = model.createObjectProperty(urlPrefixMetaData + rt.getId()); objectProperty.addComment(rt.getDescription(), "en"); for (RelationType rt : omd.getRelationTypes()) { ObjectProperty objectProperty = model.getObjectProperty(urlPrefixMetaData + rt.getId()); RelationType superRt = rt.getSpecialisationOf();
Set<RelationType> rts = omd.getRelationTypes(); copyRelationTypes(rts, omd, nomd);