1 /*--------------------------------------------------------------------------
\r
2 * Copyright 2009 Taro L. Saito
\r
4 * Licensed under the Apache License, Version 2.0 (the "License");
\r
5 * you may not use this file except in compliance with the License.
\r
6 * You may obtain a copy of the License at
\r
8 * http://www.apache.org/licenses/LICENSE-2.0
\r
10 * Unless required by applicable law or agreed to in writing, software
\r
11 * distributed under the License is distributed on an "AS IS" BASIS,
\r
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
13 * See the License for the specific language governing permissions and
\r
14 * limitations under the License.
\r
15 *--------------------------------------------------------------------------*/
\r
16 //--------------------------------------
\r
19 // StreamAmoebaJoinTest.java
\r
20 // Since: 2009/05/14 17:52:37
\r
24 //--------------------------------------
\r
25 package org.xerial.relation.query;
\r
27 import org.junit.After;
\r
28 import org.junit.Before;
\r
29 import org.junit.Test;
\r
30 import org.xerial.relation.DataType;
\r
31 import org.xerial.relation.FD;
\r
32 import org.xerial.relation.Node;
\r
33 import org.xerial.relation.schema.Schema;
\r
34 import org.xerial.relation.schema.SchemaBuilder;
\r
35 import org.xerial.silk.SilkWalker;
\r
36 import org.xerial.util.FileResource;
\r
37 import org.xerial.util.log.Logger;
\r
39 public class StreamAmoebaJoinTest
\r
41 private static Logger _logger = Logger.getLogger(StreamAmoebaJoinTest.class);
\r
44 public void setUp() throws Exception
\r
48 public void tearDown() throws Exception
\r
52 public void query() throws Exception
\r
54 QuerySet qs = new QuerySet();
\r
55 qs.addQueryTarget(new SchemaBuilder().add("coordinate").add("group").add("species").add("revision").add("name")
\r
57 qs.addQueryTarget(new SchemaBuilder().add("coordinate").add("gene", DataType.STRUCT, FD.ONE_OR_MORE).build());
\r
58 qs.addQueryTarget(new SchemaBuilder().add("gene").add("id").add("name").add("start").add("end").build());
\r
60 StreamAmoebaJoin aj = new StreamAmoebaJoin(qs, new RelationEventHandler() {
\r
62 public void newRelationFragment(Schema schema, Node n1, Node n2)
\r
64 _logger.info(String.format("relation (%s, %s)", n1, n2));
\r
67 public void leaveNode(Schema schema, Node node)
\r
69 _logger.info(String.format("leave %s in %s", node, schema));
\r
72 public void text(String nodeName, String text)
\r
74 // TODO Auto-generated method stub
\r
79 aj.sweep(new SilkWalker(FileResource.find(StreamAmoebaJoinTest.class, "sample.silk")));
\r