Package org.dbwiki.data.resource

Examples of org.dbwiki.data.resource.NodeIdentifier


  public static void main(String[] args) {
      try {
          WikiServerStandalone wikiserver=new WikiServerStandalone(org.dbwiki.lib.IO.loadProperties(new File(args[0])));
        PSQLDatabaseConnector psql = new PSQLDatabaseConnector("jdbc:postgresql://localhost", "dbwiki", "password");
        RDBMSDatabase database= new RDBMSDatabase(wikiserver.get(1), psql);
        NodeIdentifier nodeidentifier= new NodeIdentifier();
        DatabaseReader.get(psql.getConnection(), database, nodeidentifier);
          database.query("wpath://child::COUNTRY/child::NAME");
          database.query("wpath://COUNTRY[CATEGORY/PROPERTY/*='Europe']/NAME");
          database.query("wpath://COUNTRY[NAME='United States']/CATEGORY[NAME='Economy']/PROPERTY[NAME='GDP (purchasing power parity)']");
          System.out.println(wikiserver.size());
View Full Code Here


      NodeWriter writer = new ExportNodeWriter();
      BufferedWriter outstr = new BufferedWriter(new OutputStreamWriter(out));
     
      writer.init(outstr);
      // new NodeIdentifier() gives a root node id
      _wiki.database().export(new NodeIdentifier(), _wiki.database().versionIndex().getLastVersion().number(), writer);
     
      outstr.close();
      out.close();
      // register the database with the server
     
View Full Code Here

    this.value().add(new RDBMSDatabaseTextNode(DatabaseConstants.RelDataColIDValUnknown, this, timestamp, value,pre,post));
  }

 
  public NodeIdentifier identifier() {
    return new NodeIdentifier();
  }
View Full Code Here

        while (rs.next()) {
          int id = rs.getInt(1);
          int start = rs.getInt(2);
          int end = rs.getInt(3);
          if (entry == null) {
            entry = new RDBMSDatabaseEntry(new NodeIdentifier(id), new TimeSequence(start, end));
            add(entry);
          } else {
            if (entry.identifier().nodeID() == id) {
              entry.timestamp().elongate(start, end);
            } else {
              entry = new RDBMSDatabaseEntry(new NodeIdentifier(id), new TimeSequence(start, end));
              add(entry);
            }
          }
        }
        rs.close();
        pStmtSelectLabel.setInt(1, database.getDisplaySchemaNode().id());
        rs = pStmtSelectLabel.executeQuery();
        entry = null;
        int maxTime = Integer.MIN_VALUE;
        while (rs.next()) {
          int id = rs.getInt(1);
          String value = rs.getString(2);
          int end = DatabaseConstants.RelTimestampColEndValOpen;
          rs.getInt(3);
          if (!rs.wasNull()) {
            end = rs.getInt(4);
          }
          if (entry == null) {
            entry = get(new NodeIdentifier(id));
            maxTime = Integer.MIN_VALUE;
          } else if (entry.identifier().nodeID() != id) {
            entry = get(new NodeIdentifier(id));
            maxTime = Integer.MIN_VALUE;
          }
          if (end == DatabaseConstants.RelTimestampColEndValOpen) {
            entry.label(value);
            maxTime = Integer.MAX_VALUE;
          } else if (end > maxTime) {
            entry.label(value);
            maxTime = end;
          }
        }
        rs.close();
        rs = pStmtSelectLastChange.executeQuery();
        while (rs.next()) {
          get(new NodeIdentifier(rs.getInt(1))).lastChange(rs.getInt(2));
        }
        rs.close();
        pStmtSelectContent.close();
        pStmtSelectLabel.close();
        pStmtSelectLastChange.close();
View Full Code Here

        "SELECT " + RelDataColID +  " FROM " + database.name() + RelationData + " " +
        "WHERE " + RelDataColSchema + " = " + identifier.nodeID());

    while (rs.next()) {
      int id = rs.getInt(RelDataColID);
      nodes.add(new NodeIdentifier(id));
    }
   
    return nodes;
  }
View Full Code Here

  /*
   * Public Methods
   */
 
  public NodeIdentifier identifier() {
    return new NodeIdentifier();
  }
View Full Code Here

    while (rs.next()) {
      int versionNumber = rs.getInt(RelVersionColNumber);
      String versionName = rs.getString(RelVersionColName);
      User user = users.get(rs.getInt(RelVersionColUser));
      int nodeId = rs.getInt(RelVersionColNode);
      NodeIdentifier nid = null;
      if(nodeId != -1)
        nid = new NodeIdentifier(nodeId);
      Provenance provenance =
        ProvenanceFactory.getProvenance((byte)rs.getInt(RelVersionColProvenance),
            user, nid, rs.getString(RelVersionColSource));
      long createTime = rs.getLong(RelVersionColTime);
      this.add(new Version(versionNumber, versionName, createTime, provenance, this));
View Full Code Here

   */
 
  public RDBMSDatabaseAttributeNode(int id, AttributeSchemaNode schema, DatabaseGroupNode parent, TimeSequence timestamp, AnnotationList annotation, int pre, int post) {
    super(schema, parent, timestamp, annotation, pre, post);
   
    _identifier = new NodeIdentifier(id);
  }
View Full Code Here

  /*
   * Public Methods
   */
 
  public QueryResultSet execute() throws org.dbwiki.exception.WikiException {
    return new QueryResultSet(_database.get(new NodeIdentifier(_nodeID)));
  }
View Full Code Here

    return _wiki.layouter().displaySchemaNode(schema());
  }
 
  public ResourceIdentifier getIdentifierForParameterString(String parameterValue) throws org.dbwiki.exception.WikiException {
    try {
      return new NodeIdentifier(Integer.parseInt(parameterValue));
    } catch (java.lang.NumberFormatException exception) {
      throw new WikiRequestException(WikiRequestException.InvalidUrl, parameterValue);
    }
  }
View Full Code Here

TOP

Related Classes of org.dbwiki.data.resource.NodeIdentifier

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.