diff options
| author | Federico Igne <federico.igne@cs.ox.ac.uk> | 2020-08-06 12:04:38 +0100 |
|---|---|---|
| committer | Federico Igne <federico.igne@cs.ox.ac.uk> | 2020-08-06 12:04:38 +0100 |
| commit | 3408515a868ca65ab907e21160f75c858ead8d46 (patch) | |
| tree | 8dcc1e2ec9a43aeb68dca6a9246415ec6569fa3e /src/main/scala/rsacomb/Main.scala | |
| parent | a9e44e1b67d373faa05dd957c124eae343ff0cfa (diff) | |
| download | RSAComb-3408515a868ca65ab907e21160f75c858ead8d46.tar.gz RSAComb-3408515a868ca65ab907e21160f75c858ead8d46.zip | |
Refactor code into different files
This has been done to better accommodate the code to detect all unsafe
roles in an ontology.
Diffstat (limited to 'src/main/scala/rsacomb/Main.scala')
| -rw-r--r-- | src/main/scala/rsacomb/Main.scala | 84 |
1 files changed, 84 insertions, 0 deletions
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 @@ | |||
| 1 | package rsacomb | ||
| 2 | |||
| 3 | /* Java imports */ | ||
| 4 | import java.io.File | ||
| 5 | |||
| 6 | /* Local imports */ | ||
| 7 | import rsacomb.RSA._ | ||
| 8 | |||
| 9 | object RSAComb { | ||
| 10 | |||
| 11 | val help: String = """ | ||
| 12 | rsacomb - combined approach for CQ answering for RSA ontologies. | ||
| 13 | |||
| 14 | USAGE | ||
| 15 | rsacomb <path/to/ontology.owl> <path/to/query.sparql> | ||
| 16 | |||
| 17 | where | ||
| 18 | the ontology is expected to be an OWL file and the (single) | ||
| 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 | |||
| 29 | if (args.length < 2) { | ||
| 30 | println(help) | ||
| 31 | return () | ||
| 32 | } | ||
| 33 | |||
| 34 | val ontoPath = new File(args(0)) | ||
| 35 | val queryPath = new File(args(1)) | ||
| 36 | |||
| 37 | if (!ontoPath.isFile || !queryPath.isFile) { | ||
| 38 | println("The provided arguments are not regular files.\n\n") | ||
| 39 | println(help) | ||
| 40 | return () | ||
| 41 | } | ||
| 42 | |||
| 43 | /* Create RSA object from generic OWLOntology | ||
| 44 | * | ||
| 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 | |||
| 50 | val ontology = RSA.loadOntology(ontoPath) | ||
| 51 | ontology.isRSA | ||
| 52 | |||
| 53 | /* Build canonical model */ | ||
| 54 | //val tboxCanon = rsa.canonicalModel() | ||
| 55 | |||
| 56 | /* Load query */ | ||
| 57 | //val query = ... | ||
| 58 | |||
| 59 | /* Compute the filtering program from the given query */ | ||
| 60 | //val tboxFilter = rsa.filteringProgram(query) | ||
| 61 | |||
| 62 | /* ... */ | ||
| 63 | |||
| 64 | /* DEBUG ONLY */ | ||
| 65 | println("Ok!") | ||
| 66 | } | ||
| 67 | } | ||
| 68 | |||
| 69 | /* Notes: | ||
| 70 | * | ||
| 71 | * To establish a connection with a local RDFox instance, do the | ||
| 72 | * following: | ||
| 73 | * | ||
| 74 | * ``` | ||
| 75 | * val serverConnection : ServerConnection = ConnectionFactory.newServerConnection("rdfox:local", "", "") | ||
| 76 | * serverConnection.createDataStore("test","seq",new HashMap()) | ||
| 77 | * val dataStoreConnection : DataStoreConnection = serverConnection.newDataStoreConnection("test") | ||
| 78 | * dataStoreConnection.importData( | ||
| 79 | * UpdateType.ADDITION, | ||
| 80 | * Prefixes.s_emptyPrefixes, | ||
| 81 | * new File("./path/to/file") | ||
| 82 | * ) | ||
| 83 | * ``` | ||
| 84 | */ | ||
