You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@clerezza.apache.org by re...@apache.org on 2011/03/06 23:27:27 UTC

svn commit: r1078607 - in /incubator/clerezza/issues/CLEREZZA-388/rdf.cris/core/src: main/scala/org/apache/clerezza/rdf/cris/GraphIndexer.scala test/scala/org/apache/clerezza/rdf/cris/GraphIndexerTest.scala

Author: reto
Date: Sun Mar  6 22:27:26 2011
New Revision: 1078607

URL: http://svn.apache.org/viewvc?rev=1078607&view=rev
Log:
CLEREZZA-388: modification of indirect properties now supported

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/test/scala/org/apache/clerezza/rdf/cris/GraphIndexerTest.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=1078607&r1=1078606&r2=1078607&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 Sun Mar  6 22:27:26 2011
@@ -158,9 +158,14 @@ class GraphIndexer(definitionGraph: Trip
 				val triple = e.getTriple
 				def followInversePaths(resource: Resource, pathToIndexedResource: List[UriRef]): Seq[Resource] = {
           if (pathToIndexedResource.size == 0) {
-            Seq[Resource]()
+            Seq(resource)
           } else {
-            throw new RuntimeException("modification of indirect properties not yet supported")
+            val predecessors = resource/-pathToIndexedResource.head
+            val tail = pathToIndexedResource.tail
+            (for (predecessor <- predecessors) yield {
+              followInversePaths(predecessor!, tail)
+            }).flatten
+            //throw new RuntimeException("modification of indirect properties not yet supported")
           }
         }
         val predicate = triple.getPredicate
@@ -224,7 +229,7 @@ class GraphIndexer(definitionGraph: Trip
 		def resourceToDocument(resource: UriRef, resourceType: UriRef) = {
 			val doc = new Document
       val indexedProperties = type2IndexedProperties(resourceType)
-      logger.info("indexing "+resource+" considering "+indexedProperties.size+" properties ("+indexedProperties+")")
+      logger.debug("indexing "+resource+" considering "+indexedProperties.size+" properties ("+indexedProperties+")")
 			for (vProperty <- indexedProperties) {
 				logger.debug("indexing "+vProperty+" with values "+(vProperty.value(resource)).length)
 				for (propertyValue <- vProperty.value(resource)) {
@@ -272,7 +277,6 @@ class GraphIndexer(definitionGraph: Trip
 		//logger.debug("instances "+instances.length)
 		val writer = new IndexWriter(index, analyzer, true, IndexWriter.MaxFieldLength.UNLIMITED);
 		for (instance <- instances) {
-      //println("indexing "+instance)
       indexResource(instance!, writer)
     }
 		writer.close
@@ -286,7 +290,6 @@ class GraphIndexer(definitionGraph: Trip
 	def findResources(conditions: Condition*) = {
 		val booleanQuery = new BooleanQuery()
 		for (c <- conditions) {
-      println("adding query "+c.query+" from "+c)
 			booleanQuery.add(c.query, BooleanClause.Occur.MUST)
 		}
 		val searcher = new IndexSearcher(index, true);

Modified: incubator/clerezza/issues/CLEREZZA-388/rdf.cris/core/src/test/scala/org/apache/clerezza/rdf/cris/GraphIndexerTest.scala
URL: http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-388/rdf.cris/core/src/test/scala/org/apache/clerezza/rdf/cris/GraphIndexerTest.scala?rev=1078607&r1=1078606&r2=1078607&view=diff
==============================================================================
--- incubator/clerezza/issues/CLEREZZA-388/rdf.cris/core/src/test/scala/org/apache/clerezza/rdf/cris/GraphIndexerTest.scala (original)
+++ incubator/clerezza/issues/CLEREZZA-388/rdf.cris/core/src/test/scala/org/apache/clerezza/rdf/cris/GraphIndexerTest.scala Sun Mar  6 22:27:26 2011
@@ -193,9 +193,7 @@ class GraphIndexerTest {
 		val indexDefinitionManager = new IndexDefinitionManager {
       val definitionGraph = definitions
     }
-    println("size before: "+definitions.size)
 		indexDefinitionManager.addDefinition(FOAF.Person, FOAF.firstName, FOAF.lastName, RDFS.comment)
-    println("size after: "+definitions.size)
 		service.reCreateIndex();
     {
       //the old data still available