From 2b661f3ac6fdb5156168b6775ede24e4c7b53758 Mon Sep 17 00:00:00 2001 From: Federico Igne Date: Mon, 7 Sep 2020 13:08:31 +0200 Subject: Add setup code to compute the RSA filtering program Not all rules of the filtering program have been implemented, but the code for the generation and reification of the rules seems to work. --- src/main/scala/rsacomb/RSA.scala | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/main/scala/rsacomb/RSA.scala') diff --git a/src/main/scala/rsacomb/RSA.scala b/src/main/scala/rsacomb/RSA.scala index 79617c7..c0d4e51 100644 --- a/src/main/scala/rsacomb/RSA.scala +++ b/src/main/scala/rsacomb/RSA.scala @@ -8,6 +8,18 @@ import tech.oxfordsemantic.jrdfox.Prefixes import tech.oxfordsemantic.jrdfox.logic.IRI import org.semanticweb.owlapi.apibinding.OWLManager import org.semanticweb.owlapi.model.OWLOntology +import rsacomb.RSAOntology + +// Debug only +import tech.oxfordsemantic.jrdfox.logic.{ + Formula, + Atom, + Variable, + Query, + QueryType, + Conjunction +} +import scala.collection.JavaConverters._ object RSA extends RSAOntology { @@ -18,6 +30,18 @@ object RSA extends RSAOntology { Prefixes.declarePrefix("rdfs:", "http://www.w3.org/2000/01/rdf-schema#") Prefixes.declarePrefix("owl:", "http://www.w3.org/2002/07/owl#") + val varX = Variable.create("X") + val varY = Variable.create("Y") + val varZ = Variable.create("Z") + val testAnswerVars = List[Variable](varX, varY, varZ).asJava; + val testFormula: Formula = + Conjunction.create( + Atom.rdf(varX, IRI.TOP_OBJECT_PROPERTY, varY), + Atom.rdf(varY, IRI.TOP_OBJECT_PROPERTY, varZ) + ) + val test_query = + Query.create(QueryType.SELECT, false, testAnswerVars, testFormula) + def internal(name: String): IRI = IRI.create( Prefixes.getPrefixIRIsByPrefixName.get("internal:").getIRI + name -- cgit v1.2.3