Resource/2,3 can/should they be used?

Using SWI-Prolog (threaded, 64 bits, version 8.4.0) on Windows 10.

Considering using resource/2,3 in some proof of concept code and was looking for usage of the predicates in code. Found many predicates that use the name resource but they were not the desired predicate. They were defined differently in different modules, e.g. rdf_diagram, saml, pce_resource_compatibility.

Is resource/2,3 something that can/should be used or is it on its death bed?

For those wanting to know more about resources see: Using program resources

A resource is similar to a file. Resources, however, can be represented in two different formats: on files, as well as part of the resource archive of a saved state (see qsave_program/2) that acts as a virtual file system for the SWI-Prolog I/O predicates (see open/4, register_iri_scheme/3).

A resource has a name . The source data of a resource is a file. Resources are declared by adding clauses to the predicate resource/2 or resource/3. Resources can be accessed from Prolog as files that start with res:// or they can be opened using open_resource/3.

1 Like

Resources are extremely useful to produce single file deployment. In my humble opinion, it is a great advantage to have them.