Problems running band example
wdduncan opened this issue · 2 comments
I installed swi-prolog using Homebrew. Version install is 8.0.3
.
Sparqlprog version is 0.2.9
.
I tried to run the example described here:
https://www.swi-prolog.org/pack/file_details/sparqlprog/prolog/sparqlprog.pl
This runs fine: [library(sparqlprog)].
This asks if I want to correct the statement:
rdf_register_prefix(dbont,'http://dbpedia.org/ontology/').
>> "rdf_prefixes:rdf_register_prefix(dbont,'http://dbpedia.org/ontology/')"?
I answered yes to this.
I can run the query: dbp ?? rdf(B,rdf:type,dbont:'Band'), rdf(B,dbont:bandMember,M).
and receive some output, although I expected more band/members to be listed:
B = 'http://dbpedia.org/resource/Alice_in_Chains',
M = 'http://dbpedia.org/resource/Sean_Kinney'
When I run:
band(X) :- rdf(X,rdf:type,dbont:'Band').
I receive the error:
ERROR: Undefined procedure: (:-)/2
ERROR: Rules must be loaded from a file
ERROR: See FAQ at http://www.swi-prolog.org/FAQ/ToplevelMode.txt
ERROR: In:
ERROR: [9] throw(error(existence_error(procedure,...),_11284))
ERROR: [8] '$dwim':dwim_existence_error(error,user:(:-)/2) at /usr/local/Cellar/swi-prolog/8.0.3_1/libexec/lib/swipl/boot/dwim.pl:113
ERROR: [6] '$dwim':correct_goal((band(_11380):-rdf(_11384,...,...)),user,['X'=_11400],_11370) at /usr/local/Cellar/swi-prolog/8.0.3_1/libexec/lib/swipl/boot/dwim.pl:85
ERROR:
ERROR: Note: some frames are missing due to last-call optimization.
ERROR: Re-run your program in debug mode (:- debug.) to get more detail.
although I expected more band/members to be listed:
you probably hit enter. Hit ;
for more
band(X) :- rdf(X,rdf:type,dbont:'Band').
you enter queries on the REPL. The above is a rule that needs to be asserted. You would do this by putting the rule in a .pl
file and consulting it
Thanks!
How would you get it to stream results w/o hitting the ;
.
After some digging, I found that you could enter rules using the user
pseudo file (not sure what this is):
?- [user].
|: band(X) :- rdf(X,rdf:type,dbont:'Band').
|: band_member(S,O) :- rdf(S,dbont:bandMember,O).
|: ^D% user://1 compiled 0.00 sec, 2 clauses
true.
So, I have the basics. What do you suggest next?