kv is a simple key-value store written in Prolog with a tagging system.
- Make sure you have Prolog installed.
- Run
prolog
. - Enter the following command to load the key-value store:
consult('kv.pl').
- Run another instance of
prolog
. - Enter the following on the second instance to start the client:
consult('client.pl').
-
POST: Store a key-value pair:
post_kv([key], [value]).
-
GET: Retrieve the value for a key:
get_kv([key], Result).
-
DELETE: Remove a key-value pair:
delete_kv([key]).
-
TAG: Add a tag to a key-value pair:
tag_kv([key], [tag]).
-
UNTAG: Remove a tag from a tagged key-value pair:
untag_kv([key], [tag]).
-
TAG_QUERY: Retrieve a list of keys corresponding to pairs that match the query.
tag_query_kv([query], Result).
The query can be modified by three operators:
+
: Intersection between two sets|
: Union between two sets-
: Subtracting the second set from the first