aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/uk/ac/ox/cs/pagoda/global_tests/TestPagodaLUBM.java
blob: 019fafaad6d8fec7a3e42d163e0d8a8fedc8b3e7 (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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package uk.ac.ox.cs.pagoda.global_tests;

import org.testng.annotations.Test;
import uk.ac.ox.cs.pagoda.Pagoda;
import uk.ac.ox.cs.pagoda.query.CheckAnswers;
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 TestPagodaLUBM {

	public void answersCorrectness(int number) throws IOException {
		String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
		Path answers = Paths.get(File.createTempFile("answers", ".json").getAbsolutePath());
		new File(answers.toString()).deleteOnExit();
		Path givenAnswers = TestUtil.getAnswersFilePath("answers/pagoda-lubm" + number + ".json");

		Pagoda pagoda = Pagoda.builder()
							  .ontology(Paths.get(ontoDir, "lubm/univ-bench.owl"))
							  .data(Paths.get(ontoDir, "lubm/data/lubm" + number + ".ttl"))
							  .query(Paths.get(ontoDir, "lubm/queries/test.sparql"))
							  .answer(answers)
							  .build();

		pagoda.run();
		CheckAnswers.assertSameAnswers(answers, givenAnswers);
	}

	@Test(groups = {"light", "correctness"})
	public void answersCorrectness_1() throws IOException {
		answersCorrectness(1);
	}

	public void justExecute_sygenia(int number) throws IOException {
		String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
//		Path answers = Paths.get(File.createTempFile("answers", ".json").getAbsolutePath());
//		new File(answers.toString()).deleteOnExit();
//		Path givenAnswers = TestUtil.getAnswersFilePath("answers/pagoda-lubm" + number + ".json");

		Pagoda pagoda = Pagoda.builder()
							  .ontology(Paths.get(ontoDir, "lubm/univ-bench.owl"))
							  .data(Paths.get(ontoDir, "lubm/data/lubm" + number + ".ttl"))
				              .query(Paths.get(ontoDir, "lubm/queries/lubm_sygenia.sparql"))
//							  .answer(answers)
				              .build();

		pagoda.run();
//		CheckAnswers.assertSameAnswers(answers, givenAnswers);
	}

	@Test(groups = {"sygenia"})
	public void justExecute_sygenia_1() throws IOException {
		justExecute_sygenia(1);
	}

	public void justExecute_sygenia_allBlanks(int number) throws IOException {
		String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
//		Path answers = Paths.get(File.createTempFile("answers", ".json").getAbsolutePath());
//		new File(answers.toString()).deleteOnExit();
//		Path givenAnswers = TestUtil.getAnswersFilePath("answers/pagoda-lubm" + number + ".json");

		Pagoda pagoda = Pagoda.builder()
							  .ontology(Paths.get(ontoDir, "lubm/univ-bench.owl"))
							  .data(Paths.get(ontoDir, "lubm/data/lubm" + number + ".ttl"))
				.query(Paths.get(ontoDir, "lubm/queries/lubm_sygenia_all-blanks.sparql"))
//							  .answer(answers)
				.build();

		pagoda.run();
//		CheckAnswers.assertSameAnswers(answers, givenAnswers);
	}

	@Test(groups = {"sygenia"})
	public void justExecute_sygenia_1_allBlanks() throws IOException {
		justExecute_sygenia_allBlanks(1);
	}

    @Test(groups = {"existential"})
    public void justExecute_feier() throws IOException {
        String ontoDir = TestUtil.getConfig().getProperty("ontoDir");

        Pagoda.builder()
              .ontology(Paths.get(ontoDir, "lubm/univ-bench.owl"))
              .data(Paths.get(ontoDir, "lubm/data/lubm1.ttl"))
              .query(Paths.get(ontoDir, "lubm/queries/queries_from_rules.sparql"))
              .build()
              .run();
    }
}