package test;

import java.io.File;
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
import uk.ac.bbk.dcs.automed.qproc.iql.ASG;


/**
 * SerialiseASG.java<br><br>
 *
 *
 *
 * @author Duc M Le  <a href="mailto:dmle@doc.ic.ac.uk"><i>dmle@doc.ic.ac.uk</i></a>
 * <br>Created on August 19, 2006
 * <br>Department of Computing, Imperial College
 */

public class SerialiseASG {
  
  /**
   * Creates a new instance of SerialiseASG
   */
  public SerialiseASG() throws Exception {

      String query = "[{x} | {r,x} <- <<staff,name>>]";
//    String query = "[{id ,name ,yob }|{t ,id }<-<<person,id>> ; " +
//      "{t ,name }<-<<person,name>> ; {t ,yob }<-<<person,yob>> ; " +
//      "( (<=) 6 id ) ; ( (<=) id 10 ) ]";
    
    ASG q = new ASG(query);
    
    FileOutputStream fout = new FileOutputStream(System.getProperty("user.home")+
      File.separator + ".automed" + File.separator + "ASG.object");
    ObjectOutputStream oo = new ObjectOutputStream(fout);
    long start = System.currentTimeMillis();
    System.out.println("start writing object...");
    oo.writeObject(q);
    long end = System.currentTimeMillis();
    System.out.println("took " + (end-start)/1000 + "(s)");
  }
  
  public static void main(String[] args) throws Exception {
    SerialiseASG sa = new SerialiseASG();
  }
}
