diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/main/scala/uk/ac/ox/cs/rsacomb/RSAOntology.scala | 12 | ||||
| -rw-r--r-- | src/main/scala/uk/ac/ox/cs/rsacomb/sparql/ConjunctiveQueryAnswers.scala | 12 |
2 files changed, 19 insertions, 5 deletions
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 7b4b142..0fb6c96 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 | ||
| @@ -117,6 +119,12 @@ class RSAOntology(val ontology: OWLOntology) { | |||
| 117 | .map(implicits.RDFox.owlapiToRdfoxIri) | 119 | .map(implicits.RDFox.owlapiToRdfoxIri) |
| 118 | .toList | 120 | .toList |
| 119 | 121 | ||
| 122 | val literals: List[Literal] = | ||
| 123 | abox | ||
| 124 | .collect { case a: OWLDataPropertyAssertionAxiom => a } | ||
| 125 | .map(_.getObject) | ||
| 126 | .map(implicits.RDFox.owlapiToRdfoxLiteral) | ||
| 127 | |||
| 120 | val concepts: List[OWLClass] = | 128 | val concepts: List[OWLClass] = |
| 121 | ontology.getClassesInSignature().asScala.toList | 129 | ontology.getClassesInSignature().asScala.toList |
| 122 | 130 | ||
| @@ -288,7 +296,7 @@ class RSAOntology(val ontology: OWLOntology) { | |||
| 288 | } | 296 | } |
| 289 | 297 | ||
| 290 | def filteringProgram(query: ConjunctiveQuery): FilteringProgram = | 298 | def filteringProgram(query: ConjunctiveQuery): FilteringProgram = |
| 291 | new FilteringProgram(query, individuals) | 299 | new FilteringProgram(query, individuals ++ literals) |
| 292 | 300 | ||
| 293 | lazy val canonicalModel = new CanonicalModel(this) | 301 | lazy val canonicalModel = new CanonicalModel(this) |
| 294 | 302 | ||
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 327ae8e..3db5500 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 | * |
| @@ -27,8 +32,9 @@ class ConjunctiveQueryAnswers( | |||
| 27 | val header = variables map (_.getName) mkString "\t" | 32 | val header = variables map (_.getName) mkString "\t" |
| 28 | val body = answers | 33 | val body = answers |
| 29 | .map(_.map { | 34 | .map(_.map { |
| 30 | case x: IRI => x.getIRI | 35 | case x: IRI => x.getIRI |
| 31 | case x => x.toString | 36 | case x: Literal => x.getLexicalForm |
| 37 | case x => x.toString | ||
| 32 | }.mkString("\t")) | 38 | }.mkString("\t")) |
| 33 | .mkString("\n") | 39 | .mkString("\n") |
| 34 | s"$header\n$body" | 40 | s"$header\n$body" |
