diff options
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( |