if(rt.getFullname().equals("")) { relType= rt.getId(); relType= rt.getFullname();
/** * Extracts the label from a given RelationType. * * @param rt * ARelationType * @return String */ private String getLabel(RelationType rt) { String label = null; // first try fullname of rt label = rt.getFullname(); // else take id of rtset if (label.trim().length() == 0) { label = rt.getId(); } label = makeMaxLength(label); 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 relation type */ @Override public Object getElementAt(int index) { JLabel label = null; if (index > -1) { RelationType rt = relationTypes.get(index); String name = rt.getFullname(); if (name.trim().length() == 0) name = rt.getId(); label = new JLabel(name); label.setName(rt.getId()); label.setToolTipText("(" + rt.getId() + ") " + rt.getDescription().replaceAll("\\s+", " ")); } return label; }
/** * Extracts the label from a given edge. * * @param edge * ONDEXRelation * @return String */ private String getLabel(ONDEXRelation edge) { String label; // first try fullname of rt RelationType rt = edge.getOfType(); label = rt.getFullname(); // else take id of rt if (label.trim().length() == 0) { label = rt.getId(); } label = makeMaxLength(label); return label; }
/** * 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; }
/** * Generate metadata for Relation Type. * @param rt * Relation Type (from the Ondex API). * @return JSONObject * JSONObject containing information about the Relation Type. */ private JSONObject buildRelationType(RelationType rt) { JSONObject rtJson= new JSONObject(); rtJson.put(JSONAttributeNames.ID, rt.getId()); rtJson.put(JSONAttributeNames.FULLNAME, rt.getFullname()); rtJson.put(JSONAttributeNames.INVERSENAME, rt.getInverseName()); rtJson.put(JSONAttributeNames.ISANTISYMMETRIC, String.valueOf(rt.isAntisymmetric())); rtJson.put(JSONAttributeNames.ISREFLEXTIVE, String.valueOf(rt.isReflexive())); rtJson.put(JSONAttributeNames.ISTRANSITIVE, String.valueOf(rt.isTransitiv())); rtJson.put(JSONAttributeNames.ISSYMMETRIC, String.valueOf(rt.isSymmetric())); rtJson.put(JSONAttributeNames.DESCRIPTION, rt.getDescription()); // RelationType SpecialisationOf (optional). RelationType spec= rt.getSpecialisationOf(); if(spec != null) { rtJson.put(JSONAttributeNames.SPECIALISATIONOF, buildRelationType(spec)); } return rtJson; }
/** * 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; }
/** * For a given concept returns all connecting target concepts, usually the * reactions. * * @param c * ONDEXConcept * @return connecting target concepts */ private Set<ONDEXConcept> getTargets(ONDEXConcept c) throws NullValueException, AccessDeniedException { Set<ONDEXConcept> output = new HashSet<ONDEXConcept>(); for (ONDEXRelation r : graph.getRelationsOfConcept(c)) { if (!proc_subset || sourceRelations.contains(r)) { String relationType = r.getOfType().getFullname(); if (relationType == null) relationType = r.getOfType().getId(); if (!relationTypeToRegArc.contains(relationType) && !relationTypeToAnnotation.contains(relationType) && !getTarget(r).equals(c)) { output.add(getTarget(r)); } } } return output; }
/** * For a given concept returns all connecting source concepts, usually the * reactions. * * @param c * ONDEXConcept * @return connecting source concepts */ private Set<ONDEXConcept> getSources(ONDEXConcept c) { Set<ONDEXConcept> output = new HashSet<ONDEXConcept>(); for (ONDEXRelation r : graph.getRelationsOfConcept(c)) { if (!proc_subset || sourceRelations.contains(r)) { String relationType = r.getOfType().getFullname(); if (relationType == null) relationType = r.getOfType().getId(); if (!relationTypeToRegArc.contains(relationType) && !relationTypeToAnnotation.contains(relationType) && !getSource(r).equals(c)) { output.add(getSource(r)); } } } return output; }
/** * Which concepts are taking part in modifier relations for a given concept. * * @param c * ONDEXConcept with relations * @return modifier concepts */ private Set<ONDEXConcept> getModifiers(ONDEXConcept c) { Set<ONDEXConcept> output = new HashSet<ONDEXConcept>(); for (ONDEXRelation r : graph.getRelationsOfConcept(c)) { if (!proc_subset || sourceRelations.contains(r)) { String relationType = r.getOfType().getFullname(); if (relationType == null) relationType = r.getOfType().getId(); if (relationTypeToRegArc.contains(relationType) && !getSource(r).equals(c)) { output.add(getSource(r)); } } } return output; }
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 RelationType) { RelationType rt = (RelationType) o; if (rt.getFullname() == null || rt.getFullname().equals("")) variable.setText(rt.getId()); else variable.setText(rt.getFullname()); variable.setName(rt.getId()); variable.setToolTipText("Relation type");
/** * 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(); }
/** * For a given relation returns the source concept, observes the reverse * logic flag. * * @param r * ONDEXRelation * @return source concept */ private ONDEXConcept getSource(ONDEXRelation r) { String relationType = r.getOfType().getFullname(); if (relationType == null) relationType = r.getOfType().getId(); if (relationTypeReverseLogic.contains(relationType)) { return r.getToConcept(); } return r.getFromConcept(); }
/** * For a given relation returns the target concept, observes the reverse * logic flag. * * @param r * ONDEXRelation * @return target concept */ private ONDEXConcept getTarget(ONDEXRelation r) { String relationType = r.getOfType().getFullname(); if (relationType == null) relationType = r.getOfType().getId(); if (relationTypeReverseLogic.contains(relationType)) { return r.getFromConcept(); } return r.getToConcept(); }
nomd.createRelationType(rt.getId(), rt.getFullname(), rt .getDescription(), rt.getInverseName(), rt .isAntisymmetric(), rt.isReflexive(), rt.isSymmetric(),
/** * Cast a given RelationType into a BerkeleyRelationType. * * @param old * RelationType * @return BerkeleyRelationType */ protected static BerkeleyRelationType convert(RelationType old) { BerkeleyRelationType nu = new BerkeleyRelationType(old.getSID(), old.getId(), old.getFullname(), old.getDescription(), old.getInverseName(), old.isAntisymmetric(), old.isReflexive(), old.isSymmetric(), old.isTransitiv(), old.getSpecialisationOf()); return nu; }
title = relation.getOfType().getFullname();
ObjectProperty objectProperty = model.createObjectProperty(urlPrefixMetaData + rt.getId()); objectProperty.addComment(rt.getDescription(), "en"); objectProperty.addLabel(rt.getFullname(), "en");