On 07/03/14 13:58, Christophe FAGOT wrote:
Thanks Dave for your answer.
I need to use a RETE engine since I want it to infer « live » when I add new
triples in the graph. So it seems to me that forward_rete is the only option
for that. Other options recheck the full graph to recompute inferences, right ?
Right.
Based on your answer, it seems that I now have 2 choices :
1. try to patch the RETE engine
2. try to start developing a brand new rete-like engine, probably less
memory consuming, but probably also slower than the existing one.
You may be able to get away with a simpler solution than a full
replacement engine. For example, may be able to handle cases like this
by running SPARQL update queries in response to additions, then let the
RETE engine handle the chaining from there. Depends on the nature of
your rules, how they chain and why you want to use rules in the first place.
Dave
Chris.
Le 7 mars 2014 à 13:00, Dave Reynolds <[email protected]> a écrit :
On 07/03/14 10:36, Christophe FAGOT wrote:
Hi there,
I’m actually using Jena in forward rete configuration, with Jena 2.11.1. If I
use some very simple rules like the following, the memory used by my JVM
becomes huge with few statements (around 100Mo for only 3500 statements). I ran
a simple test in which instances and data property values were always
different, in order to avoid combinatorial combinaisons.
The sample rule :
[rule: (?instance rdf:type test:Instance),
(?object rdf:type test:Object),
(?instance test:instanceAge ?age),
(?object test:objectAge ?age),
->
(?instance test:isLinked "true"^^xsd:boolean)]
Does anyone see a reason for such huge memory space required by the RETE engine
? Any workaround to use ?
It's due to the crudeness of the Jena RETE implementation.
It is in effect doing (pseudo-notation):
(?instance rdf:type test:Instance)
(?object rdf:type test:Object)
(?instance test:instanceAge ?age1)
(?object test:objectAge ?age2)
(= ?age1 ?age2)
So that it builds a queue of all possible instance/object pairs before the
final join on age.
Which means that queue ends up as N(objects) * N(instances) long. So quadratic
rather than combinatorial but that's enough for the blow up.
Can't think of a work around.
If you can use backward rules instead of RETE that should help.
The RETE engine could certainly be improved (patches welcome). Though the
looooong term best option might be to consider phasing out both the existing
rule engines in favour of something simpler and more scalable. Not something I
could personally contribute to right now.
Dave
Christophe FAGOT, PhD - Product owner, informatique
:: intactile DESIGN :: création industrielle en Interface Homme Machine [ IHM
] :: 20 rue du carré du roi :: 34000 MONTPELLIER :: France
:: +33 (0)4 67 52 88 61 :: +33 (0)9 50 12 05 66 :: [email protected]
:: http://www.intactile.com
Hugh MacLeod : "It's not what the software does, it's what the user does"
Les informations contenues dans cet email et ses documents attachés sont
confidentielles. Elles sont exclusivement adressées aux destinataires
explicitement désignés ci-dessus et ne peuvent être divulguées sans
consentement de son auteur. Si vous n'êtes pas le destinataire de cet email
vous ne devez pas employer, révéler, distribuer, copier, imprimer ou
transmettre le contenu de cet email et devez le détruire immédiatement.