Author: reto
Date: Wed Jan 19 13:42:50 2011
New Revision: 1060811

URL: http://svn.apache.org/viewvc?rev=1060811&view=rev
Log:
CLEREZZA-388: added ResourceFinder trait

Added:
    
incubator/clerezza/issues/CLEREZZA-388/org.apache.clerezza.rdf.cris/core/src/main/scala/org/apache/clerezza/rdf/cris/ResourceFinder.scala
Modified:
    
incubator/clerezza/issues/CLEREZZA-388/org.apache.clerezza.rdf.cris/core/src/main/scala/org/apache/clerezza/rdf/cris/GraphIndexer.scala

Modified: 
incubator/clerezza/issues/CLEREZZA-388/org.apache.clerezza.rdf.cris/core/src/main/scala/org/apache/clerezza/rdf/cris/GraphIndexer.scala
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-388/org.apache.clerezza.rdf.cris/core/src/main/scala/org/apache/clerezza/rdf/cris/GraphIndexer.scala?rev=1060811&r1=1060810&r2=1060811&view=diff
==============================================================================
--- 
incubator/clerezza/issues/CLEREZZA-388/org.apache.clerezza.rdf.cris/core/src/main/scala/org/apache/clerezza/rdf/cris/GraphIndexer.scala
 (original)
+++ 
incubator/clerezza/issues/CLEREZZA-388/org.apache.clerezza.rdf.cris/core/src/main/scala/org/apache/clerezza/rdf/cris/GraphIndexer.scala
 Wed Jan 19 13:42:50 2011
@@ -48,7 +48,8 @@ import scala.actors.TIMEOUT
  */
 //while implemented in scala we don't expose any scala-library classes in the
 //public interface
-class GraphIndexer(definitions: TripleCollection, baseGraph: TripleCollection, 
index: Directory) {
+class GraphIndexer(definitions: TripleCollection, 
+                                  baseGraph: TripleCollection, index: 
Directory) extends ResourceFinder {
 
        def this(definitions: TripleCollection, baseGraph: TripleCollection) {
                this(definitions, baseGraph, new RAMDirectory)
@@ -209,15 +210,4 @@ class GraphIndexer(definitions: TripleCo
                }
                result
        }
-
-       def findResources(property: UriRef, pattern: String): List[Resource] = {
-               
-               /*val query: Query = new TermQuery(new Term(
-                               FOAF.firstName.getUnicodeString, something))*/
-               val query: Query = new WildcardQuery(new Term(
-                               property.getUnicodeString, pattern))
-               /*val query: Query = new FuzzyQuery(new Term(
-                               FOAF.firstName.getUnicodeString, something))*/
-               findResources(WildcardCondition(property, pattern))
-       }
 }

Added: 
incubator/clerezza/issues/CLEREZZA-388/org.apache.clerezza.rdf.cris/core/src/main/scala/org/apache/clerezza/rdf/cris/ResourceFinder.scala
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-388/org.apache.clerezza.rdf.cris/core/src/main/scala/org/apache/clerezza/rdf/cris/ResourceFinder.scala?rev=1060811&view=auto
==============================================================================
--- 
incubator/clerezza/issues/CLEREZZA-388/org.apache.clerezza.rdf.cris/core/src/main/scala/org/apache/clerezza/rdf/cris/ResourceFinder.scala
 (added)
+++ 
incubator/clerezza/issues/CLEREZZA-388/org.apache.clerezza.rdf.cris/core/src/main/scala/org/apache/clerezza/rdf/cris/ResourceFinder.scala
 Wed Jan 19 13:42:50 2011
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+
+package org.apache.clerezza.rdf.cris
+
+import org.apache.clerezza.rdf.core.Resource
+import org.apache.clerezza.rdf.core.UriRef
+import org.apache.lucene.index.Term
+import org.apache.lucene.search.Query
+import org.apache.lucene.search.WildcardQuery
+import java.util.List
+
+trait ResourceFinder {
+       def findResources(conditions: Condition*): List[Resource]
+
+       def findResources(property: UriRef, pattern: String): List[Resource] = {
+
+               /*val query: Query = new TermQuery(new Term(
+                               FOAF.firstName.getUnicodeString, something))*/
+               val query: Query = new WildcardQuery(new Term(
+                               property.getUnicodeString, pattern))
+               /*val query: Query = new FuzzyQuery(new Term(
+                               FOAF.firstName.getUnicodeString, something))*/
+               findResources(WildcardCondition(property, pattern))
+       }
+}


Reply via email to