‘Literal maps' provide a relation between literal values,
intended to create additional indexes on literals. The current
implementation can only deal with integers and atoms (string literals).
A literal map maintains an ordered set of keys. The ordering
uses the same rules as described in section
4.5. Each key is associated with an ordered set of values.
Literal map objects can be shared between threads, using a locking
strategy that allows for multiple concurrent readers.
Typically, this module is used together with rdf_monitor/2
on the channals
maintain an index of words that appear in a literal. Further abstraction
using Porter stemming or Metaphone can be used to create additional
search indices. These can map either directly to the literal values, or
indirectly to the plain word-map. The SWI-Prolog NLP package provides
complimentary building blocks, such as a tokenizer, Porter stem and
- Create a new literal map, returning an opaque handle.
- Destroy a literal map. After this call, further use of the Map
handle is illegal. Additional synchronisation is needed if maps that are
shared between threads are destroyed to guarantee the handle is no
longer used. In some scenarios rdf_reset_literal_map/1
provides a safe alternative.
- Delete all content from the literal map.
- Add a relation between Key and Value to the map.
If this relation already exists no action is performed.
+Key, +Value, -KeyCount)
- As rdf_insert_literal_map/3.
In addition, if Key is a new key in
Map, unify KeyCount with the number of keys in Map.
This serves two purposes. Derived maps, such as the stem and metaphone
maps need to know about new keys and it avoids additional foreign calls
for doing the progress in
- Delete Key and all associated values from the map. Succeeds
- Delete the association between Key and Value from
the map. Succeeds always.
- Unify ValueList with an ordered set of values associated to
all keys from KeyList. Each key in KeyList is
either an atom, an integer or a term
not(Key). If not-terms
are provided, there must be at least one positive keywords. The
negations are tested after establishing the positive matches.
- Realises various queries on the key-set:
- Unify Answer with an ordered list of all keys.
- Succeeds if Key is a key in the map and unify Answer
with the number of values associated with the key. This provides a fast
test of existence without fetching the possibly large associated value
set as with rdf_find_literal_map/3.
- Unify Answer with an ordered set of all keys that have the
given prefix. Prefix must be an atom. This call is intended
for auto-completion in user interfaces.
- Unify Answer with all keys that are larger or equal to the
- Unify Answer with all keys that are smaller or equal to the
- between(+Min, +Max)
- Unify Answer with all keys between Min and Max
- Query some statistics of the map. Provides keys are:
- size(-Keys, -Relations)
- Unify Keys with the total key-count of the index and
Relation with the total Key-Value