From c8ba151b172ee0349a79a4cbeda57c6e2255e78a Mon Sep 17 00:00:00 2001 From: Federico Igne Date: Thu, 10 Sep 2020 10:16:47 +0200 Subject: Use `App` trait instead of `main` function --- src/main/scala/rsacomb/Main.scala | 82 ++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 44 deletions(-) (limited to 'src') 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 /* Local imports */ import rsacomb.RSA._ -object RSAComb { +object RSAComb extends App { val help: String = """ - rsacomb - combined approach for CQ answering for RSA ontologies. + rsacomb - combined approach for CQ answering for RSA ontologies. - USAGE - rsacomb + USAGE + rsacomb - where - the ontology is expected to be an OWL file and the (single) - query a SPARQL query file. - """ - - def main(args: Array[String]): Unit = { - - /* Simple arguments handling - * - * TODO: use something better later on - */ + where + the ontology is expected to be an OWL file and the (single) + query a SPARQL query file. - if (args.length < 2) { - println(help) - return () - } + """ - val ontoPath = new File(args(0)) - val queryPath = new File(args(1)) + /* Simple arguments handling + * + * TODO: use something better later on + */ - if (!ontoPath.isFile || !queryPath.isFile) { - println("The provided arguments are not regular files.\n\n") - println(help) - return () - } + if (args.length < 2) { + println(help) + sys.exit; + } - /* Create RSA object from generic OWLOntology - * - * TODO: It might be required to check if the ontology in input is - * Horn-ALCHOIQ. At the moment we are assuming this is always the - * case. - */ + val ontoPath = new File(args(0)) + val queryPath = new File(args(1)) - val ontology = RSA.loadOntology(ontoPath) - if (ontology.isRSA) { + if (!ontoPath.isFile || !queryPath.isFile) { + println("The provided arguments are not regular files.\n\n") + println(help) + sys.exit; + } - /* Build canonical model */ - //val tboxCanon = rsa.canonicalModel() + /* Create RSA object from generic OWLOntology + * + * TODO: It might be required to check if the ontology in input is + * Horn-ALCHOIQ. At the moment we are assuming this is always the + * case. + */ - /* Load query */ - val query = RSA.test_query + val ontology = RSA.loadOntology(ontoPath) + if (ontology.isRSA) { - /* Compute the filtering program from the given query */ - val filter = ontology.filteringProgram(query) + /* Build canonical model */ + //val tboxCanon = rsa.canonicalModel() - /* ... */ + /* Load query */ + val query = RSA.test_query - } + /* Compute the filtering program from the given query */ + val filter = ontology.filteringProgram(query) - /* DEBUG ONLY */ - println("Ok!") + /* ... */ } } -- cgit v1.2.3