diff options
| author | Federico Igne <federico.igne@cs.ox.ac.uk> | 2020-11-16 20:09:22 +0000 |
|---|---|---|
| committer | Federico Igne <federico.igne@cs.ox.ac.uk> | 2020-11-16 20:09:22 +0000 |
| commit | c6ae617490ad7e2429207e1393415ec9bff7a501 (patch) | |
| tree | 43ebdced920b5088cac7de1d16f5b4adebe03ee3 /src/main/scala/rsacomb/RSASuffix.scala | |
| parent | 2d8afc3a50384d2aea6c97958a814fedc7b9bd40 (diff) | |
| download | RSAComb-c6ae617490ad7e2429207e1393415ec9bff7a501.tar.gz RSAComb-c6ae617490ad7e2429207e1393415ec9bff7a501.zip | |
Rework suffixes
This is a WIP implementation of a generalized way of handling IRI
suffixes. It is not currently used everywhere.
Diffstat (limited to 'src/main/scala/rsacomb/RSASuffix.scala')
| -rw-r--r-- | src/main/scala/rsacomb/RSASuffix.scala | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/src/main/scala/rsacomb/RSASuffix.scala b/src/main/scala/rsacomb/RSASuffix.scala index f15d01b..7650ae0 100644 --- a/src/main/scala/rsacomb/RSASuffix.scala +++ b/src/main/scala/rsacomb/RSASuffix.scala | |||
| @@ -1,20 +1,28 @@ | |||
| 1 | package rsacomb | 1 | package rsacomb.suffix |
| 2 | 2 | ||
| 3 | sealed trait RSASuffix { | 3 | import org.semanticweb.owlapi.model.{ |
| 4 | def getSuffix: String; | 4 | OWLPropertyExpression, |
| 5 | OWLObjectInverseOf, | ||
| 6 | OWLObjectProperty | ||
| 5 | } | 7 | } |
| 6 | 8 | ||
| 7 | object RSASuffix { | 9 | class RSASuffix(val suffix: String => String) { |
| 8 | 10 | ||
| 9 | case object None extends RSASuffix { | 11 | def +(other: RSASuffix): RSASuffix = |
| 10 | def getSuffix: String = "" | 12 | new RSASuffix((s: String) => other suffix (this suffix s)) |
| 11 | } | ||
| 12 | 13 | ||
| 13 | case object Forward extends RSASuffix { | 14 | def ::(str: String): String = this suffix str |
| 14 | def getSuffix: String = "_f" | 15 | |
| 15 | } | 16 | def ::(expr: OWLPropertyExpression): String = |
| 17 | expr match { | ||
| 18 | case e: OWLObjectProperty => e.getIRI.getIRIString :: this | ||
| 19 | case e: OWLObjectInverseOf => e.getInverse :: this | ||
| 20 | } | ||
| 16 | 21 | ||
| 17 | case object Backward extends RSASuffix { | ||
| 18 | def getSuffix: String = "_b" | ||
| 19 | } | ||
| 20 | } | 22 | } |
| 23 | |||
| 24 | case object Empty extends RSASuffix((x) => x) | ||
| 25 | case object Forward extends RSASuffix((s) => s"${s}_f") | ||
| 26 | case object Backward extends RSASuffix((s) => s"${s}_b") | ||
| 27 | case object Inverse extends RSASuffix((s) => s"${s}_inv") | ||
| 28 | case class Nth(n: Int) extends RSASuffix((s) => s"${s}_$n") | ||
