--
You received this message because you are subscribed to the Google Groups "ErgoAI, Flora-2, and XSB Users Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ErgoAI-Flora2-XSB...@coherentknowledge.com.
To post to this group, send email to ErgoAI-Flor...@coherentknowledge.com.
Visit this group at https://groups.google.com/a/coherentknowledge.com/group/ErgoAI-Flora2-XSB-forum/.
To view this discussion on the web visit https://groups.google.com/a/coherentknowledge.com/d/msgid/ErgoAI-Flora2-XSB-forum/D659F25B-D8EE-4599-ACCB-659732BF1027%40gmail.com.
--
You received this message because you are subscribed to the Google Groups "ErgoAI, Flora-2, and XSB Users Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ErgoAI-Flora2-XSB...@coherentknowledge.com.
To post to this group, send email to ErgoAI-Flor...@coherentknowledge.com.
Visit this group at https://groups.google.com/a/coherentknowledge.com/group/ErgoAI-Flora2-XSB-forum/.
To view this discussion on the web visit https://groups.google.com/a/coherentknowledge.com/d/msgid/ErgoAI-Flora2-XSB-forum/22411832-df9b-4ff2-83dc-89e409074711%40coherentknowledge.com.
Both primitives and class memberships. The “is…” family of functions returns boolean. This forces me to enumerate many cases. But if I have access to the class description of a variable ?x, then I can (if needed), compare that with the description of another variable ?y and see if they are same.
getClass(?x) == getClass(?y)
But the class hierarchy can be complex with multiple inheritance. The above test gives you absolutely nothing and is procedural, not declarative, thinking.
Note:
ergo> ?X^^foo = ?Y^^bar, writeln(?X)@\plg.
_h12171 { \$typed variable : type = (bar,foo) }
After unification, this becomes one variable that can still be bound to something that belongs both to the classes bar and foo.
In sum, for variables, getClass(...) is useless. For objects, one
can define getClass(?inobj,?outclass) to yield the most
immediate class(es) of an object, but the result (?outclass) may
not be unique and may not even exist for some hierarchies.
--
--- michael
To view this discussion on the web visit https://groups.google.com/a/coherentknowledge.com/d/msgid/ErgoAI-Flora2-XSB-forum/df74f4dd-fa10-6e22-9462-e713a61ce3bc%40coherentknowledge.com.
On 19-Nov-2018, at 6:02 AM, Michael Kifer <michae...@coherentknowledge.com> wrote:good. It can be further simplified to\udf foo(?arg) := 1 \if ?arg:B, !.
\udf foo(?arg) := 2 \if ?arg:A.
--
--- michaelOn 11/18/18 3:02 PM, Paul Fodor wrote:I sent Rangarajan some examples earlier today.Paul.On Sun, Nov 18, 2018 at 1:06 PM Paul Fodor <paul....@coherentknowledge.com> wrote:Yes.B::A.\udf foo(?arg) := 1 \if ?arg:B.\udf foo(?arg) := 2 \if ?arg:A, \naf ?arg:B.bob:B.anne:A.%test1 :-writeln( foo(bob) )@\plg.%test2 :-writeln( foo(anne) )@\plg.?- %test1.?- %test2.On Sun, Nov 18, 2018 at 10:21 AM Rangarajan Krishnamoorthy <rang...@gmail.com> wrote:OK, got it. Here is what I would like to do. Given two UDFs,foo(?arg^^A) and foo(?arg^^B) (with respective bodies),and two classes A, B such that B::AI want to be able to introspect using “clause{}” and determine that foo(?arg^^B) is more “specific” than foo(?arg^^A) with respect to that hierarchy.Is this possible?- RangarajanOn 18-Nov-2018, at 8:33 PM, Paul Fodor <paul....@coherentknowledge.com> wrote:That you can do with?X:name.On Sun, Nov 18, 2018 at 9:51 AM Rangarajan Krishnamoorthy <rang...@gmail.com> wrote:Yes, I saw this section. These are boolean queries. What about classes? What I am looking for is some representation of the type itself, for example, name, etc. Something equivalent to the C++/Java feature.- Rangarajan
To view this discussion on the web visit https://groups.google.com/a/coherentknowledge.com/d/msgid/ErgoAI-Flora2-XSB-forum/CAJwJZ4bqaS46k_yCPn0yNYpVcS9JsNjJ1DBOvnrw%3Dvk9U3fvKw%40mail.gmail.com.
---------------------------------
Paul Fodor, PhD
E-mail: paul....@coherentknowledge.com
http://www.coherentknowledge.com
-------------------------------
---------------------------------
Paul Fodor, PhD
E-mail: paul....@coherentknowledge.com
http://www.coherentknowledge.com
-------------------------------
I am lost in your description below, but to find the most specific class one would do something like this:
msc(?obj,?cl) :- ?obj:?cl, \naf (?subcl::?cl, ?obj:?subcl).
Note that the MSC is often not unique and may not exist.
The latter is because one can define an infinite sequence of classes such that foo : cl_i, for all i=0,1,2,3,...
and ... :: cl_4 :: cl_3 :: cl_2 :: cl_1 :: cl_0.
In this case, msc(foo,?cl) won't terminate, but, of course, one must work hard to create such a situation.
If you have a hairy class hierarchy then the above will also be inefficient.
But if your
hierarchy is finite, well-designed, and is similar to what
people do in procedural OO languages then it'll be ok.
Anyway, with this msc you can dispatch whatever
possibly makes sense to dispatch.
--
--- michael
Did you mean this?
\udf foo(?_arg^^B) := 1 \if !.
\udf foo(?_arg^^A) := 2.
Yes, it is better.
--
--- michael