Author: reto
Date: Wed Feb 23 09:22:34 2011
New Revision: 1073650
URL: http://svn.apache.org/viewvc?rev=1073650&view=rev
Log:
CLEREZZA-388: reduced method visibility added comments
Modified:
incubator/clerezza/issues/CLEREZZA-388/rdf.cris/core/src/main/scala/org/apache/clerezza/rdf/cris/GraphIndexer.scala
incubator/clerezza/issues/CLEREZZA-388/rdf.cris/core/src/main/scala/org/apache/clerezza/rdf/cris/ResourceFinder.scala
Modified:
incubator/clerezza/issues/CLEREZZA-388/rdf.cris/core/src/main/scala/org/apache/clerezza/rdf/cris/GraphIndexer.scala
URL:
http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-388/rdf.cris/core/src/main/scala/org/apache/clerezza/rdf/cris/GraphIndexer.scala?rev=1073650&r1=1073649&r2=1073650&view=diff
==============================================================================
---
incubator/clerezza/issues/CLEREZZA-388/rdf.cris/core/src/main/scala/org/apache/clerezza/rdf/cris/GraphIndexer.scala
(original)
+++
incubator/clerezza/issues/CLEREZZA-388/rdf.cris/core/src/main/scala/org/apache/clerezza/rdf/cris/GraphIndexer.scala
Wed Feb 23 09:22:34 2011
@@ -40,6 +40,7 @@ import java.util.List
import scala.actors.DaemonActor
import scala.actors.TIMEOUT
import scala.collection.mutable
+import org.apache.lucene.analysis.Analyzer
/**
*
@@ -58,6 +59,9 @@ import scala.collection.mutable
class GraphIndexer(definitions: TripleCollection,
baseGraph: TripleCollection, index:
Directory, createNewIndex: Boolean) extends ResourceFinder {
+ /**
+ * Creates an in-memory index
+ */
def this(definitions: TripleCollection, baseGraph: TripleCollection) {
this(definitions, baseGraph, new RAMDirectory, true)
}
@@ -69,7 +73,7 @@ class GraphIndexer(definitions: TripleCo
private[this] var property2TypeMap = Map[UriRef, mutable.Set[UriRef]]()
//private[this] var indexedProperties: Seq[UriRef] = null
- def processDefinitions() {
+ protected def processDefinitions() {
val definitionsPreamble = new Preamble(definitions)
import definitionsPreamble._
val indexDefinitionsResources = CRIS.IndexDefinition/-RDF.`type`
@@ -89,9 +93,9 @@ class GraphIndexer(definitions: TripleCo
processDefinitions()
- val analyzer = new StandardAnalyzer(Version.LUCENE_30);
+ protected val analyzer: Analyzer = new
StandardAnalyzer(Version.LUCENE_30);
- val basePreamble = new Preamble(baseGraph)
+ private[this] val basePreamble = new Preamble(baseGraph)
import basePreamble._
baseGraph.addGraphListener(new GraphListener() {
@@ -127,12 +131,12 @@ class GraphIndexer(definitions: TripleCo
}
})
- def scheduleForReindex(r: Resource) {
+ protected def scheduleForReindex(r: Resource) {
logger.debug("Scheduling for reindex: "+r)
reindexActor ! r
}
- val reindexActor = new DaemonActor {
+ private[this] val reindexActor = new DaemonActor {
val resourcesToProcess = new
scala.collection.mutable.HashSet[Resource]
def act() {
@@ -162,7 +166,7 @@ class GraphIndexer(definitions: TripleCo
}
reindexActor.start()
- def indexResource(resource: Resource, writer: IndexWriter) {
+ protected def indexResource(resource: Resource, writer: IndexWriter) {
def resourceToDocument(resource: UriRef, resourceType: UriRef)
= {
val doc = new Document
Modified:
incubator/clerezza/issues/CLEREZZA-388/rdf.cris/core/src/main/scala/org/apache/clerezza/rdf/cris/ResourceFinder.scala
URL:
http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-388/rdf.cris/core/src/main/scala/org/apache/clerezza/rdf/cris/ResourceFinder.scala?rev=1073650&r1=1073649&r2=1073650&view=diff
==============================================================================
---
incubator/clerezza/issues/CLEREZZA-388/rdf.cris/core/src/main/scala/org/apache/clerezza/rdf/cris/ResourceFinder.scala
(original)
+++
incubator/clerezza/issues/CLEREZZA-388/rdf.cris/core/src/main/scala/org/apache/clerezza/rdf/cris/ResourceFinder.scala
Wed Feb 23 09:22:34 2011
@@ -27,11 +27,20 @@ import org.apache.lucene.search.Wildcard
import java.util.List
trait ResourceFinder {
-
+
+ /**
+ * recreates the index
+ */
def reCreateIndex()
+ /**
+ * find resources matching the specified condition
+ */
def findResources(conditions: Condition*): List[Resource]
+ /**
+ * Find resource with a properties whose value matches a pattern
+ */
def findResources(property: UriRef, pattern: String): List[Resource] = {
/*val query: Query = new TermQuery(new Term(