diff options
author | Federico Igne <federico.igne@cs.ox.ac.uk> | 2020-09-10 10:16:47 +0200 |
---|---|---|
committer | Federico Igne <federico.igne@cs.ox.ac.uk> | 2020-09-10 10:16:47 +0200 |
commit | c8ba151b172ee0349a79a4cbeda57c6e2255e78a (patch) | |
tree | 518003ad90b1faa48d4435fce4488dd0cd6b5271 /src/main/scala/rsacomb | |
parent | dce92d56b1c26497dc32312fd5a3a4494abe4dbd (diff) | |
download | RSAComb-c8ba151b172ee0349a79a4cbeda57c6e2255e78a.tar.gz RSAComb-c8ba151b172ee0349a79a4cbeda57c6e2255e78a.zip |
Use `App` trait instead of `main` function
Diffstat (limited to 'src/main/scala/rsacomb')
-rw-r--r-- | src/main/scala/rsacomb/Main.scala | 82 |
1 files changed, 38 insertions, 44 deletions
diff --git a/src/main/scala/rsacomb/Main.scala b/src/main/scala/rsacomb/Main.scala index a449db4..35c682e 100644 --- a/src/main/scala/rsacomb/Main.scala +++ b/src/main/scala/rsacomb/Main.scala | |||
@@ -6,65 +6,59 @@ import java.io.File | |||
6 | /* Local imports */ | 6 | /* Local imports */ |
7 | import rsacomb.RSA._ | 7 | import rsacomb.RSA._ |
8 | 8 | ||
9 | object RSAComb { | 9 | object RSAComb extends App { |
10 | 10 | ||
11 | val help: String = """ | 11 | val help: String = """ |
12 | rsacomb - combined approach for CQ answering for RSA ontologies. | 12 | rsacomb - combined approach for CQ answering for RSA ontologies. |
13 | 13 | ||
14 | USAGE | 14 | USAGE |
15 | rsacomb <path/to/ontology.owl> <path/to/query.sparql> | 15 | rsacomb <path/to/ontology.owl> <path/to/query.sparql> |
16 | 16 | ||
17 | where | 17 | where |
18 | the ontology is expected to be an OWL file and the (single) | 18 | the ontology is expected to be an OWL file and the (single) |
19 | query a SPARQL query file. | 19 | query a SPARQL query file. |
20 | """ | ||
21 | |||
22 | def main(args: Array[String]): Unit = { | ||
23 | |||
24 | /* Simple arguments handling | ||
25 | * | ||
26 | * TODO: use something better later on | ||
27 | */ | ||
28 | 20 | ||
29 | if (args.length < 2) { | 21 | """ |
30 | println(help) | ||
31 | return () | ||
32 | } | ||
33 | 22 | ||
34 | val ontoPath = new File(args(0)) | 23 | /* Simple arguments handling |
35 | val queryPath = new File(args(1)) | 24 | * |
25 | * TODO: use something better later on | ||
26 | */ | ||
36 | 27 | ||
37 | if (!ontoPath.isFile || !queryPath.isFile) { | 28 | if (args.length < 2) { |
38 | println("The provided arguments are not regular files.\n\n") | 29 | println(help) |
39 | println(help) | 30 | sys.exit; |
40 | return () | 31 | } |
41 | } | ||
42 | 32 | ||
43 | /* Create RSA object from generic OWLOntology | 33 | val ontoPath = new File(args(0)) |
44 | * | 34 | val queryPath = new File(args(1)) |
45 | * TODO: It might be required to check if the ontology in input is | ||
46 | * Horn-ALCHOIQ. At the moment we are assuming this is always the | ||
47 | * case. | ||
48 | */ | ||
49 | 35 | ||
50 | val ontology = RSA.loadOntology(ontoPath) | 36 | if (!ontoPath.isFile || !queryPath.isFile) { |
51 | if (ontology.isRSA) { | 37 | println("The provided arguments are not regular files.\n\n") |
38 | println(help) | ||
39 | sys.exit; | ||
40 | } | ||
52 | 41 | ||
53 | /* Build canonical model */ | 42 | /* Create RSA object from generic OWLOntology |
54 | //val tboxCanon = rsa.canonicalModel() | 43 | * |
44 | * TODO: It might be required to check if the ontology in input is | ||
45 | * Horn-ALCHOIQ. At the moment we are assuming this is always the | ||
46 | * case. | ||
47 | */ | ||
55 | 48 | ||
56 | /* Load query */ | 49 | val ontology = RSA.loadOntology(ontoPath) |
57 | val query = RSA.test_query | 50 | if (ontology.isRSA) { |
58 | 51 | ||
59 | /* Compute the filtering program from the given query */ | 52 | /* Build canonical model */ |
60 | val filter = ontology.filteringProgram(query) | 53 | //val tboxCanon = rsa.canonicalModel() |
61 | 54 | ||
62 | /* ... */ | 55 | /* Load query */ |
56 | val query = RSA.test_query | ||
63 | 57 | ||
64 | } | 58 | /* Compute the filtering program from the given query */ |
59 | val filter = ontology.filteringProgram(query) | ||
65 | 60 | ||
66 | /* DEBUG ONLY */ | 61 | /* ... */ |
67 | println("Ok!") | ||
68 | } | 62 | } |
69 | } | 63 | } |
70 | 64 | ||