diff options
Diffstat (limited to 'src/main/scala/uk/ac/ox/cs/acqua/Main.scala')
| -rw-r--r-- | src/main/scala/uk/ac/ox/cs/acqua/Main.scala | 82 |
1 files changed, 63 insertions, 19 deletions
diff --git a/src/main/scala/uk/ac/ox/cs/acqua/Main.scala b/src/main/scala/uk/ac/ox/cs/acqua/Main.scala index 749a492..e8cfeb7 100644 --- a/src/main/scala/uk/ac/ox/cs/acqua/Main.scala +++ b/src/main/scala/uk/ac/ox/cs/acqua/Main.scala | |||
| @@ -1,16 +1,41 @@ | |||
| 1 | /* | ||
| 2 | * Copyright 2021,2022 KRR Oxford | ||
| 3 | * | ||
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | * you may not use this file except in compliance with the License. | ||
| 6 | * You may obtain a copy of the License at | ||
| 7 | * | ||
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | * | ||
| 10 | * Unless required by applicable law or agreed to in writing, software | ||
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | * See the License for the specific language governing permissions and | ||
| 14 | * limitations under the License. | ||
| 15 | */ | ||
| 16 | |||
| 1 | package uk.ac.ox.cs.acqua | 17 | package uk.ac.ox.cs.acqua |
| 2 | 18 | ||
| 19 | import uk.ac.ox.cs.rsacomb.converter.Normalizer | ||
| 3 | import uk.ac.ox.cs.rsacomb.ontology.Ontology | 20 | import uk.ac.ox.cs.rsacomb.ontology.Ontology |
| 21 | import uk.ac.ox.cs.rsacomb.util.{RDFoxUtil,RSA} | ||
| 4 | 22 | ||
| 5 | import uk.ac.ox.cs.pagoda.owl.OWLHelper | 23 | import uk.ac.ox.cs.pagoda.owl.OWLHelper |
| 6 | import uk.ac.ox.cs.pagoda.reasoner.{ELHOQueryReasoner,QueryReasoner,RLQueryReasoner} | 24 | import uk.ac.ox.cs.pagoda.reasoner.{ELHOQueryReasoner,MyQueryReasoner,QueryReasoner,RLQueryReasoner} |
| 7 | // import uk.ac.ox.cs.pagoda.Pagoda | 25 | import uk.ac.ox.cs.pagoda.util.PagodaProperties; |
| 8 | // import uk.ac.ox.cs.pagoda.util.PagodaProperties; | 26 | import uk.ac.ox.cs.pagoda.util.Utility; |
| 27 | |||
| 28 | import uk.ac.ox.cs.acqua.reasoner.RSAQueryReasoner | ||
| 29 | import uk.ac.ox.cs.acqua.util.AcquaConfig | ||
| 9 | 30 | ||
| 10 | object Acqua extends App { | 31 | object Acqua extends App { |
| 32 | val config = AcquaConfig.parse(args.toList) | ||
| 33 | AcquaConfig describe config | ||
| 11 | 34 | ||
| 12 | val ontopath = os.Path("tests/lubm/univ-bench.owl", base = os.pwd) | 35 | val ontopath = os.Path("tests/lubm/univ-bench.owl", base = os.pwd) |
| 13 | val ontology = Ontology(ontopath, List.empty) | 36 | val ontology = Ontology(ontopath, List.empty).normalize(new Normalizer) |
| 37 | |||
| 38 | val properties = new PagodaProperties() | ||
| 14 | 39 | ||
| 15 | val performMultiStages = true | 40 | val performMultiStages = true |
| 16 | val considerEqualities = true | 41 | val considerEqualities = true |
| @@ -20,22 +45,41 @@ object Acqua extends App { | |||
| 20 | } else if (OWLHelper.isInELHO(ontology.origin)) { | 45 | } else if (OWLHelper.isInELHO(ontology.origin)) { |
| 21 | new ELHOQueryReasoner(); | 46 | new ELHOQueryReasoner(); |
| 22 | } else if (ontology.isRSA) { | 47 | } else if (ontology.isRSA) { |
| 23 | // Use combined approach for RSA | 48 | new RSAQueryReasoner(ontology) |
| 24 | ??? | ||
| 25 | } else { | 49 | } else { |
| 26 | new MyQueryReasoner(performMultiStages, considerEqualities); | 50 | // Return ACQuA reasoner |
| 51 | // new MyQueryReasoner(performMultiStages, considerEqualities); | ||
| 52 | ??? | ||
| 53 | } | ||
| 54 | |||
| 55 | /* Preprocessing */ | ||
| 56 | reasoner.setProperties(properties) | ||
| 57 | reasoner.loadOntology(ontology.origin) | ||
| 58 | reasoner.importData(properties.getDataPath()) | ||
| 59 | if (reasoner.preprocess()) { | ||
| 60 | Utility.logInfo("The ontology is consistent!"); | ||
| 61 | } | ||
| 62 | else { | ||
| 63 | Utility.logInfo("The ontology is inconsistent!"); | ||
| 64 | reasoner.dispose(); | ||
| 27 | } | 65 | } |
| 28 | // else | ||
| 29 | // switch(type) { | ||
| 30 | // case RLU: | ||
| 31 | // reasoner = new RLUQueryReasoner(performMultiStages, considerEqualities); | ||
| 32 | // break; | ||
| 33 | // case ELHOU: | ||
| 34 | // reasoner = new ELHOUQueryReasoner(performMultiStages, considerEqualities); | ||
| 35 | // break; | ||
| 36 | // default: | ||
| 37 | // reasoner = new MyQueryReasoner(performMultiStages, considerEqualities); | ||
| 38 | // } | ||
| 39 | // return reasoner; | ||
| 40 | 66 | ||
| 67 | if (config contains 'queries) { | ||
| 68 | val queries = | ||
| 69 | RDFoxUtil.loadQueriesFromFiles( | ||
| 70 | config('queries).get[List[os.Path]], | ||
| 71 | RSA.Prefixes | ||
| 72 | ) | ||
| 73 | // for(String queryFile : properties.getQueryPath().split(";")) { | ||
| 74 | // Collection<QueryRecord> queryRecords = pagoda.getQueryManager().collectQueryRecords(queryFile); | ||
| 75 | // pagoda.evaluate(queryRecords); | ||
| 76 | } | ||
| 41 | } | 77 | } |
| 78 | |||
| 79 | |||
| 80 | // /* Perform query answering */ | ||
| 81 | // val answers = rsa ask queries | ||
| 82 | |||
| 83 | // /* Perform logging */ | ||
| 84 | // Logger write answers | ||
| 85 | // Logger.generateSimulationScripts(datapath, queries) | ||
