From 3408515a868ca65ab907e21160f75c858ead8d46 Mon Sep 17 00:00:00 2001 From: Federico Igne Date: Thu, 6 Aug 2020 12:04:38 +0100 Subject: Refactor code into different files This has been done to better accommodate the code to detect all unsafe roles in an ontology. --- src/main/scala/rsacomb/Main.scala | 84 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 src/main/scala/rsacomb/Main.scala (limited to 'src/main/scala/rsacomb/Main.scala') diff --git a/src/main/scala/rsacomb/Main.scala b/src/main/scala/rsacomb/Main.scala new file mode 100644 index 0000000..9cd6680 --- /dev/null +++ b/src/main/scala/rsacomb/Main.scala @@ -0,0 +1,84 @@ +package rsacomb + +/* Java imports */ +import java.io.File + +/* Local imports */ +import rsacomb.RSA._ + +object RSAComb { + + val help: String = """ + rsacomb - combined approach for CQ answering for RSA ontologies. + + 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 + */ + + if (args.length < 2) { + println(help) + return () + } + + val ontoPath = new File(args(0)) + val queryPath = new File(args(1)) + + if (!ontoPath.isFile || !queryPath.isFile) { + println("The provided arguments are not regular files.\n\n") + println(help) + return () + } + + /* 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 ontology = RSA.loadOntology(ontoPath) + ontology.isRSA + + /* Build canonical model */ + //val tboxCanon = rsa.canonicalModel() + + /* Load query */ + //val query = ... + + /* Compute the filtering program from the given query */ + //val tboxFilter = rsa.filteringProgram(query) + + /* ... */ + + /* DEBUG ONLY */ + println("Ok!") + } +} + +/* Notes: + * + * To establish a connection with a local RDFox instance, do the + * following: + * + * ``` + * val serverConnection : ServerConnection = ConnectionFactory.newServerConnection("rdfox:local", "", "") + * serverConnection.createDataStore("test","seq",new HashMap()) + * val dataStoreConnection : DataStoreConnection = serverConnection.newDataStoreConnection("test") + * dataStoreConnection.importData( + * UpdateType.ADDITION, + * Prefixes.s_emptyPrefixes, + * new File("./path/to/file") + * ) + * ``` + */ -- cgit v1.2.3