public Object getValueAt(int row, int col) { ONDEXRelation[] keys = edges.keySet().toArray(new ONDEXRelation[0]); // return existing data if (col == 0) { return keys[row].getId(); } else if (col == 1) { return labels.get(keys[row]); } else if (col == 2) { return rt_labels.get(keys[row]); } else if (col == 3) { return edges.get(keys[row]); } else if (col == 4) { return elv.get(keys[row]); } return null; }
public BitSet getMatchingIdSet(Set<ONDEXRelation> ov) throws NullValueException, EmptyStringException, AccessDeniedException{ BitSet result = new BitSet(); for(ONDEXRelation relation : ov){ boolean addToset = true; for(RelationAttributeChecker chk :conditions.values()){ if(!chk.check(relation)){ addToset = false; break; } } if(addToset)result.set(relation.getId()); } return result; }
public static String relationToUri(String graphUri, ONDEXRelation r) { return toUri(graphUri, "relation", String.valueOf(r.getId())); } public static String dataSourceToUri(String graphUri, DataSource dataSource) {
public String toString() { StringBuilder sb = new StringBuilder(); sb.append("[CONCEPTS] "); for (ONDEXConcept concept : getConceptsInPositionOrder()) { sb.append(concept.getId() + " "); sb.append(' '); } sb.append("[RELATIONS] "); for (ONDEXRelation relation : getRelationsInPositionOrder()) { sb.append(relation.getId()); sb.append(' '); } return sb.toString(); }
public void filter(Set<ONDEXRelation> ov) throws NullValueException, EmptyStringException, AccessDeniedException{ for(ONDEXRelation relation : ov){ boolean addToset = true; for(RelationAttributeChecker chk :conditions.values()){ if(!chk.check(relation)){ addToset = false; break; } } if(addToset)graph.deleteRelation(relation.getId()); } } }
public SerializablePathNode(PathNode pathNode) { List<ONDEXConcept> conceptL = pathNode.getConceptsInPositionOrder(); List<ONDEXRelation> relationL = pathNode.getRelationsInPositionOrder(); concepts = new int[conceptL.size()]; for (int i = 0; i < concepts.length; i++) concepts[i] = conceptL.get(i).getId(); relations = new int[relationL.size()]; for (int i = 0; i < relations.length; i++) relations[i] = relationL.get(i).getId(); }
/** * Updates the graph with the new concept and all tables with it. * * @param newRelation * ONDEXConcept newly created */ private void updateRelationInGraph(ONDEXRelation newRelation) { // update all linked tables GraphTableEditor.updateRelationInTables(newRelation, row); // delete old relation from graph graph.deleteConcept(relation.getId()); }
public SerializableEvidencePathNode(EvidencePathNode pathNode) { List<ONDEXConcept> conceptL = pathNode.getConceptsInPositionOrder(); List<ONDEXRelation> relationL = pathNode.getRelationsInPositionOrder(); concepts = new int[conceptL.size()]; for (int i = 0; i < concepts.length; i++) concepts[i] = conceptL.get(i).getId(); relations = new int[relationL.size()]; for (int i = 0; i < relations.length; i++) relations[i] = relationL.get(i).getId(); evidences = pathNode.getEvidencesInPositionOrder(); }
@Override public boolean deleteRelation(ONDEXConcept fromConcept, ONDEXConcept toConcept, RelationType ofType) { ONDEXRelation r = getRelation(fromConcept, toConcept, ofType); return deleteRelation(r.getId()); }
/** * Returns visibility for a given edge. * * @param edge * ONDEXRelation * @return is visible */ public boolean isVisible(ONDEXRelation edge) { if (edge == null) return false; return edge_visibility.get(edge.getId()) && vertex_visibility.get(edge.getFromConcept().getId()) && vertex_visibility.get(edge.getToConcept().getId()); }
/** * Returns an array of two bitset of neighbouring concepts at array position * 0 and all relations at array position 1 * * @param seed * @param graph * @return */ public static BitSet[] getNeighbours(ONDEXConcept seed, ONDEXGraph graph) { BitSet[] result = new BitSet[2]; result[0] = new BitSet(); // concepts result[1] = new BitSet(); // relations for (ONDEXRelation r : graph.getRelationsOfConcept(seed)) { result[0].set(StandardFunctions.getOtherNode(seed, r).getId()); result[1].set(r.getId()); } return result; }
/** * Sets visibility of a given ONDEXRelation. * * @param edge * ONDEXRelation * @param visible * visibility flag */ public void setVisibility(ONDEXRelation edge, boolean visible) { edge_visibility.put(edge.getId(), visible); synchronized (sgListeners) { for (SparseONDEXListener sgl : sgListeners) { if (visible) sgl.edgeShow(edge); else sgl.edgeHide(edge); } } }
@Override public boolean containsEdge(ONDEXRelation edge) { return getRelation(edge.getId()) != null && isVisible(edge); }
private static Set<ONDEXRelation> getRelationsWithAttribute(ONDEXGraph graph, ONDEXConcept c, AttributeName an) { BitSet set = new BitSet(); for (ONDEXRelation r : graph.getRelationsOfConcept(c)) { if (r.getFromConcept().equals(r.getToConcept())) continue; if (r.getAttribute(an) != null) set.set(r.getId()); } Set<ONDEXRelation> result = BitSetFunctions.create(graph, ONDEXRelation.class, set); return result; }
@Override public String toString(TableModel model, int row, int column) { Object o = model.getValueAt(row, column); if (o instanceof MetaData) return ((MetaData) o).getId(); else if (o instanceof ONDEXConcept) return String.valueOf(((ONDEXConcept) o).getId()); else if (o instanceof ONDEXRelation) return String.valueOf(((ONDEXRelation) o).getId()); else if (o instanceof ConceptName) return ((ConceptName) o).getName(); else if (o instanceof ConceptAccession) return ((ConceptAccession) o).getAccession(); else if (o instanceof Attribute) return ((Attribute) o).getValue().toString(); else if (o != null) return o.toString(); else return ""; }
@Override protected Set<ONDEXRelation> retrieveRelationAll() { BerkeleyBrowser<ONDEXRelation> browser = new BerkeleyBrowser<ONDEXRelation>( berkeley, null, BerkeleyRelation.class); if (browser.size() > 0) { BitSet set = new BitSet(browser.size()); for (ONDEXRelation r : browser) { try { int id = r.getId(); set.set(id); } catch (AccessDeniedException e) { } } return BitSetFunctions.create(this, ONDEXRelation.class, set); } else { return BitSetFunctions.create(this, ONDEXRelation.class, new BitSet()); } }
/** * Constructor wraps a given ONDEXRelation. * * @param sid * unique id * @param aog * LuceneONDEXGraph * @param r * ONDEXRelation */ LuceneRelation(long sid, LuceneONDEXGraph aog, ONDEXRelation r) { this(sid, aog, r.getId(), r.getFromConcept(), r.getToConcept(), r .getOfType()); this.parent = r; }
public SerializablePath(Path path) { concepts = new int[path.getConceptLength()]; List<ONDEXConcept> conceptToAdd = path.getConceptsInPositionOrder(); for (int i = 0; i < concepts.length; i++) { concepts[i] = conceptToAdd.get(i).getId(); } relations = new int[path.getRelationLength()]; List<ONDEXRelation> relationToAdd = path.getRelationsInPositionOrder(); for (int i = 0; i < relations.length; i++) { relations[i] = relationToAdd.get(i).getId(); } startsWithConcept = path.getStartingEntity() instanceof ONDEXConcept; }
/** * Updates or adds new relations to the index * * @param relations * the relations to add to the index * @throws AccessDeniedException */ public void updateRelationsToIndex ( Set<ONDEXRelation> relations ) throws AccessDeniedException { updateIndexVoid ( () -> { for ( ONDEXRelation relation : relations ) { Exceptions.sneak ().run ( () -> iw.deleteDocuments ( new Term ( RELID_FIELD, String.valueOf ( relation.getId () ) ) ) ); addRelationToIndex ( relation ); } }); }
public static void printRelationState(OVTK2PropertiesAggregator viewer) { ONDEXGraph graph = viewer.getONDEXJUNGGraph(); ONDEXJUNGGraph jung = viewer.getONDEXJUNGGraph(); for (ONDEXRelation r : graph.getRelations()) { System.err.println(viewer.getONDEXJUNGGraph().isVisible(jung.getRelation(r.getId()))); } }