https://github.com/mbentoalves/jena
With my last last update, a Sparql command in a rule can be parsed. Examples of valid rules with a Sparql command can be (look only to syntax, the rule doesn't have any meaning): [rule1: (\\\sparql Select ?c ?d where {?c <eg:p> ?d} \\\sparql) (?a <eg:p> ?b) (?b <eg:p> ?c) -> (?a <eg:p> ?c)] [rule1: (?a <eg:p> ?c) <- (\\\sparql Select ?c ?d where {?c <eg:p> ?d} \\\sparql) (?a <eg:p> ?b) (?b <eg:p> ?c)] A Sparql command is enclosure in a rule as: (\\\SPARQL PREFIX SELECT ... \\\SPARQL) An "open door" was left if in future we want go deep in parsing, overcoming corner cases, and simplify the declaration, like this: [rule1: (Select ?c ?d where {?c <eg:p> ?d}) (?a <eg:p> ?b) (?b <eg:p> ?c) -> (?a <eg:p> ?c)] Next steps: working on execution of a rule with a Sparql command. In my opinion, it will be better to start with a rule only with one Sparql command. Something like: [rule1: (?a <eg:p2> ?c) <- (\\\sparql Select ?c ?d where {?c <eg:p> ?d} \\\sparql) ] After this step, the main goals are fulfilled. However, is desired rules that combines sparql commands with clauses, that is the next step. Comments and reviews are welcome. Miguel