Skip to content

Commit

Permalink
updated rdf2vec example
Browse files Browse the repository at this point in the history
  • Loading branch information
sven-h committed Nov 22, 2023
1 parent 43fdc31 commit 04f7e48
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
4 changes: 2 additions & 2 deletions examples/RDF2VecMatcher/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<maven.compiler.target>1.8</maven.compiler.target>

<maven.deploy.skip>true</maven.deploy.skip><!-- needed to call mvn deploy without having a distributionManagement -->
<matching.version>2.6</matching.version> <!-- version for all matching related packages -->
<matching.version>3.3</matching.version> <!-- version for all matching related packages -->
</properties>

<!-- Accessing the resources:
Expand All @@ -29,7 +29,7 @@
<dependency>
<groupId>de.uni-mannheim.informatik.dws</groupId>
<artifactId>jrdf2vec</artifactId>
<version>1.0</version>
<version>1.2</version>
</dependency>


Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package de.uni_mannheim.informatik.dws.melt.demomatcher;

import de.uni_mannheim.informatik.dws.jrdf2vec.RDF2Vec;
import de.uni_mannheim.informatik.dws.jrdf2vec.training.Gensim;
import de.uni_mannheim.informatik.dws.jrdf2vec.training.Word2VecConfiguration;
import de.uni_mannheim.informatik.dws.melt.matching_jena.MatcherYAAAJena;
import de.uni_mannheim.informatik.dws.melt.matching_ml.python.PythonServer;

import java.io.File;
import java.util.Properties;

import de.uni_mannheim.informatik.dws.melt.matching_ml.python.Gensim;
import de.uni_mannheim.informatik.dws.melt.yet_another_alignment_api.Alignment;
import org.apache.commons.io.FileUtils;
import org.apache.jena.ontology.OntModel;
Expand Down Expand Up @@ -53,9 +54,9 @@ public Alignment match(OntModel source, OntModel target, Alignment inputAlignmen
// trigger target training
String targetModel = rdf2Vec.trainNew(target, targetWalks);

de.uni_mannheim.informatik.dws.jrdf2vec.training.Gensim.shutDown();
Gensim.shutDown();

Alignment alignment = Gensim.getInstance().alignModel("./sourceDirectory/model.kv", "./targetDirectory/model.kv", "linear_projection", usedAlignment);
Alignment alignment = PythonServer.getInstance().alignModel("./sourceDirectory/model.kv", "./targetDirectory/model.kv", "linear_projection", usedAlignment);

FileUtils.deleteDirectory(sourceWalkDirectory);
FileUtils.deleteDirectory(targetWalks);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
package de.uni_mannheim.informatik.dws.melt.demomatcher;

import de.uni_mannheim.informatik.dws.melt.matching_data.TestCase;
import de.uni_mannheim.informatik.dws.melt.matching_data.TrackRepository;
import de.uni_mannheim.informatik.dws.melt.matching_eval.ExecutionResultSet;
import de.uni_mannheim.informatik.dws.melt.matching_eval.Executor;
import de.uni_mannheim.informatik.dws.melt.matching_eval.evaluator.EvaluatorCSV;
import de.uni_mannheim.informatik.dws.melt.matching_eval.evaluator.metric.cm.GoldStandardCompleteness;
import de.uni_mannheim.informatik.dws.melt.matching_eval.tracks.TestCase;
import de.uni_mannheim.informatik.dws.melt.matching_eval.tracks.Track;
import de.uni_mannheim.informatik.dws.melt.matching_eval.tracks.TrackRepository;
import de.uni_mannheim.informatik.dws.melt.matching_jena.MatcherPipelineYAAAJenaConstructor;
import de.uni_mannheim.informatik.dws.melt.matching_jena_matchers.filter.AnnonymousNodeFilter;
import de.uni_mannheim.informatik.dws.melt.matching_jena_matchers.filter.AnonymousNodeFilter;
import de.uni_mannheim.informatik.dws.melt.matching_jena_matchers.filter.BadHostsFilter;
import de.uni_mannheim.informatik.dws.melt.matching_jena_matchers.filter.ConfidenceFilter;
import de.uni_mannheim.informatik.dws.melt.matching_jena_matchers.filter.extraction.NaiveDescendingExtractor;
import de.uni_mannheim.informatik.dws.melt.matching_jena_matchers.metalevel.ForwardMatcher;
import de.uni_mannheim.informatik.dws.melt.yet_another_alignment_api.Alignment;
import eu.sealsproject.platform.res.domain.omt.IOntologyMatchingToolBridge;

import java.io.File;
import java.util.*;

import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -60,7 +56,7 @@ public void evalSimpleMatcher() {
matchers.put("ReferenceSample", new ForwardMatcher());
//matchers.put("RDF2Vec", new MatcherPipelineYAAAJenaConstructor(new ExactStringMatcher(), new ReferenceSampleMatcher(sample)));
matchers.put("RDF2VecPostProcessed", new MatcherPipelineYAAAJenaConstructor(new RDF2VecMatcher(sample),
new BadHostsFilter(true), new AnnonymousNodeFilter(), new ConfidenceFilter(0.9), new NaiveDescendingExtractor()));
new BadHostsFilter(true), new AnonymousNodeFilter(), new ConfidenceFilter(0.9), new NaiveDescendingExtractor()));

ExecutionResultSet results = Executor.run(TrackRepository.Anatomy.Default, matchers);

Expand Down

0 comments on commit 04f7e48

Please sign in to comment.