* @author leo
*
*/
-public class QuerySet
-{
+public class QuerySet {
private IndexedSet<Schema> queryTarget = new IndexedSet<Schema>();
private Set<String> treeNodeSet = new HashSet<String>();
- private QuerySet()
- {}
+ public QuerySet() {}
- private QuerySet(Collection<Schema> schemaSet)
- {
- for (Schema eachSchema : schemaSet)
- {
+ private QuerySet(Collection<Schema> schemaSet) {
+ for (Schema eachSchema : schemaSet) {
queryTarget.add(eachSchema);
}
}
- public Set<Schema> getTargetQuerySet()
- {
+ public Set<Schema> getTargetQuerySet() {
return queryTarget;
}
- public boolean isTreeNode(String nodeName)
- {
+ public boolean isTreeNode(String nodeName) {
return treeNodeSet.contains(nodeName);
}
@Override
- public String toString()
- {
+ public String toString() {
return queryTarget.toString();
}
- public static class QuerySetBuilder
- {
+ public static class QuerySetBuilder {
List<Schema> schemaList = new ArrayList<Schema>();
Set<String> treeNodeSet = new HashSet<String>();
- public void addTreeNode(String treeNode)
- {
+ public void addTreeNode(String treeNode) {
treeNodeSet.add(treeNode);
}
- public void addQueryTarget(Schema schema)
- {
+ public void addQueryTarget(Schema schema) {
schemaList.add(schema);
}
- public QuerySet build()
- {
+ public QuerySet build() {
return new QuerySet(schemaList);
}
--- /dev/null
+/*--------------------------------------------------------------------------\r
+ * Copyright 2009 Taro L. Saito\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *--------------------------------------------------------------------------*/\r
+//--------------------------------------\r
+// XerialJ\r
+//\r
+// SilkArchiver.java\r
+// Since: Jul 6, 2009 6:44:31 PM\r
+//\r
+// $URL$\r
+// $Author$\r
+//--------------------------------------\r
+package org.xerial.silk.archive;\r
+\r
+import org.xerial.relation.Node;\r
+import org.xerial.relation.query.AmoebaJoinHandler;\r
+import org.xerial.relation.query.QuerySet;\r
+import org.xerial.relation.query.StreamAmoebaJoin;\r
+import org.xerial.relation.schema.Schema;\r
+import org.xerial.silk.schema.SilkSchema;\r
+import org.xerial.util.tree.TreeParser;\r
+\r
+/**\r
+ * Create a queryable archive of Silk (Tree-format) data.\r
+ * \r
+ * @author leo\r
+ * \r
+ */\r
+public class SilkArchiver {\r
+\r
+ public static class SilkInput {\r
+ TreeParser parser;\r
+ SilkSchema schema;\r
+ }\r
+\r
+ public void createArchive(SilkInput input) throws Exception {\r
+\r
+ QuerySet qs = new QuerySet.QuerySetBuilder().build();\r
+\r
+ AmoebaJoinHandler handler = new RelationHandler();\r
+\r
+ StreamAmoebaJoin aj = new StreamAmoebaJoin(qs, handler);\r
+\r
+ aj.sweep(input.parser);\r
+\r
+ }\r
+\r
+ private class RelationHandler implements AmoebaJoinHandler {\r
+\r
+ public void finish() {\r
+ // TODO Auto-generated method stub\r
+\r
+ }\r
+\r
+ public void init() {\r
+ // TODO Auto-generated method stub\r
+\r
+ }\r
+\r
+ public void leaveNode(Schema schema, Node node) throws Exception {\r
+ // TODO Auto-generated method stub\r
+\r
+ }\r
+\r
+ public void newAmoeba(Schema schema, Node coreNode, Node attributeNode) throws Exception {\r
+ // TODO Auto-generated method stub\r
+\r
+ }\r
+\r
+ public void text(Schema schema, Node coreNode, Node textNode, String text) throws Exception {\r
+ // TODO Auto-generated method stub\r
+\r
+ }\r
+\r
+ }\r
+\r
+}\r