Rules
I finally got all my RDFS rules running today. They all seem to work fine. I'm not sure if I should just move onto OWL lite rules, or if I should be integrating the code that I have. I'll discuss it with AN tomorrow.
I had a few problems getting the workarounds going today, but I managed to resolve them. The first was due to how Drools performed its tests.
Drools regularly checks if a rule should be run without actually running the rule. This was unexpected, as I thought that it was supposed to efficiently avoid unnecessarily running tests, however it only seems to avoid running the consequent of the rules. The logged output demonstrated that the tests were performed numerous times with positive results, but without resulting in the consequent being run. This is unfortunate, as the test is a query on the database. Queries are fast, but at the iTQL level there is a lot of overhead involved.
I suspect that the problem was due to the test being tried with the wrong rules, and so the name matching on one rule failed even though all the other tests passed. This is because all rules are of the same type, and they are identified by testing their names. Drools may work faster if every rule is a different type, but that would make for a lot of redundant Java code. Perhaps unique interfaces would be enough to differentiate them for this. I should also move the expensive tests to the bottom of the list, as I believe that the tests are executed in order.
To see when a consequent needed to run, I had been checking to see if the query each rule is based on had changed its count between one test and the next. This approach failed with the tests being called so many times. I addressed this by holding onto the old count until the next insertion was performed for that rule. This seemed to work well.
The other problem was caused by rule XI. There is no way to query for all resources which begin with "rdf:", so I had to get everything and filter my way through the results. This is slow, but since iTQL will be modified to provide appropriate queries for this shortly then it won't stay like this for long, and in the meantime it works. The real problem is that there is no count of statements which match my criteria, and I can't go executing a slow count of these prefixes all the time as it is already quite inefficient.
Since the number of statements which affect rule IX is a subset of the entire model, then if there is no change in the number of statements in a model then there will be no need for rule IX to execute. This isn't quite ideal, as every increase in the inferred model means that this number will increase, but since there are only 5 rules which can trigger IX it won't be checked too often.
I just need to make sure than iTQL gets updated soon.
Wednesday, July 21, 2004
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment