package net.sansa_stack.rdf.spark.model.tensor

import com.holdenkarau.spark.testing.DataFrameSuiteBase
import net.sansa_stack.rdf.spark.io._
import org.apache.jena.graph.{ Node, Triple }
import org.apache.jena.riot.Lang
import org.scalatest.FunSuite

class TensorTripleOpsTests extends FunSuite with DataFrameSuiteBase {

  import net.sansa_stack.rdf.spark.model._

  test("converting RDD of triples into Tensor should match") {
    val path = getClass.getResource("/rdf.nt").getPath
    val lang: Lang = Lang.NTRIPLES

    val triples = spark.rdf(lang)(path)

    val tensor = triples.asTensor()
    val size = tensor.count()

    assert(size == 450)
  }

  test("getting number of entities from RDD of triples should match") {
    val path = getClass.getResource("/rdf.nt").getPath
    val lang: Lang = Lang.NTRIPLES

    val triples = spark.rdf(lang)(path)

    val num = triples.getNumEntities()

    assert(num == 30)
  }

  test("getting number of relations from RDD of triples should match") {
    val path = getClass.getResource("/rdf.nt").getPath
    val lang: Lang = Lang.NTRIPLES

    val triples = spark.rdf(lang)(path)

    val num = triples.getNumRelations()

    assert(num == 26)
  }

}
Add basic unit test for the Tensor TripleOps
Add basic unit test for the Tensor TripleOps
