KRR-Oxford / RSAComb

Re-implementation of the combined approach for CQ answering over RSA ontologies
https://www.cs.ox.ac.uk/isg/tools/RSAComb
Apache License 2.0
2 stars 0 forks source link

Answer Filtering #3

Closed dyamon closed 4 years ago

dyamon commented 4 years ago

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:

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 a String. This most likely means that they have a method to parse Querys from Strings but it's not exposed. Maybe ask Valerio about this.


Apart from importing the query we still need to:

dyamon commented 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();