diff options
author | Federico Igne <federico.igne@cs.ox.ac.uk> | 2020-12-04 17:09:30 +0000 |
---|---|---|
committer | Federico Igne <federico.igne@cs.ox.ac.uk> | 2020-12-04 17:09:30 +0000 |
commit | a808ae8b3dd945fd7aa485cd02bfb7229cb8331d (patch) | |
tree | 9fa2d79ad257ec5f3bb68868f7b49d3a7332bfc5 /src | |
parent | ec76d6cfbf5410fc90060667612461c1e8f3c111 (diff) | |
download | RSAComb-a808ae8b3dd945fd7aa485cd02bfb7229cb8331d.tar.gz RSAComb-a808ae8b3dd945fd7aa485cd02bfb7229cb8331d.zip |
Simplify duplication of skolemization strategy
Diffstat (limited to 'src')
-rw-r--r-- | src/main/scala/uk/ac/ox/cs/rsacomb/converter/SkolemStrategy.scala | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/main/scala/uk/ac/ox/cs/rsacomb/converter/SkolemStrategy.scala b/src/main/scala/uk/ac/ox/cs/rsacomb/converter/SkolemStrategy.scala index 587db91..2142ff3 100644 --- a/src/main/scala/uk/ac/ox/cs/rsacomb/converter/SkolemStrategy.scala +++ b/src/main/scala/uk/ac/ox/cs/rsacomb/converter/SkolemStrategy.scala | |||
@@ -4,7 +4,9 @@ import org.semanticweb.owlapi.model.OWLAxiom | |||
4 | import tech.oxfordsemantic.jrdfox.logic.Datatype | 4 | import tech.oxfordsemantic.jrdfox.logic.Datatype |
5 | import tech.oxfordsemantic.jrdfox.logic.expression.{Literal, IRI} | 5 | import tech.oxfordsemantic.jrdfox.logic.expression.{Literal, IRI} |
6 | 6 | ||
7 | sealed trait SkolemStrategy | 7 | sealed trait SkolemStrategy { |
8 | def dup(a: OWLAxiom): SkolemStrategy | ||
9 | } | ||
8 | 10 | ||
9 | /** No skolemization. | 11 | /** No skolemization. |
10 | * | 12 | * |
@@ -17,7 +19,9 @@ sealed trait SkolemStrategy | |||
17 | * R(x,y), B(y) -> B(x) | 19 | * R(x,y), B(y) -> B(x) |
18 | * }}} | 20 | * }}} |
19 | */ | 21 | */ |
20 | case object NoSkolem extends SkolemStrategy | 22 | case object NoSkolem extends SkolemStrategy { |
23 | def dup(a: OWLAxiom): SkolemStrategy = this | ||
24 | } | ||
21 | 25 | ||
22 | /** Functional skolemization | 26 | /** Functional skolemization |
23 | * | 27 | * |
@@ -46,9 +50,9 @@ case object NoSkolem extends SkolemStrategy | |||
46 | * @note this requirement is not enforced by RDFox, that will fail | 50 | * @note this requirement is not enforced by RDFox, that will fail |
47 | * silently if a string argument is omitted. | 51 | * silently if a string argument is omitted. |
48 | */ | 52 | */ |
49 | class Standard(var axiom: OWLAxiom)(implicit toString: (OWLAxiom) => String) | 53 | case class Standard(axiom: OWLAxiom)(implicit toString: (OWLAxiom) => String) |
50 | extends SkolemStrategy { | 54 | extends SkolemStrategy { |
51 | def dup(a: OWLAxiom) = new Standard(a)(toString) | 55 | def dup(_axiom: OWLAxiom): Standard = copy(axiom = _axiom)(toString) |
52 | lazy val literal = | 56 | lazy val literal = |
53 | Literal.create(s"f_${toString(axiom)}", Datatype.XSD_STRING) | 57 | Literal.create(s"f_${toString(axiom)}", Datatype.XSD_STRING) |
54 | } | 58 | } |
@@ -69,8 +73,8 @@ class Standard(var axiom: OWLAxiom)(implicit toString: (OWLAxiom) => String) | |||
69 | * for `c`, fresh constant '''uniquely''' associated with the input | 73 | * for `c`, fresh constant '''uniquely''' associated with the input |
70 | * axiom | 74 | * axiom |
71 | */ | 75 | */ |
72 | class Constant(var axiom: OWLAxiom)(implicit toString: (OWLAxiom) => String) | 76 | case class Constant(axiom: OWLAxiom)(implicit toString: (OWLAxiom) => String) |
73 | extends SkolemStrategy { | 77 | extends SkolemStrategy { |
74 | def dup(a: OWLAxiom) = new Constant(a)(toString) | 78 | def dup(_axiom: OWLAxiom): Constant = copy(axiom = _axiom)(toString) |
75 | lazy val iri = IRI.create(s"c_${toString(axiom)}") | 79 | lazy val iri = IRI.create(s"c_${toString(axiom)}") |
76 | } | 80 | } |