Hi all, I wrote a Java program with the intent of inferring statements using rules:
Model m = ModelFactory.createDefaultModel(); Resource configuration = m.createResource(); configuration.addProperty(ReasonerVocabulary.PROPruleMode, "hybrid"); configuration.addProperty(ReasonerVocabulary.PROPruleSet, rules_filename); // Create an instance of such a reasoner Reasoner reasoner = GenericRuleReasonerFactory.theInstance().create(configuration); // Load dataset Model data = loadModel(code_filename, lang); InfModel infmodel = ModelFactory.createInfModel(reasoner, data); Where rules_filename is the file containing the Jena rules. I have played around with the rules and I came to the conclusion that the order of triples in rules can cause delays in the execution time. For example, for the following rule the execution time is 2 seconds: [connection: (?A1 :IDENT ?A2 ), (?A2 rdf:value ?variable_conn ), (?A1 :EXPR ?A3 ), (?A3 :METHOD_CALL ?A4 ), (?A4 :DOT ?A5 ), (?A5 :IDENT ?A6 ), (?A5 :IDENT ?A7 ), (?A7 rdf:value "IO" ), (?A6 rdf:value "getDBConnection" ), (?A8 rdf:value "Connection" ) -> (fc:unit fc:variable_conn ?variable_conn)] And for this rule, the execution time is 12 seconds: [connection: (?A3 :METHOD_CALL ?A4 ), (?A2 rdf:value ?variable_conn ), (?A1 :EXPR ?A3 ), (?A6 rdf:value "getDBConnection" ), (?A4 :DOT ?A5 ), (?A5 :IDENT ?A6 ), (?A5 :IDENT ?A7 ), (?A7 rdf:value "IO" ), (?A1 :IDENT ?A2 ), (?A8 rdf:value "Connection" ) -> (fc:unit fc:variable_conn ?variable_conn)] Both rules contain the same triples, just in different order. Is this considered normal behaviour? And what to do about it.. since I create the rules automatically.. It would be very difficult to determine the exact order of the statements in the rules. Regards, Oana.
