KP65
KP65

Reputation: 13585

XSB Prolog - How can I consult a .p file?

Hey guys, this should be quite simple to answer....

Im using XSB Prolog...trying to load a .p prolog database

I have a file xxx.P in directory C:\XSB

So in XSB I type

?consult('xxx.p').

and i get:

cannot find the file or module xxx.p

i've tried moving the p file to the same directory as the XSB executable but no luck. Any ideas?

edit: contents of xxx.p:

has_access(tom,123).
has_access(bob,456).

thanks

Upvotes: 2

Views: 1968

Answers (2)

Jeff Dallien
Jeff Dallien

Reputation: 5091

XSB uses the file extension to determine the file type and it only recognizes .P (capital P) and .pl as Prolog files. Name your file with either a .P or .pl extension and consult it that way.

| ?- consult('test.p').

no
| ?- consult('test.P').
[Compiling .\test]
[test compiled, cpu time used: 0.0200 seconds]
[test loaded]

yes

Upvotes: 2

Vincent Ramdhanie
Vincent Ramdhanie

Reputation: 103135

Try using the fully qualified name of the file like this:

 ?consult('C:\\XSB\\xxx.p').

If I remember correctly you have to escape the backslashes.

Upvotes: 1

Related Questions