Author: reto
Date: Thu Jan 20 15:41:06 2011
New Revision: 1061348

URL: http://svn.apache.org/viewvc?rev=1061348&view=rev
Log:
CLEREZZA-388: re-reading definitions befor reindexing

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=1061348&r1=1061347&r2=1061348&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
 Thu Jan 20 15:41:06 2011
@@ -61,14 +61,24 @@ class GraphIndexer(definitions: TripleCo
                this(definitions, baseGraph, new RAMDirectory, true)
        }
 
-       private val URI_FIELD_NAME = "resource-uri"
-       private val logger = LoggerFactory.getLogger(classOf[GraphIndexer])
-       private val definitionsPreamble = new Preamble(definitions)
-       import definitionsPreamble._
-       val indexDefinitions = CRIS.IndexDefinition/-RDF.`type`
-       val indexedTypes = for (d <- indexDefinitions) yield d/CRIS.indexedType!
-       val indexedProperties = for (p <- (for (d <- indexDefinitions)
+       private[this] val URI_FIELD_NAME = "resource-uri"
+       private[this] val logger = 
LoggerFactory.getLogger(classOf[GraphIndexer])
+       private[this] var indexedTypes: Seq[Resource] = null
+       private[this] var indexedProperties: Seq[UriRef] = null
+
+       def processDefinitions() {
+               val definitionsPreamble = new Preamble(definitions)
+               import definitionsPreamble._
+               val indexDefinitions = CRIS.IndexDefinition/-RDF.`type`
+               val tmp = for (d <- indexDefinitions) yield 
(d/CRIS.indexedType!)
+               //indexedTypes = for (d <- indexDefinitions) yield 
d/CRIS.indexedType!
+               indexedTypes = tmp
+               indexedProperties = for (p <- (for (d <- indexDefinitions)
                yield (d/CRIS.indexedProperty)).flatten) yield 
(p!).asInstanceOf[UriRef]
+       }
+       
+       processDefinitions()
+
        val analyzer = new StandardAnalyzer(Version.LUCENE_30);
 
        val basePreamble = new Preamble(baseGraph)
@@ -182,6 +192,7 @@ class GraphIndexer(definitions: TripleCo
        }
 
        def reCreateIndex() {
+               processDefinitions()
                val basePreamble = new Preamble(baseGraph)
                import basePreamble._
                val instances = (for (indexedType <- indexedTypes) yield 
(indexedType)/-RDF.`type`).flatten


Reply via email to