Printing all events

20 views
Skip to first unread message

hayri

unread,
Sep 20, 2010, 11:03:33 AM9/20/10
to ETALIS
Is there a command to print all defined events? Instead of writing for
every event a "print_trigger", I would like to have something like
print_trigger(all_events).



hayri

unread,
Sep 20, 2010, 11:31:45 AM9/20/10
to ETALIS
I found the "logging" flag in Etalis manual but this is a bit too much
for me. It doesn't show only the events but also some details about
the whole process made in background. I would like to have a lighter
version of this.

Paul Fodor

unread,
Sep 20, 2010, 12:07:54 PM9/20/10
to eta...@googlegroups.com

No, there is not. But you can try something like:
print_trigger(_/1).
print_trigger(_/2).
...

It will print all events with 1, respectively 2, ..., arguments.
The problem with this approach is that it will print also temporary
events obtained during binarization of CEP that you might not need.

I will add "print_trigger(all_events)." to ETALIS to print all
"defined" events (except the events obtained automatically from
binarization).

Just a parenthesis for how ETALIS works. If you have a rule:
ce <- a seq b seq c.
ETALIS will create binary events:
temp1 <- a seq b
ce <- temp1 seq c.
This is the binarization step that I mentioned above. It adds a
temporary event temp1 to the program.
We can share common subexpressions in CEP, etc.
I understand you want to print only the composed events that you
created. We can do this by saving the predicate symbols that you
created in the program and printing their instances.

Paul.

Paul Fodor

unread,
Sep 20, 2010, 1:39:44 PM9/20/10
to eta...@googlegroups.com
On Mon, Sep 20, 2010 at 12:07 PM, Paul Fodor <fodor...@gmail.com> wrote:
> On Mon, Sep 20, 2010 at 11:03 AM, hayri <hayri...@googlemail.com> wrote:
>> Is there a command to print all defined events? Instead of writing for
>> every event a "print_trigger", I would like to have something like
>> print_trigger(all_events).

Hi,
I added code to support a new declaration:
print_trigger(all_defined_events).
Please update your copy of ETALIS form the SVN repository and see the
example in etalis/examples/print_all_defined_events
Paul.

hayri

unread,
Sep 21, 2010, 5:30:37 AM9/21/10
to ETALIS
Thanks for the quick support. I tried the new method and it works
well. But I have too many events and some of them are just some
subevents to trigger the actual events. I don't want to print these
subevents but only the main events. I tried to use the filters but I
couldn't get it work.

That's why I wanted to ask if there is another way to make some
exceptions fot print_trigger(all_defined_methods). Kind of a command
like do_not_print(event_name). I am also eager to hear any other
alternatives.

hayri

On 20 Sep., 19:39, Paul Fodor <fodor.p...@gmail.com> wrote:
> On Mon, Sep 20, 2010 at 12:07 PM, Paul Fodor <fodor.p...@gmail.com> wrote:

Paul Fodor

unread,
Sep 21, 2010, 5:51:44 PM9/21/10
to eta...@googlegroups.com
On Tue, Sep 21, 2010 at 5:30 AM, hayri <hayri...@googlemail.com> wrote:
> Thanks for the quick support. I tried the new method and it works
> well. But I have too many events and some of them are just some
> subevents to trigger the actual events. I don't want to print these
> subevents but only the main events. I tried to use the filters but I
> couldn't get it work.

I would write a procedure inside the file that selects to print all
events except some events.
You can also put a flag "printing_on_1/1". When it's on, it prints
(you can eliminate this flag if you wish).
I put an example in:
etalis\examples\print_selected_events_01

:- dynamic(printing_on_1/1), assert(printing_on_1(on)).

print_trigger(Event) :-
printing_on_1(on),
(
( functor(Event,Functor,Arity),
Functor\='/',
Functor\=all_defined_events,
EventSymbol=Functor/Arity,
! );
EventSymbol=Event
),
EventSymbol \= all_defined_events,
EventSymbol \= d/1,
EventSymbol \= e/1.

d(X) <- a(X).
e(X) <- a(X).
f(X) <- a(X).
g(X) <- a(X).

Paul.

Paul Fodor

unread,
Sep 21, 2010, 5:52:42 PM9/21/10
to eta...@googlegroups.com
Hi,
Please update ETALIS to get the print example that you wanted.
Paul.

hayri

unread,
Oct 5, 2010, 9:59:47 AM10/5/10
to ETALIS
"No, there is not. But you can try something like:
print_trigger(_/1).
print_trigger(_/2). "

