Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Can't load logforest files in Flora-2

1 view
Skip to first unread message

Jason Morris

unread,
Dec 10, 2020, 4:45:35 PM12/10/20
to ErgoAI, Flora-2, and XSB Users Forum
I'm trying to use forest logging to understand what my code is doing, and I would like to be able to just load the log and query it to quickly find relevant info, but it seems there are a number of constructs in the logging format that are not considered valid Flora-2 when you try to load them.

As I recall, entries about warnings didn't work, entries about delayed sub goals didn't work, and some other things.

Is there a known strategy to convert what logforest generates into something I can reliably load without losing useful info?

Thanks,

Jason Morris

Michael Kifer

unread,
Dec 10, 2020, 8:26:48 PM12/10/20
to Jason Morris, ErgoAI, Flora-2, and XSB Users Forum
You can load it as a Prolog file. Just use .P as the file extension.
That file is expressly in the prolog format and not every such file is valid Flora. Variables and operators, for example.

--
Sent from my mobile.

Jason Morris

unread,
Dec 11, 2020, 10:40:57 AM12/11/20
to Michael Kifer, ErgoAI, Flora-2, and XSB Users Forum
OK, I will give that a try, thank you.

Jason Morris

unread,
Dec 11, 2020, 2:19:19 PM12/11/20
to ErgoAI, Flora-2, and XSB Users Forum, Jason Morris, ErgoAI, Flora-2, and XSB Users Forum, Michael Kifer
I may be misunderstanding something, here, but it's not loading either way.

If I create the following knowledge-base:

Person[|
    child=>Person
    |].

Morticia:Person[
    child->{Pugsley,Wednesday}
    ].

Gomez:Person[
    child->{Pugsley,Wednesday}
    ].

Wednesday:Person.
Pugsley:Person.

@!{Siblings_Share_Parents[
    source->'common sense',
    description->"two people are siblings if all of the parents of the first person are also parents of the second person"^^\string]}
?X[sibling->?Y] :-
  ?X:Person,
  ?Y:Person,
  forall(?parents)^(?parents:Person[child->?X] ~~> ?parents[child->?Y]).

and then I load that into Flora-2, and run the following commands
\logforest('family_log').
Wednesday[sibling->Pugsley].
\nologforest.

It creates a file called family_log. If I rename it to family_log.flr and attempt to load it using [family_log]., I get the following errors.

flora2 ?- ['family_log.flr'].

++Warning[Flora-2]> Errors found: discarding the rest of the file


++Error[Flora-2]> [family_log.flr] <Composer> near line(35)/char(44) `@' and near line(35)/char(70) `@'
                operators around this point cannot be meaningfully composed
++Error[Flora-2]> [family_log.flr] <Composer> near line(36)/char(90) `@' and near line(36)/char(116) `@'
                operators around this point cannot be meaningfully composed
++Error[Flora-2]> [family_log.flr] <Composer> near line(40)/char(80) `@' and near line(40)/char(106) `@'
                operators around this point cannot be meaningfully composed
++Error[Flora-2]> [family_log.flr] <Composer> near line(44)/char(163) `@' and near line(44)/char(189) `@'
                operators around this point cannot be meaningfully composed
++Error[Flora-2]> [family_log.flr] <Parser> near line(33)/char(196) `@'
                term@module in arguments in rule heads & facts is illegal unless explicitly reified
++Error[Flora-2]> [family_log.flr] <Parser> near line(34)/char(201) `@'
                term@module in arguments in rule heads & facts is illegal unless explicitly reified
