-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added the eu network as dataset for JUnit tests. Created a JUnit test…
… for the DatasetCreator class. (#3)
- Loading branch information
1 parent
9631e69
commit 29fd3c8
Showing
4 changed files
with
25,637 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,9 @@ | ||
# Lemming | ||
LEMMING is an ExaMple MImickiNg graph Generator | ||
|
||
|
||
### Used data and software | ||
|
||
Internally, Lemming is using the [Grph library](http://www.i3s.unice.fr/~hogie/software/index.php). | ||
|
||
For testing, we are using the [email-Eu-core network](https://snap.stanford.edu/data/email-Eu-core.html) published by the Stanford University. It has been transformed into a simple RDF file. |
58 changes: 58 additions & 0 deletions
58
src/test/java/org/aksw/simba/lemming/creation/GraphCreatorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package org.aksw.simba.lemming.creation; | ||
|
||
import java.io.InputStream; | ||
import java.util.ArrayList; | ||
import java.util.Collection; | ||
import java.util.List; | ||
|
||
import org.aksw.simba.lemming.ColouredGraph; | ||
import org.aksw.simba.lemming.creation.GraphCreator; | ||
import org.apache.commons.io.IOUtils; | ||
import org.apache.jena.rdf.model.Model; | ||
import org.apache.jena.rdf.model.ModelFactory; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.junit.runners.Parameterized; | ||
import org.junit.runners.Parameterized.Parameters; | ||
|
||
@RunWith(Parameterized.class) | ||
public class GraphCreatorTest { | ||
|
||
@Parameters | ||
public static Collection<Object[]> data() { | ||
List<Object[]> testConfigs = new ArrayList<Object[]>(); | ||
testConfigs.add(new Object[] { "graph1.n3", 5, 5 }); | ||
testConfigs.add(new Object[] { "graph_loop.n3", 3, 5 }); | ||
testConfigs.add(new Object[] { "email-Eu-core.n3", 1005, 25571 }); | ||
|
||
return testConfigs; | ||
} | ||
|
||
private String graphFile; | ||
private int expectedVertices; | ||
private int expectedEdges; | ||
|
||
public GraphCreatorTest(String graphFile, int expectedVertices, int expectedEdges) { | ||
super(); | ||
this.graphFile = graphFile; | ||
this.expectedVertices = expectedVertices; | ||
this.expectedEdges = expectedEdges; | ||
} | ||
|
||
@Test | ||
public void test() { | ||
Model model = ModelFactory.createDefaultModel(); | ||
InputStream is = this.getClass().getClassLoader().getResourceAsStream(graphFile); | ||
model.read(is, null, "N3"); | ||
IOUtils.closeQuietly(is); | ||
|
||
GraphCreator creator = new GraphCreator(); | ||
ColouredGraph graph = creator.processModel(model); | ||
Assert.assertNotNull(graph); | ||
Assert.assertEquals(expectedVertices, graph.getVertices().size()); | ||
Assert.assertEquals(expectedVertices, graph.getVertexColours().size()); | ||
Assert.assertEquals(expectedEdges, graph.getEdgeColours().size()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.