I tried the code above. It works for the events which have parameters
but not for those that don't. I tried something like

print_trigger(_/0). and print_trigger(_/_) but it didn't work.

How can I print the events with no parameters?

Paul Fodor

unread,
Oct 5, 2010, 12:06:57 PM10/5/10
to eta...@googlegroups.com

both
print_trigger(_/_).
and
print_trigger(_/0).
are working.

I just tested them in etalis/examples/sequence_01

print_trigger(_/_).

c <- a seq b.

E:\_workspaces\_workspace_01_internal_SVN_based\etalis\examples\sequence_01>swipl
-g "open('../results.txt',append,FH), ['../../src/etalis.P'],
set_etalis_flag(store_fired_events,on), compile_event_fi
le('test_01.event'), event(a), event(b),
findall(stored_event(event(c,T)),stored_event(event(c,T)),List), (
List = [stored_event(event(c,[datime(_,_,_,_,_,_,_),datime(_,_,_,_,_,_,_)]))]
-> write(FH,'s
equence_01\t\t\tpassed\n') ; write(FH,'sequence_01\t\t\tfailed\n') ),halt."

E:\_workspaces\_workspace_01_internal_SVN_based\etalis\examples\sequence_01>"c:\Program
Files\pl\bin\swipl" -g "open('../results.txt',append,FH),
['../../src/etalis.P'], set_etalis_flag(store_fired_ev
ents,on), compile_event_file('test_01.event'), event(a), event(b),
findall(stored_event(event(c,T)),stored_event(event(c,T)),List), (
List = [stored_event(event(c,[datime(_,_,_,_,_,_,_),datime(_,_,_,_
,_,_,_)]))] -> write(FH,'sequence_01\t\t\tpassed\n') ;
write(FH,'sequence_01\t\t\tfailed\n') ),halt."
% c:/documents and settings/pfodor/application data/swi-prolog/pl.ini
compiled 0.00 sec, 1,940 bytes
% binarizer.P compiled 0.00 sec, 10,768 bytes
% compiler.P compiled 0.05 sec, 73,336 bytes
% date_time.P compiled 0.02 sec, 19,536 bytes
% event_utils.P compiled 0.00 sec, 3,924 bytes
% executor.P compiled 0.02 sec, 14,500 bytes
% flags.P compiled 0.00 sec, 2,936 bytes
% garbage_collection.P compiled 0.00 sec, 4,132 bytes
% java_interface.P compiled 0.00 sec, 1,956 bytes
% justify_etalis.P compiled 0.00 sec, 21,504 bytes
% labeled_event_rules.P compiled 0.00 sec, 2,348 bytes
% logging.P compiled 0.02 sec, 2,380 bytes
% parser.P compiled 0.00 sec, 15,256 bytes
% storage.P compiled 0.00 sec, 14,888 bytes
% string.P compiled 0.00 sec, 6,292 bytes
% utils.P compiled 0.00 sec, 8,316 bytes
% ../../src/etalis.P compiled 0.09 sec, 222,636 bytes
*Event: a @ [datime(2010,10,5,12,6,43,1),datime(2010,10,5,12,6,43,1)]
*Event: b @ [datime(2010,10,5,12,6,43,2),datime(2010,10,5,12,6,43,2)]
*Event: temp_e_1(a,b) @
[datime(2010,10,5,12,6,43,1),datime(2010,10,5,12,6,43,2)]
*Event: c @ [datime(2010,10,5,12,6,43,1),datime(2010,10,5,12,6,43,2)]

Paul.

hayri

unread,
Oct 5, 2010, 12:40:37 PM10/5/10
to ETALIS
Ok, I guess I couldn't explain my problem properly. Your output is
actually the same as mine but the difference is all your events (a,b
and c) have no parameters. In my case I have events which have some
parameters and some that with no parameters.

So, when I use one of those triggers like print_trigger(_/1) or
print_trigger(_/0) all events are being printed without regarding the
number of parameters. No event is filtered out. I don't know if and
what I'm doing wrong.

Paul Fodor

unread,
Oct 5, 2010, 12:45:11 PM10/5/10
to eta...@googlegroups.com
Ok. Yes, that is the behaviour.
I thought that people would forget the right arity of their events and
I put a variable there.
I will correct this glitch in the future.
Paul.

fodor

unread,
Oct 5, 2010, 12:52:23 PM10/5/10
to ETALIS
Fixed. Please update from the repository.
Thanks,
Paul.
Reply all
Reply to author
Forward
0 new messages