Author: reto
Date: Thu Mar 24 14:47:19 2011
New Revision: 1084976

URL: http://svn.apache.org/viewvc?rev=1084976&view=rev
Log:
CLEREZZA-388: reformatting code

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

Modified: 
incubator/clerezza/issues/CLEREZZA-388/rdf.cris/core/src/main/scala/org/apache/clerezza/rdf/cris/VirtualProperty.scala
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-388/rdf.cris/core/src/main/scala/org/apache/clerezza/rdf/cris/VirtualProperty.scala?rev=1084976&r1=1084975&r2=1084976&view=diff
==============================================================================
--- 
incubator/clerezza/issues/CLEREZZA-388/rdf.cris/core/src/main/scala/org/apache/clerezza/rdf/cris/VirtualProperty.scala
 (original)
+++ 
incubator/clerezza/issues/CLEREZZA-388/rdf.cris/core/src/main/scala/org/apache/clerezza/rdf/cris/VirtualProperty.scala
 Thu Mar 24 14:47:19 2011
@@ -38,72 +38,72 @@ abstract class VirtualProperty {
        val stringKey: String
        def value(node: RichGraphNode): Seq[String]
 
-  /**
-   * The RDF properties that are used to compute the value of this virtual 
property
-   */
-  protected[cris] val baseProperties: Set[UriRef]
-
-  /**
-   * The shortest path of inverse RDF properties from property to the indexed 
resource, this is an
-   * empty List for PropertyHolders, for properties in a PathVirtualProperties 
this is a list with the elements
-   * passed to its constructor till the first occurrence of property in 
reverse order.<br/>
-   * This method just returns the shortest path as virtual properties with the 
same base property in
-   * different positions are assumed to be very rare.
-   */
-  protected[cris] def pathToIndexedResource(property: UriRef): List[UriRef]
+       /**
+        * The RDF properties that are used to compute the value of this 
virtual property
+        */
+       protected[cris] val baseProperties: Set[UriRef]
+
+       /**
+        * The shortest path of inverse RDF properties from property to the 
indexed resource, this is an
+        * empty List for PropertyHolders, for properties in a 
PathVirtualProperties this is a list with the elements
+        * passed to its constructor till the first occurrence of property in 
reverse order.<br/>
+        * This method just returns the shortest path as virtual properties 
with the same base property in
+        * different positions are assumed to be very rare.
+        */
+       protected[cris] def pathToIndexedResource(property: UriRef): 
List[UriRef]
 }
 
 case class PropertyHolder(property: UriRef) extends VirtualProperty {
        val stringKey = property.getUnicodeString
        def value(node: RichGraphNode): Seq[String] = for (v <- node/property) 
yield v*
-  val baseProperties = Set(property)
-  protected[cris] def pathToIndexedResource(property: UriRef) = List[UriRef]()
+       val baseProperties = Set(property)
+       protected[cris] def pathToIndexedResource(property: UriRef) = 
List[UriRef]()
 }
 
 case class JoinVirtualProperty(properties: List[VirtualProperty]) extends 
VirtualProperty {
        val stringKey = "J"+VirtualProperty.listDigest(properties)
-  private def singleValue(node: RichGraphNode): String = (for (property <- 
properties) yield {
-    property.value(node).mkString(" ")
-  }).mkString(" ")
+       private def singleValue(node: RichGraphNode): String = (for (property 
<- properties) yield {
+                       property.value(node).mkString(" ")
+               }).mkString(" ")
        def value(node: RichGraphNode): Seq[String] = Seq(singleValue(node))
-  val baseProperties = (for (p <- properties) yield 
p.baseProperties).flatten.toSet
-  protected[cris] def pathToIndexedResource(property: UriRef) = {
-    (for (p <- properties) yield {
-      p.pathToIndexedResource(property)
-    }).foldLeft(List[UriRef]())((p1,p2) => {
-      if (p1.size > p2.size) {
-        p1
-      } else {
-        p2
-      }
-    })
-  }
+       val baseProperties = (for (p <- properties) yield 
p.baseProperties).flatten.toSet
+       protected[cris] def pathToIndexedResource(property: UriRef) = {
+               (for (p <- properties) yield {
+                               p.pathToIndexedResource(property)
+                       }).foldLeft(List[UriRef]())((p1,p2) => {
+                               if (p1.size > p2.size) {
+                                       p1
+                               } else {
+                                       p2
+                               }
+                       })
+       }
 }
 
 case class PathVirtualProperty(properties: List[UriRef]) extends 
VirtualProperty {
        val stringKey = "J"+VirtualProperty.listDigest(for (p <- properties) 
yield PropertyHolder(p))
        def value(node: RichGraphNode): Seq[String] =  {
-   def getPathResults(node: RichGraphNode, properties: List[UriRef]): 
Seq[String] = {
-     if (properties.size == 1) {
-       PropertyHolder(properties.head).value(node)
-     } else {
-       (for (v <- node/properties.head) yield getPathResults(v, 
properties.tail)).flatten
-     }
-   }
-   getPathResults(node, properties)
-  }
-  val baseProperties = properties.toSet
-  protected[cris] def pathToIndexedResource(property: UriRef) =  
properties.span(p => p != property)._1
+               def getPathResults(node: RichGraphNode, properties: 
List[UriRef]): Seq[String] = {
+                       if (properties.size == 1) {
+                               PropertyHolder(properties.head).value(node)
+                       } else {
+                               (for (v <- node/properties.head) yield 
getPathResults(v, properties.tail)).flatten
+                       }
+               }
+               getPathResults(node, properties)
+       }
+       val baseProperties = properties.toSet
+       protected[cris] def pathToIndexedResource(property: UriRef) =  
properties.span(p => p != property)._1
 }
 
 object VirtualProperty {
-  protected[cris] def listDigest(properties: List[VirtualProperty]) = {
-    val longString = (for (p <- properties) yield {
-      p.stringKey
-    }).mkString("|")
-    Util.sha1(longString)
-  }
+       protected[cris] def listDigest(properties: List[VirtualProperty]) = {
+               val longString = (for (p <- properties) yield {
+                               p.stringKey
+                       }).mkString("|")
+               Util.sha1(longString)
+       }
 }
 object VirtualProperties {
-  implicit def property2Virtual(property: UriRef) = new 
PropertyHolder(property)
+       implicit def property2Virtual(property: UriRef) = new 
PropertyHolder(property)
 }
\ No newline at end of file


Reply via email to