diff options
| author | Federico Igne <federico.igne@cs.ox.ac.uk> | 2020-11-05 20:00:34 +0000 |
|---|---|---|
| committer | Federico Igne <federico.igne@cs.ox.ac.uk> | 2020-11-05 20:00:34 +0000 |
| commit | 360675d5b659ba8e9e5fe83dfa038d27f962b4de (patch) | |
| tree | 38e21ad6270da7c85f1d0069ced18dd9aea12045 /src/main/scala/rsacomb/RDFoxUtil.scala | |
| parent | 6df3ffe815a5ea65da92e818c1eb48fca13bc5ce (diff) | |
| download | RSAComb-360675d5b659ba8e9e5fe83dfa038d27f962b4de.tar.gz RSAComb-360675d5b659ba8e9e5fe83dfa038d27f962b4de.zip | |
Update code to RDFox v4.0
Diffstat (limited to 'src/main/scala/rsacomb/RDFoxUtil.scala')
| -rw-r--r-- | src/main/scala/rsacomb/RDFoxUtil.scala | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/main/scala/rsacomb/RDFoxUtil.scala b/src/main/scala/rsacomb/RDFoxUtil.scala index 4e0a118..748c72f 100644 --- a/src/main/scala/rsacomb/RDFoxUtil.scala +++ b/src/main/scala/rsacomb/RDFoxUtil.scala | |||
| @@ -2,9 +2,9 @@ package rsacomb | |||
| 2 | 2 | ||
| 3 | /* Java imports */ | 3 | /* Java imports */ |
| 4 | import java.util.HashMap | 4 | import java.util.HashMap |
| 5 | import java.io.ByteArrayInputStream | 5 | import java.io.StringReader |
| 6 | import tech.oxfordsemantic.jrdfox.Prefixes | 6 | import tech.oxfordsemantic.jrdfox.Prefixes |
| 7 | import tech.oxfordsemantic.jrdfox.logic.{IRI, Query} | 7 | import tech.oxfordsemantic.jrdfox.logic.sparql.statement.{Query, SelectQuery} |
| 8 | import tech.oxfordsemantic.jrdfox.client.{ | 8 | import tech.oxfordsemantic.jrdfox.client.{ |
| 9 | ConnectionFactory, | 9 | ConnectionFactory, |
| 10 | ServerConnection, | 10 | ServerConnection, |
| @@ -12,7 +12,7 @@ import tech.oxfordsemantic.jrdfox.client.{ | |||
| 12 | } | 12 | } |
| 13 | import tech.oxfordsemantic.jrdfox.formats.SPARQLParser | 13 | import tech.oxfordsemantic.jrdfox.formats.SPARQLParser |
| 14 | 14 | ||
| 15 | import tech.oxfordsemantic.jrdfox.logic.{IRI => RDFox_IRI} | 15 | import tech.oxfordsemantic.jrdfox.logic.expression.{IRI => RDFox_IRI} |
| 16 | import org.semanticweb.owlapi.model.{IRI => OWL_IRI} | 16 | import org.semanticweb.owlapi.model.{IRI => OWL_IRI} |
| 17 | 17 | ||
| 18 | object RDFoxUtil { | 18 | object RDFoxUtil { |
| @@ -51,12 +51,19 @@ object RDFoxUtil { | |||
| 51 | (server, data) | 51 | (server, data) |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | def parseQuery(query: String, prefixes: Prefixes = RSA.Prefixes): Query = { | 54 | def parseQuery( |
| 55 | query: String, | ||
| 56 | prefixes: Prefixes = RSA.Prefixes | ||
| 57 | ): Option[SelectQuery] = { | ||
| 55 | val parser = new SPARQLParser( | 58 | val parser = new SPARQLParser( |
| 56 | prefixes, | 59 | prefixes, |
| 57 | new ByteArrayInputStream(query.getBytes()) | 60 | new StringReader(query) |
| 58 | ) | 61 | ) |
| 59 | parser.parseSingleQuery() | 62 | // NOTE: return only conjunctive queries for now (SelectQuery) |
| 63 | parser.parseSingleQuery() match { | ||
| 64 | case q: SelectQuery => Some(q) | ||
| 65 | case _ => None | ||
| 66 | } | ||
| 60 | } | 67 | } |
| 61 | 68 | ||
| 62 | def submitQuery( | 69 | def submitQuery( |
