Skip to content

Instantly share code, notes, and snippets.

@CliffordAnderson
Last active May 26, 2020 16:32
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save CliffordAnderson/5be754415308dc407fc9 to your computer and use it in GitHub Desktop.
Save CliffordAnderson/5be754415308dc407fc9 to your computer and use it in GitHub Desktop.
Some books
Author Title ISBN Binding Year Published
Jeannette Walls The Glass Castle 074324754X Paperback 2006
James Surowiecki The Wisdom of Crowds 9780385503860 Paperback 2005
Lawrence Lessig The Future of Ideas 9780375505782 Paperback 2002
Larry Bossidy, Ram Charan, Charles Burck Execution 9780609610572 Hardcover 2002
Kurt Vonnegut Slaughterhouse-Five 9780791059258 Paperback 1999
Haruki Murakami After the Quake 9780375413902 Paperback 2003
Nassim Nicholas Taleb Fooled by Randomness 9781587991905 Paperback 2005
Robert A. Dahl On Democracy (Yale Nota Bene) 9780300194463 Paperback 2000
Daniel Defoe A Journal of the Plague Year 9780140430158 Paperback 2001
Philip K. Dick Do Androids Dream of Electric Sheep? 9780345404473 Paperback 1996
Janna Levin A Madman Dreams of Turing Machines 9781400040308 Hardcover 2006
Alan Moore, David Lloyd V for Vendetta 9781401207922 Paperback 1995
Edward W. Said Orientalism 9780394740676 Paperback 1979
Gary Shteyngart The Russian Debutante's Handbook 9781573229883 Paperback 2003
Raymond Chandler Farewell, My Lovely 9780679740902 Paperback 1992
Stefan Zweig Beware of Pity 9780517546734 Paperback 2006
James Blish A Case of Conscience 9780345438355 Paperback 2000
Alan Moore Watchmen 99780606357425 Paperback 1995
Marilynne Robinson Gilead 9780374153892 Hardcover 2004
xquery version "3.1";
let $csv := fetch:text("https://gist.githubusercontent.com/CliffordAnderson/5be754415308dc407fc9/raw/daa23df71ceef375b83dd5b290284f83beeb710b/books.csv")
let $books := csv:parse($csv, map { 'header': true() })/csv/record
for $book in $books
order by fn:replace($book/Title, "^([A|The]? )(.*)", "$2") (: Remove stopwords from titles :)
group by $binding := $book/Binding (: Group into hardcovers and paperbacks :)
order by $binding (: Put groups into alphabetical order :)
return element {$binding} {attribute number {fn:count($book)}, $book}
xquery version "3.1";
let $books := fetch:text("https://gist.githubusercontent.com/CliffordAnderson/5be754415308dc407fc9/raw/daa23df71ceef375b83dd5b290284f83beeb710b/books.csv")
return csv:parse($books, map { 'header': true() })
xquery version "3.1";
(: Returns a list of the group by covers (hardcover, paperback) :)
let $books := fetch:text("https://gist.githubusercontent.com/CliffordAnderson/5be754415308dc407fc9/raw/daa23df71ceef375b83dd5b290284f83beeb710b/books.csv")
return csv:parse($books, map { 'header': true() })
xquery version "3.1";
(: Returns a list of the books ordered by author and titles :)
let $books := fetch:text("https://gist.githubusercontent.com/CliffordAnderson/5be754415308dc407fc9/raw/daa23df71ceef375b83dd5b290284f83beeb710b/books.csv")
return csv:parse($books, map { 'header': true() })
xquery version "3.1";
(: Returns a list of the books ordered by author :)
let $books := fetch:text("https://gist.githubusercontent.com/CliffordAnderson/5be754415308dc407fc9/raw/daa23df71ceef375b83dd5b290284f83beeb710b/books.csv")
return csv:parse($books, map { 'header': true() })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment