From a-doug@microsoft.com  Sat Jul 22 19:42:48 2000
Received: from mail2.microsoft.com (mail2.microsoft.com [131.107.3.124])
	by swi.psy.uva.nl (8.9.3/8.9.3) with SMTP id TAA24296
	for <prolog@swi.psy.uva.nl>; Sat, 22 Jul 2000 19:42:47 +0200 (MET DST)
Received: from 157.54.9.104 by mail2.microsoft.com (InterScan E-Mail VirusWall NT); Sat, 22 Jul 2000 10:40:59 -0700 (Pacific Daylight Time)
Received: by INET-IMC-02 with Internet Mail Service (5.5.2651.58)
	id <P261JLCY>; Sat, 22 Jul 2000 09:46:49 -0700
Message-ID: <E713F2760348D211A9B600805F6FA1AB05676C4D@RED-MSG-09.itg-messaging.redmond.corp.microsoft.com>
From: "Douglas Miles (Volt Computer)" <a-doug@microsoft.com>
To: "'Jason Che-han Yip'" <yip@ee.ualberta.ca>, prolog@swi.psy.uva.nl
Subject: RE: Modifying consulted rules
Date: Sat, 22 Jul 2000 09:47:02 -0700
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2651.58)
Content-Type: multipart/alternative;
	boundary="----_=_NextPart_001_01BFF3FC.761132D0"

This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01BFF3FC.761132D0
Content-Type: text/plain;
	charset="ISO-8859-1"

Jason,
 
try this out and see if it is what you want...
 
in "consultTest.txt" put these 4 lines:
 
:-dynamic(test/1). % this will make sure it doesnt compile the test/1
predicates in this file
 
test(1).
test(original).
test(3).
 
 
open the standalone prolog shell..
 
?- consult('consultTest.txt') .  % or ['consultTest.txt'] would have done
the same.
?- listing(test).
test(1).
test(original).
test(3).
 
?- asserta(test(a)),assertz(test(z)).
?- retract(test(1)).
?- listing(test).
test(a).
test(original).
test(3).
test(z).
 
?- consult('consultTest.txt'), listing(test).
test(1).
test(original).
test(3).
 
?- assert(test(z)),listing(test).
test(1). 
test(original).
test(3).
test(z).
 
% now in the top of "consultTest.txt" put the line
 
 :-multifile(test/1).
 
?- consult('consultTest.txt'), listing(test).
test(z).
test(1). 
test(original).
test(3).
 
 
The problem you had ran into is when the file was consulted it also compiled
test/1. as static (static is default).
Since Prolog is a programming language as well as a smart database.. 
When I have a list of facts this is how i import them...
 
load_datafile(DataFile) :-
    see(DataFile),
    repeat,
        read(Datum),assert(Datum),
        Datum=end_of_file,seen,retract(Datum).   
                % the last 'retract' takes out the  end_of_file :)
 
 
 
Jan is there  implemented a 'Default consulting mode' flag somewhere that
can be defaulted to dynamic and/or multifile?
 

-----Original Message-----
From: Jason Che-han Yip [mailto:yip@ee.ualberta.ca]
Sent: Saturday, July 22, 2000 9:14 AM
To: Douglas Miles (Volt Computer)
Subject: Re: Modifying consulted rules


Here's my test running SWI-Prolog stand-alone:
 
I have a file "consultTest.txt" with the fact test(original).
I consult this file.  listing shows that test(original) is now in the
database.
I try assert(test(new)) and I get ERROR: No permission to modify
static_procedure 'test_1'
 
So I try assert(newTest(old)), check listing, it's there.
Try assert(newTest(new)).  Checking listing shows both newTest(old) and
newTest(new)
----
So I figured that consulted facts/rules were un-modifiable but I didn't
think that was supposed to be the case?

----- Original Message ----- 
From: Douglas  <mailto:a-doug@microsoft.com> Miles (Volt Computer) 
To: 'Jason Che-han Yip' <mailto:yip@ee.ualberta.ca>  ; prolog@swi.psy.uva.nl
<mailto:prolog@swi.psy.uva.nl>  
Sent: Friday, July 21, 2000 5:06 PM
Subject: RE: Modifying consulted rules


"no permission to modify static procedures"
is ussuly due to a syntactical misplacement of a comma or semicollon in code
one missing period or one comma can make the prolog engine think you are
trying to add your own  version of  ','(_,_).


------_=_NextPart_001_01BFF3FC.761132D0
Content-Type: text/html;
	charset="ISO-8859-1"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">


