Reputation: 4199
With SWI-Prolog (Multi-threaded, 64 bits, Version 5.10.4) in Ubuntu, I am trying to get rdf triples from the rdf/3 predicate, following one of the tutorials (actually, all of them tell me the same, but the example below is along the lines of http://cliopatria.swi-prolog.org/tutorial/Parsia/ ). However, while other predicates seem to work well, the rdf/3 just gives nothing:
?- [library(semweb/rdf_db)].
...
true
?- [library(semweb/rdf_http_plugin)].
...
true
?- rdf_load('http://dbpedia.org/resource/Amsterdam').
% Parsed "http://dbpedia.org/resource/Amsterdam" in 0.32 sec; 4,194 triples
true.
?- rdf(S, P, O).
false.
?- rdf_graph(G).
G = 'http://dbpedia.org/resource/Amsterdam'.
Once or twice I got results for the S, if I put constants for P and O (but I forgot how to do it.). I am not sure, if it's a bug in my version of swipl or I have forgotten something important or something trivial. Prolog and libraries were installed from the standard Ubuntu 12.10 repo.
(I have not run any tests for the semweb library, because I do not know how to do it, as I do not program in Prolog every day)
Upvotes: 3
Views: 255
Reputation: 118
I always try to name the graph I'm loading my triples into and then using that name in the rdf/4
function. This works for me and makes explicit which graph you're querying. So for example:
?- rdf_load('http://dbpedia.org/resource/Amsterdam', [graph('amsterdam')]).
% Parsed "http://dbpedia.org/resource/Amsterdam" in 0.19 sec; 5,120 triples
true.
?- rdf_statistics(triples_by_graph(Graph, Triples)).
Graph = amsterdam,
Triples = 5120.
?- rdf(S, P, O, 'amsterdam').
S = 'http://dbpedia.org/resource/Cornelis_Pronk',
P = 'http://dbpedia.org/property/placeOfBirth',
O = 'http://dbpedia.org/resource/Amsterdam' .
Upvotes: 0
Reputation: 60034
I'm using SWI-Prolog installed from source, and I can see the triples after your example. Then probably you need to upgrade your version.
Upvotes: 1