aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/rsacomb/RDFoxUtil.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/scala/rsacomb/RDFoxUtil.scala')
-rw-r--r--src/main/scala/rsacomb/RDFoxUtil.scala19
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 */
4import java.util.HashMap 4import java.util.HashMap
5import java.io.ByteArrayInputStream 5import java.io.StringReader
6import tech.oxfordsemantic.jrdfox.Prefixes 6import tech.oxfordsemantic.jrdfox.Prefixes
7import tech.oxfordsemantic.jrdfox.logic.{IRI, Query} 7import tech.oxfordsemantic.jrdfox.logic.sparql.statement.{Query, SelectQuery}
8import tech.oxfordsemantic.jrdfox.client.{ 8import tech.oxfordsemantic.jrdfox.client.{
9 ConnectionFactory, 9 ConnectionFactory,
10 ServerConnection, 10 ServerConnection,
@@ -12,7 +12,7 @@ import tech.oxfordsemantic.jrdfox.client.{
12} 12}
13import tech.oxfordsemantic.jrdfox.formats.SPARQLParser 13import tech.oxfordsemantic.jrdfox.formats.SPARQLParser
14 14
15import tech.oxfordsemantic.jrdfox.logic.{IRI => RDFox_IRI} 15import tech.oxfordsemantic.jrdfox.logic.expression.{IRI => RDFox_IRI}
16import org.semanticweb.owlapi.model.{IRI => OWL_IRI} 16import org.semanticweb.owlapi.model.{IRI => OWL_IRI}
17 17
18object RDFoxUtil { 18object 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(