Being new to prolog I am reading existing code (as well as trying to write some code). Having some prior background in semweb I started to play with it and see something that is confusing me. Example assertion:
?- rdf_assert(ex:bob, rdf:type, foaf:'Person').
I also did find the following in the documentation:
Remember: Internally, all resources are atoms. The transformations
above are realised at compile-time using rules for goal_expansion/2
provided by the rdf_db library
Am I correct in assuming that somehow the library is treating the three URIs as atoms? I thought that the compiler would treat this as module_name:predicate, but that does not seem to be the case. If that is true, could you please provide a simple example on how this could be done in prolog?
Thanks
Prolog is not a functional language. This implies
2+3does not evaluate to5and is just a term that gets meaning from the predicate that processes it. Likewise,ex:bobis just a term that has no direct relations to modules or predicates. Only predicates such call/1 will interpret this as "callbobin the moduleex".Next to that, (SWI-)Prolog (most Prolog's, but not all) have term expansion that allows you to rewrite the term that is read before it is handed to the compiler. That is used to rewrite the argument of
rdf/3: each appearance ofprefix:localis expanded to a full atom. You can check that by usinglisting/1on predicates that call rdf/3 using the prefix notation.See also rdf_meta