From: leo Date: Mon, 6 Jul 2009 10:08:54 +0000 (+0000) Subject: git-svn-id: http://www.xerial.org/svn/project/XerialJ/trunk/xerial-core@3443 ae02f08e... X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=5150bb6c0c1f5e733e3fd1768d08dc2c23d2ee22;p=xerial%2Fxerial-core.git git-svn-id: xerial.org/svn/project/XerialJ/trunk/xerial-core@3443 ae02f08e-27ec-0310-ae8c-8ba02fe2eafd --- diff --git a/src/main/java/org/xerial/relation/query/QuerySet.java b/src/main/java/org/xerial/relation/query/QuerySet.java index 91a327a..9c40134 100644 --- a/src/main/java/org/xerial/relation/query/QuerySet.java +++ b/src/main/java/org/xerial/relation/query/QuerySet.java @@ -39,55 +39,44 @@ import org.xerial.util.IndexedSet; * @author leo * */ -public class QuerySet -{ +public class QuerySet { private IndexedSet queryTarget = new IndexedSet(); private Set treeNodeSet = new HashSet(); - private QuerySet() - {} + public QuerySet() {} - private QuerySet(Collection schemaSet) - { - for (Schema eachSchema : schemaSet) - { + private QuerySet(Collection schemaSet) { + for (Schema eachSchema : schemaSet) { queryTarget.add(eachSchema); } } - public Set getTargetQuerySet() - { + public Set 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 schemaList = new ArrayList(); Set treeNodeSet = new HashSet(); - 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); } diff --git a/src/main/java/org/xerial/silk/archive/SilkArchiver.java b/src/main/java/org/xerial/silk/archive/SilkArchiver.java new file mode 100644 index 0000000..16636d8 --- /dev/null +++ b/src/main/java/org/xerial/silk/archive/SilkArchiver.java @@ -0,0 +1,89 @@ +/*-------------------------------------------------------------------------- + * Copyright 2009 Taro L. Saito + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *--------------------------------------------------------------------------*/ +//-------------------------------------- +// XerialJ +// +// SilkArchiver.java +// Since: Jul 6, 2009 6:44:31 PM +// +// $URL$ +// $Author$ +//-------------------------------------- +package org.xerial.silk.archive; + +import org.xerial.relation.Node; +import org.xerial.relation.query.AmoebaJoinHandler; +import org.xerial.relation.query.QuerySet; +import org.xerial.relation.query.StreamAmoebaJoin; +import org.xerial.relation.schema.Schema; +import org.xerial.silk.schema.SilkSchema; +import org.xerial.util.tree.TreeParser; + +/** + * Create a queryable archive of Silk (Tree-format) data. + * + * @author leo + * + */ +public class SilkArchiver { + + public static class SilkInput { + TreeParser parser; + SilkSchema schema; + } + + public void createArchive(SilkInput input) throws Exception { + + QuerySet qs = new QuerySet.QuerySetBuilder().build(); + + AmoebaJoinHandler handler = new RelationHandler(); + + StreamAmoebaJoin aj = new StreamAmoebaJoin(qs, handler); + + aj.sweep(input.parser); + + } + + private class RelationHandler implements AmoebaJoinHandler { + + public void finish() { + // TODO Auto-generated method stub + + } + + public void init() { + // TODO Auto-generated method stub + + } + + public void leaveNode(Schema schema, Node node) throws Exception { + // TODO Auto-generated method stub + + } + + public void newAmoeba(Schema schema, Node coreNode, Node attributeNode) throws Exception { + // TODO Auto-generated method stub + + } + + public void text(Schema schema, Node coreNode, Node textNode, String text) throws Exception { + // TODO Auto-generated method stub + + } + + } + +}