On 12/11/13 11:54, Miguel Bento Alves wrote:
Dear Dave,
Can I express myself in Prolog?
I want something like:
v(s1, 8).
v(s2, 120).
p1(X, Y, C):-
p11(X, Y, C).
p1(X, Y, C):-
p12(X, Y, C).
p11(X, o1, 0.8):-
v(X, V),
V < 10.
p12(X, o1, 0.7):-
v(X, V),
V >= 100.
p1(s1, Y, C)?
Y = o1, C = 0.8
p1(s2, Y, C)?
Y = o1, C = 0.7
In best of my knowledge, is not possible what I want. But I¹m new in Jena
and perhaps there are a solution that I can¹t figure out. I think that is
not possible because I need a quad: Subject, Property, Object, Confidence.
I tried with blank nodes but I didn¹t had success.
If that's really what you want then that is more or less possible,
however I think you'll find you need more.
The issue is that in your example there is no overlap of rules. So p11
and p12 never occur together, indeed for values of V between 10 and 99
there's no value for p1. Normally once you have uncertainty measures you
find cases where there are multiple routes to a conclusion, each of
which contributes some confidence/certainty/belief/whatever. In which
case you need to trace out all the possible routes and combine the
confidence measures from each route, which in turn requires dependency
assumptions. If that's where you are headed them I would start with a
tool designed for that job, not start with a rule based system and hope
to extend it.
However, if there are *really* no overlaps, and only ever a single
deduction path for a single conclusion, and that won't change, then you
could do something in Jena.
There are two options for handling n-ary relations in Jena rules.
First you can represent them as groups of triples. To deduce an instance
of an n-ary relationship from a rule then you need to create a bNode to
represent the instance. For this you can use makeTemp (which a guard to
prevent multiple instantiation) or makeSkolem. The latter is probably
the better choice.
Alternatively, Jena rules has the notion of a "functor" (bad name) which
is essentially a structured literal. So you can represent your Y/C pairs
as certainty(Y,C) and write rules which generate and match triples whose
object is a certainty(?x,?y) pair. By default these literals are kept
internal to the inference engine but there is an option to make them
visible to external queries (PROPenableFunctorFiltering).
Dave
MBA
On 12/11/13 11:19, "Dave Reynolds" <[email protected]> wrote:
Depending on exactly what semantics you want for confidence coefficients
then you probably want to look at a Bayesian network software.
Dave
On 12/11/13 09:04, Miguel Bento Alves wrote:
I want to introduce a confidence coefficient in my rules. For instance,
in
the example below, let's consider that p11 has a confidence coefficient
of
0.8 while p12 has a confidence coefficient of 0.7. When ?x exa:p1 ?y
happens
I want to know the confidence of this conclusion. Any ideas? I have been
study but I couldn't figure out a good solution.
(?x exa:p1 ?y) <- (?x exa:p11 ?y).
(?x exa:p1 ?y) <- (?x exa:p12 ?y).
(?x exa:p11 exa:o1) <- (?x exa:qvalue ?v), lessThan(?v, 10).
(?x exa:p12 exa:o2) <- (?x exa:qvalue ?v), ge(?v, 100).
MBA