aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/uk/ac/ox/cs/acqua/reasoner
diff options
context:
space:
mode:
authorFederico Igne <federico.igne@cs.ox.ac.uk>2022-05-11 12:35:56 +0100
committerFederico Igne <federico.igne@cs.ox.ac.uk>2022-05-11 12:35:56 +0100
commit32fe8f94255b913c570275043a3c056eaa4ec07b (patch)
tree2a370c3998db1eab758f214f16f2cebc3fd2ef34 /src/main/scala/uk/ac/ox/cs/acqua/reasoner
parenteaa8ed73aec7ca0ba02eb3e1c954388b8dbfc2cd (diff)
downloadACQuA-32fe8f94255b913c570275043a3c056eaa4ec07b.tar.gz
ACQuA-32fe8f94255b913c570275043a3c056eaa4ec07b.zip
Implement stub for query answering procedure
Diffstat (limited to 'src/main/scala/uk/ac/ox/cs/acqua/reasoner')
-rw-r--r--src/main/scala/uk/ac/ox/cs/acqua/reasoner/RSAQueryReasoner.scala78
1 files changed, 78 insertions, 0 deletions
diff --git a/src/main/scala/uk/ac/ox/cs/acqua/reasoner/RSAQueryReasoner.scala b/src/main/scala/uk/ac/ox/cs/acqua/reasoner/RSAQueryReasoner.scala
new file mode 100644
index 0000000..6b98d79
--- /dev/null
+++ b/src/main/scala/uk/ac/ox/cs/acqua/reasoner/RSAQueryReasoner.scala
@@ -0,0 +1,78 @@
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
17package uk.ac.ox.cs.acqua.reasoner
18
19import org.semanticweb.owlapi.model.OWLOntology
20import uk.ac.ox.cs.rsacomb.RSAOntology
21import uk.ac.ox.cs.rsacomb.approximation.{Approximation,Lowerbound}
22import uk.ac.ox.cs.rsacomb.ontology.Ontology
23import uk.ac.ox.cs.pagoda.query.QueryRecord
24import uk.ac.ox.cs.pagoda.reasoner.QueryReasoner
25
26class RSAQueryReasoner(val origin: Ontology) extends QueryReasoner {
27
28 /* Implicit compatibility between PAGOdA and RSAComb types */
29 import uk.ac.ox.cs.acqua.implicits.PagodaConverters._
30
31 /** This class is instantiated when the input ontology is RSA.
32 * Approximation (via any algorithm with RSAOntology as target)
33 * doesn't perform anything, but is useful to turn a generic
34 * [[uk.ac.ox.cs.rsacomb.ontology.Ontology]] into an
35 * [[uk.ac.ox.cs.rsacomb.RSAOntology]].
36 */
37 private val toRSA: Approximation[RSAOntology] = new Lowerbound
38 val rsa: RSAOntology = origin approximate toRSA
39
40 /** Doesn't perform any action.
41 *
42 * @note Implemented for compatibility with other reasoners.
43 */
44 def loadOntology(ontology: OWLOntology): Unit = {
45 /* Nothing to do */
46 }
47
48 /** Check consistency and returns whether the ontology is RSA.
49 *
50 * Preprocessing is performed on instance creation, so no actual work
51 * is being done here.
52 *
53 * @note Implemented for compatibility with other reasoners.
54 */
55 def preprocess(): Boolean = {
56 origin.isRSA
57 }
58
59 /** Check consistency and returns whether the ontology is RSA.
60 *
61 * Preprocessing is performed on instance creation, along with
62 * consistency checking, so no actual work is being done here.
63 *
64 * @note Implemented for compatibility with other reasoners.
65 */
66 def isConsistent(): Boolean = {
67 origin.isRSA
68 }
69
70 // TODO: probably need to override `evaluate` on multiple queries
71 def evaluate(query: QueryRecord): Unit = {
72 rsa ask query
73 }
74
75 def evaluateUpper(record: QueryRecord): Unit= {
76 ???
77 }
78}