<META content="MSHTML 5.50.4134.600" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=558191016-22072000><SPAN 
class=558191016-22072000>Jason,</SPAN></SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=558191016-22072000><SPAN 
class=558191016-22072000></SPAN></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=558191016-22072000><SPAN 
class=558191016-22072000>try this out and see if it is what you 
want...</SPAN></SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=558191016-22072000><SPAN 
class=558191016-22072000></SPAN></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=558191016-22072000><SPAN 
class=558191016-22072000>in "consultTest.txt" put these 4 
lines:</SPAN></SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=558191016-22072000></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=558191016-22072000>:-dynamic(test/1). % <FONT face=Arial color=#0000ff 
size=2><SPAN class=558191016-22072000>this will make sure it doesnt compile the 
test/1 predicates in this file</SPAN></FONT></SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=558191016-22072000></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=558191016-22072000>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=558191016-22072000>test(1).</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=558191016-22072000>test(original).</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=558191016-22072000>test(3).</SPAN></FONT></DIV></SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=558191016-22072000></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=558191016-22072000></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=558191016-22072000><SPAN 
class=558191016-22072000>open&nbsp;the standalone prolog 
shell..</SPAN></SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=558191016-22072000></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=558191016-22072000>?- 
consult('consultTest.txt')&nbsp;.&nbsp; % or ['consultTest.txt'] would have done 
the same.</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=558191016-22072000>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=558191016-22072000>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=558191016-22072000>?- 
listing(test).</SPAN></FONT></DIV>
<DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=558191016-22072000>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=558191016-22072000>test(1).</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=558191016-22072000>test(original).</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=558191016-22072000>test(3).</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=558191016-22072000></SPAN></FONT>&nbsp;</DIV></SPAN></FONT></DIV></SPAN></FONT></SPAN></FONT><FONT 
face=Arial color=#0000ff size=2><SPAN 
class=558191016-22072000></SPAN></FONT></DIV></DIV></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=558191016-22072000>?- 
asserta(test(a)),</SPAN></FONT><FONT face=Arial color=#0000ff size=2><SPAN 
class=558191016-22072000>assertz(test(z)).</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=558191016-22072000>?- 
retract(test(1)).</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=558191016-22072000>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=558191016-22072000>?- 
listing(test).</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=558191016-22072000>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=558191016-22072000>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=558191016-22072000>test(a).</SPAN></FONT></DIV>test(original).</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=558191016-22072000>test(3).</SPAN></FONT></DIV></SPAN></FONT></DIV></SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=558191016-22072000>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=558191016-22072000>test(z).</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=558191016-22072000></SPAN></FONT>&nbsp;</DIV></SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=558191016-22072000>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=558191016-22072000>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=558191016-22072000>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=558191016-22072000>?- 
consult('consultTest.txt'), listing(test).</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=558191016-22072000>test(1).</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=558191016-22072000>test(original).</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=558191016-22072000>test(3).</SPAN></FONT></DIV></SPAN></FONT></SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=558191016-22072000></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=558191016-22072000>?- 
assert(test(z)),listing(test).</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=558191016-22072000>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=558191016-22072000>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=558191016-22072000>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=558191016-22072000>test(1). 
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=558191016-22072000>test(original).</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=558191016-22072000>test(3).</SPAN></FONT></DIV></SPAN></FONT></DIV>test(z).</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=558191016-22072000></SPAN></FONT>&nbsp;</DIV></SPAN></FONT></DIV></SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=558191016-22072000>%&nbsp;now in the top of <SPAN 
class=558191016-22072000>"consultTest.txt" put the 
line</SPAN></SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=558191016-22072000><SPAN 
class=558191016-22072000></SPAN></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=558191016-22072000><SPAN 
class=558191016-22072000><SPAN class=558191016-22072000><SPAN 
class=558191016-22072000>&nbsp;:-multifile(test/1).</SPAN></SPAN></SPAN></SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=558191016-22072000><SPAN 
class=558191016-22072000>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=558191016-22072000></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=558191016-22072000>?- 
consult('consultTest.txt'), 
listing(test).</SPAN></FONT></DIV></SPAN></SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=558191016-22072000><SPAN 
class=558191016-22072000>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=558191016-22072000>test(z).</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=558191016-22072000>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=558191016-22072000>test(1). 
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=558191016-22072000>test(original).</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=558191016-22072000>test(3).</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=558191016-22072000></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=558191016-22072000></SPAN></FONT>&nbsp;</DIV></SPAN></FONT></DIV></SPAN></FONT></DIV></SPAN></SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=558191016-22072000>The 
problem you had ran into is when the file was consulted it also compiled test/1. 
as static (static is default).</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=558191016-22072000>Since 
Prolog is a programming language as well as a smart database.. 
</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=558191016-22072000>When I 
have a list of facts this is how i&nbsp;import them...</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=558191016-22072000></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=558191016-22072000>load_datafile(DataFile) :-</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=558191016-22072000>&nbsp;&nbsp;&nbsp; see(DataFile),</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=558191016-22072000>&nbsp;&nbsp;&nbsp; repeat,</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=558191016-22072000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
read(Datum),</SPAN></FONT><FONT face=Arial color=#0000ff size=2><SPAN 
class=558191016-22072000>assert(Datum),</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=558191016-22072000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
Datum=end_of_file,seen,retract(Datum).&nbsp;&nbsp; </SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=558191016-22072000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
% the last 'retract'&nbsp;takes out the&nbsp;&nbsp;end_of_file 
:)</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=558191016-22072000></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=558191016-22072000></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=558191016-22072000></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=558191016-22072000><SPAN 
class=558191016-22072000>Jan&nbsp;is there &nbsp;implemented a 'Default 
consulting mode' flag somewhere that can be defaulted to dynamic and/or 
multifile?</SPAN></SPAN></FONT></DIV>
<DIV></SPAN></FONT></SPAN></FONT><FONT face=Arial color=#0000ff size=2><SPAN 
class=558191016-22072000></SPAN></FONT>&nbsp;</DIV></DIV></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
  <DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma 
  size=2>-----Original Message-----<BR><B>From:</B> Jason Che-han Yip 
  [mailto:yip@ee.ualberta.ca]<BR><B>Sent:</B> Saturday, July 22, 2000 9:14 
  AM<BR><B>To:</B> Douglas Miles (Volt Computer)<BR><B>Subject:</B> Re: 
  Modifying consulted rules<BR><BR></FONT></DIV>
  <DIV><FONT face=Arial size=2>Here's my test running SWI-Prolog 
  stand-alone:</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>I have a file "consultTest.txt" with the fact 
  test(original).</FONT></DIV>
  <DIV><FONT face=Arial size=2>I consult this file.&nbsp; listing shows that 
  test(original) is now in the database.</FONT></DIV>
  <DIV><FONT face=Arial size=2>I try assert(test(new)) and I get ERROR: No 
  permission to modify static_procedure 'test_1'</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>So I try assert(newTest(old)), check listing, 
  it's there.</FONT></DIV>
  <DIV><FONT face=Arial size=2>Try assert(newTest(new)).&nbsp; Checking listing 
  shows both newTest(old) and newTest(new)</FONT></DIV>
  <DIV><FONT face=Arial size=2>----</FONT></DIV>
  <DIV><FONT face=Arial size=2>So I figured that consulted facts/rules were 
  un-modifiable but I didn't think that was supposed to be the 
