Ejemplo n.º 1
0
  /**
   * Runs a query with an external variable declaration.
   *
   * @throws IOException I/O exception
   */
  @Test
  public void queryBindSequence() throws IOException {
    Query query = session.query("declare variable $a external; $a");
    query.bind("a", "1\u00012", "xs:integer");
    assertEqual("1", query.next());
    assertEqual("2", query.next());
    query.close();

    query = session.query("declare variable $a external; $a");
    query.bind("a", "09\u0002xs:hexBinary\u00012", "xs:integer");
    assertEqual("09", query.next());
    assertEqual("2", query.next());
    query.close();

    query = session.query("declare variable $a external; $a");
    query.bind("a", Seq.get(new Item[] {Int.get(1), Str.get("X")}, 2));
    assertEqual("1", query.next());
    assertEqual("X", query.next());
    query.close();

    query = session.query("declare variable $a external; $a");
    query.bind("a", IntSeq.get(new long[] {1, 2}, AtomType.INT));
    assertEqual("1", query.next());
    assertEqual("2", query.next());
    query.close();

    query = session.query("declare variable $a external; $a");
    query.bind("a", IntSeq.get(new long[] {1, 2}, AtomType.INT), "xs:integer");
    assertEqual("1", query.next());
    assertEqual("2", query.next());
    query.close();
  }
Ejemplo n.º 2
0
 public void splitIndex(String name, String seq) {
   int start = 0;
   boolean go = true;
   while (go) {
     int end = start + numberOfBases;
     if (end >= seq.length()) {
       end = seq.length();
       go = false;
     }
     String subSeq = seq.substring(start, end);
     File binarySeq = new File(indexDirectory, name + "_" + start + "-" + (end - 1));
     if (binarySeq.exists()) {
       System.out.println("WARNING, " + binarySeq + " already exists, skipping!");
       return;
     }
     Seq.writeBinarySequence(subSeq, binarySeq);
     start = end;
   }
 }