diff options
Diffstat (limited to 'src/main/scala/rsacomb/RSAOntology.scala')
| -rw-r--r-- | src/main/scala/rsacomb/RSAOntology.scala | 33 |
1 files changed, 5 insertions, 28 deletions
diff --git a/src/main/scala/rsacomb/RSAOntology.scala b/src/main/scala/rsacomb/RSAOntology.scala index 681dbb0..10f2fa4 100644 --- a/src/main/scala/rsacomb/RSAOntology.scala +++ b/src/main/scala/rsacomb/RSAOntology.scala | |||
| @@ -9,7 +9,6 @@ import org.semanticweb.owlapi.model.OWLObjectPropertyExpression | |||
| 9 | import org.semanticweb.owlapi.model.parameters.Imports | 9 | import org.semanticweb.owlapi.model.parameters.Imports |
| 10 | import org.semanticweb.owlapi.reasoner.structural.StructuralReasonerFactory | 10 | import org.semanticweb.owlapi.reasoner.structural.StructuralReasonerFactory |
| 11 | 11 | ||
| 12 | import tech.oxfordsemantic.jrdfox.Prefixes | ||
| 13 | import tech.oxfordsemantic.jrdfox.logic.Variable | 12 | import tech.oxfordsemantic.jrdfox.logic.Variable |
| 14 | import tech.oxfordsemantic.jrdfox.client.UpdateType | 13 | import tech.oxfordsemantic.jrdfox.client.UpdateType |
| 15 | import tech.oxfordsemantic.jrdfox.logic.{Rule, Atom, Variable, IRI} | 14 | import tech.oxfordsemantic.jrdfox.logic.{Rule, Atom, Variable, IRI} |
| @@ -74,38 +73,16 @@ trait RSAOntology { | |||
| 74 | println("\nDatalog roles:") | 73 | println("\nDatalog roles:") |
| 75 | datalog.foreach(println) | 74 | datalog.foreach(println) |
| 76 | 75 | ||
| 77 | // TODO: Define Prefixes in RSA object | ||
| 78 | val prefixes = new Prefixes() | ||
| 79 | prefixes.declarePrefix(":", RSA.PrefixBase) | ||
| 80 | prefixes.declarePrefix("internal:", RSA.PrefixInternal) | ||
| 81 | prefixes.declarePrefix( | ||
| 82 | "rdf:", | ||
| 83 | "http://www.w3.org/1999/02/22-rdf-syntax-ns#" | ||
| 84 | ) | ||
| 85 | prefixes.declarePrefix("rdfs:", "http://www.w3.org/2000/01/rdf-schema#") | ||
| 86 | prefixes.declarePrefix("owl:", "http://www.w3.org/2002/07/owl#") | ||
| 87 | |||
| 88 | // Open connection with RDFox | 76 | // Open connection with RDFox |
| 89 | val (server, data) = RDFoxUtil.openConnection("RSACheck") | 77 | val (server, data) = RDFoxUtil.openConnection("RSACheck") |
| 90 | // Add Data (hardcoded for now) | 78 | // Add Data (hardcoded for now) |
| 91 | data.importData(UpdateType.ADDITION, prefixes, ":a a :A .") | 79 | data.importData(UpdateType.ADDITION, RSA.Prefixes, ":a a :A .") |
| 92 | |||
| 93 | /* Add rules | ||
| 94 | * | ||
| 95 | * NOTE: | ||
| 96 | * - using the `addRules(...)` method in `DataStoreConnection` is not working as expected, complaining | ||
| 97 | * about missing TupleTable entries; | ||
| 98 | * - weirdly enough, the same error is returned when trying to pass the rules to the `importData` method, | ||
| 99 | * simply turning them into strings. It seems like the `toString` implementation of `Rule` uses parenthesis | ||
| 100 | * for predicate arguments (e.g., `<predicate>(?X,?Y)`) while the specification for the proprietary RDFox | ||
| 101 | * syntax uses squared brackets (e.g., `<preditate>[?X,?Y]`). | ||
| 102 | */ | ||
| 103 | 80 | ||
| 104 | /* Add built-in rules | 81 | /* Add built-in rules |
| 105 | */ | 82 | */ |
| 106 | data.importData( | 83 | data.importData( |
| 107 | UpdateType.ADDITION, | 84 | UpdateType.ADDITION, |
| 108 | prefixes, | 85 | RSA.Prefixes, |
| 109 | "<http://127.0.0.1/E>[?X,?Y] :- <http://127.0.0.1/PE>[?X,?Y], <http://127.0.0.1/U>[?X], <http://127.0.0.1/U>[?Y] ." | 86 | "<http://127.0.0.1/E>[?X,?Y] :- <http://127.0.0.1/PE>[?X,?Y], <http://127.0.0.1/U>[?X], <http://127.0.0.1/U>[?Y] ." |
| 110 | ) | 87 | ) |
| 111 | 88 | ||
| @@ -117,17 +94,17 @@ trait RSAOntology { | |||
| 117 | println("\nQueries:") | 94 | println("\nQueries:") |
| 118 | RDFoxUtil.query( | 95 | RDFoxUtil.query( |
| 119 | data, | 96 | data, |
| 120 | prefixes, | 97 | RSA.Prefixes, |
| 121 | "SELECT ?X ?Y WHERE { ?X internal:PE ?Y }" | 98 | "SELECT ?X ?Y WHERE { ?X internal:PE ?Y }" |
| 122 | ) | 99 | ) |
| 123 | RDFoxUtil.query( | 100 | RDFoxUtil.query( |
| 124 | data, | 101 | data, |
| 125 | prefixes, | 102 | RSA.Prefixes, |
| 126 | "SELECT ?X ?Y WHERE { ?X internal:E ?Y }" | 103 | "SELECT ?X ?Y WHERE { ?X internal:E ?Y }" |
| 127 | ) | 104 | ) |
| 128 | RDFoxUtil.query( | 105 | RDFoxUtil.query( |
| 129 | data, | 106 | data, |
| 130 | prefixes, | 107 | RSA.Prefixes, |
| 131 | "SELECT ?X WHERE { ?X rdf:type owl:Thing }" | 108 | "SELECT ?X WHERE { ?X rdf:type owl:Thing }" |
| 132 | ) | 109 | ) |
| 133 | 110 | ||