case?</FONT></DIV>
  <BLOCKQUOTE dir=ltr 
  style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
    <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
    <DIV 
    style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> 
    <A title=a-doug@microsoft.com href="mailto:a-doug@microsoft.com">Douglas 
    Miles (Volt Computer)</A> </DIV>
    <DIV style="FONT: 10pt arial"><B>To:</B> <A title=yip@ee.ualberta.ca 
    href="mailto:yip@ee.ualberta.ca">'Jason Che-han Yip'</A> ; <A 
    title=prolog@swi.psy.uva.nl 
    href="mailto:prolog@swi.psy.uva.nl">prolog@swi.psy.uva.nl</A> </DIV>
    <DIV style="FONT: 10pt arial"><B>Sent:</B> Friday, July 21, 2000 5:06 
    PM</DIV>
    <DIV style="FONT: 10pt arial"><B>Subject:</B> RE: Modifying consulted 
    rules</DIV>
    <DIV><FONT face=Arial size=2></FONT><FONT face=Arial size=2></FONT><FONT 
    face=Arial size=2></FONT><FONT face=Arial size=2></FONT><FONT face=Arial 
    size=2></FONT><FONT face=Arial size=2></FONT><BR></DIV>
    <DIV><FONT face=Arial color=#0000ff size=2><SPAN 
    class=471135322-21072000>"<FONT color=#000000>no permission to modify static 
    procedures"</FONT></SPAN></FONT></DIV>
    <DIV><FONT face=Arial size=2><SPAN class=471135322-21072000>is ussuly due to 
    a syntactical misplacement of a&nbsp;comma or semicollon in 
    code</SPAN></FONT></DIV>
    <DIV><FONT face=Arial size=2><SPAN class=471135322-21072000>one missing 
    period or one comma can make the prolog engine think you are trying to add 
    your&nbsp;own&nbsp; version of&nbsp; 
','(_,_).</SPAN></FONT></DIV></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>

------_=_NextPart_001_01BFF3FC.761132D0--

