aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/uk/ac/ox/cs/rsacomb/CanonicalModel.scala
diff options
context:
space:
mode:
authorFederico Igne <federico.igne@cs.ox.ac.uk>2020-11-19 11:45:01 +0000
committerFederico Igne <federico.igne@cs.ox.ac.uk>2020-11-19 11:46:13 +0000
commite84d4a15401b0a83dbb7d502723c33abf656b9ff (patch)
tree6d7380862399a87f1841532f8e97f2471c54e27c /src/main/scala/uk/ac/ox/cs/rsacomb/CanonicalModel.scala
parent3c6307166d18890212c364a82fc15fb1ba7725e1 (diff)
downloadRSAComb-e84d4a15401b0a83dbb7d502723c33abf656b9ff.tar.gz
RSAComb-e84d4a15401b0a83dbb7d502723c33abf656b9ff.zip
Move NI instantiation in FilteringProgram
Diffstat (limited to 'src/main/scala/uk/ac/ox/cs/rsacomb/CanonicalModel.scala')
-rw-r--r--src/main/scala/uk/ac/ox/cs/rsacomb/CanonicalModel.scala19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/main/scala/uk/ac/ox/cs/rsacomb/CanonicalModel.scala b/src/main/scala/uk/ac/ox/cs/rsacomb/CanonicalModel.scala
index f0f1bf8..d5956ae 100644
--- a/src/main/scala/uk/ac/ox/cs/rsacomb/CanonicalModel.scala
+++ b/src/main/scala/uk/ac/ox/cs/rsacomb/CanonicalModel.scala
@@ -37,9 +37,6 @@ class CanonicalModel(val ontology: RSAOntology) extends RSAAxiom {
37 import implicits.RDFox._ 37 import implicits.RDFox._
38 import implicits.JavaCollections._ 38 import implicits.JavaCollections._
39 39
40 val named: List[Rule] =
41 ontology.individuals.map(a => Rule.create(RSA.Named(a)))
42
43 val rolesAdditionalRules: List[Rule] = { 40 val rolesAdditionalRules: List[Rule] = {
44 // Given a role (predicate) compute additional logic rules 41 // Given a role (predicate) compute additional logic rules
45 def additional(pred: String): Seq[Rule] = { 42 def additional(pred: String): Seq[Rule] = {
@@ -98,14 +95,14 @@ class CanonicalModel(val ontology: RSAOntology) extends RSAAxiom {
98 val varZ = Variable.create("Z") 95 val varZ = Variable.create("Z")
99 List( 96 List(
100 // Reflexivity 97 // Reflexivity
101 Rule.create(RSA.congruent(varX, varX), RSA.Thing(varX)), 98 Rule.create(RSA.Congruent(varX, varX), RSA.Thing(varX)),
102 // Simmetry 99 // Simmetry
103 Rule.create(RSA.congruent(varY, varX), RSA.congruent(varX, varY)), 100 Rule.create(RSA.Congruent(varY, varX), RSA.Congruent(varX, varY)),
104 // Transitivity 101 // Transitivity
105 Rule.create( 102 Rule.create(
106 RSA.congruent(varX, varZ), 103 RSA.Congruent(varX, varZ),
107 RSA.congruent(varX, varY), 104 RSA.Congruent(varX, varY),
108 RSA.congruent(varY, varZ) 105 RSA.Congruent(varY, varZ)
109 ) 106 )
110 ) 107 )
111 } 108 }
@@ -114,7 +111,7 @@ class CanonicalModel(val ontology: RSAOntology) extends RSAAxiom {
114 // Compute rules from ontology axioms 111 // Compute rules from ontology axioms
115 val rules = ontology.axioms.flatMap(_.accept(RuleGenerator)) 112 val rules = ontology.axioms.flatMap(_.accept(RuleGenerator))
116 // Return full set of rules 113 // Return full set of rules
117 rules ::: rolesAdditionalRules ::: topAxioms ::: equalityAxioms ::: named 114 rules ::: rolesAdditionalRules ::: topAxioms ::: equalityAxioms
118 } 115 }
119 116
120 object RuleGenerator 117 object RuleGenerator
@@ -159,8 +156,8 @@ class CanonicalModel(val ontology: RSAOntology) extends RSAAxiom {
159 // do that? 156 // do that?
160 val facts = unfold.map(x => Rule.create(RSA.In(x))) 157 val facts = unfold.map(x => Rule.create(RSA.In(x)))
161 val rules = List( 158 val rules = List(
162 Rule.create(roleRf, atomA, RSA.notIn(varX)), 159 Rule.create(roleRf, atomA, RSA.NotIn(varX)),
163 Rule.create(atomB, atomA, RSA.notIn(varX)) 160 Rule.create(atomB, atomA, RSA.NotIn(varX))
164 ) 161 )
165 facts ++ rules 162 facts ++ rules
166 } 163 }