Skip to content

Commit 91db87b

Browse files
committed
so query
1 parent 762fe20 commit 91db87b

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

src/java/datomic/samples/Query.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -117,24 +117,14 @@ public static void main(String[] args) {
117117
System.out.println(year);
118118
pause();
119119

120-
System.out.println("Total number of artists without :artist/country attribute.");
120+
System.out.println("Total number of artists who aren't Canadian.");
121121
Integer res = Peer.query("[:find (count ?eid) . " +
122122
":where [?eid :artist/name] " +
123-
"(not [?eid :artist/country])]",
123+
"(not [?eid :artist/country :country/CA])]",
124124
db);
125125
System.out.println(res);
126126
pause();
127127

128-
System.out.println("Number of artists missing either country or gender. "+
129-
"(negation of conjunction reads 'not (clause1 and clause2)'");
130-
res = Peer.query("[:find (count ?eid) . " +
131-
":where [?eid :artist/name] " +
132-
"(not [?eid :artist/country] " +
133-
"[?eid :artist/gender])]",
134-
db);
135-
System.out.println(res);
136-
pause();
137-
138128
System.out.println("Use not-join to bind variable in subquery. Artists w/o releases in 1970.");
139129
res = Peer.query("[:find (count ?artist) . " +
140130
":where [?artist :artist/name] " +
@@ -145,6 +135,16 @@ public static void main(String[] args) {
145135
System.out.println(res);
146136
pause();
147137

138+
System.out.println("Number of 'Live at Carnegie Hall' releases not by Bill Withers");
139+
res = Peer.query("[:find (count ?r) . " +
140+
":where [?r :release/name \"Live at Carnegie Hall\"] " +
141+
"(not-join [?r] " +
142+
"[?r :release/artists ?a] " +
143+
"[?a :artist/name \"Bill Withers\"])]",
144+
db);
145+
System.out.println(res);
146+
pause();
147+
148148
System.out.println("Total of artists who are a group or female by use of 'or'.");
149149
res = Peer.query("[:find (count ?artist) . " +
150150
" :where (or [?artist :artist/type :artist.type/group] " +

0 commit comments

Comments
 (0)