aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scripts/Violations_processor.py12
-rw-r--r--src/uk/ac/ox/cs/pagoda/util/PagodaProperties.java8
2 files changed, 14 insertions, 6 deletions
diff --git a/scripts/Violations_processor.py b/scripts/Violations_processor.py
index 62c1ade..2178d87 100644
--- a/scripts/Violations_processor.py
+++ b/scripts/Violations_processor.py
@@ -17,7 +17,7 @@ class Cleaner:
17 self._used_words = 0 17 self._used_words = 0
18 self._cache = {} 18 self._cache = {}
19 19
20 def clean(self, violation, prefix): 20 def clean(self, violation, prefix, query_predicate=None):
21 j = 0 21 j = 0
22 atoms = [] 22 atoms = []
23 for i in range(3): 23 for i in range(3):
@@ -25,8 +25,11 @@ class Cleaner:
25 j = violation.find('>', i) 25 j = violation.find('>', i)
26 atom = violation[i:j] 26 atom = violation[i:j]
27 if atom not in self._cache: 27 if atom not in self._cache:
28 self._cache[atom] = str(prefix) + self._words[self._used_words] 28 if atom == query_predicate:
29 self._used_words += 1 29 self._cache[atom] = 'Q'
30 else:
31 self._cache[atom] = str(prefix) + self._words[self._used_words]
32 self._used_words += 1
30 atoms.append(self._cache[atom]) 33 atoms.append(self._cache[atom])
31 return '%10s(X) -> %10s(X,Y), %10s(Y)' % (atoms[2], atoms[0], atoms[1]) 34 return '%10s(X) -> %10s(X,Y), %10s(Y)' % (atoms[2], atoms[0], atoms[1])
32 35
@@ -34,6 +37,7 @@ class Cleaner:
34if __name__ == '__main__': 37if __name__ == '__main__':
35 parser = argparse.ArgumentParser(description='Transform violations (as output by PAGOdA) into a very readable form.') 38 parser = argparse.ArgumentParser(description='Transform violations (as output by PAGOdA) into a very readable form.')
36 parser.add_argument('input', help='json file containing violations') 39 parser.add_argument('input', help='json file containing violations')
40 parser.add_argument('-q', help='query predicate')
37 args = parser.parse_args() 41 args = parser.parse_args()
38 42
39 cleaner = Cleaner() 43 cleaner = Cleaner()
@@ -42,7 +46,7 @@ if __name__ == '__main__':
42 clean_rules_list_list = [] 46 clean_rules_list_list = []
43 i = 0 47 i = 0
44 for violations_list in violations_list_list: 48 for violations_list in violations_list_list:
45 clean_rules_list_list.append(sorted(map(lambda x: cleaner.clean(x, i), violations_list))) 49 clean_rules_list_list.append(sorted(map(lambda x: cleaner.clean(x, i, args.q), violations_list)))
46 i += 1 50 i += 1
47 print json.dumps(clean_rules_list_list, indent=2) 51 print json.dumps(clean_rules_list_list, indent=2)
48 52
diff --git a/src/uk/ac/ox/cs/pagoda/util/PagodaProperties.java b/src/uk/ac/ox/cs/pagoda/util/PagodaProperties.java
index 2c53063..e501821 100644
--- a/src/uk/ac/ox/cs/pagoda/util/PagodaProperties.java
+++ b/src/uk/ac/ox/cs/pagoda/util/PagodaProperties.java
@@ -42,11 +42,15 @@ public class PagodaProperties {
42 if(config.containsKey("useAlwaysSimpleUpperBound")) { 42 if(config.containsKey("useAlwaysSimpleUpperBound")) {
43 defaultUseAlwaysSimpleUpperBound = 43 defaultUseAlwaysSimpleUpperBound =
44 Boolean.parseBoolean(config.getProperty("useAlwaysSimpleUpperBound")); 44 Boolean.parseBoolean(config.getProperty("useAlwaysSimpleUpperBound"));
45 logger.info("The simple upper bound is always used"); 45 if(defaultUseAlwaysSimpleUpperBound)
46 logger.info("By default the simple upper bound is always used");
46 } 47 }
47 if(config.containsKey("useSkolemUpperBound")) { 48 if(config.containsKey("useSkolemUpperBound")) {
48 defaultUseSkolemUpperBound = Boolean.parseBoolean(config.getProperty("useSkolemUpperBound")); 49 defaultUseSkolemUpperBound = Boolean.parseBoolean(config.getProperty("useSkolemUpperBound"));
49 logger.info("The Skolem upper bound is enabled"); 50 if(defaultUseSkolemUpperBound)
51 logger.info("By default the Skolem upper bound is enabled");
52 else
53 logger.info("By default the Skolem upper bound is disabled");
50 } 54 }
51 55
52 } catch(IOException e) { 56 } catch(IOException e) {