uzh / triplerush

A distributed in-memory graph store.
Apache License 2.0
31 stars 11 forks source link

Triple additions with `fastStart` or after `prepareExecution` sometimes don't add the edge from RootIndex to P vertex #34

Closed pstutz closed 9 years ago

pstutz commented 9 years ago

What were you doing?

I'm attempting to add triples to a TripleRush instance and either these additions don't happen correctly, or the queries fail to run correctly on the data. See code below in order to reproduce the scenario.

What did you expect to happen?

I expect to count 25700 unique triples after loading university 0 of LUBM-1.

What did actually happen?

The count is sometimes smaller than 25700.

What are possible reasons that might have caused this unexpected behavior?

Code that allows to reproduce the issue:

package com.signalcollect.triplerush.loading

import java.io.File

import org.scalatest.{ Finders, FlatSpec }
import org.scalatest.concurrent.ScalaFutures

import com.signalcollect.triplerush.{ TriplePattern, TripleRush }
import com.signalcollect.triplerush.dictionary.HashDictionary
import com.signalcollect.util.TestAnnouncements

class BlockingAdditionsSpec extends FlatSpec with TestAnnouncements with ScalaFutures {

  "Blocking additions" should "correctly load triples from a file" in {
    //fastStart = true, 
    val tr = TripleRush(dictionary = new HashDictionary())
    //val tr = TripleRush(dictionary = new ModularDictionary())
    try {
      val filePath = s".${File.separator}lubm${File.separator}university0_0.nt"
      println(s"Loading file $filePath ...")
      //tr.loadFromFile(filePath)
      val howMany = 25700
      //.take(howMany)
      tr.prepareExecution
      tr.addTriples(TripleIterator(filePath), blocking = true)
      tr.awaitIdle
      println(tr.dictionary)
      //tr.awaitIdle()
      //val count = tr.resultIteratorForQuery(Seq(TriplePattern(-1, -2, -3))).size
      //          assert(count == 25700)
      //      val countOptionFuture = tr.executeCountingQuery(Seq(TriplePattern(-1, -2, -3)))
      //      whenReady(countOptionFuture) { countOption =>
      //        assert(countOption == Some(howMany))
      //      }
      println(tr.resultIteratorForQuery(Seq(TriplePattern(-1, -2, -3))).size)
      println(tr.countVerticesByType)
      println(tr.edgesPerIndexType)
    } finally {
      tr.shutdown
    }
  }

}
pstutz commented 9 years ago

Fixed.