diff options
| author | Federico Igne <federico.igne@cs.ox.ac.uk> | 2022-05-12 11:21:49 +0100 |
|---|---|---|
| committer | Federico Igne <federico.igne@cs.ox.ac.uk> | 2022-05-12 11:21:49 +0100 |
| commit | 6532db6a2cc9131e8039bd0c0e53190cc30b3599 (patch) | |
| tree | 0eb569e6bd046b4c0f436affba84dc6c5aaa296a /src/main/scala/uk/ac/ox/cs/acqua/util | |
| parent | 094a6e1211c96f174040b209d0c5e2e188bfa4ac (diff) | |
| download | ACQuA-6532db6a2cc9131e8039bd0c0e53190cc30b3599.tar.gz ACQuA-6532db6a2cc9131e8039bd0c0e53190cc30b3599.zip | |
Adjust CLI
Diffstat (limited to 'src/main/scala/uk/ac/ox/cs/acqua/util')
| -rw-r--r-- | src/main/scala/uk/ac/ox/cs/acqua/util/AcquaConfig.scala | 71 |
1 files changed, 33 insertions, 38 deletions
diff --git a/src/main/scala/uk/ac/ox/cs/acqua/util/AcquaConfig.scala b/src/main/scala/uk/ac/ox/cs/acqua/util/AcquaConfig.scala index 675a592..990afb2 100644 --- a/src/main/scala/uk/ac/ox/cs/acqua/util/AcquaConfig.scala +++ b/src/main/scala/uk/ac/ox/cs/acqua/util/AcquaConfig.scala | |||
| @@ -17,13 +17,19 @@ | |||
| 17 | package uk.ac.ox.cs.acqua.util | 17 | package uk.ac.ox.cs.acqua.util |
| 18 | 18 | ||
| 19 | import scala.collection.mutable.Map | 19 | import scala.collection.mutable.Map |
| 20 | 20 | import uk.ac.ox.cs.rsacomb.util.Logger | |
| 21 | //import util.Logger | ||
| 22 | 21 | ||
| 23 | case class AcquaOption[+T](opt: T) { | 22 | case class AcquaOption[+T](opt: T) { |
| 24 | def get[T]: T = opt.asInstanceOf[T] | 23 | def get[T]: T = opt.asInstanceOf[T] |
| 25 | } | 24 | } |
| 26 | 25 | ||
| 26 | /** Command line options for ACQuA | ||
| 27 | * | ||
| 28 | * TODO: integrate with PAGOdA's Logger. | ||
| 29 | * The ideal situation would be to add a Logger interface to PAGOdA and | ||
| 30 | * make everything dependent on it so that this Logger can be | ||
| 31 | * implemented as an instance of the interface. | ||
| 32 | */ | ||
| 27 | object AcquaConfig { | 33 | object AcquaConfig { |
| 28 | type Config = Map[Symbol, AcquaOption[Any]] | 34 | type Config = Map[Symbol, AcquaOption[Any]] |
| 29 | 35 | ||
| @@ -32,10 +38,10 @@ object AcquaConfig { | |||
| 32 | /** Help message */ | 38 | /** Help message */ |
| 33 | private val help: String = """ | 39 | private val help: String = """ |
| 34 | 40 | ||
| 35 | rsacomb - combined approach for CQ answering for RSA ontologies. | 41 | acqua - conjunctive query answering over unrestricted ontologies |
| 36 | 42 | ||
| 37 | USAGE | 43 | USAGE |
| 38 | rsacomb [OPTIONS] <ontology> [<data> ...] | 44 | acqua [OPTIONS] |
| 39 | 45 | ||
| 40 | -h | -? | --help | 46 | -h | -? | --help |
| 41 | print this help message | 47 | print this help message |
| @@ -60,12 +66,6 @@ object AcquaConfig { | |||
| 60 | directory is provided, all files in the directory (recursively) | 66 | directory is provided, all files in the directory (recursively) |
| 61 | will be considered. | 67 | will be considered. |
| 62 | 68 | ||
| 63 | -x | --approximation <string> | ||
| 64 | values available are "lowerupper" or "upperbound" corresponding | ||
| 65 | to the two algorithms for ontology approximation shipping by | ||
| 66 | default with RSAComb. You will need to change the source code to | ||
| 67 | expose custom approximation modules through the CLI. | ||
| 68 | |||
| 69 | -t | --transitive | 69 | -t | --transitive |
| 70 | "upperbound" approximation specific option. Include property chain | 70 | "upperbound" approximation specific option. Include property chain |
| 71 | axioms (and hence the more common transitive properties) when | 71 | axioms (and hence the more common transitive properties) when |
| @@ -77,7 +77,6 @@ object AcquaConfig { | |||
| 77 | private val default: Config = Map( | 77 | private val default: Config = Map( |
| 78 | 'transitive -> false, | 78 | 'transitive -> false, |
| 79 | 'data -> List.empty[os.Path], | 79 | 'data -> List.empty[os.Path], |
| 80 | 'approximation -> 'lowerbound | ||
| 81 | ) | 80 | ) |
| 82 | 81 | ||
| 83 | /** Parse a string into a path. | 82 | /** Parse a string into a path. |
| @@ -126,19 +125,16 @@ object AcquaConfig { | |||
| 126 | sys.exit(0) | 125 | sys.exit(0) |
| 127 | } | 126 | } |
| 128 | case flag @ ("-l" | "--logger") :: _level :: tail => { | 127 | case flag @ ("-l" | "--logger") :: _level :: tail => { |
| 129 | // val level = _level match { | 128 | val level = _level match { |
| 130 | // case "quiet" => Logger.QUIET | 129 | case "quiet" => Logger.QUIET |
| 131 | // case "debug" => Logger.DEBUG | 130 | case "debug" => Logger.DEBUG |
| 132 | // case "verbose" => Logger.VERBOSE | 131 | case "verbose" => Logger.VERBOSE |
| 133 | // case _ => Logger.NORMAL | 132 | case _ => Logger.NORMAL |
| 134 | // } | 133 | } |
| 135 | parse(tail, config += ('logger -> _level)) | 134 | parse(tail, config += ('logger -> level)) |
| 136 | } | 135 | } |
| 137 | case flag @ ("-a" | "--answers") :: answers :: tail => | 136 | case flag @ ("-a" | "--answers") :: answers :: tail => |
| 138 | parse(tail, config += ('answers -> getPath(answers))) | 137 | parse(tail, config += ('answers -> getPath(answers))) |
| 139 | case flag @ ("-x" | "--approximation") :: approx :: tail => { | ||
| 140 | parse(tail, config += ('approximation -> Symbol(approx))) | ||
| 141 | } | ||
| 142 | case flag @ ("-t" | "--transitive") :: tail => | 138 | case flag @ ("-t" | "--transitive") :: tail => |
| 143 | parse(tail, config += ('transitive -> true)) | 139 | parse(tail, config += ('transitive -> true)) |
| 144 | case flag @ ("-q" | "--queries") :: _query :: tail => { | 140 | case flag @ ("-q" | "--queries") :: _query :: tail => { |
| @@ -190,22 +186,21 @@ object AcquaConfig { | |||
| 190 | * @returns a string describing the configuration | 186 | * @returns a string describing the configuration |
| 191 | */ | 187 | */ |
| 192 | def describe(config: Config): Unit = { | 188 | def describe(config: Config): Unit = { |
| 193 | // config foreach { case (k,v) => k match { | 189 | config foreach { case (k,v) => k match { |
| 194 | // case 'logger => Logger print s"Logger level: ${v.get[Logger.Level]}" | 190 | case 'logger => Logger print s"Logger level: ${v.get[Logger.Level]}" |
| 195 | // case 'ontology => Logger print s"Ontology file: ${v.get[os.Path]}" | 191 | case 'ontology => Logger print s"Ontology file: ${v.get[os.Path]}" |
| 196 | // case 'data => { | 192 | case 'data => { |
| 197 | // val paths = v.get[List[os.Path]] | 193 | val paths = v.get[List[os.Path]] |
| 198 | // val ellipsis = if (paths.length > 1) " [...]" else "" | 194 | val ellipsis = if (paths.length > 1) " [...]" else "" |
| 199 | // Logger print s"Data files: ${paths.head}$ellipsis" | 195 | Logger print s"Data files: ${paths.head}$ellipsis" |
| 200 | // } | 196 | } |
| 201 | // case 'queries => { | 197 | case 'queries => { |
| 202 | // val paths = v.get[List[os.Path]] | 198 | val paths = v.get[List[os.Path]] |
| 203 | // val ellipsis = if (paths.length > 1) " [...]" else "" | 199 | val ellipsis = if (paths.length > 1) " [...]" else "" |
| 204 | // Logger print s"Query files: ${paths.head}$ellipsis" | 200 | Logger print s"Query files: ${paths.head}$ellipsis" |
| 205 | // } | 201 | } |
| 206 | // case 'answers => Logger print s"Path to answers: ${v.get[os.Path]}" | 202 | case 'answers => Logger print s"Path to answers: ${v.get[os.Path]}" |
| 207 | // case 'approximation => Logger print s"Applied approximation: ${v.get[Symbol].name}" | 203 | case 'transitive => Logger print s"Include property chain axioms: ${v.get[Boolean]}" |
| 208 | // case 'transitive => Logger print s"Include property chain axioms: ${v.get[Boolean]}" | 204 | }} |
| 209 | // }} | ||
| 210 | } | 205 | } |
| 211 | } | 206 | } |
