diff options
Diffstat (limited to 'src/uk/ac/ox/cs/pagoda')
| -rw-r--r-- | src/uk/ac/ox/cs/pagoda/Pagoda.java | 8 | ||||
| -rw-r--r-- | src/uk/ac/ox/cs/pagoda/query/QueryRecord.java | 18 | ||||
| -rw-r--r-- | src/uk/ac/ox/cs/pagoda/util/PagodaProperties.java | 19 |
3 files changed, 34 insertions, 11 deletions
diff --git a/src/uk/ac/ox/cs/pagoda/Pagoda.java b/src/uk/ac/ox/cs/pagoda/Pagoda.java index da876b5..ace6851 100644 --- a/src/uk/ac/ox/cs/pagoda/Pagoda.java +++ b/src/uk/ac/ox/cs/pagoda/Pagoda.java | |||
| @@ -158,13 +158,15 @@ public class Pagoda implements Runnable { | |||
| 158 | } | 158 | } |
| 159 | 159 | ||
| 160 | private String getStatisticsFilename(PagodaProperties properties, String queryFile) { | 160 | private String getStatisticsFilename(PagodaProperties properties, String queryFile) { |
| 161 | String statisticsFilename = "statistics_" + | 161 | String statisticsFilename = "statistics"; |
| 162 | FilenameUtils.removeExtension(FilenameUtils.getName(properties.getOntologyPath().replaceAll("_", "-"))); | 162 | statisticsFilename += "_" + FilenameUtils.removeExtension(FilenameUtils.getName(properties.getOntologyPath().replaceAll("_", "-"))); |
| 163 | statisticsFilename += "_" + FilenameUtils.removeExtension(FilenameUtils.getName(properties.getDataPath().replaceAll("_", "-"))); | ||
| 163 | statisticsFilename += "_" + FilenameUtils.removeExtension(FilenameUtils.getName(queryFile).replaceAll("_", "-")); | 164 | statisticsFilename += "_" + FilenameUtils.removeExtension(FilenameUtils.getName(queryFile).replaceAll("_", "-")); |
| 164 | statisticsFilename += "_" + ((properties.getSkolemUpperBound() == PagodaProperties.SkolemUpperBoundOptions.DISABLED) | 165 | statisticsFilename += "_" + ((properties.getSkolemUpperBound() == PagodaProperties.SkolemUpperBoundOptions.DISABLED) |
| 165 | ? "" : (properties.getSkolemUpperBound() == PagodaProperties.SkolemUpperBoundOptions.BEFORE_SUMMARISATION) | 166 | ? "" : (properties.getSkolemUpperBound() == PagodaProperties.SkolemUpperBoundOptions.BEFORE_SUMMARISATION) |
| 166 | ? "before" : "after"); | 167 | ? "before" : "after"); |
| 167 | statisticsFilename += "_" + properties.getSkolemDepth(); | 168 | statisticsFilename += "_skd" + properties.getSkolemDepth(); |
| 169 | statisticsFilename += "_maxtrpl" + properties.getMaxTriplesInSkolemStore(); | ||
| 168 | statisticsFilename += ".json"; | 170 | statisticsFilename += ".json"; |
| 169 | statisticsFilename = FilenameUtils.concat(properties.getStatisticsDir().toString(), | 171 | statisticsFilename = FilenameUtils.concat(properties.getStatisticsDir().toString(), |
| 170 | statisticsFilename); | 172 | statisticsFilename); |
diff --git a/src/uk/ac/ox/cs/pagoda/query/QueryRecord.java b/src/uk/ac/ox/cs/pagoda/query/QueryRecord.java index f702d5c..3f73145 100644 --- a/src/uk/ac/ox/cs/pagoda/query/QueryRecord.java +++ b/src/uk/ac/ox/cs/pagoda/query/QueryRecord.java | |||
| @@ -31,6 +31,7 @@ public class QueryRecord extends Disposable { | |||
| 31 | OWLOntology relevantOntology = null; | 31 | OWLOntology relevantOntology = null; |
| 32 | Set<DLClause> relevantClauses = new HashSet<DLClause>(); | 32 | Set<DLClause> relevantClauses = new HashSet<DLClause>(); |
| 33 | double[] timer; | 33 | double[] timer; |
| 34 | int[] gapAnswersAtStep; | ||
| 34 | int subID; | 35 | int subID; |
| 35 | DLClause queryClause = null; | 36 | DLClause queryClause = null; |
| 36 | int queryID = -1; | 37 | int queryID = -1; |
| @@ -80,7 +81,11 @@ public class QueryRecord extends Disposable { | |||
| 80 | 81 | ||
| 81 | int length = Step.values().length; | 82 | int length = Step.values().length; |
| 82 | timer = new double[length]; | 83 | timer = new double[length]; |
| 83 | for(int i = 0; i < length; ++i) timer[i] = 0; | 84 | gapAnswersAtStep = new int[length]; |
| 85 | for(int i = 0; i < length; ++i) { | ||
| 86 | timer[i] = 0; | ||
| 87 | gapAnswersAtStep[i] = 0; | ||
| 88 | } | ||
| 84 | } | 89 | } |
| 85 | 90 | ||
| 86 | public AnswerTuples getAnswers() { | 91 | public AnswerTuples getAnswers() { |
| @@ -280,7 +285,8 @@ public class QueryRecord extends Disposable { | |||
| 280 | 285 | ||
| 281 | double totalTime = 0.0; | 286 | double totalTime = 0.0; |
| 282 | for(Step step : Step.values()) { | 287 | for(Step step : Step.values()) { |
| 283 | result.put(step.toString(), Double.toString(timer[step.ordinal()])); | 288 | result.put(step.toString() + "_time", Double.toString(timer[step.ordinal()])); |
| 289 | result.put(step.toString() + "_gap", Integer.toString(gapAnswersAtStep[step.ordinal()])); | ||
| 284 | totalTime += timer[step.ordinal()]; | 290 | totalTime += timer[step.ordinal()]; |
| 285 | } | 291 | } |
| 286 | result.put("totalTime", Double.toString(totalTime)); | 292 | result.put("totalTime", Double.toString(totalTime)); |
| @@ -396,6 +402,10 @@ public class QueryRecord extends Disposable { | |||
| 396 | if(isDisposed()) throw new DisposedException(); | 402 | if(isDisposed()) throw new DisposedException(); |
| 397 | 403 | ||
| 398 | timer[step.ordinal()] += time; | 404 | timer[step.ordinal()] += time; |
| 405 | if(gapAnswerTuples != null) | ||
| 406 | gapAnswersAtStep[step.ordinal()] = getGapAnswersCount(); | ||
| 407 | else | ||
| 408 | gapAnswersAtStep[step.ordinal()] = -1; | ||
| 399 | } | 409 | } |
| 400 | 410 | ||
| 401 | public int getArity() { | 411 | public int getArity() { |
| @@ -725,9 +735,9 @@ public class QueryRecord extends Disposable { | |||
| 725 | SKOLEM_UPPER_BOUND, | 735 | SKOLEM_UPPER_BOUND, |
| 726 | EL_LOWER_BOUND, | 736 | EL_LOWER_BOUND, |
| 727 | FRAGMENT, | 737 | FRAGMENT, |
| 728 | FRAGMENT_REFINEMENT, | 738 | // FRAGMENT_REFINEMENT, |
| 729 | SUMMARISATION, | 739 | SUMMARISATION, |
| 730 | DEPENDENCY, | 740 | // DEPENDENCY, |
| 731 | FULL_REASONING; | 741 | FULL_REASONING; |
| 732 | 742 | ||
| 733 | @Override | 743 | @Override |
diff --git a/src/uk/ac/ox/cs/pagoda/util/PagodaProperties.java b/src/uk/ac/ox/cs/pagoda/util/PagodaProperties.java index 0f9ad4e..2b52a89 100644 --- a/src/uk/ac/ox/cs/pagoda/util/PagodaProperties.java +++ b/src/uk/ac/ox/cs/pagoda/util/PagodaProperties.java | |||
| @@ -13,6 +13,7 @@ public class PagodaProperties { | |||
| 13 | 13 | ||
| 14 | public enum SkolemUpperBoundOptions {DISABLED, BEFORE_SUMMARISATION, AFTER_SUMMARISATION} | 14 | public enum SkolemUpperBoundOptions {DISABLED, BEFORE_SUMMARISATION, AFTER_SUMMARISATION} |
| 15 | 15 | ||
| 16 | public static final String DEFAULT_CONFIG_FILE = "_default_pagoda.properties"; | ||
| 16 | public static final String CONFIG_FILE = "pagoda.properties"; | 17 | public static final String CONFIG_FILE = "pagoda.properties"; |
| 17 | public static final boolean DEFAULT_DEBUG = false; | 18 | public static final boolean DEFAULT_DEBUG = false; |
| 18 | private static final boolean DEFAULT_USE_ALWAYS_SIMPLE_UPPER_BOUND; | 19 | private static final boolean DEFAULT_USE_ALWAYS_SIMPLE_UPPER_BOUND; |
| @@ -26,6 +27,8 @@ public class PagodaProperties { | |||
| 26 | private static boolean debug = DEFAULT_DEBUG; | 27 | private static boolean debug = DEFAULT_DEBUG; |
| 27 | 28 | ||
| 28 | static { | 29 | static { |
| 30 | Logger logger = Logger.getLogger("PagodaProperties"); | ||
| 31 | |||
| 29 | boolean defaultUseAlwaysSimpleUpperBound = false; | 32 | boolean defaultUseAlwaysSimpleUpperBound = false; |
| 30 | SkolemUpperBoundOptions defaultSkolemUpperBound = SkolemUpperBoundOptions.DISABLED; | 33 | SkolemUpperBoundOptions defaultSkolemUpperBound = SkolemUpperBoundOptions.DISABLED; |
| 31 | int defaultSkolemDepth = 1; | 34 | int defaultSkolemDepth = 1; |
| @@ -33,11 +36,19 @@ public class PagodaProperties { | |||
| 33 | Path defaultStatisticsDir = null; | 36 | Path defaultStatisticsDir = null; |
| 34 | long defaultMaxTriplesInSkolemStore = 1000000; | 37 | long defaultMaxTriplesInSkolemStore = 1000000; |
| 35 | 38 | ||
| 36 | try (InputStream in = PagodaProperties.class.getClassLoader().getResourceAsStream(CONFIG_FILE)) { | 39 | InputStream configStream = PagodaProperties.class.getClassLoader().getResourceAsStream(CONFIG_FILE); |
| 40 | |||
| 41 | if(configStream == null) { | ||
| 42 | logger.info("Unable to find user-defined configuration file (\"" + CONFIG_FILE + "\" in classpath)"); | ||
| 43 | logger.info("Using default configuration"); | ||
| 44 | configStream = PagodaProperties.class.getClassLoader().getResourceAsStream(DEFAULT_CONFIG_FILE); | ||
| 45 | } | ||
| 46 | |||
| 47 | try { | ||
| 37 | Properties config = new Properties(); | 48 | Properties config = new Properties(); |
| 38 | config.load(in); | 49 | config.load(configStream); |
| 39 | in.close(); | 50 | configStream.close(); |
| 40 | Logger logger = Logger.getLogger("PagodaProperties"); | 51 | |
| 41 | if (config.containsKey("debug")) { | 52 | if (config.containsKey("debug")) { |
| 42 | debug = Boolean.parseBoolean(config.getProperty("debug")); | 53 | debug = Boolean.parseBoolean(config.getProperty("debug")); |
| 43 | logger.info("Debugging mode is enabled"); | 54 | logger.info("Debugging mode is enabled"); |
