diff options
-rw-r--r-- | src/main/scala/uk/ac/ox/cs/rsacomb/Main.scala | 4 | ||||
-rw-r--r-- | src/main/scala/uk/ac/ox/cs/rsacomb/RSAConfig.scala | 10 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/main/scala/uk/ac/ox/cs/rsacomb/Main.scala b/src/main/scala/uk/ac/ox/cs/rsacomb/Main.scala index fe88b4f..cbec9ec 100644 --- a/src/main/scala/uk/ac/ox/cs/rsacomb/Main.scala +++ b/src/main/scala/uk/ac/ox/cs/rsacomb/Main.scala | |||
@@ -29,7 +29,7 @@ import sparql.ConjunctiveQuery | |||
29 | 29 | ||
30 | import uk.ac.ox.cs.rsacomb.ontology.Ontology | 30 | import uk.ac.ox.cs.rsacomb.ontology.Ontology |
31 | import uk.ac.ox.cs.rsacomb.converter.Normalizer | 31 | import uk.ac.ox.cs.rsacomb.converter.Normalizer |
32 | import uk.ac.ox.cs.rsacomb.approximation.{Upperbound, Lowerbound} | 32 | import uk.ac.ox.cs.rsacomb.approximation.Approximation |
33 | 33 | ||
34 | /** Main entry point to the program */ | 34 | /** Main entry point to the program */ |
35 | object RSAComb extends App { | 35 | object RSAComb extends App { |
@@ -53,7 +53,7 @@ object RSAComb extends App { | |||
53 | //ontology.axioms foreach println | 53 | //ontology.axioms foreach println |
54 | 54 | ||
55 | /* Approximate the ontology to RSA */ | 55 | /* Approximate the ontology to RSA */ |
56 | val toRSA = new Upperbound | 56 | val toRSA = config('approximation).get[Approximation[RSAOntology]] |
57 | val rsa = ontology approximate toRSA | 57 | val rsa = ontology approximate toRSA |
58 | 58 | ||
59 | if (config contains 'queries) { | 59 | if (config contains 'queries) { |
diff --git a/src/main/scala/uk/ac/ox/cs/rsacomb/RSAConfig.scala b/src/main/scala/uk/ac/ox/cs/rsacomb/RSAConfig.scala index 4d96850..3e92d81 100644 --- a/src/main/scala/uk/ac/ox/cs/rsacomb/RSAConfig.scala +++ b/src/main/scala/uk/ac/ox/cs/rsacomb/RSAConfig.scala | |||
@@ -18,6 +18,7 @@ package uk.ac.ox.cs.rsacomb | |||
18 | 18 | ||
19 | import scala.collection.mutable.Map | 19 | import scala.collection.mutable.Map |
20 | import util.Logger | 20 | import util.Logger |
21 | import approximation._ | ||
21 | 22 | ||
22 | case class RSAOption[+T](opt: T) { | 23 | case class RSAOption[+T](opt: T) { |
23 | def get[T]: T = opt.asInstanceOf[T] | 24 | def get[T]: T = opt.asInstanceOf[T] |
@@ -116,6 +117,13 @@ object RSAConfig { | |||
116 | } | 117 | } |
117 | case flag @ ("-a" | "--answers") :: answers :: tail => | 118 | case flag @ ("-a" | "--answers") :: answers :: tail => |
118 | parse(tail, config += ('answers -> getPath(answers))) | 119 | parse(tail, config += ('answers -> getPath(answers))) |
120 | case flag @ ("-x" | "--approximation") :: _approx :: tail => { | ||
121 | val approx = _approx match { | ||
122 | case "lowerbound" => new Lowerbound | ||
123 | case "upperbound" => new Upperbound | ||
124 | } | ||
125 | parse(tail, config += ('approximation -> approx)) | ||
126 | } | ||
119 | case flag @ ("-q" | "--queries") :: _query :: tail => { | 127 | case flag @ ("-q" | "--queries") :: _query :: tail => { |
120 | val query = getPath(_query) | 128 | val query = getPath(_query) |
121 | if (!os.isFile(query)) | 129 | if (!os.isFile(query)) |
@@ -149,6 +157,8 @@ object RSAConfig { | |||
149 | exit("The following flag is mandatory: '-o' or '--ontology'.") | 157 | exit("The following flag is mandatory: '-o' or '--ontology'.") |
150 | if (!config.contains('data)) | 158 | if (!config.contains('data)) |
151 | config += ('data -> List.empty[os.Path]) | 159 | config += ('data -> List.empty[os.Path]) |
160 | if (!config.contains('approximation)) | ||
161 | config += ('approximation -> new Lowerbound) | ||
152 | config | 162 | config |
153 | } | 163 | } |
154 | } | 164 | } |