Package vg.core.storableGraph

Examples of vg.core.storableGraph.StorableAttribute


            while(attrStatement.step()) {
              int db_id_attr = attrStatement.columnInt(0);
              String db_name = attrStatement.columnString(1);
              String db_value = attrStatement.columnString(2);
              String db_type = attrStatement.columnString(3);
              v.addStorableAttribute(new StorableAttribute(db_id_attr, db_name, db_value, db_type));
            }
            attrStatement.dispose();

          }
          vertexStatement.dispose();
          //edges--------------------------
          ArrayList<StorableEdge>listEdge = new ArrayList<StorableEdge>();
          SQLiteStatement edgeStatement = null;

          request = "select s2.db_id, s2.id, s2.db_id_source, db_id_target " +
                    "from com_subgraph_edge s1, edge s2 " +
                    "where s1.db_id_subgraph = " + Integer.valueOf(id_subgraph).toString() + " and s2.db_id = s1.db_id_edge;";
          edgeStatement = connection.prepare(request,false);
          while(edgeStatement.step()) {
            int db_id_edge = edgeStatement.columnInt(0);
            String id_edge = edgeStatement.columnString(1);
            Integer db_id_source = (Integer)edgeStatement.columnValue(2);
            Integer db_id_target = (Integer)edgeStatement.columnValue(3);
            if(db_id_source != null && db_id_target != null) {
              StorableVertex source = null, target = null;
              for(StorableVertex bufVertex : listVertex) {
                if(bufVertex.getStorableId() == db_id_source) {
                  source = bufVertex;
                }
                if(bufVertex.getStorableId() == db_id_target) {
                  target = bufVertex;
                }
              }
              if(source != null && target != null) {
                StorableEdge e = new StorableEdge(db_id_edge, source, target, id_edge);
                listEdge.add(e);
                //attributes-----------------
                SQLiteStatement attrStatement = null;
           
                request = "select s2.db_id, s2.name, s2.value, s2.value_type " +
                          "from com_edge_attribute s1, attribute s2 " +
                          "where s1.db_id_edge = " + Integer.valueOf(db_id_edge).toString() + " and s2.db_id = s1.db_id_attribute;";
                attrStatement = connection.prepare(request,false);
                while(attrStatement.step()) {
                  int db_id_attr = attrStatement.columnInt(0);
                  String db_name = attrStatement.columnString(1);
                  String db_value = attrStatement.columnString(2);
                  String db_type = attrStatement.columnString(3);
                  e.addStorableAttribute(new StorableAttribute(db_id_attr, db_name, db_value, db_type));
                }
                attrStatement.dispose();

              } else {
                VisualGraph.log.printError("[" + this.getClass().getName() + ".getStorableGraph] [BAD] Source edge = null || target edge = null.(" + db_id_source + "," + db_id_target + ")");
View Full Code Here


            while(attrStatement.step()) {
              int db_id_attr = attrStatement.columnInt(0);
              String db_name = attrStatement.columnString(1);
              String db_value = attrStatement.columnString(2);
              String db_type = attrStatement.columnString(3);
              v.addStorableAttribute(new StorableAttribute(db_id_attr, db_name, db_value, db_type));
            }
          } catch(SQLiteException ex) {
            VisualGraph.log.printException(ex);
          } finally {
            if(attrStatement != null) {
                attrStatement.dispose();
            }
          }
        }
        vertexStatement.dispose();
        //edges--------------------------
        ArrayList<StorableEdge>listEdge = new ArrayList<StorableEdge>();
        SQLiteStatement edgeStatement = null;

        request = "select s2.db_id, s2.id, s2.db_id_source, db_id_target " +
                  "from com_subgraph_edge s1, edge s2 " +
                  "where s1.db_id_subgraph = " + Integer.valueOf(id_subgraph).toString() + " and s1.db_id_edge = s2.db_id;";
        edgeStatement = connection.prepare(request,false);
        while(edgeStatement.step()) {
          int db_id_edge = edgeStatement.columnInt(0);
          String id_edge = edgeStatement.columnString(1);
          Integer db_id_source = (Integer)edgeStatement.columnValue(2);
          Integer db_id_target = (Integer)edgeStatement.columnValue(3);
          if(db_id_source != null && db_id_target != null) {
            StorableVertex source = null, target = null;
            for(StorableVertex bufVertex : listVertex) {
              if(bufVertex.getStorableId() == db_id_source) {
                source = bufVertex;
              }
              if(bufVertex.getStorableId() == db_id_target) {
                target = bufVertex;
              }
            }
            if(source != null && target != null) {
              StorableEdge e = new StorableEdge(db_id_edge, source, target, id_edge);
              listEdge.add(e);
              //attributes-----------------
              SQLiteStatement attrStatement = null;
              try {
                request = "select s2.db_id, s2.name, s2.value, s2.value_type " +
                          "from com_edge_attribute s1, attribute s2 " +
                          "where s1.db_id_edge = " + Integer.valueOf(db_id_edge).toString() + " and s1.db_id_attribute = s2.db_id;";
                attrStatement = connection.prepare(request,false);
                while(attrStatement.step()) {
                  int db_id_attr = attrStatement.columnInt(0);
                  String db_name = attrStatement.columnString(1);
                  String db_value = attrStatement.columnString(2);
                  String db_type = attrStatement.columnString(3);
                  e.addStorableAttribute(new StorableAttribute(db_id_attr, db_name, db_value,db_type));
                }
              } catch (SQLiteException ex) {
                VisualGraph.log.printException(ex);
              } finally {
                if(attrStatement != null) {
View Full Code Here

              while (resultAttribute.step()) {
                int db_id_attr = resultAttribute.columnInt(0);
                String name_attr = resultAttribute.columnString(1);
                String value_attr = resultAttribute.columnString(2);
                String type_attr = resultAttribute.columnString(3);
                StorableAttribute attr = new StorableAttribute(db_id_attr, name_attr, value_attr,
                    type_attr);
                e.addStorableAttribute(attr);
              }
            }
          }
View Full Code Here

                while (currStatement.step()) {
                  int db_id_attr = currStatement.columnInt(0);
                  String name = currStatement.columnString(1);
                  String value = currStatement.columnString(2);
                  String type = currStatement.columnString(3);
                  StorableAttribute attr = new StorableAttribute(db_id_attr, name, value, type);
                  attrs.add(attr);
                }
              }
              return attrs;
            }
View Full Code Here

                       VisualGraph.log.printInfo("Skip edge between different nested graphs");
                         continue;
                     }
                     StorableEdge ed = new StorableEdge(e.m_nodeMap.get(src), e.m_nodeMap.get(trg),e.nestedEdge.get(j).id);
                     for (Attr a:e.nestedEdge.get(j).properties) {
                       ed.addStorableAttribute(new StorableAttribute(a.name,(String) a.value,  a.type.toString()));
                     }
                     edges.add(ed);
                }
              if (e.name == "")
                e.name = e.id;
              StorableSubGraph ssg = new StorableSubGraph(e.id, e.name, e.nestedVertex, edges, e.directed);
                if (lastVertex.size() != 0) {
                    lastVertex.lastElement().setInnerGraph(ssg.getStorableId());
                }
                this.model.addStorableSubGraph(ssg);
                subgraphIDs.add(ssg.getStorableId());
               
                lastProperties.pop();
                graphSection = false;
            } else if (qName.equals(NODE)) {
                ArrayList<Attr> p = lastProperties.pop();
                for (Attr a: p) {
                  if(lastVertex.lastElement().addStorableAttribute(new StorableAttribute(a.name,
                      a.value.toString(), a.type.toString())) == false)
                  {
                        VisualGraph.log.printError("[" + this.getClass().getName() + ".endElement] [BAD] Can't add attribute to vertex");
                    }
                }
View Full Code Here

              ResultSet resultAttribute = attrStatement.executeQuery(request);
              while(resultAttribute.next()) {
                int db_id_attr = resultAttribute.getInt(1);
                String db_name = resultAttribute.getString(2);
                String db_value = resultAttribute.getString(3);
                v.addStorableAttribute(new StorableAttribute(db_id_attr, db_name, db_value));
              }
            } catch(SQLException ex) {
              VisualGraph.log.printException(ex);
            } finally {
              if(attrStatement != null) {
                  try {
                    attrStatement.close();
                  } catch(SQLException ex) {
                    VisualGraph.log.printException(ex);
                  }
              }
            }
          }
        } catch (SQLException ex) {
           VisualGraph.log.printException(ex);
        } finally {
          if(vertexStatement != null) {
              try {
                vertexStatement.close();
              } catch(SQLException ex) {
                VisualGraph.log.printException(ex);
              }
          }
        }
        //edges--------------------------
        ArrayList<StorableEdge>listEdge = new ArrayList<StorableEdge>();
        Statement edgeStatement = null;
        try {
          edgeStatement = this.currConnection.createStatement();
          request = "select s2.db_id, s2.id, s2.db_id_source, db_id_target " +
                    "from com_subgraph_edge s1, edge s2 " +
                    "where s1.db_id_subgraph = " + (new Integer(id_subgraph)).toString() + " and s2.db_id = s1.db_id_edge;";
          ResultSet resultEdge = edgeStatement.executeQuery(request);
          while(resultEdge.next()) {
            int db_id_edge = resultEdge.getInt(1);
            String id_edge = resultEdge.getString(2);
            Integer db_id_source = (Integer)resultEdge.getObject(3);
            Integer db_id_target = (Integer)resultEdge.getObject(4);
            if(db_id_source != null && db_id_target != null) {
              StorableVertex source = null, target = null;
              for(StorableVertex bufVertex : listVertex) {
                if(bufVertex.getStorableId() == db_id_source) {
                  source = bufVertex;
                }
                if(bufVertex.getStorableId() == db_id_target) {
                  target = bufVertex;
                }
              }
              if(source != null && target != null) {
                StorableEdge e = new StorableEdge(db_id_edge, source, target, id_edge);
                listEdge.add(e);
                //attributes-----------------
                Statement attrStatement = null;
                try {
                  attrStatement = this.currConnection.createStatement();
                  request = "select s2.db_id, s2.name, s2.value " +
                            "from com_edge_attribute s1, attribute s2 " +
                            "where s1.db_id_edge = " + (new Integer(db_id_edge)).toString() + " and s2.db_id = s1.db_id_attribute;";
                  ResultSet resultAttribute = attrStatement.executeQuery(request);
                  while(resultAttribute.next()) {
                    int db_id_attr = resultAttribute.getInt(1);
                    String db_name = resultAttribute.getString(2);
                    String db_value = resultAttribute.getString(3);
                    e.addStorableAttribute(new StorableAttribute(db_id_attr, db_name, db_value));
                  }
                } catch (SQLException ex) {
                  VisualGraph.log.printException(ex);
                } finally {
                  if(attrStatement != null) {
View Full Code Here

          ResultSet resultAttribute = attrStatement.executeQuery(request);
          while(resultAttribute.next()) {
            int db_id_attr = resultAttribute.getInt(1);
            String db_name = resultAttribute.getString(2);
            String db_value = resultAttribute.getString(3);
            v.addStorableAttribute(new StorableAttribute(db_id_attr, db_name, db_value));
          }
        } catch(SQLException ex) {
          VisualGraph.log.printException(ex);
        } finally {
          if(attrStatement != null) {
              try {
                attrStatement.close();
              } catch(SQLException ex) {
                VisualGraph.log.printException(ex);
              }
          }
        }
      }
    } catch (SQLException ex) {
       VisualGraph.log.printException(ex);
    } finally {
      if(vertexStatement != null) {
          try {
            vertexStatement.close();
          } catch(SQLException ex) {
            VisualGraph.log.printException(ex);
          }
      }
    }
    //edges--------------------------
    ArrayList<StorableEdge>listEdge = new ArrayList<StorableEdge>();
    Statement edgeStatement = null;
    try {
      edgeStatement = this.currConnection.createStatement();
      request = "select s2.db_id, s2.id, s2.db_id_source, db_id_target " +
                "from com_subgraph_edge s1, edge s2 " +
                "where s1.db_id_subgraph = " + (new Integer(id_subgraph)).toString() + " and s2.db_id = s1.db_id_edge;";
      ResultSet resultEdge = edgeStatement.executeQuery(request);
      while(resultEdge.next()) {
        int db_id_edge = resultEdge.getInt(1);
        String id_edge = resultEdge.getString(2);
        Integer db_id_source = (Integer)resultEdge.getObject(3);
        Integer db_id_target = (Integer)resultEdge.getObject(4);
        if(db_id_source != null && db_id_target != null) {
          StorableVertex source = null, target = null;
          for(StorableVertex bufVertex : listVertex) {
            if(bufVertex.getStorableId() == db_id_source) {
              source = bufVertex;
            }
            if(bufVertex.getStorableId() == db_id_target) {
              target = bufVertex;
            }
          }
          if(source != null && target != null) {
            StorableEdge e = new StorableEdge(db_id_edge, source, target, id_edge);
            listEdge.add(e);
            //attributes-----------------
            Statement attrStatement = null;
            try {
              attrStatement = this.currConnection.createStatement();
              request = "select s2.db_id, s2.name, s2.value " +
                        "from com_edge_attribute s1, attribute s2 " +
                        "where s1.db_id_edge = " + (new Integer(db_id_edge)).toString() + " and s2.db_id = s1.db_id_attribute;";
              ResultSet resultAttribute = attrStatement.executeQuery(request);
              while(resultAttribute.next()) {
                int db_id_attr = resultAttribute.getInt(1);
                String db_name = resultAttribute.getString(2);
                String db_value = resultAttribute.getString(3);
                e.addStorableAttribute(new StorableAttribute(db_id_attr, db_name, db_value));
              }
            } catch (SQLException ex) {
              VisualGraph.log.printException(ex);
            } finally {
              if(attrStatement != null) {
View Full Code Here

TOP

Related Classes of vg.core.storableGraph.StorableAttribute

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.