diff options
author | Federico Igne <federico.igne@cs.ox.ac.uk> | 2022-06-01 17:45:17 +0100 |
---|---|---|
committer | Federico Igne <federico.igne@cs.ox.ac.uk> | 2022-06-01 17:45:17 +0100 |
commit | f480a850161445bb3dd9ead500810db21dfa1451 (patch) | |
tree | e9846ae1c00cf6beff7defce306da1eab3a193eb /src/main/scala/uk/ac/ox/cs | |
parent | f56365b77f8519d2af3ac9d352086f1568dbf063 (diff) | |
download | RSAComb-f480a850161445bb3dd9ead500810db21dfa1451.tar.gz RSAComb-f480a850161445bb3dd9ead500810db21dfa1451.zip |
feat: implicitly propagate configs to approximations
Diffstat (limited to 'src/main/scala/uk/ac/ox/cs')
4 files changed, 9 insertions, 8 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 8784651..233e170 100644 --- a/src/main/scala/uk/ac/ox/cs/rsacomb/Main.scala +++ b/src/main/scala/uk/ac/ox/cs/rsacomb/Main.scala | |||
@@ -22,7 +22,7 @@ import ontology.{Ontology,RSAOntology} | |||
22 | import util.{Logger, RDFoxUtil, RSA} | 22 | import util.{Logger, RDFoxUtil, RSA} |
23 | 23 | ||
24 | object RSAComb extends App { | 24 | object RSAComb extends App { |
25 | val config = RSAConfig.parse(args.toList) | 25 | implicit val config = RSAConfig parse args.toList |
26 | RSAConfig describe config | 26 | RSAConfig describe config |
27 | 27 | ||
28 | /* Configure logger */ | 28 | /* Configure logger */ |
diff --git a/src/main/scala/uk/ac/ox/cs/rsacomb/RSAConfig.scala b/src/main/scala/uk/ac/ox/cs/rsacomb/RSAConfig.scala index 32460b4..2dcd850 100644 --- a/src/main/scala/uk/ac/ox/cs/rsacomb/RSAConfig.scala +++ b/src/main/scala/uk/ac/ox/cs/rsacomb/RSAConfig.scala | |||
@@ -74,7 +74,7 @@ object RSAConfig { | |||
74 | """ | 74 | """ |
75 | 75 | ||
76 | /** Default config values */ | 76 | /** Default config values */ |
77 | private val default: Config = Map( | 77 | val default: Config = Map( |
78 | 'transitive -> false, | 78 | 'transitive -> false, |
79 | 'data -> List.empty[os.Path], | 79 | 'data -> List.empty[os.Path], |
80 | 'approximation -> 'lowerbound | 80 | 'approximation -> 'lowerbound |
diff --git a/src/main/scala/uk/ac/ox/cs/rsacomb/approximation/Lowerbound.scala b/src/main/scala/uk/ac/ox/cs/rsacomb/approximation/Lowerbound.scala index 1b72699..154cbd1 100644 --- a/src/main/scala/uk/ac/ox/cs/rsacomb/approximation/Lowerbound.scala +++ b/src/main/scala/uk/ac/ox/cs/rsacomb/approximation/Lowerbound.scala | |||
@@ -1,7 +1,5 @@ | |||
1 | package uk.ac.ox.cs.rsacomb.approximation | 1 | package uk.ac.ox.cs.rsacomb.approximation |
2 | 2 | ||
3 | import java.io.File | ||
4 | |||
5 | import org.semanticweb.owlapi.apibinding.OWLManager | 3 | import org.semanticweb.owlapi.apibinding.OWLManager |
6 | import org.semanticweb.owlapi.model.{IRI => OWLIRI, _} | 4 | import org.semanticweb.owlapi.model.{IRI => OWLIRI, _} |
7 | 5 | ||
@@ -15,6 +13,7 @@ import scalax.collection.GraphTraversal._ | |||
15 | import uk.ac.ox.cs.rsacomb.ontology.RSAOntology | 13 | import uk.ac.ox.cs.rsacomb.ontology.RSAOntology |
16 | import uk.ac.ox.cs.rsacomb.ontology.Ontology | 14 | import uk.ac.ox.cs.rsacomb.ontology.Ontology |
17 | import uk.ac.ox.cs.rsacomb.util.{DataFactory, RDFoxUtil, RSA} | 15 | import uk.ac.ox.cs.rsacomb.util.{DataFactory, RDFoxUtil, RSA} |
16 | import uk.ac.ox.cs.rsacomb.RSAConfig | ||
18 | 17 | ||
19 | object Lowerbound { | 18 | object Lowerbound { |
20 | 19 | ||
@@ -38,8 +37,9 @@ object Lowerbound { | |||
38 | * | 37 | * |
39 | * @see [[uk.ac.ox.cs.rsacomb.converter.Normalizer]] | 38 | * @see [[uk.ac.ox.cs.rsacomb.converter.Normalizer]] |
40 | */ | 39 | */ |
41 | class Lowerbound(implicit fresh: DataFactory) | 40 | class Lowerbound( |
42 | extends Approximation[RSAOntology] { | 41 | implicit fresh: DataFactory, config: RSAConfig.Config |
42 | ) extends Approximation[RSAOntology] { | ||
43 | 43 | ||
44 | /** Simplify conversion between Java and Scala collections */ | 44 | /** Simplify conversion between Java and Scala collections */ |
45 | import uk.ac.ox.cs.rsacomb.implicits.JavaCollections._ | 45 | import uk.ac.ox.cs.rsacomb.implicits.JavaCollections._ |
@@ -84,9 +84,9 @@ class Lowerbound(implicit fresh: DataFactory) | |||
84 | case _ => true | 84 | case _ => true |
85 | } | 85 | } |
86 | } | 86 | } |
87 | case a: OWLTransitiveObjectPropertyAxiom => false | 87 | case a: OWLTransitiveObjectPropertyAxiom => config('transitive).get[Boolean] |
88 | case a: OWLReflexiveObjectPropertyAxiom => false | 88 | case a: OWLReflexiveObjectPropertyAxiom => false |
89 | case a: OWLSubPropertyChainOfAxiom => true /*TODO: should we leave it? */ | 89 | case a: OWLSubPropertyChainOfAxiom => config('transitive).get[Boolean] |
90 | case a: OWLAsymmetricObjectPropertyAxiom => false | 90 | case a: OWLAsymmetricObjectPropertyAxiom => false |
91 | case a => true | 91 | case a => true |
92 | } | 92 | } |
diff --git a/src/main/scala/uk/ac/ox/cs/rsacomb/package.scala b/src/main/scala/uk/ac/ox/cs/rsacomb/package.scala index 53fa095..b8144c4 100644 --- a/src/main/scala/uk/ac/ox/cs/rsacomb/package.scala +++ b/src/main/scala/uk/ac/ox/cs/rsacomb/package.scala | |||
@@ -18,4 +18,5 @@ package uk.ac.ox.cs | |||
18 | package object rsacomb { | 18 | package object rsacomb { |
19 | 19 | ||
20 | implicit val seed: util.DataFactory = util.DataFactory(0) | 20 | implicit val seed: util.DataFactory = util.DataFactory(0) |
21 | |||
21 | } | 22 | } |