Prepare: using new version of CNN library
This commit is contained in:
parent
01411b4563
commit
a52f3170f3
|
|
@ -11,12 +11,12 @@ repositories {
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'org.scala-lang:scala3-library_3:3.1.2'
|
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.apache.logging.log4j:log4j-core:2.17.2'
|
||||||
implementation 'org.slf4j:slf4j-simple:1.7.36'
|
implementation 'org.slf4j:slf4j-simple:1.7.36'
|
||||||
implementation 'net.sourceforge.argparse4j:argparse4j:0.9.0'
|
implementation 'net.sourceforge.argparse4j:argparse4j:0.9.0'
|
||||||
implementation 'org.json:json:20220320'
|
implementation 'org.json:json:20220320'
|
||||||
implementation files("lib/conceptualKNN.v1.6.jar")
|
implementation files("lib/CONNOR.v22.05.13.jar")
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
|
|
@ -1,15 +1,12 @@
|
||||||
package guessNNprepare.mains
|
package guessNNprepare.mains
|
||||||
|
|
||||||
import conceptualKNN.utils.Table
|
import connor.utils.Table
|
||||||
import conceptualKNN.{ConceptualKNNModel, Partition}
|
import connor.{ConnorModel, ConnorPartition}
|
||||||
import guessNNprepare.{NamedEntity, Utils}
|
import guessNNprepare.{NamedEntity, Utils}
|
||||||
import net.sourceforge.argparse4j.impl.Arguments
|
import net.sourceforge.argparse4j.impl.Arguments
|
||||||
import net.sourceforge.argparse4j.inf.{ArgumentParser, Namespace}
|
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 org.json.{JSONArray, JSONObject, JSONTokener}
|
||||||
|
|
||||||
import java.io.PrintWriter
|
|
||||||
import java.nio.file.{Files, Path, Paths}
|
import java.nio.file.{Files, Path, Paths}
|
||||||
import java.util.concurrent.atomic.AtomicBoolean
|
import java.util.concurrent.atomic.AtomicBoolean
|
||||||
import scala.jdk.CollectionConverters.SeqHasAsJava
|
import scala.jdk.CollectionConverters.SeqHasAsJava
|
||||||
|
|
@ -43,15 +40,12 @@ object ComputeConcepts extends MainCommand {
|
||||||
val dataGraph = Utils.loadMondialDataset().get
|
val dataGraph = Utils.loadMondialDataset().get
|
||||||
println(s"Loaded ${dataGraph.listStatements().toList.size()} triples")
|
println(s"Loaded ${dataGraph.listStatements().toList.size()} triples")
|
||||||
|
|
||||||
val entityVar = Var.alloc("Neighbor_0")
|
val entityTable = Table.ofArity(1)
|
||||||
val entityTable = new Table(List(entityVar).asJava)
|
|
||||||
entities
|
entities
|
||||||
.map(entity => dataGraph.createResource(entity.rdfResource.getURI))
|
.map(entity => dataGraph.createResource(entity.rdfResource.getURI).asNode())
|
||||||
.map(resource => resource.asNode())
|
.foreach(resource => entityTable.addInitRow(List(resource).asJava))
|
||||||
.map(node => BindingFactory.binding(entityVar, node))
|
|
||||||
.foreach(binding => entityTable.addBinding(binding))
|
|
||||||
|
|
||||||
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")
|
println("Starting concept computation")
|
||||||
val stop = new AtomicBoolean(false)
|
val stop = new AtomicBoolean(false)
|
||||||
val partitionThread = new Thread(() => cnnPartition.fullPartitioning(stop))
|
val partitionThread = new Thread(() => cnnPartition.fullPartitioning(stop))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue