Databases Reference
In-Depth Information
Example 21
For the previous example, we can add more SWRL rules as follows:
(? X, dbo:revenueEUR , ? EUR )
(? X, dbo:revenueUSD , ? USD ) ,
(5)
? EUR =? USD/ 1 . 3
(? X, dbo:revenueEUR , ? REUR )
(? X, dbo:profitEUR , ? PEUR ) ,
(? X, dbo:totalExpensesEUR , ? TEUR ) ,
(6)
? REUR =? PEUR +? TEUR
(? X, dbo:totalExpensesEUR , ? TEUR )
(? X, dbo:revenueEUR , ? REUR ) ,
(? X, dbo:profitEUR , ? PEUR ) ,
(7)
? TEUR =? REUR− ? PEUR
However, here problem (ii) comes into play, as it is easy to see that these
rules potentially produce infinite results, which we leave as an exercise to
the reader. As a hint, consider the following example data:
:company1 dbo:profitEUR 1;
dbo:revenueEUR 1;
dbo:totalExpensesEUR 1;
Obviously, this data is not coherent with the equation, in the sense that
it is ambiguous and a rule-engine that tries to compute the closure would
not terminate (such example could occur in reality due to, e.g., rounding
errors).
Certain rule engines provide special built-ins to avoid running into
non-termination problems as exemplified above. For instance, Jena provides a
special built-in noValue , which returns sound but incomplete results whereby it
only fires a rule if no value exists for a certain attribute on the inferences thus
far or in the data - not unlike negation-as-failure.
Example 22
Using the noValue built-in, rule (4) (and analogously the other rule vari-
ants) could be encoded in Jena's rule syntax as follows:
[
(?X dbo:revenueEUR ?REUR) (?X dbo:totalExpensesEUR ?TEUR)
difference(?REUR, ?TEUR, ?PEUR)
noValue(?X, dbo:profitEUR)
-> (?X dbo:profitEUR ?PEUR)]
Values for ?PEUR will only be computed from the given equations if no such
value for dbo:profitEUR already exists on the resource bound to ?X .
 
Search WWH ::




Custom Search