aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/rsacomb/RDFoxClassExprConverter.scala
diff options
context:
space:
mode:
authorFederico Igne <federico.igne@cs.ox.ac.uk>2020-11-18 18:07:53 +0000
committerFederico Igne <federico.igne@cs.ox.ac.uk>2020-11-18 18:07:53 +0000
commit4df351d3b1d11fc045005323c38ba3528de631ea (patch)
tree35f809e3def7d55602ed124f7b194db29407ba33 /src/main/scala/rsacomb/RDFoxClassExprConverter.scala
parente1a04294ed8737444e40323474f4084cb64c1d55 (diff)
downloadRSAComb-4df351d3b1d11fc045005323c38ba3528de631ea.tar.gz
RSAComb-4df351d3b1d11fc045005323c38ba3528de631ea.zip
Rework RSA as a utility object
Diffstat (limited to 'src/main/scala/rsacomb/RDFoxClassExprConverter.scala')
-rw-r--r--src/main/scala/rsacomb/RDFoxClassExprConverter.scala19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/main/scala/rsacomb/RDFoxClassExprConverter.scala b/src/main/scala/rsacomb/RDFoxClassExprConverter.scala
index f3a0dfc..f4187ed 100644
--- a/src/main/scala/rsacomb/RDFoxClassExprConverter.scala
+++ b/src/main/scala/rsacomb/RDFoxClassExprConverter.scala
@@ -26,12 +26,11 @@ import tech.oxfordsemantic.jrdfox.logic.expression.{
26 IRI 26 IRI
27} 27}
28 28
29import rsacomb.SkolemStrategy
30import rsacomb.RDFoxRuleShards
31import org.semanticweb.owlapi.model.OWLObjectPropertyExpression 29import org.semanticweb.owlapi.model.OWLObjectPropertyExpression
32import org.semanticweb.owlapi.model.OWLObjectProperty 30import org.semanticweb.owlapi.model.OWLObjectProperty
33 31
34import suffix.{RSASuffix, Empty} 32import suffix.{RSASuffix, Empty}
33import util.RSA
35 34
36object RDFoxClassExprConverter { 35object RDFoxClassExprConverter {
37 36
@@ -61,7 +60,7 @@ class RDFoxClassExprConverter(
61 suffix: RSASuffix 60 suffix: RSASuffix
62) extends OWLClassExpressionVisitorEx[RDFoxRuleShards] { 61) extends OWLClassExpressionVisitorEx[RDFoxRuleShards] {
63 62
64 import RDFoxUtil.owlapi2rdfox; 63 import implicits.RDFox._
65 64
66 // OWLClass 65 // OWLClass
67 override def visit(expr: OWLClass): RDFoxRuleShards = { 66 override def visit(expr: OWLClass): RDFoxRuleShards = {
@@ -99,7 +98,7 @@ class RDFoxClassExprConverter(
99 98
100 // OWLObjectSomeValuesFrom 99 // OWLObjectSomeValuesFrom
101 override def visit(expr: OWLObjectSomeValuesFrom): RDFoxRuleShards = { 100 override def visit(expr: OWLObjectSomeValuesFrom): RDFoxRuleShards = {
102 val y = RSA.getFreshVariable() 101 val y = RSAOntology.genFreshVariable()
103 // Here we are assuming a role name 102 // Here we are assuming a role name
104 val prop = expr.getProperty() 103 val prop = expr.getProperty()
105 // Computes the result of rule skolemization. Depending on the used 104 // Computes the result of rule skolemization. Depending on the used
@@ -110,14 +109,7 @@ class RDFoxClassExprConverter(
110 case SkolemStrategy.Constant(c) => (List(), List(), c) 109 case SkolemStrategy.Constant(c) => (List(), List(), c)
111 case SkolemStrategy.ConstantRSA(c) => { 110 case SkolemStrategy.ConstantRSA(c) => {
112 if (unsafe.contains(prop)) 111 if (unsafe.contains(prop))
113 ( 112 (List(RSA.PE(term, c), RSA.U(c)), List(), c)
114 List(
115 TupleTableAtom.rdf(term, RSA.rsa("PE"), c),
116 TupleTableAtom.rdf(c, IRI.RDF_TYPE, RSA.rsa("U"))
117 ),
118 List(),
119 c
120 )
121 else 113 else
122 (List(), List(), c) 114 (List(), List(), c)
123 } 115 }
@@ -143,7 +135,8 @@ class RDFoxClassExprConverter(
143 // OWLObjectMaxCardinality 135 // OWLObjectMaxCardinality
144 override def visit(expr: OWLObjectMaxCardinality): RDFoxRuleShards = { 136 override def visit(expr: OWLObjectMaxCardinality): RDFoxRuleShards = {
145 // TODO: again, no hardcoded variables 137 // TODO: again, no hardcoded variables
146 val vars = List(RSA.getFreshVariable(), RSA.getFreshVariable()) 138 val vars =
139 List(RSAOntology.genFreshVariable(), RSAOntology.genFreshVariable())
147 val classResult = RDFoxClassExprConverter.merge( 140 val classResult = RDFoxClassExprConverter.merge(
148 vars 141 vars
149 .map(new RDFoxClassExprConverter(_, unsafe, skolem, suffix)) 142 .map(new RDFoxClassExprConverter(_, unsafe, skolem, suffix))