
data_source.pl -- Cached data access
This module provides access to external data by caching it as a Prolog
predicate. The data itself is kept in a global data module, so it is
maintained over a SWISH Pengine invocation.
data materialized(+Hash, +Signature, +SourceVersion) is det- Called by a data plugin to indicate that loading the data has
finished.
- Arguments:
-
Hash | - is the has of the original data source |
Signature | - is a term Hash(Arg1, Arg2, ...), where Arg1, ...
are atoms or small integers that indicate the field names. |
SourceVersion | - is a term that indicates the identity of the source.
this is typically a dict containing e.g., a time stamp, content
hash, HTTP Etag value, etc. |
data_source(:Id, +Source) is det- Create a data source Id from the source definition Source. Source
definitions are plugin files loaded from
swish(data)
.
record(:Id, -Record) is nondet
data_record(:Id, -Record) is nondet- True when Record is a dict representing a row in the dataset
identified by Id.
- deprecated
- - record/2 is deprecated. New code should use
data_record/2.
data_row(:Id, -Row) is nondet
data_row(:Id, +Range, +Header, -Row) is nondet- True when Row is a term Id(Arg, ...), where the first row contains
the column names.
- Arguments:
-
Header | - If true , include a header row. |
- See also
- - data_dump/3 to return a table and for a description of Range.
data_dump(:Id, +Range, -Table) is det- Table is a list of rows in the indicated range. This cooperates with
the table rendering to produce a data table. Range is one of:
- all
- All rows from the data are included. Be careful if these
are many as it is likely to make your browser very slow.
- From - To
- List the (1-based) rows From to To
- Count
- If Count >= 0, list the first, else list the last
Count rows.
data_property(:Id, ?Property) is nondet- True when Property is a known property about the data source Id.
Defined properties are:
- columns(-Count)
- Number of columns in the table.
- column_names(-Names)
- Names is a list of the column names as they appear in the
data.
- rows(-Rows)
- Number of rows in the table
- hash(-Hash)
- Get the internal (hashed) identifier for the data source
- source_version(-SourceVersion)
- A term (often a dict) that provides version information
about the source. Details depend on the source.
- materialized(-TimeStamp)
- The data source was materialized at TimeStamp.
- source(-Term)
- Description of the original source term used to declare
the data source
swish:goal_expansion(+Dict, -DataGoal)[multifile]- Translate a Dict where the tag is the identifier of a data source
and the keys are columns pf this source into a goal on the data.
Note that the data itself is represented as a Prolog predicate,
representing each row as a fact and each column as an argument.
data_flush(+Hash)- Drop the data associated with hash
Re-exported predicates
The following predicates are exported from this file while their implementation is defined in imported modules or non-module files loaded by this module.
record(:Id, -Record) is nondet
data_record(:Id, -Record) is nondet- True when Record is a dict representing a row in the dataset
identified by Id.
- deprecated
- - record/2 is deprecated. New code should use
data_record/2.
data_row(:Id, -Row) is nondet
data_row(:Id, +Range, +Header, -Row) is nondet- True when Row is a term Id(Arg, ...), where the first row contains
the column names.
- Arguments:
-
Header | - If true , include a header row. |
- See also
- - data_dump/3 to return a table and for a description of Range.
Undocumented predicates
The following predicates are exported, but not or incorrectly documented.
data assert(Arg1)
data failed(Arg1, Arg2)