diff options
Diffstat (limited to 'src/main/scala/uk/ac/ox/cs/rsacomb/Main.scala')
-rw-r--r-- | src/main/scala/uk/ac/ox/cs/rsacomb/Main.scala | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/src/main/scala/uk/ac/ox/cs/rsacomb/Main.scala b/src/main/scala/uk/ac/ox/cs/rsacomb/Main.scala index 231d2b8..258c226 100644 --- a/src/main/scala/uk/ac/ox/cs/rsacomb/Main.scala +++ b/src/main/scala/uk/ac/ox/cs/rsacomb/Main.scala | |||
@@ -26,6 +26,10 @@ import tech.oxfordsemantic.jrdfox.logic.sparql.statement.SelectQuery | |||
26 | import util.{Logger, RDFoxUtil, RSA} | 26 | import util.{Logger, RDFoxUtil, RSA} |
27 | import sparql.ConjunctiveQuery | 27 | import sparql.ConjunctiveQuery |
28 | 28 | ||
29 | import uk.ac.ox.cs.rsacomb.ontology.Ontology | ||
30 | import uk.ac.ox.cs.rsacomb.converter.Normalizer | ||
31 | import uk.ac.ox.cs.rsacomb.approximation.LowerBound | ||
32 | |||
29 | case class RSAOption[+T](opt: T) { | 33 | case class RSAOption[+T](opt: T) { |
30 | def get[T]: T = opt.asInstanceOf[T] | 34 | def get[T]: T = opt.asInstanceOf[T] |
31 | } | 35 | } |
@@ -122,12 +126,15 @@ object RSAComb extends App { | |||
122 | /* Command-line options */ | 126 | /* Command-line options */ |
123 | val config = RSAConfig.parse(args.toList) | 127 | val config = RSAConfig.parse(args.toList) |
124 | 128 | ||
125 | val ontology = RSAOntology( | 129 | /* Load original ontology and normalize it */ |
130 | val ontology = Ontology( | ||
126 | config('ontology).get[File], | 131 | config('ontology).get[File], |
127 | config('data).get[List[File]]: _* | 132 | config('data).get[List[File]] |
128 | ) | 133 | ).normalize(new Normalizer) |
129 | val rsa = ontology.toRSA() | 134 | |
130 | ontology.statistics() | 135 | /* Approximate the ontology to RSA */ |
136 | val toRSA = new LowerBound | ||
137 | val rsa = ontology approximate toRSA | ||
131 | 138 | ||
132 | if (config contains 'query) { | 139 | if (config contains 'query) { |
133 | val query = | 140 | val query = |
@@ -140,18 +147,18 @@ object RSAComb extends App { | |||
140 | Logger.print(s"$answers", Logger.VERBOSE) | 147 | Logger.print(s"$answers", Logger.VERBOSE) |
141 | Logger print s"Number of answers: ${answers.length} (${answers.lengthWithMultiplicity})" | 148 | Logger print s"Number of answers: ${answers.length} (${answers.lengthWithMultiplicity})" |
142 | // Retrieve unfiltered answers | 149 | // Retrieve unfiltered answers |
143 | val unfiltered = rsa.queryDataStore( | 150 | // val unfiltered = rsa.queryDataStore( |
144 | """ | 151 | // """ |
145 | SELECT (count(?K) as ?COUNT) | 152 | // SELECT (count(?K) as ?COUNT) |
146 | WHERE { | 153 | // WHERE { |
147 | ?K a rsa:QM . | 154 | // ?K a rsa:QM . |
148 | } | 155 | // } |
149 | """, | 156 | // """, |
150 | RSA.Prefixes | 157 | // RSA.Prefixes |
151 | ) | 158 | // ) |
152 | unfiltered.foreach((u) => | 159 | // unfiltered.foreach((u) => |
153 | Logger print s"Number of unfiltered answers: ${u.head._2}" | 160 | // Logger print s"Number of unfiltered answers: ${u.head._2}" |
154 | ) | 161 | // ) |
155 | } | 162 | } |
156 | case None => | 163 | case None => |
157 | throw new RuntimeException("Submitted query is not conjunctive") | 164 | throw new RuntimeException("Submitted query is not conjunctive") |