blob: 0956ee835c2534eaabbff56b2210fe275f6e04d7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
package uk.ac.ox.cs.pagoda.global_tests;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import uk.ac.ox.cs.pagoda.Pagoda;
import uk.ac.ox.cs.pagoda.util.TestUtil;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
public class TestPagodaUOBM {
private static final int N_1 = 1;
private static final int N_2 = 10;
@DataProvider(name = "UOBMNumbers")
private static Object[][] UOBMNumbers() {
Integer[][] integers = new Integer[N_2 - N_1 + 1][1];
for(int i = 0; i < N_2 - N_1 + 1; i++)
integers[i][0] = N_1 + i;
return integers;
}
public void answersCorrectness(int number) throws IOException {
String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
Path computedAnswers = Paths.get(File.createTempFile("answers", ".json").getAbsolutePath());
new File(computedAnswers.toString()).deleteOnExit();
Pagoda pagoda = Pagoda.builder()
.ontology(Paths.get(ontoDir, "uobm/univ-bench-dl.owl"))
.data(Paths.get(ontoDir, "uobm/data/uobm" + number + ".ttl"))
.query(Paths.get(ontoDir, "uobm/queries/test.sparql"))
.answer(computedAnswers)
.classify(true)
.hermit(true)
.build();
pagoda.run();
// TODO use HermitReasoner for computing correct answers if they are missing
String given_answers = "uobm/uobm" + number + ".json";
CheckAnswers.assertSameAnswers(computedAnswers, Paths.get(ontoDir, given_answers));
}
@Test(groups = {"light"})
public void answersCorrectness_1() throws IOException {
answersCorrectness(1);
}
@Test(groups = {"heavy"}, dataProvider = "UOBMNumbers")
public void justExecute(int number) {
String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
Pagoda pagoda = Pagoda.builder()
.ontology(Paths.get(ontoDir, "uobm/univ-bench-dl.owl"))
.data(Paths.get(ontoDir, "uobm/data/uobm" + number + ".ttl"))
.query(Paths.get(ontoDir, "uobm/queries/test.sparql"))
.classify(true)
.hermit(true)
.build();
pagoda.run();
}
}
|