3 ms·
Curious that there is no mention of Datalog [^1] for graph traversal in the paper. To support multi-locale names in Datomic or Datascript-flavoured Datalog att
by pgt 5y ago
Curious that there is no mention of Datalog [^1] for graph traversal in the paper.
To support multi-locale names in Datomic or Datascript-flavoured Datalog attractions_v1.pq would be written as (where :entity/locale is of type :db.type/ref):
(d/q [:find ?id ?name ?lang
:in $ ?type
:where
[?e :entity/type ?type]
[?e :entity/locale ?loc]
[?loc :locale/name ?name]
[?loc :locale/lang ?lang]
db #{"museum" "theme_park"})
=> (["/z/38dwfnb8" "Museum of Modern Art" "en"]
["/z/38dwfnb8" "Museo de Arte Moderno" "es"]
...)
You could store the locale inside the name string, but then you can't efficiently filter on it. If you want the whole shebang, can do `(pull ?id [*])`. It's not obvious in their example if the locale filtering is post-query or part of the unification.
With only 4-tuple EAVT-style indices, you need an intermediate join to support compound values like ["Hello" "en"] if you want to query against the components, so I have been toying with making my own graph DB with 5-tuple (or more) extensible indices, e.g. EAXVT, where X would be the locale, but then index order matters.
[^1]: http://www.learndatalogtoday.org/ http://www.learndatalogtoday.org/
- simongray 5y agoClojure's Datalog ("Clojurelog") basically looks a whole lot like SPARQL written using Clojure data structure literals and they do reference SPARQL in the paper.