aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.classpath30
-rw-r--r--.idea/libraries/Maven__com_beust_jcommander_1_27.xml (renamed from .idea/libraries/Maven__com_beust_jcommander_1_12.xml)8
-rw-r--r--.idea/libraries/Maven__commons_cli_commons_cli_1_3.xml13
-rw-r--r--.idea/libraries/Maven__org_testng_testng_6_7.xml13
-rw-r--r--.idea/libraries/Maven__org_testng_testng_6_8_8.xml13
-rw-r--r--.idea/libraries/Maven__org_yaml_snakeyaml_1_6.xml13
-rw-r--r--.project23
-rw-r--r--README.md7
-rw-r--r--lib/RDFox/Linux/JRDFox.jarbin5015178 -> 0 bytes
-rw-r--r--lib/RDFox/Mac/JRDFox.jarbin3582609 -> 0 bytes
-rw-r--r--lib/RDFox/RDFox.zipbin81224594 -> 0 bytes
-rw-r--r--lib/RDFox/Win/JRDFox.jarbin1715610 -> 0 bytes
-rw-r--r--lib/ore/OREv2ReasonerWrapper.jarbin433263 -> 0 bytes
-rw-r--r--pom.xml49
-rw-r--r--src/resources/fly.properties (renamed from config/fly.properties)0
-rw-r--r--src/resources/log4j.properties (renamed from config/log4j.properties)2
-rw-r--r--src/resources/lubm.properties (renamed from config/lubm.properties)0
-rw-r--r--src/resources/uobm.properties (renamed from config/uobm.properties)0
-rw-r--r--src/uk/ac/ox/cs/pagoda/Pagoda.java164
-rw-r--r--src/uk/ac/ox/cs/pagoda/reasoner/QueryReasoner.java1
-rw-r--r--src/uk/ac/ox/cs/pagoda/rules/approximators/SkolemTermsManager.java1
-rw-r--r--src/uk/ac/ox/cs/pagoda/util/Properties.java4
-rw-r--r--test/resources/AllTests.xml (renamed from test/AllTests.xml)4
-rw-r--r--test/resources/FullEvaluation.xml (renamed from test/FullEvaluation.xml)0
-rw-r--r--test/resources/test.properties (renamed from config/test.properties)0
-rw-r--r--test/uk/ac/ox/cs/hermit/JAIR_HermiT.java69
-rw-r--r--test/uk/ac/ox/cs/pagoda/global_tests/CheckAnswersOverDataset.java (renamed from test/uk/ac/ox/cs/pagoda/global_tests/TestGlobalCorrectness.java)19
-rw-r--r--test/uk/ac/ox/cs/pagoda/global_tests/JAIR_Scalability.java2
-rw-r--r--test/uk/ac/ox/cs/pagoda/global_tests/LightEvaluation.java64
-rw-r--r--test/uk/ac/ox/cs/pagoda/global_tests/PagodaDBPedia.java30
-rw-r--r--test/uk/ac/ox/cs/pagoda/global_tests/PagodaELU.java20
-rw-r--r--test/uk/ac/ox/cs/pagoda/global_tests/PagodaFLY.java25
-rw-r--r--test/uk/ac/ox/cs/pagoda/global_tests/PagodaLUBM.java24
-rw-r--r--test/uk/ac/ox/cs/pagoda/global_tests/PagodaNPD.java46
-rw-r--r--test/uk/ac/ox/cs/pagoda/global_tests/PagodaNPD_bench.java30
-rw-r--r--test/uk/ac/ox/cs/pagoda/global_tests/PagodaRLU.java20
-rw-r--r--test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaDBPedia.java33
-rw-r--r--test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaFLY.java28
-rw-r--r--test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaLUBM.java45
-rw-r--r--test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaNPD.java38
-rw-r--r--test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaUOBM.java (renamed from test/uk/ac/ox/cs/pagoda/global_tests/PagodaUOBM.java)30
-rw-r--r--test/uk/ac/ox/cs/pagoda/ore/PagodaOWLReasoner.java470
-rw-r--r--test/uk/ac/ox/cs/pagoda/ore/PagodaReasonerFactory.java39
-rw-r--r--test/uk/ac/ox/cs/pagoda/tester/PagodaTester.java276
-rw-r--r--test/uk/ac/ox/cs/pagoda/util/TestUtil.java7
45 files changed, 472 insertions, 1188 deletions
diff --git a/.classpath b/.classpath
deleted file mode 100644
index 1d0a725..0000000
--- a/.classpath
+++ /dev/null
@@ -1,30 +0,0 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<classpath>
3 <classpathentry kind="src" output="target/classes" path="src">
4 <attributes>
5 <attribute name="optional" value="true"/>
6 <attribute name="maven.pomderived" value="true"/>
7 </attributes>
8 </classpathentry>
9 <classpathentry kind="src" path="example"/>
10 <classpathentry kind="src" output="target/test-classes" path="test">
11 <attributes>
12 <attribute name="optional" value="true"/>
13 <attribute name="maven.pomderived" value="true"/>
14 </attributes>
15 </classpathentry>
16 <classpathentry kind="src" path="external"/>
17 <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
18 <attributes>
19 <attribute name="maven.pomderived" value="true"/>
20 </attributes>
21 </classpathentry>
22 <classpathentry kind="lib" path="lib/RDFox/Linux/JRDFox.jar"/>
23 <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
24 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
25 <attributes>
26 <attribute name="maven.pomderived" value="true"/>
27 </attributes>
28 </classpathentry>
29 <classpathentry kind="output" path="target/classes"/>
30</classpath>
diff --git a/.idea/libraries/Maven__com_beust_jcommander_1_12.xml b/.idea/libraries/Maven__com_beust_jcommander_1_27.xml
index 2b9ea17..f0f9060 100644
--- a/.idea/libraries/Maven__com_beust_jcommander_1_12.xml
+++ b/.idea/libraries/Maven__com_beust_jcommander_1_27.xml
@@ -1,13 +1,13 @@
1<component name="libraryTable"> 1<component name="libraryTable">
2 <library name="Maven: com.beust:jcommander:1.12"> 2 <library name="Maven: com.beust:jcommander:1.27">
3 <CLASSES> 3 <CLASSES>
4 <root url="jar://$MAVEN_REPOSITORY$/com/beust/jcommander/1.12/jcommander-1.12.jar!/" /> 4 <root url="jar://$MAVEN_REPOSITORY$/com/beust/jcommander/1.27/jcommander-1.27.jar!/" />
5 </CLASSES> 5 </CLASSES>
6 <JAVADOC> 6 <JAVADOC>
7 <root url="jar://$MAVEN_REPOSITORY$/com/beust/jcommander/1.12/jcommander-1.12-javadoc.jar!/" /> 7 <root url="jar://$MAVEN_REPOSITORY$/com/beust/jcommander/1.27/jcommander-1.27-javadoc.jar!/" />
8 </JAVADOC> 8 </JAVADOC>
9 <SOURCES> 9 <SOURCES>
10 <root url="jar://$MAVEN_REPOSITORY$/com/beust/jcommander/1.12/jcommander-1.12-sources.jar!/" /> 10 <root url="jar://$MAVEN_REPOSITORY$/com/beust/jcommander/1.27/jcommander-1.27-sources.jar!/" />
11 </SOURCES> 11 </SOURCES>
12 </library> 12 </library>
13</component> \ No newline at end of file 13</component> \ No newline at end of file
diff --git a/.idea/libraries/Maven__commons_cli_commons_cli_1_3.xml b/.idea/libraries/Maven__commons_cli_commons_cli_1_3.xml
new file mode 100644
index 0000000..49e7d40
--- /dev/null
+++ b/.idea/libraries/Maven__commons_cli_commons_cli_1_3.xml
@@ -0,0 +1,13 @@
1<component name="libraryTable">
2 <library name="Maven: commons-cli:commons-cli:1.3">
3 <CLASSES>
4 <root url="jar://$MAVEN_REPOSITORY$/commons-cli/commons-cli/1.3/commons-cli-1.3.jar!/" />
5 </CLASSES>
6 <JAVADOC>
7 <root url="jar://$MAVEN_REPOSITORY$/commons-cli/commons-cli/1.3/commons-cli-1.3-javadoc.jar!/" />
8 </JAVADOC>
9 <SOURCES>
10 <root url="jar://$MAVEN_REPOSITORY$/commons-cli/commons-cli/1.3/commons-cli-1.3-sources.jar!/" />
11 </SOURCES>
12 </library>
13</component> \ No newline at end of file
diff --git a/.idea/libraries/Maven__org_testng_testng_6_7.xml b/.idea/libraries/Maven__org_testng_testng_6_7.xml
deleted file mode 100644
index 264ea06..0000000
--- a/.idea/libraries/Maven__org_testng_testng_6_7.xml
+++ /dev/null
@@ -1,13 +0,0 @@
1<component name="libraryTable">
2 <library name="Maven: org.testng:testng:6.7">
3 <CLASSES>
4 <root url="jar://$MAVEN_REPOSITORY$/org/testng/testng/6.7/testng-6.7.jar!/" />
5 </CLASSES>
6 <JAVADOC>
7 <root url="jar://$MAVEN_REPOSITORY$/org/testng/testng/6.7/testng-6.7-javadoc.jar!/" />
8 </JAVADOC>
9 <SOURCES>
10 <root url="jar://$MAVEN_REPOSITORY$/org/testng/testng/6.7/testng-6.7-sources.jar!/" />
11 </SOURCES>
12 </library>
13</component> \ No newline at end of file
diff --git a/.idea/libraries/Maven__org_testng_testng_6_8_8.xml b/.idea/libraries/Maven__org_testng_testng_6_8_8.xml
new file mode 100644
index 0000000..9ea815a
--- /dev/null
+++ b/.idea/libraries/Maven__org_testng_testng_6_8_8.xml
@@ -0,0 +1,13 @@
1<component name="libraryTable">
2 <library name="Maven: org.testng:testng:6.8.8">
3 <CLASSES>
4 <root url="jar://$MAVEN_REPOSITORY$/org/testng/testng/6.8.8/testng-6.8.8.jar!/" />
5 </CLASSES>
6 <JAVADOC>
7 <root url="jar://$MAVEN_REPOSITORY$/org/testng/testng/6.8.8/testng-6.8.8-javadoc.jar!/" />
8 </JAVADOC>
9 <SOURCES>
10 <root url="jar://$MAVEN_REPOSITORY$/org/testng/testng/6.8.8/testng-6.8.8-sources.jar!/" />
11 </SOURCES>
12 </library>
13</component> \ No newline at end of file
diff --git a/.idea/libraries/Maven__org_yaml_snakeyaml_1_6.xml b/.idea/libraries/Maven__org_yaml_snakeyaml_1_6.xml
deleted file mode 100644
index 0f8bd19..0000000
--- a/.idea/libraries/Maven__org_yaml_snakeyaml_1_6.xml
+++ /dev/null
@@ -1,13 +0,0 @@
1<component name="libraryTable">
2 <library name="Maven: org.yaml:snakeyaml:1.6">
3 <CLASSES>
4 <root url="jar://$MAVEN_REPOSITORY$/org/yaml/snakeyaml/1.6/snakeyaml-1.6.jar!/" />
5 </CLASSES>
6 <JAVADOC>
7 <root url="jar://$MAVEN_REPOSITORY$/org/yaml/snakeyaml/1.6/snakeyaml-1.6-javadoc.jar!/" />
8 </JAVADOC>
9 <SOURCES>
10 <root url="jar://$MAVEN_REPOSITORY$/org/yaml/snakeyaml/1.6/snakeyaml-1.6-sources.jar!/" />
11 </SOURCES>
12 </library>
13</component> \ No newline at end of file
diff --git a/.project b/.project
deleted file mode 100644
index f706d1e..0000000
--- a/.project
+++ /dev/null
@@ -1,23 +0,0 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<projectDescription>
3 <name>krrPAGOdA</name>
4 <comment></comment>
5 <projects>
6 </projects>
7 <buildSpec>
8 <buildCommand>
9 <name>org.eclipse.jdt.core.javabuilder</name>
10 <arguments>
11 </arguments>
12 </buildCommand>
13 <buildCommand>
14 <name>org.eclipse.m2e.core.maven2Builder</name>
15 <arguments>
16 </arguments>
17 </buildCommand>
18 </buildSpec>
19 <natures>
20 <nature>org.eclipse.jdt.core.javanature</nature>
21 <nature>org.eclipse.m2e.core.maven2Nature</nature>
22 </natures>
23</projectDescription>
diff --git a/README.md b/README.md
index 9c35c3f..5e908fb 100644
--- a/README.md
+++ b/README.md
@@ -9,14 +9,13 @@ Project dependencies/requirements
9 9
10- JavaSE 8 10- JavaSE 8
11- Maven 11- Maven
12- Eclipse Luna
13 12
14 13
15How to compile the project from source in Eclipse? 14How to compile the project from source in Eclipse?
16===== 15=====
17 16
18- In order to compile the project make sure that you have JavaSE 8 and Eclipse Luna installed on your computer. 17- In order to compile the project make sure that you have JavaSE 8 and Maven installed on your computer.
19- After cloning the repository by command git clone https://github.com/yujiaoz/PAGOdA.git, you need to load the project into Eclipse and convert it into Maven project. 18- After cloning the repository by command git clone https://github.com/yujiaoz/PAGOdA.git, you need to install it using the command "maven install".
20- The project depends on a library JRDFox.jar that is not in central maven repository. The library for different operating systems can be found in lib directory. You need to include the correct one for your computer and add it to the build path. Alternative, if you have maven installed on your computer, you could add it into your local maven repository, modify maven dependencies and make sure that you remove it from the build path. If the provided JRDFox.jar doesn't work, you might need to follow the instruction below to compile the project JRDFox by yourself. 19- The project depends on a library JRDFox.jar that is not in central maven repository. The library for different operating systems can be found in lib directory. You need to include the correct one for your computer and add it to the build path. Alternative, if you have maven installed on your computer, you could add it into your local maven repository, modify maven dependencies and make sure that you remove it from the build path. If the provided JRDFox.jar doesn't work, you might need to follow the instruction below to compile the project JRDFox by yourself.
21 20
22 21
@@ -27,7 +26,7 @@ How to compile RDFox?
27- Extract all files in the zip. 26- Extract all files in the zip.
28- Go to the directory RDFox/RDFox. 27- Go to the directory RDFox/RDFox.
29- Run command "ant". 28- Run command "ant".
30- You will find JRDFox.jar in the diretory build/release/lib. 29- You will find JRDFox.jar in the directory build/release/lib.
31 30
32 31
33How to run the project? 32How to run the project?
diff --git a/lib/RDFox/Linux/JRDFox.jar b/lib/RDFox/Linux/JRDFox.jar
deleted file mode 100644
index 3339750..0000000
--- a/lib/RDFox/Linux/JRDFox.jar
+++ /dev/null
Binary files differ
diff --git a/lib/RDFox/Mac/JRDFox.jar b/lib/RDFox/Mac/JRDFox.jar
deleted file mode 100644
index 0db4b9a..0000000
--- a/lib/RDFox/Mac/JRDFox.jar
+++ /dev/null
Binary files differ
diff --git a/lib/RDFox/RDFox.zip b/lib/RDFox/RDFox.zip
deleted file mode 100644
index f40f325..0000000
--- a/lib/RDFox/RDFox.zip
+++ /dev/null
Binary files differ
diff --git a/lib/RDFox/Win/JRDFox.jar b/lib/RDFox/Win/JRDFox.jar
deleted file mode 100644
index 26145db..0000000
--- a/lib/RDFox/Win/JRDFox.jar
+++ /dev/null
Binary files differ
diff --git a/lib/ore/OREv2ReasonerWrapper.jar b/lib/ore/OREv2ReasonerWrapper.jar
deleted file mode 100644
index 635dacc..0000000
--- a/lib/ore/OREv2ReasonerWrapper.jar
+++ /dev/null
Binary files differ
diff --git a/pom.xml b/pom.xml
index c177403..ad8c2b1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,11 +3,22 @@
3 <modelVersion>4.0.0</modelVersion> 3 <modelVersion>4.0.0</modelVersion>
4 <groupId>uk.ac.ox.cs.pagoda</groupId> 4 <groupId>uk.ac.ox.cs.pagoda</groupId>
5 <artifactId>pagoda</artifactId> 5 <artifactId>pagoda</artifactId>
6 <version>2.0.0</version> 6 <version>2.1.0-SNAPSHOT</version>
7 <packaging>jar</packaging>
7 <name>PAGOdA</name> 8 <name>PAGOdA</name>
8 <build> 9 <build>
9 <sourceDirectory>src</sourceDirectory> 10 <sourceDirectory>src</sourceDirectory>
10 <testSourceDirectory>test</testSourceDirectory> 11 <testSourceDirectory>test</testSourceDirectory>
12 <resources>
13 <resource>
14 <directory>src/resources</directory>
15 </resource>
16 </resources>
17 <testResources>
18 <testResource>
19 <directory>test/resources</directory>
20 </testResource>
21 </testResources>
11 <plugins> 22 <plugins>
12 <plugin> 23 <plugin>
13 <artifactId>maven-compiler-plugin</artifactId> 24 <artifactId>maven-compiler-plugin</artifactId>
@@ -21,6 +32,19 @@
21 <artifactId>maven-project-info-reports-plugin</artifactId> 32 <artifactId>maven-project-info-reports-plugin</artifactId>
22 <version>2.7</version> 33 <version>2.7</version>
23 </plugin> 34 </plugin>
35 <plugin>
36 <artifactId>maven-assembly-plugin</artifactId>
37 <configuration>
38 <archive>
39 <manifest>
40 <mainClass>uk.ac.ox.cs.pagoda.Pagoda</mainClass>
41 </manifest>
42 </archive>
43 <descriptorRefs>
44 <descriptorRef>jar-with-dependencies</descriptorRef>
45 </descriptorRefs>
46 </configuration>
47 </plugin>
24 </plugins> 48 </plugins>
25 </build> 49 </build>
26 <reporting> 50 <reporting>
@@ -68,6 +92,11 @@
68 </reporting> 92 </reporting>
69 <dependencies> 93 <dependencies>
70 <dependency> 94 <dependency>
95 <groupId>commons-cli</groupId>
96 <artifactId>commons-cli</artifactId>
97 <version>1.3</version>
98 </dependency>
99 <dependency>
71 <groupId>com.hermit-reasoner</groupId> 100 <groupId>com.hermit-reasoner</groupId>
72 <artifactId>org.semanticweb.hermit</artifactId> 101 <artifactId>org.semanticweb.hermit</artifactId>
73 <version>1.3.8.1</version> 102 <version>1.3.8.1</version>
@@ -106,7 +135,8 @@
106 <dependency> 135 <dependency>
107 <groupId>org.testng</groupId> 136 <groupId>org.testng</groupId>
108 <artifactId>testng</artifactId> 137 <artifactId>testng</artifactId>
109 <version>6.7</version> 138 <version>6.8.8</version>
139 <scope>test</scope>
110 </dependency> 140 </dependency>
111 <!--<dependency>--> 141 <!--<dependency>-->
112 <!--<groupId>com.googlecode.json-simple</groupId>--> 142 <!--<groupId>com.googlecode.json-simple</groupId>-->
@@ -123,5 +153,20 @@
123 <artifactId>ehcache</artifactId> 153 <artifactId>ehcache</artifactId>
124 <version>2.10.0</version> 154 <version>2.10.0</version>
125 </dependency> 155 </dependency>
156 <dependency>
157 <groupId>uk.ac.ox.cs.jrdfox</groupId>
158 <artifactId>jrdfox</artifactId>
159 <version>1.0</version>
160 </dependency>
161 <!--<dependency>-->
162 <!--<groupId>commons-lang</groupId>-->
163 <!--<artifactId>commons-lang</artifactId>-->
164 <!--<version>2.1</version>-->
165 <!--</dependency>-->
166 <!--<dependency>-->
167 <!--<groupId>org.codehaus.plexus</groupId>-->
168 <!--<artifactId>plexus-utils</artifactId>-->
169 <!--<version>1.1</version>-->
170 <!--</dependency>-->
126 </dependencies> 171 </dependencies>
127</project> 172</project>
diff --git a/config/fly.properties b/src/resources/fly.properties
index 88c85c3..88c85c3 100644
--- a/config/fly.properties
+++ b/src/resources/fly.properties
diff --git a/config/log4j.properties b/src/resources/log4j.properties
index 6e88437..3bfd32e 100644
--- a/config/log4j.properties
+++ b/src/resources/log4j.properties
@@ -3,7 +3,7 @@ log4j.rootLogger=DEBUG, CONSOLE, FILE_LAST, FILE
3 3
4log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender 4log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
5log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout 5log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
6log4j.appender.CONSOLE.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} - %m%n 6log4j.appender.CONSOLE.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %c - %m%n
7log4j.appender.CONSOLE.Target=System.out 7log4j.appender.CONSOLE.Target=System.out
8log4j.appender.CONSOLE.Threshold=INFO 8log4j.appender.CONSOLE.Threshold=INFO
9 9
diff --git a/config/lubm.properties b/src/resources/lubm.properties
index 73ed470..73ed470 100644
--- a/config/lubm.properties
+++ b/src/resources/lubm.properties
diff --git a/config/uobm.properties b/src/resources/uobm.properties
index acbe78e..acbe78e 100644
--- a/config/uobm.properties
+++ b/src/resources/uobm.properties
diff --git a/src/uk/ac/ox/cs/pagoda/Pagoda.java b/src/uk/ac/ox/cs/pagoda/Pagoda.java
new file mode 100644
index 0000000..3263c03
--- /dev/null
+++ b/src/uk/ac/ox/cs/pagoda/Pagoda.java
@@ -0,0 +1,164 @@
1package uk.ac.ox.cs.pagoda;
2
3import org.apache.commons.cli.*;
4import uk.ac.ox.cs.pagoda.reasoner.QueryReasoner;
5import uk.ac.ox.cs.pagoda.util.Properties;
6import uk.ac.ox.cs.pagoda.util.Timer;
7import uk.ac.ox.cs.pagoda.util.Utility;
8
9import java.nio.file.Path;
10
11/**
12 * The main class
13 */
14public class Pagoda implements Runnable {
15
16 private static final String OPTION_ONTOLOGY = "o";
17 private static final String OPTION_DATA = "d";
18 private static final String OPTION_QUERY = "q";
19 private static final String OPTION_ANSWER = "a";
20 private static final String OPTION_CLASSIFY = "c";
21 private static final String OPTION_HERMIT = "f";
22
23 public static void main(String... args) {
24
25 Options options = new Options();
26 options.addOption(Option.builder(OPTION_ONTOLOGY).argName(OPTION_ONTOLOGY).required().hasArg().desc("The ontology path").build());
27 options.addOption(Option.builder(OPTION_DATA).argName(OPTION_DATA).hasArg().desc("The data path").build());
28 options.addOption(Option.builder(OPTION_QUERY).argName(OPTION_QUERY).required().hasArg().desc("The query path").build());
29 options.addOption(Option.builder(OPTION_ANSWER).argName(OPTION_ANSWER).hasArg().desc("The answer path").build());
30 options.addOption(Option.builder(OPTION_CLASSIFY).argName(OPTION_CLASSIFY).desc("Tell whether to classify").type(Boolean.class).build());
31 options.addOption(Option.builder(OPTION_HERMIT).argName(OPTION_HERMIT).desc("Tell whether to call Hermit").type(Boolean.class).build());
32
33 CommandLineParser parser = new DefaultParser();
34 try {
35 CommandLine cmd = parser.parse( options, args );
36 PagodaBuilder pagodaBuilder = Pagoda.builder()
37 .ontology(cmd.getOptionValue(OPTION_ONTOLOGY))
38 .query(cmd.getOptionValue(OPTION_QUERY));
39 if(cmd.hasOption(OPTION_DATA)) pagodaBuilder.data(cmd.getOptionValue(OPTION_DATA));
40 if(cmd.hasOption(OPTION_ANSWER)) pagodaBuilder.answer(cmd.getOptionValue(OPTION_ANSWER));
41 if(cmd.hasOption(OPTION_CLASSIFY)) pagodaBuilder.classify(Boolean.parseBoolean(cmd.getOptionValue(OPTION_CLASSIFY)));
42 if(cmd.hasOption(OPTION_HERMIT)) pagodaBuilder.hermit(Boolean.parseBoolean(cmd.getOptionValue(OPTION_HERMIT)));
43
44 pagodaBuilder.build().run();
45 }
46 catch( ParseException exp ) {
47 HelpFormatter formatter = new HelpFormatter();
48 formatter.printHelp("PAGOdA", options);
49 Utility.logError("Parsing failed. Reason: " + exp.getMessage());
50 System.exit(0);
51 }
52 }
53
54 /**
55 * Do not use it
56 * */
57 private Pagoda() {
58 properties = new Properties();
59 }
60
61 private final Properties properties;
62
63 /**
64 * Get a builder.
65 * */
66 public static PagodaBuilder builder() {
67 return new PagodaBuilder();
68 }
69
70 @Override
71 public void run() {
72 Utility.logInfo("Ontology file: " + properties.getOntologyPath());
73 Utility.logInfo("Data files: " + properties.getDataPath());
74 Utility.logInfo("Query files: " + properties.getQueryPath());
75 Utility.logInfo("Answer file: " + properties.getAnswerPath());
76
77 QueryReasoner pagoda = null;
78
79 try {
80 Timer t = new Timer();
81 pagoda = QueryReasoner.getInstance(properties);
82 if (pagoda == null) return;
83
84 Utility.logInfo("Preprocessing Done in " + t.duration() + " seconds.");
85
86 if (properties.getQueryPath() != null)
87 for (String queryFile: properties.getQueryPath().split(";"))
88 pagoda.evaluate(pagoda.getQueryManager().collectQueryRecords(queryFile));
89 } finally {
90 if (pagoda != null) pagoda.dispose();
91 }
92 }
93
94 /**
95 * Allows to set the parameters before creating a Pagoda instance.
96 * */
97 public static class PagodaBuilder {
98
99 private Pagoda instance;
100
101 private PagodaBuilder() {
102 instance = new Pagoda();
103 }
104
105 public PagodaBuilder ontology(String ontologyPath) {
106 if(instance == null) return null;
107 instance.properties.setOntologyPath(ontologyPath);
108 return this;
109 }
110
111 public PagodaBuilder ontology(Path ontologyPath) {
112 return ontology(ontologyPath.toString());
113 }
114
115 public PagodaBuilder data(String dataPath) {
116 if(instance == null) return null;
117 instance.properties.setDataPath(dataPath);
118 return this;
119 }
120
121 public PagodaBuilder data(Path dataPath) {
122 return data(dataPath.toString());
123 }
124
125 public PagodaBuilder query(String queryPath) {
126 if(instance == null) return null;
127 instance.properties.setQueryPath(queryPath);
128 return this;
129 }
130
131 public PagodaBuilder query(Path queryPath) {
132 return query(queryPath.toString());
133 }
134
135 public PagodaBuilder answer(String answerPath) {
136 if(instance == null) return null;
137 instance.properties.setAnswerPath(answerPath);
138 return this;
139 }
140
141 public PagodaBuilder answer(Path answerPath) {
142 return answer(answerPath.toString());
143 }
144
145 public PagodaBuilder classify(Boolean toClassify) {
146 if(instance == null) return null;
147 instance.properties.setToClassify(toClassify);
148 return this;
149 }
150
151 public PagodaBuilder hermit(Boolean callHermit) {
152 if(instance == null) return null;
153 instance.properties.setToCallHermiT(callHermit);
154 return this;
155 }
156
157 public Pagoda build() {
158 Pagoda builtInstance = instance;
159 instance = null;
160 return builtInstance;
161 }
162
163 }
164}
diff --git a/src/uk/ac/ox/cs/pagoda/reasoner/QueryReasoner.java b/src/uk/ac/ox/cs/pagoda/reasoner/QueryReasoner.java
index 97bab50..dfe0c5f 100644
--- a/src/uk/ac/ox/cs/pagoda/reasoner/QueryReasoner.java
+++ b/src/uk/ac/ox/cs/pagoda/reasoner/QueryReasoner.java
@@ -17,6 +17,7 @@ import java.nio.file.Files;
17import java.nio.file.Paths; 17import java.nio.file.Paths;
18import java.util.Collection; 18import java.util.Collection;
19 19
20// TODO clean APIs
20public abstract class QueryReasoner { 21public abstract class QueryReasoner {
21 22
22// protected boolean forSemFacet = false; 23// protected boolean forSemFacet = false;
diff --git a/src/uk/ac/ox/cs/pagoda/rules/approximators/SkolemTermsManager.java b/src/uk/ac/ox/cs/pagoda/rules/approximators/SkolemTermsManager.java
index 0413e65..0c12a27 100644
--- a/src/uk/ac/ox/cs/pagoda/rules/approximators/SkolemTermsManager.java
+++ b/src/uk/ac/ox/cs/pagoda/rules/approximators/SkolemTermsManager.java
@@ -22,6 +22,7 @@ public class SkolemTermsManager {
22 private int dependenciesCounter = 0; 22 private int dependenciesCounter = 0;
23 23
24 // replace with hashcode. in case of collision you get only a different upper bound model. 24 // replace with hashcode. in case of collision you get only a different upper bound model.
25 // or, better, use perfect hashing (i.e. devise an ad-hoc hash function without collisions)
25 private Map<Tuple<Individual>, Integer> mapDependencyToId = new HashMap<>(); 26 private Map<Tuple<Individual>, Integer> mapDependencyToId = new HashMap<>();
26 27
27 /** 28 /**
diff --git a/src/uk/ac/ox/cs/pagoda/util/Properties.java b/src/uk/ac/ox/cs/pagoda/util/Properties.java
index b687b53..9ebebb6 100644
--- a/src/uk/ac/ox/cs/pagoda/util/Properties.java
+++ b/src/uk/ac/ox/cs/pagoda/util/Properties.java
@@ -30,9 +30,9 @@ public class Properties {
30 public boolean getToCallHermiT() { return toCallHermiT; } 30 public boolean getToCallHermiT() { return toCallHermiT; }
31 public void setToCallHermiT(boolean flag) { toCallHermiT = flag; } 31 public void setToCallHermiT(boolean flag) { toCallHermiT = flag; }
32 32
33 public static boolean ShellModeDefault = false; 33 public static boolean shellModeDefault = false;
34 34
35 boolean shellMode = ShellModeDefault; 35 boolean shellMode = shellModeDefault;
36 public boolean getShellMode() { return shellMode; } 36 public boolean getShellMode() { return shellMode; }
37 public void setShellMode(boolean flag) { shellMode = flag; } 37 public void setShellMode(boolean flag) { shellMode = flag; }
38 38
diff --git a/test/AllTests.xml b/test/resources/AllTests.xml
index c2567a8..bc3e5cc 100644
--- a/test/AllTests.xml
+++ b/test/resources/AllTests.xml
@@ -5,13 +5,13 @@
5 5
6 <test name="PagodaUOBM"> 6 <test name="PagodaUOBM">
7 <classes> 7 <classes>
8 <class name="uk.ac.ox.cs.pagoda.global_tests.PagodaUOBM" /> 8 <class name="uk.ac.ox.cs.pagoda.global_tests.TestPagodaUOBM" />
9 </classes> 9 </classes>
10 </test> 10 </test>
11 11
12 <test name="PagodaLUBM"> 12 <test name="PagodaLUBM">
13 <classes> 13 <classes>
14 <class name="uk.ac.ox.cs.pagoda.global_tests.PagodaLUBM" /> 14 <class name="uk.ac.ox.cs.pagoda.global_tests.TestPagodaLUBM" />
15 </classes> 15 </classes>
16 </test> 16 </test>
17 17
diff --git a/test/FullEvaluation.xml b/test/resources/FullEvaluation.xml
index c4a3ebe..c4a3ebe 100644
--- a/test/FullEvaluation.xml
+++ b/test/resources/FullEvaluation.xml
diff --git a/config/test.properties b/test/resources/test.properties
index c4a25d0..c4a25d0 100644
--- a/config/test.properties
+++ b/test/resources/test.properties
diff --git a/test/uk/ac/ox/cs/hermit/JAIR_HermiT.java b/test/uk/ac/ox/cs/hermit/JAIR_HermiT.java
index 2fc478d..a3264ba 100644
--- a/test/uk/ac/ox/cs/hermit/JAIR_HermiT.java
+++ b/test/uk/ac/ox/cs/hermit/JAIR_HermiT.java
@@ -1,17 +1,17 @@
1package uk.ac.ox.cs.hermit; 1package uk.ac.ox.cs.hermit;
2 2
3import org.junit.Test; 3import org.junit.Test;
4 4import uk.ac.ox.cs.pagoda.util.TestUtil;
5import uk.ac.ox.cs.pagoda.tester.PagodaTester;
6 5
7public class JAIR_HermiT { 6public class JAIR_HermiT {
8 7
9 @Test 8 @Test
10 public void lubm1() throws Exception { 9 public void lubm1() throws Exception {
10 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
11 String[] args = new String[] { 11 String[] args = new String[] {
12 PagodaTester.onto_dir + "lubm/univ-bench.owl", 12 TestUtil.combinePaths(ontoDir, "lubm/univ-bench.owl"),
13 PagodaTester.onto_dir + "lubm/data/lubm1_owl", 13 TestUtil.combinePaths(ontoDir, "lubm/data/lubm1_owl"),
14 PagodaTester.onto_dir + "lubm/queries/test.sparql" 14 TestUtil.combinePaths(ontoDir, "lubm/queries/test.sparql")
15// , "/home/yzhou/java-workspace/test-share/results_new/lubm1/hermit" 15// , "/home/yzhou/java-workspace/test-share/results_new/lubm1/hermit"
16 }; 16 };
17 HermitQueryReasoner.main(args); 17 HermitQueryReasoner.main(args);
@@ -19,10 +19,11 @@ public class JAIR_HermiT {
19 19
20 @Test 20 @Test
21 public void lubm1_rolledUp() throws Exception { 21 public void lubm1_rolledUp() throws Exception {
22 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
22 String[] args = new String[] { 23 String[] args = new String[] {
23 "/home/yzhou/backup/20141212/univ-bench-queries.owl", 24 "/home/yzhou/backup/20141212/univ-bench-queries.owl",
24 PagodaTester.onto_dir + "lubm/data/lubm1_owl", 25 TestUtil.combinePaths(ontoDir, "lubm/data/lubm1_owl"),
25 PagodaTester.onto_dir + "lubm/queries/atomic_lubm.sparql" 26 TestUtil.combinePaths(ontoDir, "lubm/queries/atomic_lubm.sparql")
26// , "/home/yzhou/java-workspace/test-share/results_new/lubm1/hermit_rolledUp" 27// , "/home/yzhou/java-workspace/test-share/results_new/lubm1/hermit_rolledUp"
27 }; 28 };
28 HermitQueryReasoner.main(args); 29 HermitQueryReasoner.main(args);
@@ -30,10 +31,11 @@ public class JAIR_HermiT {
30 31
31 @Test 32 @Test
32 public void uobm1() throws Exception { 33 public void uobm1() throws Exception {
34 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
33 String[] args = new String[] { 35 String[] args = new String[] {
34 PagodaTester.onto_dir + "uobm/univ-bench-dl.owl", 36 TestUtil.combinePaths(ontoDir, "uobm/univ-bench-dl.owl"),
35 PagodaTester.onto_dir + "uobm/data/uobm1_owl_withDeclaration", 37 TestUtil.combinePaths(ontoDir, "uobm/data/uobm1_owl_withDeclaration"),
36 PagodaTester.onto_dir + "uobm/queries/standard.sparql" 38 TestUtil.combinePaths(ontoDir, "uobm/queries/standard.sparql")
37// , "hermit_uobm1.out" 39// , "hermit_uobm1.out"
38// , "/home/yzhou/java-workspace/test-share/results_new/uobm1/hermit" 40// , "/home/yzhou/java-workspace/test-share/results_new/uobm1/hermit"
39 }; 41 };
@@ -42,10 +44,11 @@ public class JAIR_HermiT {
42 44
43 @Test 45 @Test
44 public void uobm1_rolledUp() throws Exception { 46 public void uobm1_rolledUp() throws Exception {
47 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
45 String[] args = new String[] { 48 String[] args = new String[] {
46 "/home/yzhou/backup/20141212/univ-bench-dl-queries.owl", 49 "/home/yzhou/backup/20141212/univ-bench-dl-queries.owl",
47 PagodaTester.onto_dir + "uobm/data/uobm1_owl_withDeclaration", 50 TestUtil.combinePaths(ontoDir, "uobm/data/uobm1_owl_withDeclaration"),
48 PagodaTester.onto_dir + "uobm/queries/atomic_uobm.sparql" 51 TestUtil.combinePaths(ontoDir, "uobm/queries/atomic_uobm.sparql")
49 , "hermit_uobm1_rolledUp.out" 52 , "hermit_uobm1_rolledUp.out"
50// , "/home/yzhou/java-workspace/test-share/results_new/uobm1/hermit_rolledUp" 53// , "/home/yzhou/java-workspace/test-share/results_new/uobm1/hermit_rolledUp"
51 }; 54 };
@@ -54,21 +57,23 @@ public class JAIR_HermiT {
54 57
55 @Test 58 @Test
56 public void fly_rolledUp() throws Exception { 59 public void fly_rolledUp() throws Exception {
60 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
57 HermitQueryReasoner.main( 61 HermitQueryReasoner.main(
58 PagodaTester.onto_dir + "fly/fly-all-in-one_rolledUp.owl", 62 TestUtil.combinePaths(ontoDir, "fly/fly-all-in-one_rolledUp.owl"),
59// PagodaTester.onto_dir + "fly/fly_anatomy_XP_with_GJ_FC_individuals.owl", 63// TestUtil.combinePaths(ontoDir, "fly/fly_anatomy_XP_with_GJ_FC_individuals.owl",
60 null, 64 null,
61 PagodaTester.onto_dir + "fly/queries/fly_atomic.sparql" 65 TestUtil.combinePaths(ontoDir, "fly/queries/fly_atomic.sparql")
62 , "hermit_fly.out" 66 , "hermit_fly.out"
63 ); 67 );
64 } 68 }
65 69
66 @Test 70 @Test
67 public void npd() throws Exception { 71 public void npd() throws Exception {
72 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
68 HermitQueryReasoner.main( 73 HermitQueryReasoner.main(
69 PagodaTester.onto_dir + "npd/npd-all-minus-datatype.owl", 74 TestUtil.combinePaths(ontoDir, "npd/npd-all-minus-datatype.owl"),
70 PagodaTester.onto_dir + "npd/data/npd-data-dump-minus-datatype-new.ttl", 75 TestUtil.combinePaths(ontoDir, "npd/data/npd-data-dump-minus-datatype-new.ttl"),
71 PagodaTester.onto_dir + "npd/queries/atomic_ground.sparql" 76 TestUtil.combinePaths(ontoDir, "npd/queries/atomic_ground.sparql")
72 , "hermit_npd.out" 77 , "hermit_npd.out"
73// , "/home/yzhou/java-workspace/test-share/results_new/npd/hermit" 78// , "/home/yzhou/java-workspace/test-share/results_new/npd/hermit"
74 ); 79 );
@@ -76,31 +81,34 @@ public class JAIR_HermiT {
76 81
77 @Test 82 @Test
78 public void dbpedia() throws Exception { 83 public void dbpedia() throws Exception {
84 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
79 HermitQueryReasoner.main( 85 HermitQueryReasoner.main(
80 PagodaTester.onto_dir + "dbpedia/integratedOntology-all-in-one-minus-datatype.owl", 86 TestUtil.combinePaths(ontoDir, "dbpedia/integratedOntology-all-in-one-minus-datatype.owl"),
81 PagodaTester.onto_dir + "dbpedia/data/dbpedia-minus-datatype-new.ttl", 87 TestUtil.combinePaths(ontoDir, "dbpedia/data/dbpedia-minus-datatype-new.ttl"),
82 PagodaTester.onto_dir + "dbpedia/queries/atomic_ground.sparql" 88 TestUtil.combinePaths(ontoDir, "dbpedia/queries/atomic_ground.sparql")
83 , "/home/yzhou/java-workspace/test-share/results_new/dbpedia/hermit" 89 , "/home/yzhou/java-workspace/test-share/results_new/dbpedia/hermit"
84 ); 90 );
85 } 91 }
86 92
87 @Test 93 @Test
88 public void reactome() throws Exception { 94 public void reactome() throws Exception {
95 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
89 HermitQueryReasoner.main( 96 HermitQueryReasoner.main(
90 PagodaTester.onto_dir + "bio2rdf/reactome/biopax-level3-processed.owl", 97 TestUtil.combinePaths(ontoDir, "bio2rdf/reactome/biopax-level3-processed.owl"),
91 PagodaTester.onto_dir + "bio2rdf/reactome/graph sampling/reactome_sample_10.ttl", 98 TestUtil.combinePaths(ontoDir, "bio2rdf/reactome/graph sampling/reactome_sample_10.ttl"),
92 PagodaTester.onto_dir + "bio2rdf/reactome/queries/atomic_ground.sparql" 99 TestUtil.combinePaths(ontoDir, "bio2rdf/reactome/queries/atomic_ground.sparql")
93 , "/home/yzhou/java-workspace/test-share/results_new/reactome/hermit_10p" 100 , "/home/yzhou/java-workspace/test-share/results_new/reactome/hermit_10p"
94 ); 101 );
95 } 102 }
96 103
97 @Test 104 @Test
98 public void chembl() throws Exception { 105 public void chembl() throws Exception {
106 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
99 HermitQueryReasoner.main( 107 HermitQueryReasoner.main(
100 PagodaTester.onto_dir + "bio2rdf/chembl/cco-noDPR.ttl", 108 TestUtil.combinePaths(ontoDir, "bio2rdf/chembl/cco-noDPR.ttl"),
101// null, 109// null,
102 PagodaTester.onto_dir + "bio2rdf/chembl/graph sampling/sample_1.nt", 110 TestUtil.combinePaths(ontoDir, "bio2rdf/chembl/graph sampling/sample_1.nt"),
103 PagodaTester.onto_dir + "bio2rdf/chembl/queries/atomic_ground.sparql" 111 TestUtil.combinePaths(ontoDir, "bio2rdf/chembl/queries/atomic_ground.sparql")
104 , "hermit_chembl.out" 112 , "hermit_chembl.out"
105// , "/home/yzhou/java-workspace/test-share/results_new/chembl/hermit_1p" 113// , "/home/yzhou/java-workspace/test-share/results_new/chembl/hermit_1p"
106 ); 114 );
@@ -108,10 +116,11 @@ public class JAIR_HermiT {
108 116
109 @Test 117 @Test
110 public void uniprot() throws Exception { 118 public void uniprot() throws Exception {
119 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
111 HermitQueryReasoner.main( 120 HermitQueryReasoner.main(
112 PagodaTester.onto_dir + "bio2rdf/uniprot/core-sat.owl", 121 TestUtil.combinePaths(ontoDir, "bio2rdf/uniprot/core-sat.owl"),
113 PagodaTester.onto_dir + "bio2rdf/uniprot/graph sampling/sample_1.nt", 122 TestUtil.combinePaths(ontoDir, "bio2rdf/uniprot/graph sampling/sample_1.nt"),
114 PagodaTester.onto_dir + "bio2rdf/uniprot/queries/atomic_ground.sparql" 123 TestUtil.combinePaths(ontoDir, "bio2rdf/uniprot/queries/atomic_ground.sparql")
115 , "hermit_uniprot.out" 124 , "hermit_uniprot.out"
116// , "/home/yzhou/java-workspace/test-share/results_new/uniprot/hermit_1p" 125// , "/home/yzhou/java-workspace/test-share/results_new/uniprot/hermit_1p"
117 ); 126 );
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/TestGlobalCorrectness.java b/test/uk/ac/ox/cs/pagoda/global_tests/CheckAnswersOverDataset.java
index dff2366..424afa2 100644
--- a/test/uk/ac/ox/cs/pagoda/global_tests/TestGlobalCorrectness.java
+++ b/test/uk/ac/ox/cs/pagoda/global_tests/CheckAnswersOverDataset.java
@@ -2,11 +2,9 @@ package uk.ac.ox.cs.pagoda.global_tests;
2 2
3import com.google.gson.Gson; 3import com.google.gson.Gson;
4import com.google.gson.reflect.TypeToken; 4import com.google.gson.reflect.TypeToken;
5import org.apache.log4j.Level;
6import org.testng.Assert; 5import org.testng.Assert;
6import uk.ac.ox.cs.pagoda.Pagoda;
7import uk.ac.ox.cs.pagoda.query.QueryRecord; 7import uk.ac.ox.cs.pagoda.query.QueryRecord;
8import uk.ac.ox.cs.pagoda.tester.PagodaTester;
9import uk.ac.ox.cs.pagoda.util.Utility;
10 8
11import java.io.BufferedReader; 9import java.io.BufferedReader;
12import java.io.File; 10import java.io.File;
@@ -18,18 +16,17 @@ import java.nio.file.Paths;
18import java.util.Set; 16import java.util.Set;
19 17
20/** 18/**
21 * This is a unit test for TestNG. 19 * Given an instance of Pagoda, it checks the returned answers.
22 * <p>
23 * It tests the correctness on the final output.
24 * */ 20 * */
25public class TestGlobalCorrectness { 21public class CheckAnswersOverDataset {
26 22
27 public static void test(Path ontology, Path data, Path queries, Path givenAnswers) { 23 public static void check(Pagoda pagoda, Path givenAnswers) {
28 try { 24 try {
29 Utility.setLogLevel(Level.DEBUG); 25// Utility.setLogLevel(Level.DEBUG); // uncomment for outputting partial results
30 Path computedAnswers = Paths.get(File.createTempFile("answers", ".json").getAbsolutePath()); 26 Path computedAnswers = Paths.get(File.createTempFile("answers", ".json").getAbsolutePath());
31 new File(computedAnswers.toString()).deleteOnExit(); 27 new File(computedAnswers.toString()).deleteOnExit();
32 PagodaTester.main(ontology.toString(), data.toString(), queries.toString(), computedAnswers.toString()); 28
29 pagoda.run();
33 assertSameContent(computedAnswers, givenAnswers); 30 assertSameContent(computedAnswers, givenAnswers);
34 } catch (IOException e) { 31 } catch (IOException e) {
35 e.printStackTrace(); 32 e.printStackTrace();
@@ -48,6 +45,4 @@ public class TestGlobalCorrectness {
48 45
49 Assert.assertEquals(computedAnswers, givenAnswers); 46 Assert.assertEquals(computedAnswers, givenAnswers);
50 } 47 }
51
52
53} 48}
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/JAIR_Scalability.java b/test/uk/ac/ox/cs/pagoda/global_tests/JAIR_Scalability.java
index cdf55bd..687ffee 100644
--- a/test/uk/ac/ox/cs/pagoda/global_tests/JAIR_Scalability.java
+++ b/test/uk/ac/ox/cs/pagoda/global_tests/JAIR_Scalability.java
@@ -84,7 +84,7 @@ public class JAIR_Scalability {
84 } 84 }
85 85
86 public static void main(String... args) throws IOException { 86 public static void main(String... args) throws IOException {
87 Properties.ShellModeDefault = true; 87 Properties.shellModeDefault = true;
88 new JAIR_Scalability().testUniProt(50, false); 88 new JAIR_Scalability().testUniProt(50, false);
89 } 89 }
90 90
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/LightEvaluation.java b/test/uk/ac/ox/cs/pagoda/global_tests/LightEvaluation.java
index 3ee268e..b073a26 100644
--- a/test/uk/ac/ox/cs/pagoda/global_tests/LightEvaluation.java
+++ b/test/uk/ac/ox/cs/pagoda/global_tests/LightEvaluation.java
@@ -1,67 +1,17 @@
1package uk.ac.ox.cs.pagoda.global_tests; 1package uk.ac.ox.cs.pagoda.global_tests;
2 2
3import org.junit.Test; 3import org.testng.annotations.Test;
4import uk.ac.ox.cs.pagoda.tester.PagodaTester;
5import uk.ac.ox.cs.pagoda.util.TestUtil;
6 4
7import java.io.IOException; 5import java.io.IOException;
8 6
9public class LightEvaluation { 7public class LightEvaluation {
10 8
11 @Test 9 @Test
12 public void uobm1() throws IOException { 10 public void evaluation() throws IOException {
13 int number = 1; 11 new TestPagodaUOBM().test(1);
14 String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); 12 new TestPagodaLUBM().test(100);
15 PagodaTester.main( 13 new TestPagodaFLY().test();
16 TestUtil.combinePaths(ontoDir, "uobm/univ-bench-dl.owl"), 14 new TestPagodaDBPedia().test();
17 TestUtil.combinePaths(ontoDir, "uobm/data/uobm" + number + ".ttl"), 15 new TestPagodaNPD().testNPDwithoutDataType();
18 TestUtil.combinePaths(ontoDir, "uobm/queries/standard.sparql")
19 );
20 TestUtil.copyFile("log4j.log", "output/jair/uobm1.out");
21 } 16 }
22
23 @Test
24 public void lubm100() throws IOException {
25 int number = 100;
26 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
27 PagodaTester.main(
28 TestUtil.combinePaths(ontoDir, "lubm/univ-bench.owl"),
29 TestUtil.combinePaths(ontoDir, "lubm/data/lubm" + number + ".ttl"),
30 TestUtil.combinePaths(ontoDir, "lubm/queries/test.sparql")
31 );
32 TestUtil.copyFile("log4j.log", "results-backup/current/lubm100.out");
33 }
34
35 @Test
36 public void fly() throws IOException {
37 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
38 PagodaTester.main(
39 TestUtil.combinePaths(ontoDir, "fly/fly_anatomy_XP_with_GJ_FC_individuals.owl"),
40 TestUtil.combinePaths(ontoDir, "fly/queries/fly.sparql")
41 );
42 TestUtil.copyFile("log4j.log", "results-backup/current/fly.out");
43 }
44
45 @Test
46 public void dbpedia() throws IOException {
47 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
48 PagodaTester.main(
49 TestUtil.combinePaths(ontoDir, "dbpedia/integratedOntology-all-in-one-minus-datatype.owl"),
50 TestUtil.combinePaths(ontoDir, "dbpedia/data/dbpedia-minus-datatype-new.ttl"),
51 TestUtil.combinePaths(ontoDir, "dbpedia/atomic.sparql")
52 );
53 TestUtil.copyFile("log4j.log", "results-backup/current/dbpedia.out");
54 }
55
56 @Test
57 public void npdWithoutDataType() throws IOException {
58 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
59 PagodaTester.main(
60 TestUtil.combinePaths(ontoDir, "npd/npd-all-minus-datatype.owl"),
61 TestUtil.combinePaths(ontoDir, "npd/data/npd-data-dump-minus-datatype-new.ttl"),
62 TestUtil.combinePaths(ontoDir, "npd/queries/atomic.sparql")
63 );
64 TestUtil.copyFile("log4j.log", "results-backup/current/npd_minus.out");
65 }
66
67} 17}
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/PagodaDBPedia.java b/test/uk/ac/ox/cs/pagoda/global_tests/PagodaDBPedia.java
deleted file mode 100644
index 2b9cdbd..0000000
--- a/test/uk/ac/ox/cs/pagoda/global_tests/PagodaDBPedia.java
+++ /dev/null
@@ -1,30 +0,0 @@
1package uk.ac.ox.cs.pagoda.global_tests;
2
3import org.junit.Test;
4import uk.ac.ox.cs.pagoda.tester.PagodaTester;
5import uk.ac.ox.cs.pagoda.tester.Statistics;
6import uk.ac.ox.cs.pagoda.util.TestUtil;
7
8import java.io.IOException;
9
10import static org.junit.Assert.fail;
11
12public class PagodaDBPedia {
13
14 @Test
15 public void test() throws IOException {
16 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
17 PagodaTester.main(
18 TestUtil.combinePaths(ontoDir, "dbpedia/integratedOntology-all-in-one-minus-datatype.owl"),
19 TestUtil.combinePaths(ontoDir, "dbpedia/data/dbpedia-minus-datatype-new.ttl"),
20 TestUtil.combinePaths(ontoDir, "dbpedia/atomic.sparql")
21 );
22
23 Statistics stat = new Statistics("output/log4j.log");
24 String diff = stat.diff("results-backup/benchmark/dbpedia.out");
25 TestUtil.copyFile("output/log4j.log", "results-backup/current/dbpedia.out");
26 if (!diff.isEmpty())
27 fail(diff);
28 }
29
30}
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/PagodaELU.java b/test/uk/ac/ox/cs/pagoda/global_tests/PagodaELU.java
deleted file mode 100644
index da059f9..0000000
--- a/test/uk/ac/ox/cs/pagoda/global_tests/PagodaELU.java
+++ /dev/null
@@ -1,20 +0,0 @@
1package uk.ac.ox.cs.pagoda.global_tests;
2
3import org.junit.Test;
4import uk.ac.ox.cs.pagoda.tester.PagodaTester;
5import uk.ac.ox.cs.pagoda.util.TestUtil;
6
7public class PagodaELU {
8
9 @Test void test() {
10 int number = 1;
11 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
12 PagodaTester.main(
13 TestUtil.combinePaths(ontoDir, "uobm/univ-bench-dl.owl"),
14 TestUtil.combinePaths(ontoDir, "uobm/data/uobm" + number + ".ttl"),
15 TestUtil.combinePaths(ontoDir, "uobm/queries/standard.sparql")
16 );
17 }
18
19
20}
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/PagodaFLY.java b/test/uk/ac/ox/cs/pagoda/global_tests/PagodaFLY.java
deleted file mode 100644
index d558e0f..0000000
--- a/test/uk/ac/ox/cs/pagoda/global_tests/PagodaFLY.java
+++ /dev/null
@@ -1,25 +0,0 @@
1package uk.ac.ox.cs.pagoda.global_tests;
2
3import org.junit.Test;
4import uk.ac.ox.cs.pagoda.tester.PagodaTester;
5import uk.ac.ox.cs.pagoda.util.TestUtil;
6
7public class PagodaFLY {
8
9 @Test
10 public void test() {
11 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
12 PagodaTester.main(
13 TestUtil.combinePaths(ontoDir, "fly/fly_anatomy_XP_with_GJ_FC_individuals.owl"),
14 TestUtil.combinePaths(ontoDir, "fly/queries/fly_pellet.sparql")
15 );
16
17// Statistics stat = new Statistics("output/log4j.log");
18// String diff = stat.diff("results-backup/benchmark/fly.out");
19// AllTests.copy("output/log4j.log", "results-backup/current/fly.out");
20// if (!diff.isEmpty())
21// fail(diff);
22 }
23
24
25}
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/PagodaLUBM.java b/test/uk/ac/ox/cs/pagoda/global_tests/PagodaLUBM.java
deleted file mode 100644
index 2014ec1..0000000
--- a/test/uk/ac/ox/cs/pagoda/global_tests/PagodaLUBM.java
+++ /dev/null
@@ -1,24 +0,0 @@
1package uk.ac.ox.cs.pagoda.global_tests;
2
3import org.testng.annotations.Test;
4import uk.ac.ox.cs.pagoda.util.TestUtil;
5
6import java.io.IOException;
7import java.nio.file.Paths;
8
9public class PagodaLUBM {
10
11 private void testN(int number ) throws IOException {
12 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
13 TestGlobalCorrectness.test(Paths.get(ontoDir, "lubm/univ-bench.owl"),
14 Paths.get(ontoDir, "lubm/data/lubm" + number + ".ttl"),
15 Paths.get(ontoDir, "lubm/queries/test.sparql"),
16 Paths.get(ontoDir, "lubm/lubm" + number + ".json"));
17 }
18
19 @Test
20 public void test1() throws IOException {
21 testN(1);
22 }
23
24}
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/PagodaNPD.java b/test/uk/ac/ox/cs/pagoda/global_tests/PagodaNPD.java
deleted file mode 100644
index 17d1e82..0000000
--- a/test/uk/ac/ox/cs/pagoda/global_tests/PagodaNPD.java
+++ /dev/null
@@ -1,46 +0,0 @@
1package uk.ac.ox.cs.pagoda.global_tests;
2
3import org.junit.Test;
4import uk.ac.ox.cs.pagoda.tester.PagodaTester;
5import uk.ac.ox.cs.pagoda.tester.Statistics;
6import uk.ac.ox.cs.pagoda.util.TestUtil;
7
8import java.io.IOException;
9
10import static org.junit.Assert.fail;
11
12public class PagodaNPD {
13
14 @Test
15 public void testNPDwithoutDataType() throws IOException {
16 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
17 PagodaTester.main(
18 TestUtil.combinePaths(ontoDir, "npd/npd-all-minus-datatype.owl"),
19 TestUtil.combinePaths(ontoDir, "npd/data/npd-data-dump-minus-datatype-new.ttl"),
20 TestUtil.combinePaths(ontoDir, "npd/queries/atomic.sparql")
21 );
22
23 Statistics stat = new Statistics("output/log4j.log");
24 String diff = stat.diff("results-backup/benchmark/npd_minus.out");
25 TestUtil.copyFile("output/log4j.log", "results-backup/current/npd_minus.out");
26 if (!diff.isEmpty())
27 fail(diff);
28 }
29
30 @Test
31 public void testNPD() throws IOException {
32 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
33 PagodaTester.main(
34 TestUtil.combinePaths(ontoDir, "npd/npd-all.owl"),
35 TestUtil.combinePaths(ontoDir, "npd/data/npd-data-dump-processed.ttl"),
36 TestUtil.combinePaths(ontoDir, "npd/queries/atomic.sparql")
37 );
38
39 Statistics stat = new Statistics("output/log4j.log");
40 String diff = stat.diff("results-backup/benchmark/npd.out");
41 TestUtil.copyFile("output/log4j.log", "results-backup/current/npd.out");
42 if (!diff.isEmpty())
43 fail(diff);
44 }
45
46}
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/PagodaNPD_bench.java b/test/uk/ac/ox/cs/pagoda/global_tests/PagodaNPD_bench.java
deleted file mode 100644
index c908cb4..0000000
--- a/test/uk/ac/ox/cs/pagoda/global_tests/PagodaNPD_bench.java
+++ /dev/null
@@ -1,30 +0,0 @@
1package uk.ac.ox.cs.pagoda.global_tests;
2
3import org.junit.Test;
4import uk.ac.ox.cs.pagoda.tester.PagodaTester;
5import uk.ac.ox.cs.pagoda.tester.Statistics;
6import uk.ac.ox.cs.pagoda.util.TestUtil;
7
8import java.io.IOException;
9
10import static org.junit.Assert.fail;
11
12public class PagodaNPD_bench {
13
14 @Test
15 public void test() throws IOException {
16 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
17 PagodaTester.main(
18 TestUtil.combinePaths(ontoDir, "npd-benchmark/npd-v2-ql_a.owl"),
19 TestUtil.combinePaths(ontoDir, "npd-benchmark/npd-v2-ql_a.ttl"),
20 TestUtil.combinePaths(ontoDir, "npd-benchmark/queries/all.sparql")
21 );
22
23 Statistics stat = new Statistics("output/log4j.log");
24 String diff = stat.diff("results-backup/benchmark/npd-bench.out");
25 TestUtil.copyFile("output/log4j.log", "results-backup/current/npd-bench.out");
26 if (!diff.isEmpty())
27 fail(diff);
28 }
29
30}
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/PagodaRLU.java b/test/uk/ac/ox/cs/pagoda/global_tests/PagodaRLU.java
deleted file mode 100644
index 88e0835..0000000
--- a/test/uk/ac/ox/cs/pagoda/global_tests/PagodaRLU.java
+++ /dev/null
@@ -1,20 +0,0 @@
1package uk.ac.ox.cs.pagoda.global_tests;
2
3import org.junit.Test;
4import uk.ac.ox.cs.pagoda.tester.PagodaTester;
5import uk.ac.ox.cs.pagoda.util.TestUtil;
6
7public class PagodaRLU {
8
9 @Test
10 public void testRL() {
11 int number = 1;
12 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
13 PagodaTester.main(
14 TestUtil.combinePaths(ontoDir, "uobm/univ-bench-dl.owl"),
15 TestUtil.combinePaths(ontoDir, "uobm/data/uobm" + number + ".ttl"),
16 TestUtil.combinePaths(ontoDir, "uobm/queries/standard.sparql")
17 );
18 }
19
20}
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaDBPedia.java b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaDBPedia.java
new file mode 100644
index 0000000..04c9f3b
--- /dev/null
+++ b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaDBPedia.java
@@ -0,0 +1,33 @@
1package uk.ac.ox.cs.pagoda.global_tests;
2
3import org.testng.annotations.Test;
4import uk.ac.ox.cs.pagoda.Pagoda;
5import uk.ac.ox.cs.pagoda.util.TestUtil;
6
7import java.io.IOException;
8import java.nio.file.Paths;
9
10public class TestPagodaDBPedia {
11
12 public static final String ANSWER_PATH = "~/TestPagodaDEBPedia.json";
13
14 @Test
15 public void just_execute() throws IOException {
16 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
17 Pagoda pagoda = Pagoda.builder()
18 .ontology(Paths.get(ontoDir, "dbpedia/integratedOntology-all-in-one-minus-datatype.owl"))
19 .data(Paths.get(ontoDir, "dbpedia/data/dbpedia-minus-datatype-new.ttl"))
20 .query(Paths.get(ontoDir, "dbpedia/atomic.sparql"))
21 .answer(ANSWER_PATH)
22 .classify(true)
23 .hermit(true)
24 .build();
25 pagoda.run();
26 }
27
28 @Test
29 public void test() {
30 // TODO implement
31 }
32
33}
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaFLY.java b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaFLY.java
new file mode 100644
index 0000000..623034e
--- /dev/null
+++ b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaFLY.java
@@ -0,0 +1,28 @@
1package uk.ac.ox.cs.pagoda.global_tests;
2
3import org.testng.annotations.Test;
4import uk.ac.ox.cs.pagoda.Pagoda;
5import uk.ac.ox.cs.pagoda.util.TestUtil;
6
7public class TestPagodaFLY {
8
9 public static final String ANSWER_PATH = "~/TestPagodaFLY.json";
10
11 @Test
12 public void just_execute() {
13 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
14 Pagoda pagoda = Pagoda.builder()
15 .ontology(TestUtil.combinePaths(ontoDir, "fly/fly_anatomy_XP_with_GJ_FC_individuals.owl"))
16 .query(TestUtil.combinePaths(ontoDir, "fly/queries/fly.sparql"))
17// .answer(ANSWER_PATH)
18 .classify(true)
19 .hermit(true)
20 .build();
21 pagoda.run();
22 }
23
24 @Test
25 public void test() {
26 // TODO implement
27 }
28}
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaLUBM.java b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaLUBM.java
new file mode 100644
index 0000000..bb58681
--- /dev/null
+++ b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaLUBM.java
@@ -0,0 +1,45 @@
1package uk.ac.ox.cs.pagoda.global_tests;
2
3import org.testng.annotations.Test;
4import uk.ac.ox.cs.pagoda.Pagoda;
5import uk.ac.ox.cs.pagoda.util.TestUtil;
6
7import java.io.IOException;
8import java.nio.file.Paths;
9
10public class TestPagodaLUBM {
11
12 public void test(int number) throws IOException {
13 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
14 Pagoda pagoda = Pagoda.builder()
15 .ontology(Paths.get(ontoDir, "lubm/univ-bench.owl"))
16 .data(Paths.get(ontoDir, "lubm/data/lubm" + number + ".ttl"))
17 .query(Paths.get(ontoDir, "lubm/queries/test.sparql"))
18 .classify(true)
19 .hermit(true)
20 .build();
21 CheckAnswersOverDataset.check(pagoda, Paths.get(ontoDir, "lubm/lubm" + number + ".json"));
22 }
23
24 @Test
25 public void test_1() throws IOException {
26 test(1);
27 }
28
29 public void justExecute_100() {
30 int number = 100;
31 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
32 Pagoda pagoda = Pagoda.builder()
33 .ontology(Paths.get(ontoDir, "lubm/univ-bench.owl"))
34 .data(Paths.get(ontoDir, "lubm/data/lubm" + number + ".ttl"))
35 .query(Paths.get(ontoDir, "lubm/queries/test.sparql"))
36 .classify(true)
37 .hermit(true)
38 .build();
39 pagoda.run();
40 }
41
42 public static void main(String... args) {
43 new TestPagodaLUBM().justExecute_100();
44 }
45}
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaNPD.java b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaNPD.java
new file mode 100644
index 0000000..939ee6e
--- /dev/null
+++ b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaNPD.java
@@ -0,0 +1,38 @@
1package uk.ac.ox.cs.pagoda.global_tests;
2
3import org.testng.annotations.Test;
4import uk.ac.ox.cs.pagoda.Pagoda;
5import uk.ac.ox.cs.pagoda.util.TestUtil;
6
7import java.io.IOException;
8import java.nio.file.Paths;
9
10public class TestPagodaNPD {
11
12 public static final String ANSWER_PATH = "~/PagodaNPDWithoutDatatype.json";
13
14 @Test
15 public void justExecuteNPDWithoutDataType() {
16 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
17 Pagoda pagoda = Pagoda.builder()
18 .ontology(Paths.get(ontoDir, "npd/npd-all-minus-datatype.owl"))
19 .data(Paths.get(ontoDir, "npd/data/npd-data-dump-minus-datatype-new.ttl"))
20 .query(Paths.get(ontoDir, "npd/queries/atomic.sparql"))
21 .answer(ANSWER_PATH)
22 .classify(true)
23 .hermit(true)
24 .build();
25 pagoda.run();
26 }
27
28 @Test
29 public void testNPDwithoutDataType() throws IOException {
30 // TODO implement
31 }
32
33 @Test
34 public void testNPD() throws IOException {
35 // TODO implement
36 }
37
38}
diff --git a/test/uk/ac/ox/cs/pagoda/global_tests/PagodaUOBM.java b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaUOBM.java
index 065fb29..61235d3 100644
--- a/test/uk/ac/ox/cs/pagoda/global_tests/PagodaUOBM.java
+++ b/test/uk/ac/ox/cs/pagoda/global_tests/TestPagodaUOBM.java
@@ -2,6 +2,7 @@ package uk.ac.ox.cs.pagoda.global_tests;
2 2
3import org.testng.annotations.DataProvider; 3import org.testng.annotations.DataProvider;
4import org.testng.annotations.Test; 4import org.testng.annotations.Test;
5import uk.ac.ox.cs.pagoda.Pagoda;
5import uk.ac.ox.cs.pagoda.tester.PagodaTester; 6import uk.ac.ox.cs.pagoda.tester.PagodaTester;
6import uk.ac.ox.cs.pagoda.util.TestUtil; 7import uk.ac.ox.cs.pagoda.util.TestUtil;
7 8
@@ -10,25 +11,29 @@ import java.nio.file.Paths;
10 11
11import static uk.ac.ox.cs.pagoda.util.TestUtil.combinePaths; 12import static uk.ac.ox.cs.pagoda.util.TestUtil.combinePaths;
12 13
13public class PagodaUOBM { 14public class TestPagodaUOBM {
14 15
15 private void testN(int number ) throws IOException { 16 public void test(int number) throws IOException {
16 String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); 17 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
17 TestGlobalCorrectness.test(Paths.get(ontoDir, "uobm/univ-bench-dl.owl"), 18 Pagoda pagoda = Pagoda.builder()
18 Paths.get(ontoDir, "uobm/data/uobm" + number + ".ttl"), 19 .ontology(Paths.get(ontoDir, "uobm/univ-bench-dl.owl"))
19 Paths.get(ontoDir, "uobm/queries/test.sparql"), 20 .data(Paths.get(ontoDir, "uobm/data/uobm" + number + ".ttl"))
20 Paths.get(ontoDir, "uobm/uobm" + number + ".json")); 21 .query(Paths.get(ontoDir, "uobm/queries/test.sparql"))
22 .classify(true)
23 .hermit(true)
24 .build();
25 CheckAnswersOverDataset.check(pagoda,
26 Paths.get(ontoDir, "uobm/uobm" + number + ".json"));
21 } 27 }
22 28
23 @Test 29 @Test
24 public void test1() throws IOException { 30 public void test_1() throws IOException {
25 testN(1); 31 test(1);
26 } 32 }
27 33
28 private static final int N_1 = 8; 34 private static final int N_1 = 1;
29 private static final int N_2 = 10; 35 private static final int N_2 = 10;
30 36
31
32 @DataProvider(name = "uobmNumbers") 37 @DataProvider(name = "uobmNumbers")
33 public static Object[][] uobmNumbers() { 38 public static Object[][] uobmNumbers() {
34 Integer[][] integers = new Integer[N_2 - N_1 + 1][1]; 39 Integer[][] integers = new Integer[N_2 - N_1 + 1][1];
@@ -37,11 +42,6 @@ public class PagodaUOBM {
37 return integers; 42 return integers;
38 } 43 }
39 44
40// @Test
41// public void justExecute3() {
42// justExecute(1);
43// }
44
45 @Test(dataProvider = "uobmNumbers") 45 @Test(dataProvider = "uobmNumbers")
46 public void justExecute(int number) { 46 public void justExecute(int number) {
47 String ontoDir = TestUtil.getConfig().getProperty("ontoDir"); 47 String ontoDir = TestUtil.getConfig().getProperty("ontoDir");
diff --git a/test/uk/ac/ox/cs/pagoda/ore/PagodaOWLReasoner.java b/test/uk/ac/ox/cs/pagoda/ore/PagodaOWLReasoner.java
deleted file mode 100644
index a07323d..0000000
--- a/test/uk/ac/ox/cs/pagoda/ore/PagodaOWLReasoner.java
+++ /dev/null
@@ -1,470 +0,0 @@
1package uk.ac.ox.cs.pagoda.ore;
2
3import java.util.HashMap;
4import java.util.HashSet;
5import java.util.List;
6import java.util.Map;
7import java.util.Set;
8
9import org.semanticweb.owlapi.model.AxiomType;
10import org.semanticweb.owlapi.model.IRI;
11import org.semanticweb.owlapi.model.OWLAxiom;
12import org.semanticweb.owlapi.model.OWLClass;
13import org.semanticweb.owlapi.model.OWLClassExpression;
14import org.semanticweb.owlapi.model.OWLDataFactory;
15import org.semanticweb.owlapi.model.OWLDataProperty;
16import org.semanticweb.owlapi.model.OWLDataPropertyExpression;
17import org.semanticweb.owlapi.model.OWLLiteral;
18import org.semanticweb.owlapi.model.OWLNamedIndividual;
19import org.semanticweb.owlapi.model.OWLObjectPropertyExpression;
20import org.semanticweb.owlapi.model.OWLOntology;
21import org.semanticweb.owlapi.model.OWLOntologyChange;
22import org.semanticweb.owlapi.reasoner.AxiomNotInProfileException;
23import org.semanticweb.owlapi.reasoner.BufferingMode;
24import org.semanticweb.owlapi.reasoner.ClassExpressionNotInProfileException;
25import org.semanticweb.owlapi.reasoner.FreshEntitiesException;
26import org.semanticweb.owlapi.reasoner.FreshEntityPolicy;
27import org.semanticweb.owlapi.reasoner.InconsistentOntologyException;
28import org.semanticweb.owlapi.reasoner.IndividualNodeSetPolicy;
29import org.semanticweb.owlapi.reasoner.InferenceType;
30import org.semanticweb.owlapi.reasoner.Node;
31import org.semanticweb.owlapi.reasoner.NodeSet;
32import org.semanticweb.owlapi.reasoner.OWLReasoner;
33import org.semanticweb.owlapi.reasoner.ReasonerInterruptedException;
34import org.semanticweb.owlapi.reasoner.TimeOutException;
35import org.semanticweb.owlapi.reasoner.UnsupportedEntailmentTypeException;
36import org.semanticweb.owlapi.reasoner.impl.OWLClassNodeSet;
37import org.semanticweb.owlapi.util.Version;
38
39import uk.ac.ox.cs.JRDFox.model.GroundTerm;
40import uk.ac.ox.cs.JRDFox.model.Individual;
41import uk.ac.ox.cs.pagoda.query.AnswerTuples;
42import uk.ac.ox.cs.pagoda.reasoner.QueryReasoner;
43import uk.ac.ox.cs.pagoda.util.Utility;
44
45public class PagodaOWLReasoner implements OWLReasoner {
46
47 QueryReasoner reasoner;
48 OWLOntology ontology;
49 OWLDataFactory factory;
50 boolean sat;
51
52 public PagodaOWLReasoner(OWLOntology ontology) {
53 this.ontology = ontology;
54 factory = ontology.getOWLOntologyManager().getOWLDataFactory();
55 reasoner = QueryReasoner.getInstance(ontology);
56 reasoner.setToClassify(false);
57 reasoner.loadOntology(ontology);
58 sat = reasoner.preprocess();
59 thing = new OWLClassNodeSet(factory.getOWLThing());
60 }
61
62 @Override
63 public String getReasonerName() {
64 return "PAGOdA";
65 }
66
67 @Override
68 public Version getReasonerVersion() {
69 return null;
70 }
71
72 @Override
73 public BufferingMode getBufferingMode() {
74 // TODO Auto-generated method stub
75 return null;
76 }
77
78 @Override
79 public void flush() {
80 // TODO Auto-generated method stub
81
82 }
83
84 @Override
85 public List<OWLOntologyChange> getPendingChanges() {
86 // TODO Auto-generated method stub
87 return null;
88 }
89
90 @Override
91 public Set<OWLAxiom> getPendingAxiomAdditions() {
92 // TODO Auto-generated method stub
93 return null;
94 }
95
96 @Override
97 public Set<OWLAxiom> getPendingAxiomRemovals() {
98 // TODO Auto-generated method stub
99 return null;
100 }
101
102 @Override
103 public OWLOntology getRootOntology() {
104 return ontology;
105 }
106
107 @Override
108 public void interrupt() {
109 // TODO Auto-generated method stub
110
111 }
112
113 @Override
114 public void precomputeInferences(InferenceType... inferenceTypes) throws ReasonerInterruptedException, TimeOutException, InconsistentOntologyException {
115 if (!sat) {
116 throw new InconsistentOntologyException();
117 }
118 if (inferenceTypes.length == 1 && inferenceTypes[0].equals(InferenceType.CLASS_ASSERTIONS) && types.isEmpty()) {
119 Set<OWLClass> queriedClasses = new HashSet<OWLClass>();
120 for (OWLOntology onto: ontology.getImportsClosure())
121 for (OWLClass cls: onto.getClassesInSignature(true)) {
122// if (cls.toStringID().equals("http://www.w3.org/TR/2003/PR-owl-guide-20031209/wine#Meritage"));
123// else continue;
124 if (!cls.equals(factory.getOWLThing()) && !queriedClasses.contains(cls)) {
125 queriedClasses.add(cls);
126 AnswerTuples tuples = null;
127 try {
128 tuples = reasoner.evaluate(String.format("select distinct ?x where { ?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <%s> .}", cls.toStringID()));
129 int cnt = 0;
130 for (GroundTerm t; tuples.isValid(); tuples.moveNext()) {
131 t = tuples.getTuple().getGroundTerm(0);
132 if (t instanceof Individual) {
133 addType(((Individual) t).getIRI(), cls);
134 ++cnt;
135 }
136 }
137 Utility.logInfo("The number of answers: " + cnt);
138 } finally {
139 if (tuples != null) tuples.dispose();
140 }
141 }
142 }
143 }
144 }
145
146 private void addType(String iri, OWLClass cls) {
147 OWLNamedIndividual ind = factory.getOWLNamedIndividual(IRI.create(iri));
148 OWLClassNodeSet set;
149 if (types.containsKey(ind)) {
150 set = types.get(ind);
151 }
152 else {
153 set = new OWLClassNodeSet(factory.getOWLThing());
154 types.put(ind, set);
155 }
156 set.addEntity(cls);
157 }
158
159 @Override
160 public boolean isPrecomputed(InferenceType inferenceType) {
161 // TODO Auto-generated method stub
162 return false;
163 }
164
165 @Override
166 public Set<InferenceType> getPrecomputableInferenceTypes() {
167 return java.util.Collections.singleton(InferenceType.CLASS_ASSERTIONS);
168 }
169
170 @Override
171 public boolean isConsistent() throws ReasonerInterruptedException, TimeOutException {
172 return sat;
173 }
174
175 @Override
176 public boolean isSatisfiable(OWLClassExpression classExpression) throws ReasonerInterruptedException, TimeOutException, ClassExpressionNotInProfileException, FreshEntitiesException, InconsistentOntologyException {
177 // TODO Auto-generated method stub
178 return false;
179 }
180
181 @Override
182 public Node<OWLClass> getUnsatisfiableClasses() throws ReasonerInterruptedException, TimeOutException, InconsistentOntologyException {
183 // TODO Auto-generated method stub
184 return null;
185 }
186
187 @Override
188 public boolean isEntailed(OWLAxiom axiom)
189 throws ReasonerInterruptedException,
190 UnsupportedEntailmentTypeException, TimeOutException,
191 AxiomNotInProfileException, FreshEntitiesException,
192 InconsistentOntologyException {
193 // TODO Auto-generated method stub
194 return false;
195 }
196
197 @Override
198 public boolean isEntailed(Set<? extends OWLAxiom> axioms)
199 throws ReasonerInterruptedException,
200 UnsupportedEntailmentTypeException, TimeOutException,
201 AxiomNotInProfileException, FreshEntitiesException,
202 InconsistentOntologyException {
203 // TODO Auto-generated method stub
204 return false;
205 }
206
207 @Override
208 public boolean isEntailmentCheckingSupported(AxiomType<?> axiomType) {
209 // TODO Auto-generated method stub
210 return false;
211 }
212
213 @Override
214 public Node<OWLClass> getTopClassNode() {
215 // TODO Auto-generated method stub
216 return null;
217 }
218
219 @Override
220 public Node<OWLClass> getBottomClassNode() {
221 // TODO Auto-generated method stub
222 return null;
223 }
224
225 @Override
226 public NodeSet<OWLClass> getSubClasses(OWLClassExpression ce, boolean direct)
227 throws ReasonerInterruptedException, TimeOutException,
228 FreshEntitiesException, InconsistentOntologyException,
229 ClassExpressionNotInProfileException {
230 // TODO Auto-generated method stub
231 return null;
232 }
233
234 @Override
235 public NodeSet<OWLClass> getSuperClasses(OWLClassExpression ce,
236 boolean direct) throws InconsistentOntologyException,
237 ClassExpressionNotInProfileException, FreshEntitiesException,
238 ReasonerInterruptedException, TimeOutException {
239 // TODO Auto-generated method stub
240 return null;
241 }
242
243 @Override
244 public Node<OWLClass> getEquivalentClasses(OWLClassExpression ce)
245 throws InconsistentOntologyException,
246 ClassExpressionNotInProfileException, FreshEntitiesException,
247 ReasonerInterruptedException, TimeOutException {
248 // TODO Auto-generated method stub
249 return null;
250 }
251
252 @Override
253 public NodeSet<OWLClass> getDisjointClasses(OWLClassExpression ce)
254 throws ReasonerInterruptedException, TimeOutException,
255 FreshEntitiesException, InconsistentOntologyException {
256 // TODO Auto-generated method stub
257 return null;
258 }
259
260 @Override
261 public Node<OWLObjectPropertyExpression> getTopObjectPropertyNode() {
262 // TODO Auto-generated method stub
263 return null;
264 }
265
266 @Override
267 public Node<OWLObjectPropertyExpression> getBottomObjectPropertyNode() {
268 // TODO Auto-generated method stub
269 return null;
270 }
271
272 @Override
273 public NodeSet<OWLObjectPropertyExpression> getSubObjectProperties(
274 OWLObjectPropertyExpression pe, boolean direct)
275 throws InconsistentOntologyException, FreshEntitiesException,
276 ReasonerInterruptedException, TimeOutException {
277 // TODO Auto-generated method stub
278 return null;
279 }
280
281 @Override
282 public NodeSet<OWLObjectPropertyExpression> getSuperObjectProperties(
283 OWLObjectPropertyExpression pe, boolean direct)
284 throws InconsistentOntologyException, FreshEntitiesException,
285 ReasonerInterruptedException, TimeOutException {
286 // TODO Auto-generated method stub
287 return null;
288 }
289
290 @Override
291 public Node<OWLObjectPropertyExpression> getEquivalentObjectProperties(
292 OWLObjectPropertyExpression pe)
293 throws InconsistentOntologyException, FreshEntitiesException,
294 ReasonerInterruptedException, TimeOutException {
295 // TODO Auto-generated method stub
296 return null;
297 }
298
299 @Override
300 public NodeSet<OWLObjectPropertyExpression> getDisjointObjectProperties(
301 OWLObjectPropertyExpression pe)
302 throws InconsistentOntologyException, FreshEntitiesException,
303 ReasonerInterruptedException, TimeOutException {
304 // TODO Auto-generated method stub
305 return null;
306 }
307
308 @Override
309 public Node<OWLObjectPropertyExpression> getInverseObjectProperties(
310 OWLObjectPropertyExpression pe)
311 throws InconsistentOntologyException, FreshEntitiesException,
312 ReasonerInterruptedException, TimeOutException {
313 // TODO Auto-generated method stub
314 return null;
315 }
316
317 @Override
318 public NodeSet<OWLClass> getObjectPropertyDomains(
319 OWLObjectPropertyExpression pe, boolean direct)
320 throws InconsistentOntologyException, FreshEntitiesException,
321 ReasonerInterruptedException, TimeOutException {
322 // TODO Auto-generated method stub
323 return null;
324 }
325
326 @Override
327 public NodeSet<OWLClass> getObjectPropertyRanges(
328 OWLObjectPropertyExpression pe, boolean direct)
329 throws InconsistentOntologyException, FreshEntitiesException,
330 ReasonerInterruptedException, TimeOutException {
331 // TODO Auto-generated method stub
332 return null;
333 }
334
335 @Override
336 public Node<OWLDataProperty> getTopDataPropertyNode() {
337 // TODO Auto-generated method stub
338 return null;
339 }
340
341 @Override
342 public Node<OWLDataProperty> getBottomDataPropertyNode() {
343 // TODO Auto-generated method stub
344 return null;
345 }
346
347 @Override
348 public NodeSet<OWLDataProperty> getSubDataProperties(OWLDataProperty pe,
349 boolean direct) throws InconsistentOntologyException,
350 FreshEntitiesException, ReasonerInterruptedException,
351 TimeOutException {
352 // TODO Auto-generated method stub
353 return null;
354 }
355
356 @Override
357 public NodeSet<OWLDataProperty> getSuperDataProperties(OWLDataProperty pe,
358 boolean direct) throws InconsistentOntologyException,
359 FreshEntitiesException, ReasonerInterruptedException,
360 TimeOutException {
361 // TODO Auto-generated method stub
362 return null;
363 }
364
365 @Override
366 public Node<OWLDataProperty> getEquivalentDataProperties(OWLDataProperty pe)
367 throws InconsistentOntologyException, FreshEntitiesException,
368 ReasonerInterruptedException, TimeOutException {
369 // TODO Auto-generated method stub
370 return null;
371 }
372
373 @Override
374 public NodeSet<OWLDataProperty> getDisjointDataProperties(
375 OWLDataPropertyExpression pe) throws InconsistentOntologyException,
376 FreshEntitiesException, ReasonerInterruptedException,
377 TimeOutException {
378 // TODO Auto-generated method stub
379 return null;
380 }
381
382 @Override
383 public NodeSet<OWLClass> getDataPropertyDomains(OWLDataProperty pe,
384 boolean direct) throws InconsistentOntologyException,
385 FreshEntitiesException, ReasonerInterruptedException,
386 TimeOutException {
387 // TODO Auto-generated method stub
388 return null;
389 }
390
391 private Map<OWLNamedIndividual, OWLClassNodeSet> types = new HashMap<OWLNamedIndividual, OWLClassNodeSet>();
392 private OWLClassNodeSet thing;
393
394 @Override
395 public NodeSet<OWLClass> getTypes(OWLNamedIndividual ind, boolean direct) throws InconsistentOntologyException, FreshEntitiesException, ReasonerInterruptedException, TimeOutException {
396 if (!sat) {
397 throw new InconsistentOntologyException();
398 }
399 if (types.containsKey(ind)) return types.get(ind);
400 return thing;
401 }
402
403 @Override
404 public NodeSet<OWLNamedIndividual> getInstances(OWLClassExpression ce,
405 boolean direct) throws InconsistentOntologyException,
406 ClassExpressionNotInProfileException, FreshEntitiesException,
407 ReasonerInterruptedException, TimeOutException {
408 // TODO Auto-generated method stub
409 return null;
410 }
411
412 @Override
413 public NodeSet<OWLNamedIndividual> getObjectPropertyValues(
414 OWLNamedIndividual ind, OWLObjectPropertyExpression pe)
415 throws InconsistentOntologyException, FreshEntitiesException,
416 ReasonerInterruptedException, TimeOutException {
417 // TODO Auto-generated method stub
418 return null;
419 }
420
421 @Override
422 public Set<OWLLiteral> getDataPropertyValues(OWLNamedIndividual ind,
423 OWLDataProperty pe) throws InconsistentOntologyException,
424 FreshEntitiesException, ReasonerInterruptedException,
425 TimeOutException {
426 // TODO Auto-generated method stub
427 return null;
428 }
429
430 @Override
431 public Node<OWLNamedIndividual> getSameIndividuals(OWLNamedIndividual ind)
432 throws InconsistentOntologyException, FreshEntitiesException,
433 ReasonerInterruptedException, TimeOutException {
434 // TODO Auto-generated method stub
435 return null;
436 }
437
438 @Override
439 public NodeSet<OWLNamedIndividual> getDifferentIndividuals(
440 OWLNamedIndividual ind) throws InconsistentOntologyException,
441 FreshEntitiesException, ReasonerInterruptedException,
442 TimeOutException {
443 // TODO Auto-generated method stub
444 return null;
445 }
446
447 @Override
448 public long getTimeOut() {
449 // TODO Auto-generated method stub
450 return 0;
451 }
452
453 @Override
454 public FreshEntityPolicy getFreshEntityPolicy() {
455 // TODO Auto-generated method stub
456 return null;
457 }
458
459 @Override
460 public IndividualNodeSetPolicy getIndividualNodeSetPolicy() {
461 // TODO Auto-generated method stub
462 return null;
463 }
464
465 @Override
466 public void dispose() {
467 reasoner.dispose();
468 }
469
470}
diff --git a/test/uk/ac/ox/cs/pagoda/ore/PagodaReasonerFactory.java b/test/uk/ac/ox/cs/pagoda/ore/PagodaReasonerFactory.java
deleted file mode 100644
index 8ecdf1d..0000000
--- a/test/uk/ac/ox/cs/pagoda/ore/PagodaReasonerFactory.java
+++ /dev/null
@@ -1,39 +0,0 @@
1package uk.ac.ox.cs.pagoda.ore;
2
3import org.semanticweb.owlapi.model.OWLOntology;
4import org.semanticweb.owlapi.reasoner.IllegalConfigurationException;
5import org.semanticweb.owlapi.reasoner.OWLReasoner;
6import org.semanticweb.owlapi.reasoner.OWLReasonerConfiguration;
7import org.semanticweb.owlapi.reasoner.OWLReasonerFactory;
8
9public class PagodaReasonerFactory implements OWLReasonerFactory {
10
11 @Override
12 public String getReasonerName() {
13 return "PAGOdA";
14 }
15
16 @Override
17 public OWLReasoner createNonBufferingReasoner(OWLOntology ontology) {
18 // TODO Auto-generated method stub
19 return null;
20 }
21
22 @Override
23 public OWLReasoner createReasoner(OWLOntology ontology) {
24 return new PagodaOWLReasoner(ontology);
25 }
26
27 @Override
28 public OWLReasoner createNonBufferingReasoner(OWLOntology ontology, OWLReasonerConfiguration config) throws IllegalConfigurationException {
29 // TODO Auto-generated method stub
30 return null;
31 }
32
33 @Override
34 public OWLReasoner createReasoner(OWLOntology ontology, OWLReasonerConfiguration config) throws IllegalConfigurationException {
35 // TODO Auto-generated method stub
36 return null;
37 }
38
39}
diff --git a/test/uk/ac/ox/cs/pagoda/tester/PagodaTester.java b/test/uk/ac/ox/cs/pagoda/tester/PagodaTester.java
index b97d85e..7d9b49c 100644
--- a/test/uk/ac/ox/cs/pagoda/tester/PagodaTester.java
+++ b/test/uk/ac/ox/cs/pagoda/tester/PagodaTester.java
@@ -1,126 +1,18 @@
1package uk.ac.ox.cs.pagoda.tester; 1package uk.ac.ox.cs.pagoda.tester;
2 2
3import uk.ac.ox.cs.pagoda.query.AnswerTuple;
4import uk.ac.ox.cs.pagoda.query.AnswerTuples;
5import uk.ac.ox.cs.pagoda.reasoner.QueryReasoner; 3import uk.ac.ox.cs.pagoda.reasoner.QueryReasoner;
6import uk.ac.ox.cs.pagoda.util.Properties; 4import uk.ac.ox.cs.pagoda.util.Properties;
7import uk.ac.ox.cs.pagoda.util.Timer; 5import uk.ac.ox.cs.pagoda.util.Timer;
8import uk.ac.ox.cs.pagoda.util.Utility; 6import uk.ac.ox.cs.pagoda.util.Utility;
9 7
10import java.io.File; 8// TODO clean it, or code another one
11import java.io.FileNotFoundException;
12import java.io.IOException;
13import java.util.Scanner;
14
15public class PagodaTester { 9public class PagodaTester {
16 10
17// public static final String onto_dir = "/media/RDFData/yzhou/";
18// public static final String onto_dir = "/users/yzhou/ontologies/";
19// public static final String onto_dir = "/home/scratch/yzhou/ontologies/";
20 public static final String onto_dir = "/home/alessandro/Big_files/Ontologies/";
21
22 public static final String fly = onto_dir + "fly/fly_anatomy_XP_with_GJ_FC_individuals.owl";
23 public static final String fly_query = onto_dir + "fly/queries/fly.sparql";
24
25 public static final String test_tbox = onto_dir + "smallExampleFromAna/dummy.owl";
26 public static final String test_abox = onto_dir + "smallExampleFromAna/initialABox.ttl";
27 public static final String test_query = onto_dir + "smallExampleFromAna/queries.dlog";
28
29 public static final int lubm_number = 1;
30 public static final String lubm_tbox = onto_dir + "lubm/univ-bench.owl";
31 public static final String lubm_abox = onto_dir + "lubm/data/lubm" + lubm_number + ".ttl";
32 public static final String lubm_abox_copy = onto_dir + "lubm/data/lubm" + lubm_number + " (copy).ttl";
33 public static final String lubm_query = onto_dir + "lubm/queries/test.sparql";
34 public static final String lubm_query6 = onto_dir + "lubm/queries/test_q6.sparql";
35 public static final String lubm_query20 = onto_dir + "lubm/queries/test_q16.sparql";
36
37 public static final int uobm_number = 1;
38 public static final String uobm_tbox = onto_dir + "uobm/univ-bench-dl.owl";
39 public static final String uobm_abox = onto_dir + "uobm/data/uobm" + uobm_number + ".ttl";
40 public static final String uobm_query = onto_dir + "uobm/queries/test.sparql";
41 public static final String uobm_query_temp = onto_dir + "uobm/queries/temp.sparql";
42 public static final String uobm_query2 = onto_dir + "uobm/queries/standard_q2.sparql";
43 public static final String uobm_query9 = onto_dir + "uobm/queries/standard_q9.sparql";
44 public static final String uobm_query11 = onto_dir + "uobm/queries/standard_q11.sparql";
45 public static final String uobm_query12 = onto_dir + "uobm/queries/standard_q12.sparql";
46 public static final String uobm_query14 = onto_dir + "uobm/queries/standard_q14.sparql";
47 public static final String uobm_query15 = onto_dir + "uobm/queries/standard_q15.sparql";
48 public static final String uobm_query_multi = onto_dir + "uobm/queries/standard_multi.sparql";
49 public static final String uobm_generated_query1 = onto_dir + "uobm/queries/generated_q1.sparql";
50 public static final String uobm_query_group3 = onto_dir + "uobm/queries/standard_group3.sparql";
51
52 public static final String npd_tbox = onto_dir + "npd/npd-all-minus-datatype.owl";
53 // "npd/npd-all.owl";
54 // "npd-all-minus-datatype.owl";
55 public static final String npd_abox = onto_dir + "npd/data/npd-data-dump-minus-datatype-new.ttl";
56 // "npd/data/npd-data-dump-processed.ttl";
57 // "npd-data-dump-minus-datatype-old.ttl";
58 public static final String npd_query = onto_dir + "npd/queries/atomic.sparql";
59
60 public static final String npd_bench_tbox = onto_dir + "npd-benchmark/npd-v2-ql_a.owl"; // npd-all-minus-datatype.owl";
61 public static final String npd_bench_abox = onto_dir + "npd-benchmark/npd-v2-ql_a.ttl"; // npd-data-dump-minus-datatype-old.ttl";
62 public static final String npd_bench_query = onto_dir + "npd-benchmark/queries/all.sparql";
63
64 public static final String dbpedia_tbox = onto_dir + "dbpedia/integratedOntology-all-in-one-minus-datatype.owl";
65 public static final String dbpedia_abox = onto_dir + "dbpedia/data/dbpedia-minus-datatype-new.ttl";
66 public static final String dbpedia_query = onto_dir + "dbpedia/queries/atomic_ground.sparql";
67 public static final String dbpedia_query274 = onto_dir + "dbpedia/atomic_q274.sparql";
68
69 public static final String dbpedia_latest_tbox = onto_dir + "dbpedia/dbpedia_2014.owl";
70 public static final String travel_tbox = onto_dir + "dbpedia/travel.owl";
71 public static final String dbpedia_tbox_simple = onto_dir + "dbpedia/dbpedia_simple.owl";
72
73 public static final String bioModels_tbox = onto_dir + "biomodels/biomodels-21.owl";
74 public static final String bioModels_abox = onto_dir + "biomodels/data_processed_1.ttl";
75 public static final String bioModels_queries = onto_dir + "biomodels/queries/queries.sparql";
76
77 public static final String chembl_tbox = onto_dir + "bio2rdf/chembl/cco-processed-noDPR-noDPD.ttl";
78 public static final String chembl_abox = onto_dir + "bio2rdf/chembl/graph sampling old/sample_100.nt";
79 public static final String chembl_queries = onto_dir + "bio2rdf/chembl/queries/problematic.sparql"; //"bio2rdf/chembl/queries/atomic_one_filtered.sparql"; //
80
81 public static final String reactome_tbox = onto_dir + "bio2rdf/reactome/biopax-level3-processed.owl";
82 public static final String reactome_abox = onto_dir + "bio2rdf/reactome/graph sampling old/sample.ttl"; //data/data.ttl"; //graph sampling old/reactome_sample_10.ttl"; //
83 public static final String reactome_queries = onto_dir +"bio2rdf/reactome/queries/atomic.sparql";
84
85 public static final String uniprot_tbox = onto_dir + "bio2rdf/uniprot/core-processed.owl";
86 public static final String uniprot_abox = onto_dir + "bio2rdf/uniprot/graph sampling/sample_1.nt";
87 public static final String uniprot_queries = onto_dir + "bio2rdf/uniprot/queries/atomic_one.sparql";
88
89 public static final String atlas_tbox = onto_dir + "bio2rdf/atlas/gxaterms.owl";
90 public static final String atlas_abox = onto_dir + "bio2rdf/atlas/graph sampling/sample_1.nt";
91 public static final String atlas_queries = onto_dir + "bio2rdf/atlas/queries/atomic_one.sparql";
92
93 public static void main(String... args) { 11 public static void main(String... args) {
94 if (args.length == 0) { 12// Properties properties = new Properties(PagodaTester.class.
95// args = new String[] {test_tbox, test_abox, test_query}; 13// getClassLoader().getResource("uobm.properties").getPath());
96// args = new String[] {lubm_tbox, lubm_abox, lubm_query}; 14 Properties properties = new Properties();
97// args = new String[] {uobm_tbox, uobm_abox, uobm_query};
98// args = new String[] {fly, "null", fly_query};
99// args = new String[] {dbpedia_tbox, dbpedia_abox, dbpedia_query};
100// args = new String[] {travel_tbox, null, dbpedia_query274};
101 args = new String[] {fly, fly_query};
102// args = new String[] {npd_tbox, npd_abox, npd_query};
103// args = new String[] {npd_bench_tbox, npd_bench_abox, npd_bench_query};
104// args = new String[] {"../SemFacet/WebContent/WEB-INF/data/dbpedia.owl", "../SemFacet/WebContent/WEB-INF/data/dbpediaA.nt", null};
105// args = new String[] {"../core/WebContent/WEB-INF/data/fly.owl", "../core/WebContent/WEB-INF/data/fly-data.nt", null};
106// args = new String[] {"data/lubm/univ-bench.owl", "data/lubm/lubm1.ttl", "data/lubm/lubm.sparql", "lubm.ans"};
107// args = new String[] {"data/uobm/univ-bench-dl.owl", "data/uobm/uobm1.ttl", "data/uobm/uobm.sparql", "uobm.ans"};
108// args = new String[] {"data/fly/fly_anatomy_XP_with_GJ_FC_individuals.owl", "data/fly/fly.sparql", "fly.ans"};
109// args = new String[] {bioModels_tbox, bioModels_abox, bioModels_queries};
110// args = new String[] {chembl_tbox, chembl_abox, chembl_queries};
111// args = new String[] {reactome_tbox, reactome_abox, reactome_queries};
112// args = new String[] {reactome_tbox, "/users/yzhou/temp/reactome_debug.ttl", onto_dir +"bio2rdf/reactome/queries/atomic_one_q65.sparql"};
113// args = new String[] {uniprot_tbox.replace(".owl", "-noDis.owl"), "/users/yzhou/temp/uniprot_debug/sample_1_string.nt", uniprot_queries};
114// args = new String[] {uniprot_tbox.replace(".owl", "-noDis.owl"), uniprot_abox, uniprot_queries};
115// args = new String[] {atlas_tbox, atlas_abox, atlas_queries};
116// args = new String[] {onto_dir + "test/unsatisfiable.owl", null, onto_dir + "test/unsatisfiable_queries.sparql"};
117// args = new String[] {onto_dir + "test/jair-example.owl", null, onto_dir + "test/jair-example_query.sparql"};
118// args[2] = args[2].replace(".sparql", "_all_pagoda.sparql");
119// args[2] = args[2].replace(".sparql", "_pellet.sparql");
120 }
121 15
122 Properties properties = new Properties("config/uobm.properties");
123
124 int index = 0; 16 int index = 0;
125 if (args.length > index) properties.setOntologyPath(args[index++]); 17 if (args.length > index) properties.setOntologyPath(args[index++]);
126 if (args.length > index && (args[index].endsWith(".ttl") || args[index].endsWith(".nt"))) properties.setDataPath(args[index++]); 18 if (args.length > index && (args[index].endsWith(".ttl") || args[index].endsWith(".nt"))) properties.setDataPath(args[index++]);
@@ -146,169 +38,9 @@ public class PagodaTester {
146 if (properties.getQueryPath() != null) 38 if (properties.getQueryPath() != null)
147 for (String queryFile: properties.getQueryPath().split(";")) 39 for (String queryFile: properties.getQueryPath().split(";"))
148 pagoda.evaluate(pagoda.getQueryManager().collectQueryRecords(queryFile)); 40 pagoda.evaluate(pagoda.getQueryManager().collectQueryRecords(queryFile));
149
150 if (properties.getShellMode())
151 try {
152 evaluateConsoleQuery(pagoda);
153 } catch (IOException e) {
154 e.printStackTrace();
155 }
156 } finally { 41 } finally {
157 if (pagoda != null) pagoda.dispose(); 42 if (pagoda != null) pagoda.dispose();
158 } 43 }
159
160// Utility.closeCurrentOut();
161
162 if (properties.getShellMode()) System.exit(0);
163 }
164
165// private void printPredicatesWithGap() {
166// for (String p: ((MyQueryReasoner) pagoda).getPredicatesWithGap()) {
167// System.out.println(p);
168// }
169// }
170
171 private static void evaluateConsoleQuery(QueryReasoner pagoda) throws IOException {
172 int ending = (int) '$', symbol;
173 while (true) {
174 Utility.logInfo("Input your query ending with $");
175 StringBuilder queryBuilder = new StringBuilder();
176 while ((symbol = System.in.read()) != ending) {
177 queryBuilder.append((char) symbol);
178 }
179 System.in.read();
180 if (queryBuilder.length() == 0) return ;
181 pagoda.evaluate_shell(queryBuilder.toString());
182 }
183 }
184
185 void testReactomeQueries() {
186 evaluate("select ?x where { ?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.biopax.org/release/biopax-level3.owl#DnaReference> . }");
187 evaluate("select ?y ?z where { <http://identifiers.org/ensembl/ENSG00000157557> ?y ?z . }");
188 evaluate("select ?y where { <http://identifiers.org/ensembl/ENSG00000157557> <http://www.biopax.org/release/biopax-level3.owl#name> ?y . }", true);
189
190 }
191
192 void testSemFacetQueries() {
193// try {
194// BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream("query.line")));
195// for (String line; (line = reader.readLine()) != null && !line.isEmpty(); )
196// evaluate(line, true);
197// reader.close();
198// } catch (FileNotFoundException e) {
199// e.printStackTrace();
200// } catch (IOException e) {
201// e.printStackTrace();
202// }
203 evaluate("select ?x ?z where { ?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?z }", true);
204 evaluate("select distinct ?y where { ?x ?y ?z }", true);
205 evaluate("select distinct ?z where { ?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?z }", true);
206 evaluate("select ?y ?z where { <http://www.reactome.org/biopax/46/49633#Protein3885> ?y ?z .}", true);
207 }
208
209 void testISGQueries() {
210 evaluate("select ?z where {<http://cs.ox.ac.uk/Evgeny_Kharlamov> <http://cs.ox.ac.uk/lat> ?z .}", false);
211 evaluate("select ?x where {?x <http://cs.ox.ac.uk/type> <http://cs.ox.ac.uk/person> .}", false);
212 }
213
214 void testSomeTravelQueries() {
215 evaluate("select ?y ?z where {<http://www.owl-ontologies.com/travel.owl#BlueMountains> ?y ?z. }", true);
216 evaluate("select ?x where {?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.owl-ontologies.com/travel.owl#RetireeDestination>. }");
217 evaluate("select ?x where {?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.owl-ontologies.com/travel.owl#BackpackersDestination>. }");
218 }
219
220 void testSomeFlyQueries() {
221 evaluate("select ?x where { ?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.obolibrary.org/obo/FBbt_00005106> . }", false);
222
223 evaluate("select DISTINCT ?z where { ?x <http://purl.obolibrary.org/obo/FBbt#develops_from> ?any . ?any <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?z . ?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.obolibrary.org/obo/FBbt_00067123> . } ", true);
224
225 evaluate("Select ?x where { ?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> "
226 + "<http://purl.obolibrary.org/obo/FBbt_00067123>. ?x "
227 + "<http://purl.obolibrary.org/obo/RO_0002131> ?any . ?any "
228 + "<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> "
229 + "<http://purl.obolibrary.org/obo/FBbt_00005140> . }", true);
230
231 evaluate("Select ?x where {?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> "
232 + "<http://purl.obolibrary.org/obo/FBbt_00067363> . ?x "
233 + "<http://purl.obolibrary.org/obo/RO_0002131> ?any . ?any "
234 + "<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> "
235 + "<http://purl.obolibrary.org/obo/FBbt_00005140> . }", true);
236
237// evaluate("Select ?x where { "
238// + "?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.obolibrary.org/obo/FBbt_00003660>. "
239// + "?x <http://purl.obolibrary.org/obo/FBbt#develops_from> ?any . "
240// + "?any <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.obolibrary.org/obo/FBbt_00001446> . }", true);
241
242 evaluate("select DISTINCT ?z where { ?x <http://purl.obolibrary.org/obo/RO_0002110> ?any . "
243 + "?any <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?z . "
244 + "?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.obolibrary.org/obo/FBbt_00007016> . } ", true);
245
246 evaluate("Select * where {"
247 + "<http://www.virtualflybrain.org/ontologies/individuals/VFB_00100607> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.obolibrary.org/obo/FBbt_00007364>. "
248 + "<http://www.virtualflybrain.org/ontologies/individuals/VFB_00100607> <http://www.w3.org/2002/07/owl#sameAs> ?z }", true);
249
250 evaluate("SELECT DISTINCT ?x ?z WHERE {?x <http://www.w3.org/2002/07/owl#sameAs> ?z}", true);
251 evaluate("SELECT DISTINCT ?x ?z WHERE {?x <http://purl.obolibrary.org/obo/BFO_0000051> ?z}", true);
252
253 evaluate("select DISTINCT ?y where { ?x ?y ?z . "
254 + "?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.obolibrary.org/obo/FBbt_00007364> }", true);
255
256 evaluateQueriesFromFile("/users/yzhou/Downloads/logs(1).log");
257 evaluateQueriesFromFile("/users/yzhou/Downloads/logs.log");
258
259 evaluate("SELECT DISTINCT ?x ?z WHERE {?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?z}", true);
260 evaluate("SELECT DISTINCT ?x ?z WHERE {?x <http://xmlns.com/foaf/0.1/depicts> ?z}", true);
261
262 evaluate("select ?x ?z where { ?x <http://www.w3.org/2002/07/owl#sameAs> ?z } ", true);
263 evaluate("select ?x ?z where { ?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?z } ", true);
264 }
265
266 public void evaluateQueriesFromFile(String fileName) {
267 Scanner scanner = null;
268 try {
269 scanner = new Scanner(new File(fileName));
270 String line;
271 while (scanner.hasNextLine()) {
272 line = scanner.nextLine();
273 if (line.startsWith("select"))
274 evaluate(line, true);
275 }
276 } catch (FileNotFoundException e) {
277 e.printStackTrace();
278 } finally {
279 if (scanner != null)
280 scanner.close();
281 }
282 }
283
284 QueryReasoner pagoda;
285
286 public PagodaTester(QueryReasoner reasoner) {
287 pagoda = reasoner;
288 }
289
290 Timer timer = new Timer();
291
292 private void evaluate(String query) {
293 evaluate(query, false);
294 }
295
296 private void evaluate(String query, boolean tag) {
297 timer.reset();
298 AnswerTuples tuples = pagoda.evaluate(query, tag);
299 int arity = tuples.getArity();
300 int count = 0;
301 for (AnswerTuple tuple; tuples.isValid(); tuples.moveNext()) {
302 tuple = tuples.getTuple();
303 for (int i = 0; i < arity; ++i)
304 tuple.getGroundTerm(i).toString();
305// System.out.print(tuple.getGroundTerm(i).toString() + "\t");
306// System.out.println();
307 ++count;
308 }
309 tuples.dispose();
310 Utility.logInfo("The number of answers for this SemFacet query: " + count);
311 Utility.logInfo("Total time for this SemFacet query: " + timer.duration());
312 } 44 }
313 45
314} 46}
diff --git a/test/uk/ac/ox/cs/pagoda/util/TestUtil.java b/test/uk/ac/ox/cs/pagoda/util/TestUtil.java
index 06d391a..1802147 100644
--- a/test/uk/ac/ox/cs/pagoda/util/TestUtil.java
+++ b/test/uk/ac/ox/cs/pagoda/util/TestUtil.java
@@ -5,8 +5,8 @@ import org.apache.log4j.FileAppender;
5import org.apache.log4j.Logger; 5import org.apache.log4j.Logger;
6 6
7import java.io.File; 7import java.io.File;
8import java.io.FileInputStream;
9import java.io.IOException; 8import java.io.IOException;
9import java.io.InputStream;
10import java.nio.file.Files; 10import java.nio.file.Files;
11import java.nio.file.Paths; 11import java.nio.file.Paths;
12import java.util.Enumeration; 12import java.util.Enumeration;
@@ -19,14 +19,15 @@ import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
19 */ 19 */
20public class TestUtil { 20public class TestUtil {
21 21
22 public static final String CONFIG_FILE = "config/test.properties"; 22 public static final String CONFIG_FILE = "test.properties";
23 23
24 private static boolean isConfigLoaded = false; 24 private static boolean isConfigLoaded = false;
25 private static Properties config; 25 private static Properties config;
26 26
27 public static Properties getConfig() { 27 public static Properties getConfig() {
28 if(!isConfigLoaded) { 28 if(!isConfigLoaded) {
29 try (FileInputStream in = new FileInputStream(CONFIG_FILE)) { 29 try (InputStream in = TestUtil.class.getClassLoader()
30 .getResourceAsStream(CONFIG_FILE)) {
30 config = new java.util.Properties(); 31 config = new java.util.Properties();
31 config.load(in); 32 config.load(in);
32 in.close(); 33 in.close();