aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/rsacomb/RSAComb.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/scala/rsacomb/RSAComb.scala')
-rw-r--r--src/main/scala/rsacomb/RSAComb.scala31
1 files changed, 28 insertions, 3 deletions
diff --git a/src/main/scala/rsacomb/RSAComb.scala b/src/main/scala/rsacomb/RSAComb.scala
index 16d7a04..62414e9 100644
--- a/src/main/scala/rsacomb/RSAComb.scala
+++ b/src/main/scala/rsacomb/RSAComb.scala
@@ -10,7 +10,9 @@ import org.semanticweb.owlapi.model.{OWLAxiom, OWLSubClassOfAxiom, OWLEquivalent
10import org.semanticweb.owlapi.model.OWLClassExpression 10import org.semanticweb.owlapi.model.OWLClassExpression
11import org.semanticweb.owlapi.model.OWLOntology 11import org.semanticweb.owlapi.model.OWLOntology
12import org.semanticweb.owlapi.model.OWLOntologyManager 12import org.semanticweb.owlapi.model.OWLOntologyManager
13import org.semanticweb.owlapi.model.IRI
13import org.semanticweb.owlapi.model.parameters.Imports 14import org.semanticweb.owlapi.model.parameters.Imports
15import uk.ac.manchester.cs.owl.owlapi.OWLObjectPropertyImpl
14 16
15import tech.oxfordsemantic.jrdfox.Prefixes 17import tech.oxfordsemantic.jrdfox.Prefixes
16import tech.oxfordsemantic.jrdfox.client.{ConnectionFactory, ServerConnection, DataStoreConnection} 18import tech.oxfordsemantic.jrdfox.client.{ConnectionFactory, ServerConnection, DataStoreConnection}
@@ -22,6 +24,7 @@ import tech.oxfordsemantic.jrdfox.logic.{LogicFormat}
22import scala.collection.JavaConverters._ 24import scala.collection.JavaConverters._
23 25
24import rsacomb.SkolemStrategy 26import rsacomb.SkolemStrategy
27import org.semanticweb.owlapi.dlsyntax.renderer.DLSyntaxObjectRenderer
25 28
26class RSA(ontology : OWLOntology) { 29class RSA(ontology : OWLOntology) {
27 30
@@ -52,12 +55,34 @@ object RSA {
52 * step of approximation of an Horn-ALCHOIQ to RSA 55 * step of approximation of an Horn-ALCHOIQ to RSA
53 */ 56 */
54 57
58 val renderer = new DLSyntaxObjectRenderer()
59
60 // Here we need to compute the unsafe roles. This is hardcoded for now.
61 val unsafe = List(
62 new OWLObjectPropertyImpl(IRI.create("http://example.com/rsa_example.owl#S")).getInverseProperty()
63 )
64
65 /* Print TBox axioms */
66 println("TBox/RBox:")
67 for {
68 axiom <- onto.tboxAxioms(Imports.EXCLUDED).collect(Collectors.toList()).asScala
69 } yield println(renderer.render(axiom))
70 for {
71 axiom <- onto.rboxAxioms(Imports.EXCLUDED).collect(Collectors.toList()).asScala
72 } yield println(renderer.render(axiom))
73
55 /* Ontology axiom convertion into LP rules */ 74 /* Ontology axiom convertion into LP rules */
56 for { 75 println("Logic rules:")
76 for {
57 axiom <- onto.tboxAxioms(Imports.EXCLUDED).collect(Collectors.toList()).asScala 77 axiom <- onto.tboxAxioms(Imports.EXCLUDED).collect(Collectors.toList()).asScala
58 visitor = new RDFoxAxiomConverter(Variable.create("x"), SkolemStrategy.Constant(axiom.toString)) 78 visitor = new RDFoxAxiomConverter(Variable.create("x"), SkolemStrategy.ConstantRSA(axiom.toString), unsafe)
79 rule <- axiom.accept(visitor)
80 } yield println(rule)
81 for {
82 axiom <- onto.rboxAxioms(Imports.EXCLUDED).collect(Collectors.toList()).asScala
83 visitor = new RDFoxAxiomConverter(Variable.create("x"), SkolemStrategy.ConstantRSA(axiom.toString), unsafe)
59 rule <- axiom.accept(visitor) 84 rule <- axiom.accept(visitor)
60 } yield println(rule) 85 } yield println(rule)
61 86
62 /* Return true for now... */ 87 /* Return true for now... */
63 true 88 true