From 9d7ae05224c9dd650967a1932ba76bfdd5c8d89a Mon Sep 17 00:00:00 2001 From: RncLsn Date: Fri, 11 Sep 2015 11:52:36 +0100 Subject: Improved the statistics that are generated for evaluating the system; configuration file: now default and user-specified. --- src/uk/ac/ox/cs/pagoda/Pagoda.java | 8 +++++--- src/uk/ac/ox/cs/pagoda/query/QueryRecord.java | 18 ++++++++++++++---- src/uk/ac/ox/cs/pagoda/util/PagodaProperties.java | 19 +++++++++++++++---- 3 files changed, 34 insertions(+), 11 deletions(-) (limited to 'src/uk/ac/ox') 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 { } private String getStatisticsFilename(PagodaProperties properties, String queryFile) { - String statisticsFilename = "statistics_" + - FilenameUtils.removeExtension(FilenameUtils.getName(properties.getOntologyPath().replaceAll("_", "-"))); + String statisticsFilename = "statistics"; + statisticsFilename += "_" + FilenameUtils.removeExtension(FilenameUtils.getName(properties.getOntologyPath().replaceAll("_", "-"))); + statisticsFilename += "_" + FilenameUtils.removeExtension(FilenameUtils.getName(properties.getDataPath().replaceAll("_", "-"))); statisticsFilename += "_" + FilenameUtils.removeExtension(FilenameUtils.getName(queryFile).replaceAll("_", "-")); statisticsFilename += "_" + ((properties.getSkolemUpperBound() == PagodaProperties.SkolemUpperBoundOptions.DISABLED) ? "" : (properties.getSkolemUpperBound() == PagodaProperties.SkolemUpperBoundOptions.BEFORE_SUMMARISATION) ? "before" : "after"); - statisticsFilename += "_" + properties.getSkolemDepth(); + statisticsFilename += "_skd" + properties.getSkolemDepth(); + statisticsFilename += "_maxtrpl" + properties.getMaxTriplesInSkolemStore(); statisticsFilename += ".json"; statisticsFilename = FilenameUtils.concat(properties.getStatisticsDir().toString(), 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 { OWLOntology relevantOntology = null; Set relevantClauses = new HashSet(); double[] timer; + int[] gapAnswersAtStep; int subID; DLClause queryClause = null; int queryID = -1; @@ -80,7 +81,11 @@ public class QueryRecord extends Disposable { int length = Step.values().length; timer = new double[length]; - for(int i = 0; i < length; ++i) timer[i] = 0; + gapAnswersAtStep = new int[length]; + for(int i = 0; i < length; ++i) { + timer[i] = 0; + gapAnswersAtStep[i] = 0; + } } public AnswerTuples getAnswers() { @@ -280,7 +285,8 @@ public class QueryRecord extends Disposable { double totalTime = 0.0; for(Step step : Step.values()) { - result.put(step.toString(), Double.toString(timer[step.ordinal()])); + result.put(step.toString() + "_time", Double.toString(timer[step.ordinal()])); + result.put(step.toString() + "_gap", Integer.toString(gapAnswersAtStep[step.ordinal()])); totalTime += timer[step.ordinal()]; } result.put("totalTime", Double.toString(totalTime)); @@ -396,6 +402,10 @@ public class QueryRecord extends Disposable { if(isDisposed()) throw new DisposedException(); timer[step.ordinal()] += time; + if(gapAnswerTuples != null) + gapAnswersAtStep[step.ordinal()] = getGapAnswersCount(); + else + gapAnswersAtStep[step.ordinal()] = -1; } public int getArity() { @@ -725,9 +735,9 @@ public class QueryRecord extends Disposable { SKOLEM_UPPER_BOUND, EL_LOWER_BOUND, FRAGMENT, - FRAGMENT_REFINEMENT, +// FRAGMENT_REFINEMENT, SUMMARISATION, - DEPENDENCY, +// DEPENDENCY, FULL_REASONING; @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 { public enum SkolemUpperBoundOptions {DISABLED, BEFORE_SUMMARISATION, AFTER_SUMMARISATION} + public static final String DEFAULT_CONFIG_FILE = "_default_pagoda.properties"; public static final String CONFIG_FILE = "pagoda.properties"; public static final boolean DEFAULT_DEBUG = false; private static final boolean DEFAULT_USE_ALWAYS_SIMPLE_UPPER_BOUND; @@ -26,6 +27,8 @@ public class PagodaProperties { private static boolean debug = DEFAULT_DEBUG; static { + Logger logger = Logger.getLogger("PagodaProperties"); + boolean defaultUseAlwaysSimpleUpperBound = false; SkolemUpperBoundOptions defaultSkolemUpperBound = SkolemUpperBoundOptions.DISABLED; int defaultSkolemDepth = 1; @@ -33,11 +36,19 @@ public class PagodaProperties { Path defaultStatisticsDir = null; long defaultMaxTriplesInSkolemStore = 1000000; - try (InputStream in = PagodaProperties.class.getClassLoader().getResourceAsStream(CONFIG_FILE)) { + InputStream configStream = PagodaProperties.class.getClassLoader().getResourceAsStream(CONFIG_FILE); + + if(configStream == null) { + logger.info("Unable to find user-defined configuration file (\"" + CONFIG_FILE + "\" in classpath)"); + logger.info("Using default configuration"); + configStream = PagodaProperties.class.getClassLoader().getResourceAsStream(DEFAULT_CONFIG_FILE); + } + + try { Properties config = new Properties(); - config.load(in); - in.close(); - Logger logger = Logger.getLogger("PagodaProperties"); + config.load(configStream); + configStream.close(); + if (config.containsKey("debug")) { debug = Boolean.parseBoolean(config.getProperty("debug")); logger.info("Debugging mode is enabled"); -- cgit v1.2.3