Prepare: using new version of CNN library

This commit is contained in:
Francesco 2022-05-16 18:40:11 +02:00
parent 01411b4563
commit a52f3170f3
4 changed files with 8 additions and 14 deletions

View File

@ -11,12 +11,12 @@ repositories {
dependencies {
implementation 'org.scala-lang:scala3-library_3:3.1.2'
implementation 'org.apache.jena:apache-jena-libs:3.17.0'
implementation 'org.apache.jena:apache-jena-libs:4.4.0'
implementation 'org.apache.logging.log4j:log4j-core:2.17.2'
implementation 'org.slf4j:slf4j-simple:1.7.36'
implementation 'net.sourceforge.argparse4j:argparse4j:0.9.0'
implementation 'org.json:json:20220320'
implementation files("lib/conceptualKNN.v1.6.jar")
implementation files("lib/CONNOR.v22.05.13.jar")
}
sourceSets {

Binary file not shown.

Binary file not shown.

View File

@ -1,15 +1,12 @@
package guessNNprepare.mains
import conceptualKNN.utils.Table
import conceptualKNN.{ConceptualKNNModel, Partition}
import connor.utils.Table
import connor.{ConnorModel, ConnorPartition}
import guessNNprepare.{NamedEntity, Utils}
import net.sourceforge.argparse4j.impl.Arguments
import net.sourceforge.argparse4j.inf.{ArgumentParser, Namespace}
import org.apache.jena.sparql.core.Var
import org.apache.jena.sparql.engine.binding.BindingFactory
import org.json.{JSONArray, JSONObject, JSONTokener}
import java.io.PrintWriter
import java.nio.file.{Files, Path, Paths}
import java.util.concurrent.atomic.AtomicBoolean
import scala.jdk.CollectionConverters.SeqHasAsJava
@ -43,15 +40,12 @@ object ComputeConcepts extends MainCommand {
val dataGraph = Utils.loadMondialDataset().get
println(s"Loaded ${dataGraph.listStatements().toList.size()} triples")
val entityVar = Var.alloc("Neighbor_0")
val entityTable = new Table(List(entityVar).asJava)
val entityTable = Table.ofArity(1)
entities
.map(entity => dataGraph.createResource(entity.rdfResource.getURI))
.map(resource => resource.asNode())
.map(node => BindingFactory.binding(entityVar, node))
.foreach(binding => entityTable.addBinding(binding))
.map(entity => dataGraph.createResource(entity.rdfResource.getURI).asNode())
.foreach(resource => entityTable.addInitRow(List(resource).asJava))
val cnnPartition = new Partition(new ConceptualKNNModel(dataGraph), List(guessTarget).asJava, entityTable, -1)
val cnnPartition = new ConnorPartition(new ConnorModel(dataGraph), List(guessTarget).asJava, entityTable, -1)
println("Starting concept computation")
val stop = new AtomicBoolean(false)
val partitionThread = new Thread(() => cnnPartition.fullPartitioning(stop))