This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-06-04
Channels
- # announcements (13)
- # asami (68)
- # babashka (19)
- # beginners (51)
- # calva (4)
- # cider (3)
- # clj-kondo (13)
- # clojure (161)
- # clojure-australia (3)
- # clojure-europe (21)
- # clojure-nl (4)
- # clojure-spec (9)
- # clojure-sweden (13)
- # clojure-uk (9)
- # clojured (14)
- # clojurescript (7)
- # conjure (4)
- # cursive (16)
- # data-science (2)
- # datalog (1)
- # figwheel-main (7)
- # graalvm (18)
- # helix (14)
- # introduce-yourself (1)
- # jackdaw (9)
- # jobs (1)
- # kaocha (1)
- # malli (8)
- # meander (8)
- # off-topic (7)
- # pathom (11)
- # proletarian (3)
- # shadow-cljs (29)
- # tools-deps (106)
- # xtdb (8)
https://github.com/threatgrid/asami/wiki/Introduction#multiple-answers => To see this, let's look for all of the _*:first-name*_s again.
... renders a little weirdly on GitHub.
Took me a minute to parse "Part 1/2" ~= "Pattern 1 / 2" (in the table) in this section: https://github.com/threatgrid/asami/wiki/Introduction#part-2-1 ... maybe labels on the patterns themselves would help with clarity? (Ditto Part 3... though I think by the time a person gets that far, the references to the query triples is obvious.)
@quoll This is a great intro! I don't think I've seen these kinds of query / image pairings before. They really do a nice job of demonstrating what each clause is doing. đ
Thanks for the first one. Fixed. The second one⌠I was just breaking it down into parts⌠it didnât occur to me exactly that there was a one-to-one with patterns. Should I rename the sections âPattern 1â, âPattern 2", âPattern 3â?
That would work too, yup.
It's not as though it's impenetrable as-is... but it did cause me to backtrack on my first pass.
Iâm kinda running on fumes right now. I started it yesterday afternoon, and finished it this evening.
Oh, I know why I was calling it parts! I have a bullet point list of the requirements, and I was aligning it with that!
It's very readable. It's late, 35 degrees celsius, and I'm full of hamburgers. But I could still breeze through it nodding "yup, yup" to myself the whole way.
Ah, in the Goal section
but it aligns with patterns already. So Iâm good making the change (already done)
Looking forward to the next instalment. đ
Iâve been meaning to write it for a while, but when a colleague said that they didnât really get these graph queries, then I decided that I had to get it done
Iâve been hearing from friends with ADHD recently that colored images help them stay connected with the material, so I worked on that a lot
Like⌠I want to compare these patterns to SPARQL Basic Graph Patterns (BGPs), because theyâre basically the same
e.g.
[:find ?title
:where {:first-name "Sally"
:last-name "Smith"
:title ?title}]
c.f.
SELECT ?title
WHERE {:first-name "Sally";
:last-name "Smith";
:title ?title}
equivalent to:
[:find ?title
:where [?n :first-name "Sally"]
[?n :last-name "Smith"]
[?n :title ?title]]
Hmmmmm.
I think unless Asami actually works like that, I wouldn't include alternate syntax in your intro guide... I could definitely see that get confusing for new users.
Relatedly, I have been fantasizing about writing up a SPARQL / Datalog / edn Datalog flavours (Datomic, Asami, Crux) / SQL comparison sheet.
Asami doesnât do that now, though Iâd like it to. But if it did do that then I still would not put it into an introduction
It doesnât show any of the projection options (in fact, I kind of gloss over the return type of the q
function)
I think that once you have a handle on how patterns and conjunctive joins work, then the rest of it comes much easier
I wasnât even going to include the _
syntax until I realized that it helped me to explain the template nature of the patterns
Also, my colleague who was struggling with it explained that seeing ?varname
everywhere was the most confusing part
I agree. The concepts are actually surprisingly simple for a first-time user, which can be confusing in its own right. If someone is accustomed to cobbling together lumpy SQL queries, tiny clauses each potentially representing its own join can feel pretty alien.
So I tried to introduce variables more carefully, and I was told that it worked. (whew!)
Yes⌠this is a thing that has frustrated me for many years. Itâs actually quite simple (as in, there are few connected parts), and yet it still eludes many people.
> The ? characters were throwing them off
I had this problem too, back in 2014. I couldn't actually say why, though. Like, I understood what the ?var
pattern meant, intellectually, but I couldn't visually parse it for the longest time.
> as in, there are few connected parts Yeah, it's a bit of a paradox. Because we're so accustomed to more complex query languages, we're expecting complications where there aren't any.
When we built TQL (Tucana Query Language) for Tucana/Kowari/Mulgara then we used $
instead. But then RDQL (RDF Data Query Language) used ?
. So when SPARQL first came out it allowed either (committees FTW!)
I donât know why Rich went that way though. Maybe because SPARQL tends to use it? He did say that it was an influence
Makes sense. Hakan said the Crux Datalog implementation had a massive SPARQL overlap, too.
We just adapted the Learn Datalog Today tutorial to Crux: http://opencrux.com/tutorials/ (right hand side) ... but I'm realizing that the visuals you've come up with here are actually better introductory material.
I actually think a middle-ground between the two approaches would be a lot of fun.
Iâve been thinking that I need to bring in Instaparse and parse SPARQL. It can just generate Clojure data structures, and it will work
"Solve for XYZ query, execute it, and see the small graph visualization on the other side of the screen highlight what you've done." kind of thing.
BTW, youâre going to see me studiously avoiding the use of the term âDatalogâ đ
Ha! Fair. I think we've progressively started labelling it "EDN Datalog" more and more often internally.
I only know of a single Clojure implementation of https://en.wikipedia.org/wiki/Datalog#Syntax
Yeah, I was harassing Hakan for a Crux parser that could handle horn clauses much earlier, but his pushback is that there isn't a good standard for "true" Datalog syntax anyway... which feels like a legitimate reason not to chase it. He basically made me read the What you Always Wanted to Know About Datalog (And Never Dared to Ask)
paper and I gave up. đ
I think thatâs true; I suspect itâs compounded by the fact that itâs usually a subset of prolog syntax. And prolog syntax is ISO standardised; but you have to pay to access the standard, and canât republish it, and consequently canât really define a proper formal subset. So I suspect folk just hack something that works & looks like prolog.
Also I guess itâs rooted in academic literature; and academics are usually more interested in papers, and creating their own implementations than shared standards.
Morning, I was playing with some algorithms for top sorting, I just stumble upon a possible "issue" other users can meet:
(def db-uri "asami:")
(def data
[{:db/ident :t1 :task/name "Task 1" :task/requires [{:db/ident :t3}]}
{:db/ident :t2 :task/name "Task 2" :task/requires [{:db/ident :t1}]}
{:db/ident :t3 :task/name "Task 3" :task/requires [{:db/ident :t1} {:db/ident :t2}]}
{:db/ident :t4 :task/name "Task 4" :task/requires [{:db/ident :t2} {:db/ident :t3}]}
{:db/ident :j1 :job/name "Job 1"}])
(defn build-db
[db-uri]
(d/create-database db-uri)
(let [conn (d/connect db-uri)]
(d/transact conn data)
(d/entity (d/db conn) :t3 true)))
Expanding :t3
results in a Execution error (StackOverflowError) at zuko.schema/eval9645$vartest? (schema.cljc:35). null
Probably it's not an Asami duty to inform the user that the graph is circular
But it can happen