Hi Miguel,

The SPARQL parser can be invoked via:

QueryFactory.create

It calls

SPARQLParser.create(Syntax)

which checks the registered language to find a factory for the right language. The factory creates a parser instance.

QueryFactory calls the parser with a Query object to be filled in. The parser is a one-use object.

Normally there are three languages registered: SPARQL 1.0, SPARQL 1.1 amd ARQ (extended superset of SPARQL 1.1). The default is SPARQL 1.1. (except Fuseki, which uses Syntax.ARQ -- there isn't a lot of difference between SPARQL 1.1 and ARQ these days).

The result object "Query" is built in the parsing process. That gets passed to the QueryExecFactory to look for the right engine to execute that query/data source combination. The general purpose QueryEngineMain can execute any query so there is always a way to execute a query.

Query object can be used for executions multiple times. Once built, they are (should be) immutable.

        Andy



On 26/05/14 02:54, Joshua TAYLOR wrote:
I'm not near a Jena source archive at the moment, but there's code in
the tutorials, e.g., the inference support document [1] that includes
code sames that use this functionality, e.g.,

     String rules = "[rule1: (?a eg:p ?b) (?b eg:p ?c) -> (?a eg:p ?c)]";
     Reasoner reasoner = new GenericRuleReasoner(Rule.parseRules(rules));
     reasoner.setDerivationLogging(true);
     InfModel inf = ModelFactory.createInfModel(reasoner, rawData);

A Java IDE (e.g., Eclipse) should give you a "find source"
functionality so that you can select Rule.parseRules and "goto
source".  In some aspects, things get a little more complicated with
Interface and InterfaceImpl hierarchies, but generally this will get
you started…


[1] http://jena.apache.org/documentation/inference/

On Sun, May 25, 2014 at 9:51 AM, Miguel Bento Alves
<[email protected]> wrote:
Dear All,

I'm working on JENA-650 - Define SPARQL commands in Jena rules under GSoC
project. I'm starting to study and analyse the relevant libraries and the
coding relevants to my work.

Can anyone locate for me the libraries/classes where:
a) a rule is parsed;
b) a rule is executed;
c) a SPARQL command is parsed;

Thanks, Miguel






Reply via email to