diff options
author | Federico Igne <federico.igne@cs.ox.ac.uk> | 2020-09-30 19:45:25 +0200 |
---|---|---|
committer | Federico Igne <federico.igne@cs.ox.ac.uk> | 2020-09-30 19:45:25 +0200 |
commit | 6a29b16dee0592fdeb03b26ff87fd00d57555f78 (patch) | |
tree | f50800aa56a2f1b03a538c0a82eaa739ac671466 /src/main/scala/rsacomb/RDFoxClassExprConverter.scala | |
parent | 7fd4023ab6d3b8cd379f4119c7bfbeaedca0b7b4 (diff) | |
download | RSAComb-6a29b16dee0592fdeb03b26ff87fd00d57555f78.tar.gz RSAComb-6a29b16dee0592fdeb03b26ff87fd00d57555f78.zip |
Add rule generation for unsafe T5 axioms for canonical model
Diffstat (limited to 'src/main/scala/rsacomb/RDFoxClassExprConverter.scala')
-rw-r--r-- | src/main/scala/rsacomb/RDFoxClassExprConverter.scala | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/main/scala/rsacomb/RDFoxClassExprConverter.scala b/src/main/scala/rsacomb/RDFoxClassExprConverter.scala index a319d86..2029f0b 100644 --- a/src/main/scala/rsacomb/RDFoxClassExprConverter.scala +++ b/src/main/scala/rsacomb/RDFoxClassExprConverter.scala | |||
@@ -35,10 +35,11 @@ object RDFoxClassExprConverter { | |||
35 | 35 | ||
36 | def apply( | 36 | def apply( |
37 | term: Term, | 37 | term: Term, |
38 | unsafe: List[OWLObjectPropertyExpression], | ||
38 | skolem: SkolemStrategy = SkolemStrategy.None, | 39 | skolem: SkolemStrategy = SkolemStrategy.None, |
39 | unsafe: List[OWLObjectPropertyExpression] = List() | 40 | suffix: RSASuffix = RSASuffix.None |
40 | ): RDFoxClassExprConverter = | 41 | ): RDFoxClassExprConverter = |
41 | new RDFoxClassExprConverter(term, skolem, unsafe) | 42 | new RDFoxClassExprConverter(term, unsafe, skolem, suffix) |
42 | 43 | ||
43 | def merge(rules: List[RDFoxRuleShards]): RDFoxRuleShards = { | 44 | def merge(rules: List[RDFoxRuleShards]): RDFoxRuleShards = { |
44 | rules.foldLeft(RDFoxRuleShards(List(), List())) { (r1, r2) => | 45 | rules.foldLeft(RDFoxRuleShards(List(), List())) { (r1, r2) => |
@@ -53,8 +54,9 @@ object RDFoxClassExprConverter { | |||
53 | 54 | ||
54 | class RDFoxClassExprConverter( | 55 | class RDFoxClassExprConverter( |
55 | term: Term, | 56 | term: Term, |
57 | unsafe: List[OWLObjectPropertyExpression], | ||
56 | skolem: SkolemStrategy, | 58 | skolem: SkolemStrategy, |
57 | unsafe: List[OWLObjectPropertyExpression] | 59 | suffix: RSASuffix |
58 | ) extends OWLClassExpressionVisitorEx[RDFoxRuleShards] { | 60 | ) extends OWLClassExpressionVisitorEx[RDFoxRuleShards] { |
59 | 61 | ||
60 | import RDFoxUtil.owlapi2rdfox; | 62 | import RDFoxUtil.owlapi2rdfox; |
@@ -68,7 +70,7 @@ class RDFoxClassExprConverter( | |||
68 | 70 | ||
69 | // OWLObjectIntersectionOf | 71 | // OWLObjectIntersectionOf |
70 | override def visit(expr: OWLObjectIntersectionOf): RDFoxRuleShards = { | 72 | override def visit(expr: OWLObjectIntersectionOf): RDFoxRuleShards = { |
71 | val visitor = new RDFoxClassExprConverter(term, skolem, unsafe) | 73 | val visitor = new RDFoxClassExprConverter(term, unsafe, skolem, suffix) |
72 | // TODO: maybe using `flatMap` instead of `merge` + `map` works as well | 74 | // TODO: maybe using `flatMap` instead of `merge` + `map` works as well |
73 | RDFoxClassExprConverter.merge( | 75 | RDFoxClassExprConverter.merge( |
74 | expr.asConjunctSet.asScala.toList | 76 | expr.asConjunctSet.asScala.toList |
@@ -78,7 +80,7 @@ class RDFoxClassExprConverter( | |||
78 | 80 | ||
79 | // OWLObjectOneOf | 81 | // OWLObjectOneOf |
80 | override def visit(expr: OWLObjectOneOf): RDFoxRuleShards = { | 82 | override def visit(expr: OWLObjectOneOf): RDFoxRuleShards = { |
81 | val visitor = RDFoxClassExprConverter(term, skolem) | 83 | val visitor = RDFoxClassExprConverter(term, unsafe, skolem, suffix) |
82 | // TODO: review nominal handling. Here we are taking "just" one | 84 | // TODO: review nominal handling. Here we are taking "just" one |
83 | val ind = expr.individuals | 85 | val ind = expr.individuals |
84 | .collect(Collectors.toList()) | 86 | .collect(Collectors.toList()) |
@@ -126,9 +128,10 @@ class RDFoxClassExprConverter( | |||
126 | y | 128 | y |
127 | ) | 129 | ) |
128 | } | 130 | } |
129 | val classVisitor = new RDFoxClassExprConverter(term1, skolem, unsafe) | 131 | val classVisitor = |
132 | new RDFoxClassExprConverter(term1, unsafe, skolem, suffix) | ||
130 | val classResult = expr.getFiller.accept(classVisitor) | 133 | val classResult = expr.getFiller.accept(classVisitor) |
131 | val propertyVisitor = new RDFoxPropertyExprConverter(term, term1, skolem) | 134 | val propertyVisitor = new RDFoxPropertyExprConverter(term, term1, suffix) |
132 | val propertyResult = expr.getProperty.accept(propertyVisitor) | 135 | val propertyResult = expr.getProperty.accept(propertyVisitor) |
133 | RDFoxRuleShards( | 136 | RDFoxRuleShards( |
134 | classResult.res ++ propertyResult ++ head, | 137 | classResult.res ++ propertyResult ++ head, |
@@ -142,12 +145,12 @@ class RDFoxClassExprConverter( | |||
142 | val vars = List(RSA.getFreshVariable(), RSA.getFreshVariable()) | 145 | val vars = List(RSA.getFreshVariable(), RSA.getFreshVariable()) |
143 | val classResult = RDFoxClassExprConverter.merge( | 146 | val classResult = RDFoxClassExprConverter.merge( |
144 | vars | 147 | vars |
145 | .map(new RDFoxClassExprConverter(_, skolem, unsafe)) | 148 | .map(new RDFoxClassExprConverter(_, unsafe, skolem, suffix)) |
146 | .map(expr.getFiller.accept(_)) | 149 | .map(expr.getFiller.accept(_)) |
147 | ) | 150 | ) |
148 | val propertyResult = | 151 | val propertyResult = |
149 | vars | 152 | vars |
150 | .map(new RDFoxPropertyExprConverter(term, _, skolem)) | 153 | .map(new RDFoxPropertyExprConverter(term, _, suffix)) |
151 | .map(expr.getProperty.accept(_)) | 154 | .map(expr.getProperty.accept(_)) |
152 | .flatten | 155 | .flatten |
153 | RDFoxRuleShards( | 156 | RDFoxRuleShards( |