https://github.com/eraserhd/clara-eql
Supports ClojureScript and resolves an issue with generated code when
attribute names contain periods.
*clara-eql*
Generate Clara rules to collect data from EDN Query Language queries (a.k.a
pull expressions).
Usage
(require '[net.eraserhead.clara-eql :as clara-eql])
(clara-eql/defrule test-query
:query
[:person/first-name
:person/last-name
{:person/supervisor
[:person/uuid]}]
:from ?eid
:where
[EAV (= e ?eid) (= a :person/uuid)]
[:test (even? ?eid)])
(defrule foo
[clara-eql/QueryResult (= root 42) (= query 'test-query) (= data ?data)]
=>
(println "Data is now: " (pr-str ?data)))
*Assumptions*
All data is stored in EAV triples, in clara_eav.eav.EAV records
Nothing else from clara-eav is required, but using the same type makes the
libraries compatible.
Attribute values in the EAV triples are keywords
Well, they don’t have to be keywords, specifically, but this library does
not handle Datomic-style indirection where a number represents an attribute
and a keyword is assigned with a :db/ident property.
Many-valued Attributes
The shape of the pull result differs for many-valued attributes. clara-eql
assumes these attributes have a fact (→EAV attr-name :db/cardinality
:db.cardinality/many).
Identity Attributes
Identity attributes can be used for entity references, such as
[:person/uuid #uuid "3fec670d-da20-4171-a96d-e5852be05ded"]. clara-eql
assumes identity attributes have a fact (→EAV attr-name :db/unique
:db.unique/identity).
License
Copyright © 2019 Jason Felice
This program and the accompanying materials are made available under the
terms of the Eclipse Public License 2.0 which is available at
http://www.eclipse.org/legal/epl-2.0.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/clojure/CAB6_SobRJBeKZzPOtL1Bh2iCnFpPheCy-jR7B4y%3DrTPP%2BuZavQ%40mail.gmail.com.