++Error[Flora-2]> [family_log.flr] <Parser> near line(45)/char(173) `@'
                term@module in arguments in rule heads & facts is illegal unless explicitly reified

++7 errors

++compilation aborted


Times (in seconds): elapsed = 0.444; pure CPU = 0.141

No

Which I take it is the expected behaviour. But if I rename to family_log.P, and try to load it again with [family_log]., I get the following. For context, the first line of the family_log file is 'error(2)[goal->null].' So loading it as a prolog module seems to be failling on the first line.

++Abort[Flora-2]> syntax_error(_h0):error ( 2 )  <--- HERE? ************ 
++                                      [ goal -> null ]


Forward Continuation...
... machine:xsb_backtrace/1  From C:/Program Files/Flora-2/XSB/syslib/machine.xwam
... xsb_read:iso_read_syntax_error/3  From C:/Program Files/Flora-2/XSB/syslib/xsb_read.xwam
... parse:my_read/2  From C:/Program Files/Flora-2/XSB/cmplib/parse.xwam      
... parse:parse_clauses/2  From C:/Program Files/Flora-2/XSB/cmplib/parse.xwam
... parse:parse1/3  From C:/Program Files/Flora-2/XSB/cmplib/parse.xwam
... parse:parse/4  From C:/Program Files/Flora-2/XSB/cmplib/parse.xwam 
... standard:call/1  From C:/Program Files/Flora-2/XSB/syslib/standard.xwam   
... consult:compile_f/6  From C:/Program Files/Flora-2/XSB/syslib/consult.xwam
... consult:reconsult0/3  From C:/Program Files/Flora-2/XSB/syslib/consult.xwam
... consult:consult/1  From C:/Program Files/Flora-2/XSB/syslib/consult.xwam   
... flora_load_file/4  From C:\Program Files\Flora-2\flora2\syslib\flrload.xwam
... standard:call/1  From C:/Program Files/Flora-2/XSB/syslib/standard.xwam
... standard:catch/3  From C:/Program Files/Flora-2/XSB/syslib/standard.xwam
... standard:call_cleanup/2  From C:/Program Files/Flora-2/XSB/syslib/standard.xwam
... standard:call/1  From C:/Program Files/Flora-2/XSB/syslib/standard.xwam
... standard:catch/3  From C:/Program Files/Flora-2/XSB/syslib/standard.xwam
... standard:call/1  From C:/Program Files/Flora-2/XSB/syslib/standard.xwam
... standard:catch/3  From C:/Program Files/Flora-2/XSB/syslib/standard.xwam
... flora_process_shell_command/1  From C:\Program Files\Flora-2\flora2\flrshell.xwam
... standard:call/1  From C:/Program Files/Flora-2/XSB/syslib/standard.xwam
... x_interp:_$call/1  From C:/Program Files/Flora-2/XSB/syslib/x_interp.xwam
... x_interp:call_query/1  From C:/Program Files/Flora-2/XSB/syslib/x_interp.xwam
... standard:call/1  From C:/Program Files/Flora-2/XSB/syslib/standard.xwam
... standard:catch/3  From C:/Program Files/Flora-2/XSB/syslib/standard.xwam
... x_interp:interpreter/0  From C:/Program Files/Flora-2/XSB/syslib/x_interp.xwam
... loader:ll_code_call/3  From C:/Program Files/Flora-2/XSB/syslib/loader.xwam
... loader:load_object_file/2  From C:/Program Files/Flora-2/XSB/syslib/loader.xwam
... standard:call/1  From C:/Program Files/Flora-2/XSB/syslib/standard.xwam
... standard:catch/3  From C:/Program Files/Flora-2/XSB/syslib/standard.xwam

Any further help would be appreciated.

Michael Kifer

unread,
Dec 12, 2020, 2:16:32 AM12/12/20
to Jason Morris, ErgoAI, Flora-2, and XSB Users Forum

I suggest that meanwhile you try to manually reify these terms or put parens around them.

This bug should be fixed in an Ergo release candidate in a few weeks. Getting it into Flora branch will take a bit longer.


In my previous reply (about loading this as Prolog), I thought you are using a direct call to the XSB logging primitive.

Jason Morris

unread,
Dec 12, 2020, 4:23:53 AM12/12/20
to Michael Kifer, ErgoAI, Flora-2, and XSB Users Forum
Thanks for the heads up. Any idea how long before Flora-2 sees a fix? Just wondering how much effort to put into a workaround.

Jason

Michael Kifer

unread,
Dec 13, 2020, 12:57:49 AM12/13/20
to Jason Morris, ErgoAI, Flora-2, and XSB Users Forum

it will probably make it into the flora2 repository in the second part of January. The actual release will hopefully  be in February.

--

       --- michael


 

Reply all
Reply to author
Forward
0 new messages