public GraphAttribute createAttribute(String name, Object value, Graph graph ){ GraphAttribute ga=new GraphAttributeImp(name,value,((GraphImp)graph).getGraph(),ids); return ga; }
public Vector<GraphRelationship> getAllRelationships(){ HashSet<GraphRelationship> result=new HashSet<GraphRelationship>(); Graph[] g=null; g = browser.getGraphs(); for (int k=0;k<g.length;k++){ HashSet rel=this.getRelationshipsFromAGraph(((GraphImp)g[k]).getGraph()); result.addAll(rel); } return new Vector<GraphRelationship>(result); }
public Vector getAllRelationships(String relType){ HashSet<GraphRelationship> result=new HashSet<GraphRelationship>(); Graph[] g=null; g = browser.getGraphs(); for (int k=0;k<g.length;k++){ HashSet<GraphRelationship> rel=this.getRelationshipsFromAGraph(((GraphImp)g[k]).getGraph()); for (GraphRelationship gr:rel){ if (gr.getType().equalsIgnoreCase(relType)) result.add(gr); } } return new Vector<GraphRelationship>(result); }
public GraphAttribute createAttribute(String name, GraphCollection value, Graph graph ){ GraphAttribute ga=new GraphAttributeImp(name,((GraphCollectionImp)value).getValue(),((GraphImp)graph).getGraph(),ids); return ga; }
public GraphCollection createCollection(Vector<GraphEntity> elements, Graph g) throws InvalidColection{ if (elements.size()>0){ TypedVector tv=new TypedVector(((GraphEntityImp)elements.firstElement()).getEntity().getClass()); for (int k=0;k<elements.size();k++){ tv.add(((GraphEntityImp)elements.elementAt(k)).getEntity()); } return new GraphCollectionImp(tv,((GraphImp)g).getGraph(),ids); } throw new InvalidColection("Collection used is empty"); }