Basic Query Language as a PEG and in-memory evaluation for simple statements.
Closes #9
Query api is exposed at '/query' endpoint, with the query encoded as text in the body, and the data returned in json.
Example:
# publish a couple of statements
$ curl -H "Content-Type: application/json" -d '{"object": "QmABC", "refs": ["abc"], "tags": ["test"]}' http://127.0.0.1:9002/publish/foo.bar
QmWwnVop4hHB3K6z2vuUgU9rh5VrDwMnwuiP9LZew7NzUK:1474465964:0
$ curl -H "Content-Type: application/json" -d '{"object": "QmABC", "refs": ["abc"], "tags": ["test"]}' http://127.0.0.1:9002/publish/foo.baz
QmWwnVop4hHB3K6z2vuUgU9rh5VrDwMnwuiP9LZew7NzUK:1474465972:1
# count the number of statements
$ curl -H "Content-Type: application/text" -d 'SELECT COUNT(*) FROM *' http://127.0.0.1:9002/query
[2]
# get the set of namespaces we have published in
$ curl -H "Content-Type: application/text" -d 'SELECT namespace FROM *' http://127.0.0.1:9002/query
["foo.bar","foo.baz"]
# fets the statement id and timestamp of all statements in foo.bar
$ curl -H "Content-Type: application/text" -d 'SELECT (id, timestamp) FROM foo.bar' http://127.0.0.1:9002/query
[{"id":"QmWwnVop4hHB3K6z2vuUgU9rh5VrDwMnwuiP9LZew7NzUK:1474465964:0","timestamp":1474465964}]
See mc/query/query.peg for the complete syntax of the query language as a PEG.
Basic Query Language as a PEG and in-memory evaluation for simple statements. Closes #9
Query api is exposed at '/query' endpoint, with the query encoded as text in the body, and the data returned in json.
Example:
See
mc/query/query.peg
for the complete syntax of the query language as a PEG.