On Thu, Mar 13, 2014 at 3:05 PM, Miguel Bento Alves
<[email protected]> wrote:
> I¹m doing some tests with jena reasoner and I concluded, that I cannot have
> a rule in the head of a forward rule. In a forward rule I only can have
> assert data, not deducted data.
>
> I¹m right? Why the reason?
You most certainly can have rules in the heads of forward rules.
E.g., from Jena's RDFS forward backward reasoner, there's this rule:
[rdfs2: (?p rdfs:domain ?c) -> [(?x rdf:type ?c) <- (?x ?p ?y)] ]
You mention a situation like
c1, c2 -> c3, c4 - where c1 is a rule.
First, that would be a rule in the body, not in the head, since the
grammar [1] is
bare-rule
:= term, ... term -> hterm, ... hterm // forward rule
or bhterm <- term, ... term // backward rule
and hterm means "head term". So you're actually asking about whether a
rule can appear as a body in a forward chaining rule. According to
the grammar, it cannot, since the production for term is
term
:= (node, node, node) // triple pattern
or (node, node, functor) // extended triple pattern
or builtin(node, ... node) // invoke procedural primitive
Can you give an example of what such a thing would be useful for? It
doesn't make much sense to me to have a rule as a precondition in a
rule. What would it mean to use a rule as a precondition? None of
your examples show a rule used a as a precondition or a post condition
in a rule. Can you give an example where you'd want a rule in the
body? I also don't see what the problem would be with your r5:
[r5: (?x exa:sportPartner ?y),
(?x rdf:type exa:SeaMan),
(?y rdf:type exa:SeaMan) ->
(?x exa:seaPartner3 ?y)]
If ?x has a ?y as a sportPartner, and both and ?x and ?y are instances
of SeaMan, then ?x has ?y as a seaPartner3. What's the matter with
that?
//JT
[1] http://jena.apache.org/documentation/inference/#RULEsyntax
--
Joshua Taylor, http://www.cs.rpi.edu/~tayloj/