Closed dyamon closed 4 years ago
Turns out RDFox is indeed able to parse a query string into a Query
. While this is not documented in the JavaDoc one can proceed as follows
SPARQLParser parser = new SPARQLParser(Prefixes.s_defaultPrefixes, new ByteArrayInputStream("SELECT * WHERE {?a ?b ?c} LIMIT 5".getBytes(StandardCharsets.UTF_8)));
Query myQ = parser.parseSingleQuery();
We need to find a way to read and parse SPARQL queries. This is because we need to derive a filtering program from a query.
So far we have this:
String
s or built using the internal abstract syntax. There is no bridge between the two, i.e., there is no way to provide aString
/file and parse it into the internal representation;Another option for now is to just ignore all of this and embed the queries in the code using the RDFox internal representation.
Update: it seems like RDFox functions that take a
Query
as a parameter usually provide alternative signatures that accept the query as aString
. This most likely means that they have a method to parseQuery
s fromString
s but it's not exposed. Maybe ask Valerio about this.Apart from importing the query we still need to:
SELECT-FROM-WHERE
SPARQL query this corresponds to all variables that are not named in theSELECT
statement (a.k.a. answer variables);