@Override protected ONDEXRelation reallyGetEntity(int i) { return aog.getRelation(i); } };
for (ONDEXRelation protFamRelation : graph.getRelationsOfConcept(protFam)) { if (go.contains(protFamRelation.getToConcept().getOfType())) { if (graph.getRelation(protein, protFamRelation.getToConcept(), rtMis) == null) { graph.getFactory().createRelation(protein, protFamRelation.getToConcept(), rtMis, eqTrans);
/** * @param fromConcept * @param toConcept * @param ofType * @return * @see net.sourceforge.ondex.core.ONDEXGraph#getRelation(net.sourceforge.ondex.core.ONDEXConcept, * net.sourceforge.ondex.core.ONDEXConcept, * net.sourceforge.ondex.core.RelationType) */ public ONDEXRelation getRelation(ONDEXConcept fromConcept, ONDEXConcept toConcept, RelationType ofType) { return og.getRelation(fromConcept, toConcept, ofType); }
@Override protected ONDEXRelation reallyGetEntity(int i) { return aog.getRelation(i); } };
/** * @param id * @return * @see net.sourceforge.ondex.core.ONDEXGraph#getRelation(int) */ public ONDEXRelation getRelation(int id) { return og.getRelation(id); }
public Collection<ONDEXRelation> getRelationSet() { Vector<ONDEXRelation> rs = new Vector<ONDEXRelation>(); for (int r : rels) rs.add(aog.getRelation(r)); if (DEBUG) System.out.println(">>>>> found " + rs.size() + " relations"); return rs; }
/** * Converts a collection of ids to a set of respective relations * * @param graph * @param ids * @return */ public static Set<ONDEXRelation> toRelations(ONDEXGraph graph, Collection<Integer> ids){ Set<ONDEXRelation> cs = new HashSet<ONDEXRelation>(); for(Integer id: ids){ cs.add(graph.getRelation(id)); } return cs; } }
@Override protected ONDEXRelation retrieveRelation(int id) { ONDEXRelation r = parent.getRelation(id); if (r != null) { return new LuceneRelation(sid, this, r); } else { return null; } }
/** * @param rid * the relation id in the original graph * @return the relation in the new graph */ public ONDEXRelation cloneRelation(int rid) { return cloneRelation(origGraph.getRelation(rid)); }
public ONDEXRelation createRealtion(ONDEXConcept from, ONDEXConcept to, RelationType rt) { ONDEXRelation result = graph.getRelation(from, to, rt); if (result == null) { result = graph.getFactory().createRelation(from, to, rt, evidence); } return result; }
private static ONDEXRelation createRealtion(ONDEXGraph graph, ONDEXConcept from, ONDEXConcept to, RelationType ofType, EvidenceType ev) { ONDEXRelation result = graph.getRelation(from, to, ofType); if (result == null) { result = graph.getFactory().createRelation(from, to, ofType, ev); } return result; }
private Path(List<Integer> ids) throws MalformedPathException { path = new ONDEXEntity[ids.size()]; for (int i = 0; i < path.length; i++) { if (i % 2 == 0) { path[i] = og.getConcept(ids.get(i)); if (path[i] == null) { throw new MalformedPathException("No concept for id "+ids.get(i)); } } else { path[i] = og.getRelation(ids.get(i)); if (path[i] == null) { throw new MalformedPathException("No relation for id"+ids.get(i)); } } } } public ONDEXConcept head() {
ONDEXRelation relation = graph.getRelation(relationId); relation.createAttribute(specAtt, specificity, false); relation.createAttribute(degreeAtt, (int) numRelations,
/** * @throws NullValueException * if from- or to-concept are null * @see net.sourceforge.ondex.core.base.AbstractONDEXGraph#retrieveRelation(net.sourceforge.ondex.core.ONDEXConcept, * net.sourceforge.ondex.core.ONDEXConcept, * net.sourceforge.ondex.core.ONDEXConcept, * net.sourceforge.ondex.core.RelationType) */ @Override protected ONDEXRelation retrieveRelation(ONDEXConcept fromConcept, ONDEXConcept toConcept, RelationType ofType) throws NullValueException { ONDEXRelation r = parent.getRelation( ((LuceneConcept) fromConcept).getParent(), ((LuceneConcept) toConcept).getParent(), ofType); if (r != null) { return new LuceneRelation(sid, this, r); } else { return null; } }
/** * Will add a specified tag concept to all members of this subgraph * * @param tag - a tag concept */ public void addTag(ONDEXConcept tag) { int conceptCounter = 0; for(ONDEXConcept c : concepts) { if (graph.getConcept(c.getId()) != null) { graph.getConcept(c.getId()).addTag(tag); conceptCounter++; } } int relationCounter = 0; for(ONDEXRelation r : relations) { if (graph.getRelation(r.getId()) != null) { graph.getRelation(r.getId()).addTag(tag); relationCounter++; } } System.err.println("Assigned tag to " + conceptCounter + " concepts and " + relationCounter + " relations."); }
throw new RelationTypeMissingException(rtPartOf + " is missing."); ONDEXRelation r = graph.getRelation(pathC, pathwayC, rt); if (r != null) {
if (fromConcept.getId() != hit.getTargetId()){ ONDEXConcept toConcept = graph.getConcept(hit.getTargetId()); ONDEXRelation relation = graph.getRelation(fromConcept,toConcept,rtSet);
newR = graph.getRelation(newC, oldR.getToConcept(), oldR.getOfType()); if (newR == null) newR = graph.createRelation(newC, oldR.getToConcept(), oldR.getOfType(), oldR.getEvidence()); case TO: newR = graph.getRelation(oldR.getFromConcept(), newC, oldR.getOfType()); if (newR == null) newR = graph.createRelation(oldR.getFromConcept(), newC, oldR.getOfType(), oldR.getEvidence());
/** * Clone relation with having a new RelationType. * * @param oldR * old ONDEXRelation * @param newRT * new RelationType to use * @return new ONDEXRelation */ public ONDEXRelation clone(ONDEXRelation oldR, RelationType newRT) { // first clone concept with new ConceptClass ONDEXRelation newR = graph.getRelation(oldR.getFromConcept(), oldR.getToConcept(), oldR.getOfType()); if (newR == null) graph.createRelation(oldR.getFromConcept(), oldR.getToConcept(), oldR.getOfType(), oldR.getEvidence()); // copies everything else copyEverythingElse(oldR, newR); return newR; }
/** * This function will create a context from a set of concepts and relations * currently selected in the graph * * @param viewer * - viewer * @param name * - name that the new context will have */ public static void createContextFromSelection(OVTK2PropertiesAggregator viewer, String name) { ONDEXGraph graph = viewer.getONDEXJUNGGraph(); ONDEXConcept context = graph.getFactory().createConcept(name, createDataSource(graph, "unknown"), createCC(graph, "Thing"), createEvidence(graph, "manual")); context.createConceptName(name, true); PickedState<ONDEXRelation> stateE = viewer.getVisualizationViewer().getPickedEdgeState(); Set<ONDEXRelation> setE = stateE.getPicked(); for (ONDEXRelation e : setE) { graph.getRelation(e.getId()).addTag(context); } PickedState<ONDEXConcept> stateN = viewer.getVisualizationViewer().getPickedVertexState(); Set<ONDEXConcept> setN = stateN.getPicked(); for (ONDEXConcept n : setN) { graph.getConcept(n.getId()).addTag(context); } } }