From e237c660994978588dea7c8d26043440986ba6df Mon Sep 17 00:00:00 2001 From: Federico Igne Date: Tue, 17 Nov 2020 11:45:55 +0000 Subject: Unify use of RSASuffix This commit comes with minor fixes and code simplifications. --- src/main/scala/rsacomb/RSASuffix.scala | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'src/main/scala/rsacomb/RSASuffix.scala') diff --git a/src/main/scala/rsacomb/RSASuffix.scala b/src/main/scala/rsacomb/RSASuffix.scala index 7650ae0..ce36b10 100644 --- a/src/main/scala/rsacomb/RSASuffix.scala +++ b/src/main/scala/rsacomb/RSASuffix.scala @@ -6,22 +6,25 @@ import org.semanticweb.owlapi.model.{ OWLObjectProperty } +import tech.oxfordsemantic.jrdfox.logic.expression.{IRI} +import tech.oxfordsemantic.jrdfox.logic.datalog.{TupleTableAtom, TupleTableName} + +object RSASuffix { + + def apply(suffix: String => String): RSASuffix = new RSASuffix(suffix) + +} + class RSASuffix(val suffix: String => String) { - def +(other: RSASuffix): RSASuffix = - new RSASuffix((s: String) => other suffix (this suffix s)) + def +(that: RSASuffix): RSASuffix = + new RSASuffix(this.suffix andThen that.suffix) def ::(str: String): String = this suffix str - def ::(expr: OWLPropertyExpression): String = - expr match { - case e: OWLObjectProperty => e.getIRI.getIRIString :: this - case e: OWLObjectInverseOf => e.getInverse :: this - } - } -case object Empty extends RSASuffix((x) => x) +case object Empty extends RSASuffix(identity) case object Forward extends RSASuffix((s) => s"${s}_f") case object Backward extends RSASuffix((s) => s"${s}_b") case object Inverse extends RSASuffix((s) => s"${s}_inv") -- cgit v1.2.3