diff options
Diffstat (limited to 'src/main/scala/uk/ac')
4 files changed, 24 insertions, 11 deletions
diff --git a/src/main/scala/uk/ac/ox/cs/rsacomb/CanonicalModel.scala b/src/main/scala/uk/ac/ox/cs/rsacomb/CanonicalModel.scala index c605e51..5001c8a 100644 --- a/src/main/scala/uk/ac/ox/cs/rsacomb/CanonicalModel.scala +++ b/src/main/scala/uk/ac/ox/cs/rsacomb/CanonicalModel.scala | |||
@@ -247,11 +247,10 @@ class CanonicalModel(val ontology: RSAOntology) { | |||
247 | } | 247 | } |
248 | 248 | ||
249 | case a: OWLSubObjectPropertyOfAxiom => { | 249 | case a: OWLSubObjectPropertyOfAxiom => { |
250 | val (factsF, rulesF) = | 250 | val (facts, rules) = List(Empty, Forward, Backward) |
251 | super.convert(a, term, unsafe, NoSkolem, Forward) | 251 | .map(super.convert(a, term, unsafe, NoSkolem, _)) |
252 | val (factsB, rulesB) = | 252 | .unzip |
253 | super.convert(a, term, unsafe, NoSkolem, Backward) | 253 | (facts.flatten, rules.flatten) |
254 | (factsF ::: factsB, rulesF ::: rulesB) | ||
255 | } | 254 | } |
256 | 255 | ||
257 | case a => super.convert(a, term, unsafe, skolem, suffix) | 256 | case a => super.convert(a, term, unsafe, skolem, suffix) |
diff --git a/src/main/scala/uk/ac/ox/cs/rsacomb/RSAOntology.scala b/src/main/scala/uk/ac/ox/cs/rsacomb/RSAOntology.scala index 79f2ef3..dc64c79 100644 --- a/src/main/scala/uk/ac/ox/cs/rsacomb/RSAOntology.scala +++ b/src/main/scala/uk/ac/ox/cs/rsacomb/RSAOntology.scala | |||
@@ -11,6 +11,7 @@ import org.semanticweb.owlapi.model.{OWLOntology, OWLAxiom, OWLLogicalAxiom} | |||
11 | import org.semanticweb.owlapi.model.{ | 11 | import org.semanticweb.owlapi.model.{ |
12 | OWLClass, | 12 | OWLClass, |
13 | OWLClassExpression, | 13 | OWLClassExpression, |
14 | OWLDataPropertyAssertionAxiom, | ||
14 | OWLObjectProperty, | 15 | OWLObjectProperty, |
15 | OWLSubObjectPropertyOfAxiom, | 16 | OWLSubObjectPropertyOfAxiom, |
16 | OWLObjectPropertyExpression, | 17 | OWLObjectPropertyExpression, |
@@ -35,7 +36,8 @@ import tech.oxfordsemantic.jrdfox.logic.expression.{ | |||
35 | Term, | 36 | Term, |
36 | Variable, | 37 | Variable, |
37 | IRI, | 38 | IRI, |
38 | Resource | 39 | Resource, |
40 | Literal | ||
39 | } | 41 | } |
40 | import tech.oxfordsemantic.jrdfox.logic.sparql.statement.SelectQuery | 42 | import tech.oxfordsemantic.jrdfox.logic.sparql.statement.SelectQuery |
41 | 43 | ||
@@ -122,6 +124,12 @@ class RSAOntology(val ontology: OWLOntology) { | |||
122 | .map(implicits.RDFox.owlapiToRdfoxIri) | 124 | .map(implicits.RDFox.owlapiToRdfoxIri) |
123 | .toList | 125 | .toList |
124 | 126 | ||
127 | val literals: List[Literal] = | ||
128 | abox | ||
129 | .collect { case a: OWLDataPropertyAssertionAxiom => a } | ||
130 | .map(_.getObject) | ||
131 | .map(implicits.RDFox.owlapiToRdfoxLiteral) | ||
132 | |||
125 | val concepts: List[OWLClass] = | 133 | val concepts: List[OWLClass] = |
126 | ontology.getClassesInSignature().asScala.toList | 134 | ontology.getClassesInSignature().asScala.toList |
127 | 135 | ||
@@ -298,7 +306,7 @@ class RSAOntology(val ontology: OWLOntology) { | |||
298 | 306 | ||
299 | def filteringProgram(query: ConjunctiveQuery): FilteringProgram = | 307 | def filteringProgram(query: ConjunctiveQuery): FilteringProgram = |
300 | Logger.timed( | 308 | Logger.timed( |
301 | new FilteringProgram(query, individuals), | 309 | new FilteringProgram(query, individuals ++ literals), |
302 | "Generating filtering program", | 310 | "Generating filtering program", |
303 | Logger.DEBUG | 311 | Logger.DEBUG |
304 | ) | 312 | ) |
diff --git a/src/main/scala/uk/ac/ox/cs/rsacomb/converter/RDFoxConverter.scala b/src/main/scala/uk/ac/ox/cs/rsacomb/converter/RDFoxConverter.scala index 6c83caf..6193296 100644 --- a/src/main/scala/uk/ac/ox/cs/rsacomb/converter/RDFoxConverter.scala +++ b/src/main/scala/uk/ac/ox/cs/rsacomb/converter/RDFoxConverter.scala | |||
@@ -225,7 +225,7 @@ trait RDFoxConverter { | |||
225 | * @see [[org.semanticweb.owlapi.model.OWLDataPropertyAssertionAxiom OWLDataPropertyAssertionAxiom]] | 225 | * @see [[org.semanticweb.owlapi.model.OWLDataPropertyAssertionAxiom OWLDataPropertyAssertionAxiom]] |
226 | */ | 226 | */ |
227 | case a: OWLDataPropertyAssertionAxiom => | 227 | case a: OWLDataPropertyAssertionAxiom => |
228 | if (!a.getSubject.isNamed || !a.getObject.isNamed) | 228 | if (!a.getSubject.isNamed) |
229 | Result() | 229 | Result() |
230 | else { | 230 | else { |
231 | val subj = a.getSubject.asOWLNamedIndividual.getIRI | 231 | val subj = a.getSubject.asOWLNamedIndividual.getIRI |
diff --git a/src/main/scala/uk/ac/ox/cs/rsacomb/sparql/ConjunctiveQueryAnswers.scala b/src/main/scala/uk/ac/ox/cs/rsacomb/sparql/ConjunctiveQueryAnswers.scala index 50cbb86..667defc 100644 --- a/src/main/scala/uk/ac/ox/cs/rsacomb/sparql/ConjunctiveQueryAnswers.scala +++ b/src/main/scala/uk/ac/ox/cs/rsacomb/sparql/ConjunctiveQueryAnswers.scala | |||
@@ -1,6 +1,11 @@ | |||
1 | package uk.ac.ox.cs.rsacomb.sparql | 1 | package uk.ac.ox.cs.rsacomb.sparql |
2 | 2 | ||
3 | import tech.oxfordsemantic.jrdfox.logic.expression.{IRI, Resource, Variable} | 3 | import tech.oxfordsemantic.jrdfox.logic.expression.{ |
4 | IRI, | ||
5 | Literal, | ||
6 | Resource, | ||
7 | Variable | ||
8 | } | ||
4 | 9 | ||
5 | /** A collections of answers to a query. | 10 | /** A collections of answers to a query. |
6 | * | 11 | * |
@@ -30,8 +35,9 @@ class ConjunctiveQueryAnswers( | |||
30 | val header = variables map (_.getName) mkString "\t" | 35 | val header = variables map (_.getName) mkString "\t" |
31 | val body = answers | 36 | val body = answers |
32 | .map(_.map { | 37 | .map(_.map { |
33 | case x: IRI => x.getIRI | 38 | case x: IRI => x.getIRI |
34 | case x => x.toString | 39 | case x: Literal => x.getLexicalForm |
40 | case x => x.toString | ||
35 | }.mkString("\t")) | 41 | }.mkString("\t")) |
36 | .mkString("\n") | 42 | .mkString("\n") |
37 | s"$header\n$body" | 43 | s"$header\n$body" |