diff options
Diffstat (limited to 'src/main/scala/rsacomb/RSA.scala')
| -rw-r--r-- | src/main/scala/rsacomb/RSA.scala | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/src/main/scala/rsacomb/RSA.scala b/src/main/scala/rsacomb/RSA.scala index 79617c7..9125f9f 100644 --- a/src/main/scala/rsacomb/RSA.scala +++ b/src/main/scala/rsacomb/RSA.scala | |||
| @@ -8,6 +8,18 @@ import tech.oxfordsemantic.jrdfox.Prefixes | |||
| 8 | import tech.oxfordsemantic.jrdfox.logic.IRI | 8 | import tech.oxfordsemantic.jrdfox.logic.IRI |
| 9 | import org.semanticweb.owlapi.apibinding.OWLManager | 9 | import org.semanticweb.owlapi.apibinding.OWLManager |
| 10 | import org.semanticweb.owlapi.model.OWLOntology | 10 | import org.semanticweb.owlapi.model.OWLOntology |
| 11 | import rsacomb.RSAOntology | ||
| 12 | |||
| 13 | // Debug only | ||
| 14 | import tech.oxfordsemantic.jrdfox.logic.{ | ||
| 15 | Formula, | ||
| 16 | Atom, | ||
| 17 | Variable, | ||
| 18 | Query, | ||
| 19 | QueryType, | ||
| 20 | Conjunction | ||
| 21 | } | ||
| 22 | import scala.collection.JavaConverters._ | ||
| 11 | 23 | ||
| 12 | object RSA extends RSAOntology { | 24 | object RSA extends RSAOntology { |
| 13 | 25 | ||
| @@ -18,9 +30,30 @@ object RSA extends RSAOntology { | |||
| 18 | Prefixes.declarePrefix("rdfs:", "http://www.w3.org/2000/01/rdf-schema#") | 30 | Prefixes.declarePrefix("rdfs:", "http://www.w3.org/2000/01/rdf-schema#") |
| 19 | Prefixes.declarePrefix("owl:", "http://www.w3.org/2002/07/owl#") | 31 | Prefixes.declarePrefix("owl:", "http://www.w3.org/2002/07/owl#") |
| 20 | 32 | ||
| 21 | def internal(name: String): IRI = | 33 | // Counter used to implement a simple fresh variable generator |
| 34 | private var counter = -1; | ||
| 35 | |||
| 36 | def getFreshVariable(): Variable = { | ||
| 37 | counter += 1 | ||
| 38 | Variable.create(f"I$counter%03d") | ||
| 39 | } | ||
| 40 | |||
| 41 | val varX = Variable.create("X") | ||
| 42 | val varY = Variable.create("Y") | ||
| 43 | val varZ = Variable.create("Z") | ||
| 44 | val testAnswerVars = List[Variable](varX, varY, varZ).asJava; | ||
| 45 | val testFormula: Formula = | ||
| 46 | Conjunction.create( | ||
| 47 | Atom.rdf(varX, IRI.TOP_OBJECT_PROPERTY, varY), | ||
| 48 | Atom.rdf(varY, IRI.TOP_OBJECT_PROPERTY, varZ) | ||
| 49 | ) | ||
| 50 | val test_query = | ||
| 51 | Query.create(QueryType.SELECT, false, testAnswerVars, testFormula) | ||
| 52 | |||
| 53 | def internal(name: Any): IRI = | ||
| 22 | IRI.create( | 54 | IRI.create( |
| 23 | Prefixes.getPrefixIRIsByPrefixName.get("internal:").getIRI + name | 55 | Prefixes.getPrefixIRIsByPrefixName.get("internal:").getIRI |
| 56 | + name.toString | ||
| 24 | ) | 57 | ) |
| 25 | 58 | ||
| 26 | // TODO: move this somewhere else... maybe an OntoUtils class or something. | 59 | // TODO: move this somewhere else... maybe an OntoUtils class or something. |
