aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/uk/ac/ox/cs/pagoda/global_tests/CostEvaluation.java
blob: 01e8203b7c4868f5b1101a8b7c23c9a40b4a3e98 (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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
package uk.ac.ox.cs.pagoda.global_tests;

import org.semanticweb.owlapi.model.OWLOntology;
import org.testng.annotations.Test;
import uk.ac.ox.cs.pagoda.owl.OWLHelper;
import uk.ac.ox.cs.pagoda.reasoner.QueryReasoner;
import uk.ac.ox.cs.pagoda.reasoner.QueryReasoner.Type;
import uk.ac.ox.cs.pagoda.tester.PagodaTester;
import uk.ac.ox.cs.pagoda.util.TestUtil;
import uk.ac.ox.cs.pagoda.util.Timer;
import uk.ac.ox.cs.pagoda.util.Utility;

public class CostEvaluation {	
	
	@Test
	public void lubm100() {
		int number = 1;
		String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
		PagodaTester.main(
				TestUtil.combinePaths(ontoDir, "lubm/univ-bench.owl"),
				TestUtil.combinePaths(ontoDir, "lubm/data/lubm" + number + ".ttl"),
				TestUtil.combinePaths(ontoDir, "lubm/queries/test_all_pagoda.sparql")
		); 
//		AllTests.copy("output/log4j.log", "results-backup/jair/lubm" + number + ".out"); 
	}
	
	public void lubm1000() {
		int number = 1000;
		String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
		String[] args = new String[] {
				TestUtil.combinePaths(ontoDir, "lubm/univ-bench.owl"),
				TestUtil.combinePaths(ontoDir, "lubm/data/lubm" + number + ".ttl"),
			  	TestUtil.combinePaths(ontoDir, "lubm/queries/test_all_pagoda.sparql")
		}; 
		OWLOntology ontology = OWLHelper.loadOntology(args[0]); 
		QueryReasoner reasoner = QueryReasoner.getInstance(Type.ELHOU, ontology, true, true); 
		Timer t = new Timer(); 
		reasoner.loadOntology(ontology);
		reasoner.importData(args[1]);
		if (!reasoner.preprocess())
			return ; 
		Utility.logInfo("Preprocessing Done in " + t.duration()	+ " seconds.");
		
		reasoner.evaluate(reasoner.getQueryManager().collectQueryRecords(args[2]));
//		AllTests.copy("output/log4j.log", "results-backup/jair/lubm" + number + ".out"); 
	}

	@Test
	public void uobm5() {
		int number = 1;
		String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
		String[] args = new String[] {
				TestUtil.combinePaths(ontoDir, "uobm/univ-bench-dl.owl"),
			  	TestUtil.combinePaths(ontoDir, "uobm/data/uobm" + number + ".ttl"),
				TestUtil.combinePaths(ontoDir, "uobm/queries/standard_all_pagoda.sparql")
		}; 
		PagodaTester.main(args);
//		AllTests.copy("output/log4j.log", "results-backup/jair/uobm" + number + ".out"); 
	}
	
	public void uobm100() {
		int number = 200;
		String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
		String[] args = new String[] {
				TestUtil.combinePaths(ontoDir, "uobm/univ-bench-dl.owl"),
				TestUtil.combinePaths(ontoDir, "uobm/data/uobm" + number + ".ttl"),
				TestUtil.combinePaths(ontoDir, "uobm/queries/standard_group3_all.sparql")
		}; 
		PagodaTester.main(args);
//		AllTests.copy("output/log4j.log", "results-backup/jair/uobm" + number + ".out"); 
	}
	
	public void uobm500() {
		int number = 500;
		String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
		String[] args = new String[] {
				TestUtil.combinePaths(ontoDir, "uobm/univ-bench-dl.owl"),
				TestUtil.combinePaths(ontoDir, "uobm/data/uobm" + number + ".ttl"),
				TestUtil.combinePaths(ontoDir, "uobm/queries/standard_all_pagoda.sparql")
		}; 
		
		OWLOntology ontology = OWLHelper.loadOntology(args[0]); 
		QueryReasoner reasoner = QueryReasoner.getInstance(Type.ELHOU, ontology, true, true);
		Timer t = new Timer(); 
		reasoner.loadOntology(ontology);
		reasoner.importData(args[1]);
		if (!reasoner.preprocess())
			return ; 
		Utility.logInfo("Preprocessing Done in " + t.duration()	+ " seconds.");
		
		reasoner.evaluate(reasoner.getQueryManager().collectQueryRecords(args[2]));
//		AllTests.copy("output/log4j.log", "results-backup/jair/uobm" + number + ".out"); 
	}
	
	
	public static void main(String... args) {
		String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
		args = new String[] {
				TestUtil.combinePaths(ontoDir, "dbpedia/integratedOntology-all-in-one-minus-datatype.owl"),
				TestUtil.combinePaths(ontoDir, "dbpedia/data/dbpedia-minus-datatype-new.ttl"),
				TestUtil.combinePaths(ontoDir, "dbpedia/queries/atomic_ground.sparql")
		}; 
		
		OWLOntology ontology = OWLHelper.loadOntology(args[0]); 
		QueryReasoner reasoner = QueryReasoner.getInstance(Type.ELHOU, ontology, true, true);
		Timer t = new Timer(); 
		reasoner.loadOntology(ontology);
		reasoner.importData(args[1]);
		if (!reasoner.preprocess())
			return ; 
		Utility.logInfo("Preprocessing Done in " + t.duration()	+ " seconds.");
		
		reasoner.evaluate(reasoner.getQueryManager().collectQueryRecords(args[2]));
	}
}