aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/rsacomb/RSASuffix.scala
diff options
context:
space:
mode:
authorFederico Igne <federico.igne@cs.ox.ac.uk>2020-11-16 20:09:22 +0000
committerFederico Igne <federico.igne@cs.ox.ac.uk>2020-11-16 20:09:22 +0000
commitc6ae617490ad7e2429207e1393415ec9bff7a501 (patch)
tree43ebdced920b5088cac7de1d16f5b4adebe03ee3 /src/main/scala/rsacomb/RSASuffix.scala
parent2d8afc3a50384d2aea6c97958a814fedc7b9bd40 (diff)
downloadRSAComb-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.scala34
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 @@
1package rsacomb 1package rsacomb.suffix
2 2
3sealed trait RSASuffix { 3import org.semanticweb.owlapi.model.{
4 def getSuffix: String; 4 OWLPropertyExpression,
5 OWLObjectInverseOf,
6 OWLObjectProperty
5} 7}
6 8
7object RSASuffix { 9class 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
24case object Empty extends RSASuffix((x) => x)
25case object Forward extends RSASuffix((s) => s"${s}_f")
26case object Backward extends RSASuffix((s) => s"${s}_b")
27case object Inverse extends RSASuffix((s) => s"${s}_inv")
28case class Nth(n: Int) extends RSASuffix((s) => s"${s}_$n")