Skip to content

Commit

Permalink
Get rid of HSQ, just "simple" queries
Browse files Browse the repository at this point in the history
  • Loading branch information
vmagamedov committed Sep 16, 2016
1 parent 1554806 commit b75083f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 14 deletions.
31 changes: 22 additions & 9 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,36 @@ Of course this is optional feature, and you are not required to rewrite
your code in order to use this feature later, code is initially written
in a way to make possible to run it concurrently.

★ Query your graph using `Hiku Simple Queries (HSQ)` or using GraphQL_
(in the future). This is how client can express its needs and avoid
data underfetching or data overfetching. Client will load only what
it currently needs using one query, instead of multiple queries to
different *resources* (as in RESTful APIs, for example). `HSQ` is
basically a data structure in EDN_ format. For example:
★ Query your graph using `simple` queries or using GraphQL_ (in the future).
This is how client can express its needs and avoid data underfetching or data
overfetching. Client will load only what it currently needs using one query,
instead of multiple queries to different *resources* (as in RESTful APIs, for
example). `Simple` queries are basically a data structures in edn_ format. For
example:

.. code-block:: clojure
[:now]
[{:characters [:name :species]}]
will result in:

.. code-block:: javascript
{
"now": "2015-10-21T07:28:00.000000"
"characters": [
{
"name": "James T. Kirk",
"species": "Human"
},
{
"name": "Spock",
"species": "Vulcan/Human"
},
{
"name": "Leonard McCoy",
"species": "Human"
}
]
}
★ Abstract implementation details of how and where data actually stored,
Expand All @@ -57,4 +70,4 @@ and transform data from low-level graph.
changelog/index

.. _GraphQL: http://facebook.github.io/graphql/
.. _EDN: https://github.com/edn-format/edn
.. _edn: https://github.com/edn-format/edn
12 changes: 7 additions & 5 deletions hiku/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
==========
`Hiku` doesn't rely on any specific query language, internally it uses generic
data structures (query nodes) to describe result and they could be constructed
by parsing different suitable query languages.
query representation to describe result and it could be constructed by parsing
different suitable query languages.
However, `Hiku` provides one built-in way to describe result - `edn`_ data
structure (**HSQ** - Hiku Simple Query), similar to the `Datomic Pull API`_.
However, `Hiku` provides one built-in way to describe result -- `edn`_ data
structure -- `simple` queries, which are maybe the same as `om.next`_ queries,
which are inspired by `Datomic Pull API`_.
Why not to use `GraphQL`_ by default? `GraphQL` is complex due to the need to
write queries/fragments manually by hand. `HSQ` queries are not even queries,
write queries/fragments manually by hand. `Simple` queries are not even queries,
they are just simple data structures - specifications of the result, they are
really easy to work with.
Expand Down Expand Up @@ -62,6 +63,7 @@
.. _edn: https://github.com/edn-format/edn
.. _Datomic Pull API: http://docs.datomic.com/pull.html
.. _GraphQL: http://facebook.github.io/graphql/
.. _om.next: https://github.com/omcljs/om/wiki/Documentation-(om.next)
"""
from itertools import chain
from collections import OrderedDict
Expand Down

0 comments on commit b75083f

Please sign in to comment.