“Comics” Is Hard:
On Domains and Databases
Ben Sco eld – Viget Labs
domains
biology
Kingdom
 Animalia
 Phylum
 Chordata
 Class
 Mammalia
 Order
 Carnivora
 Family
 Felidae
 Genus
 Panthera
 Species
 tigris
...
Animalia
  Chordata
  Mammalia
  Carnivora
  Felidae
  Panthera
  tigris
ickr: pandiyan
kingdoms



           phyla



                   classes



                             orders



                     ...
Problem
The levels are imaginary
kingdoms


                             subphyla
           phyla
                         superclasses


                ...
kingdoms


                             subphyla
           phyla
                         superclasses


                ...
taxa


                 subspecies
       species
                  varieties
Species
ickr: cpurrin1
Reproductive Isolation
ickr: superciliousness
Reproductive Isolation
ickr: superciliousness
ickr: chiotsrun
ickr: niznoz
Numerical taxonomy
Cladistics
clades



         organisms
Problem
Cladistics is historical and
    counter-intuitive
ickr: goellnitz
ickr: goellnitz
      pcoin
The Challenge
Unclear, imprecise domain
comics
publishers



             titles



                      issues
publishers



             imprints



                        titles



                                 issues
publishers



             imprints



                        titles



                                 volumes



     ...
publishers



             imprints



                        titles



                                 volumes         ...
publishers



             imprints



                        titles



                                 volumes         ...
publishers



             imprints



                        titles                names



                            ...
publishers



             imprints




                                  ?
                        titles                ...
publishers               imprints




             ?!?!
             titles                   names



                   ...
science fiction
    noir         horror

     genres?
 independent
              Martial Arts
   historical
               ...
publishers               imprints




  #&*!
             titles                   names



                      volumes ...
The Challenge
Complete insanity
nosql
altdb
postrelational
lesssql
http://thisisindexed.com/2009/02/just-because-you-can-doesnt-mean-you-should/
key-value
stores
dynomite
tokyo cabinet
project voldemort
pstore
redis
require "rubygems"
                 require "tokyocabinet"

                 include TokyoCabinet

                 bdb = ...
Biology   x


Comics    x
Configuration   ✓


  Caching      ✓


Translations   ✓
document
databases
couchdb
jackrabbit
mongodb
rddb
riak
{
    'name':'Ben Scofield',
    'twitter':'@bscofield'
}

{
    'name':'Jim Van Fleet',
    'adjective':'awesomesauce'
}
class Question
 include MongoMapper::Document

 key :number, Integer, :required => true
 key :text, String, :required => t...
Biology   ✓


Comics    x
{
    ‘kingdom’:‘Animalia’,
    ‘phylum’:‘Chordata’,
    ‘subphylum’:‘Vertebrata’,
    ‘class’:‘Mammalia’,
    ‘subclass’:...
{
    ‘kingdom’:‘Animalia’,
    ‘subkingdom’:‘Eumetazoa’,
    ‘phylum’:‘Chordata’,
    ‘subphylum’:‘Vertebrata’,
    ‘clas...
graph
databases
allegograph
hypergraphdb
neo4j
activeRDF
http://neotechnology.com/why-neo
http://markorodriguez.com/Lectures_ les/risk-symposium2009.pdf
ickr: 9948354@N08
Biology   ✓


Comics    ✓
Animalia


             ...


           Felidae
                         subfamilyof


          genusof              Pan...
Animalia


                         ...


                       Felidae
                                     subfamilyof
...
Group IV


  orderof


Picornavirales



  familyof


Picornaviridae



  genusof


Rhinovirus


 speciesof

   human
rhin...
class        Mammalia     Group IV        group
                   orderof      orderof


                  Carnivora   Pi...
DC
                               imprintof


                    titleof                DC Universe


 Green             ...
require 'neo4j'

Neo4j::Transaction.run do
 dc = Neo4j::Node.new
 dc[:name] = 'DC'

 dc_universe = Neo4j::Node.new
 dc_uni...
other
alternatives
column-oriented
constant
in-memory
streaming
temporal
selection
None           Key-Value


 Many-One      Document-Oriented


 Many-Many         Relational


Many-Many ++        Graph
polyglot
persistence
{
    ‘title’:‘I Love Cheese’
    ‘content’:‘Cheese is...’
    ‘posted’:’24 Sept 2009’
    ‘comments’:[{
      ‘author’:‘J...
Tag                Tag                   Post
General             Life              1ec8264

 Work              Food      ...
HTTP
application          application
HTTP
application
application
application
Thank You
                    ben sco eld - @bsco eld
                     http://bensco eld.com
              http://www....
Charlotte.rb - "Comics" Is Hard
Charlotte.rb - "Comics" Is Hard
Charlotte.rb - "Comics" Is Hard
Charlotte.rb - "Comics" Is Hard
Charlotte.rb - "Comics" Is Hard
Charlotte.rb - "Comics" Is Hard
Charlotte.rb - "Comics" Is Hard
Charlotte.rb - "Comics" Is Hard
Charlotte.rb - "Comics" Is Hard
Charlotte.rb - "Comics" Is Hard
Charlotte.rb - "Comics" Is Hard
Charlotte.rb - "Comics" Is Hard
Charlotte.rb - "Comics" Is Hard
Charlotte.rb - "Comics" Is Hard
Charlotte.rb - "Comics" Is Hard
Charlotte.rb - "Comics" Is Hard
Charlotte.rb - "Comics" Is Hard
Charlotte.rb - "Comics" Is Hard
Charlotte.rb - "Comics" Is Hard
Charlotte.rb - "Comics" Is Hard
Charlotte.rb - "Comics" Is Hard
Charlotte.rb - "Comics" Is Hard
Charlotte.rb - "Comics" Is Hard
Charlotte.rb - "Comics" Is Hard
Charlotte.rb - "Comics" Is Hard
Charlotte.rb - "Comics" Is Hard
Upcoming SlideShare
Loading in...5
×

Charlotte.rb - "Comics" Is Hard

1,736

Published on

Domain modeling/alternative database presentation given at Charlotte.rb

1 Comment
1 Like
Statistics
Notes
No Downloads
Views
Total Views
1,736
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
19
Comments
1
Likes
1
Embeds 0
No embeds

No notes for slide
  • bad diagram - self-referential join in taxon table
  • TIGON - Tiger + Lioness
    Ernst Mayr: “groups of actually or potentially interbreeding natural populations, which are reproductively isolated from other such groups”
  • tomatoes - hybrids & heirlooms
  • PLUOT
    Plum + Apricot
  • Caminalcules (from Camin and animalcule) are a group of animal-like life forms invented by Professor Joseph H. Camin (University of Kansas) as a tool for understanding phylogenetics. Interested in how taxonomists group species, he designed these creatures to show an evolutionary pattern of divergence and diversification in morphology. There are 29 recent 'species' of Caminalcules and 48 fossil forms.
  • bad diagram - self-referential join in taxon table
  • problems with cladistics: historical change is hard to see, and cladistics gives you CRAZY counter-intuitive results
  • this is a little naive - titles can change imprints; in some cases, retroactively
  • ISSUES
    collected in diff trades
  • volume has-many trades
    trade has-many issues
    issue has-many trades
  • diff covers, and sometimes internal art
  • favorite variant cover of all time...
  • issue has-many variants (incl covers, writing, art)
  • issue has-many variants (incl covers, writing, art)
  • call attention to the title change (ala Aquaman)
    numbering changes: CAC started with #1 in 1941
  • call attention to the title change (ala Aquaman)
    numbering changes: CAC started with #1 in 1941
  • most recent volume of Cap started in 2005 -> #50
    then renumbered #600
  • most recent volume of Cap started in 2005 -> #50
    then renumbered #600
  • Fallen Angel -- DC => IDW
  • could be implemented as tagging
  • just because you can model relationships in these alt DBs, doesn’t mean you should. YOU SHOULDN’T!
  • Cassandra inherits from Amazon’s Dynamo and Google’s BigTable - eventual consistency, rich data model
  • for more information
  • CouchDB - HTTP
    Mongo - socket???
  • both use JSON
  • MongoMapper from John Nunemaker
  • for more information
  • Perfect use for document DB: CMS with custom fields
  • RDF / Web 2.0
    30 years old, finally coming into its own
  • back to the blog example
  • tags don’t fit in the document model
  • baby steps: polyglotting applications and/or web services
  • step two: connect to couch via HTTP directly (couch application)
  • step three: polyglot away!
  • step three: polyglot away!
  • Transcript of "Charlotte.rb - "Comics" Is Hard"

    1. 1. “Comics” Is Hard: On Domains and Databases Ben Sco eld – Viget Labs
    2. 2. domains
    3. 3. biology
    4. 4. Kingdom Animalia Phylum Chordata Class Mammalia Order Carnivora Family Felidae Genus Panthera Species tigris ickr: pandiyan
    5. 5. Animalia Chordata Mammalia Carnivora Felidae Panthera tigris ickr: pandiyan
    6. 6. kingdoms phyla classes orders families genera species
    7. 7. Problem The levels are imaginary
    8. 8. kingdoms subphyla phyla superclasses subclasses classes superorders suborders orders superfamilies subfamilies families subgenera genera subspecies species varieties
    9. 9. kingdoms subphyla phyla superclasses subclasses ? classes superorders suborders orders superfamilies subfamilies families subgenera genera subspecies species varieties
    10. 10. taxa subspecies species varieties
    11. 11. Species ickr: cpurrin1
    12. 12. Reproductive Isolation ickr: superciliousness
    13. 13. Reproductive Isolation ickr: superciliousness
    14. 14. ickr: chiotsrun
    15. 15. ickr: niznoz
    16. 16. Numerical taxonomy
    17. 17. Cladistics
    18. 18. clades organisms
    19. 19. Problem Cladistics is historical and counter-intuitive
    20. 20. ickr: goellnitz
    21. 21. ickr: goellnitz pcoin
    22. 22. The Challenge Unclear, imprecise domain
    23. 23. comics
    24. 24. publishers titles issues
    25. 25. publishers imprints titles issues
    26. 26. publishers imprints titles volumes issues
    27. 27. publishers imprints titles volumes trades issues reprints
    28. 28. publishers imprints titles volumes trades issues reprints variants
    29. 29. publishers imprints titles names volumes trades issues reprints variants
    30. 30. publishers imprints ? titles names volumes trades issues reprints nested set? variants
    31. 31. publishers imprints ?!?! titles names volumes trades issues reprints nested set? variants
    32. 32. science fiction noir horror genres? independent Martial Arts historical superhero Pirate
    33. 33. publishers imprints #&*! titles names volumes trades genres issues reprints nested set? variants
    34. 34. The Challenge Complete insanity
    35. 35. nosql altdb postrelational lesssql
    36. 36. http://thisisindexed.com/2009/02/just-because-you-can-doesnt-mean-you-should/
    37. 37. key-value stores
    38. 38. dynomite tokyo cabinet project voldemort pstore redis
    39. 39. require "rubygems" require "tokyocabinet" include TokyoCabinet bdb = BDB::new # B-Tree database; keys may have multiple values bdb.open("casket.bdb", BDB::OWRITER | BDB::OCREAT) # store records in the database, allowing duplicates bdb.putdup("key1", "value1") bdb.putdup("key1", "value2") bdb.put("key2", "value3") bdb.put("key3", "value4") # retrieve all values p bdb.getlist("key1") # => ["value1", "value2"] # range query, find all matching keys p bdb.range("key1", true, "key3", true) # => ["key1", "key2", "key3"] http://www.igvita.com/2009/02/13/tokyo-cabinet-beyond-key-value-store/
    40. 40. Biology x Comics x
    41. 41. Configuration ✓ Caching ✓ Translations ✓
    42. 42. document databases
    43. 43. couchdb jackrabbit mongodb rddb riak
    44. 44. { 'name':'Ben Scofield', 'twitter':'@bscofield' } { 'name':'Jim Van Fleet', 'adjective':'awesomesauce' }
    45. 45. class Question include MongoMapper::Document key :number, Integer, :required => true key :text, String, :required => true many :choices end class Choice include MongoMapper::EmbeddedDocument key :text, String, :required => true end
    46. 46. Biology ✓ Comics x
    47. 47. { ‘kingdom’:‘Animalia’, ‘phylum’:‘Chordata’, ‘subphylum’:‘Vertebrata’, ‘class’:‘Mammalia’, ‘subclass’:‘Eutheria’, ‘order’:‘Carnivora’, ‘family’:‘Felidae’, ‘subfamily’:‘Panthernae’, ‘genus’:‘Pantera’, ‘species’:‘tigris’, ‘name’:‘Wanda’ }
    48. 48. { ‘kingdom’:‘Animalia’, ‘subkingdom’:‘Eumetazoa’, ‘phylum’:‘Chordata’, ‘subphylum’:‘Vertebrata’, ‘class’:‘Mammalia’, ‘subclass’:‘Theria’, ‘order’:‘Carnivora’, ‘suborder’: ‘Caniformia’, ‘family’:‘Canidae’, ‘subfamily’:‘Caninae’, ‘tribe’:‘Canini’, ‘genus’:‘Canis’, ‘species’:‘lupus’, ‘subspecies’:‘familiaris’, ‘name’:‘Daisy’ }
    49. 49. graph databases
    50. 50. allegograph hypergraphdb neo4j activeRDF
    51. 51. http://neotechnology.com/why-neo
    52. 52. http://markorodriguez.com/Lectures_ les/risk-symposium2009.pdf
    53. 53. ickr: 9948354@N08
    54. 54. Biology ✓ Comics ✓
    55. 55. Animalia ... Felidae subfamilyof genusof Panthernae genusof Panthera speciesof tigris member 001 age name weight 3 Wanda 300
    56. 56. Animalia ... Felidae subfamilyof genusof Panthernae genusof Panthera species speciesof type tigris 010 name tigris member 001 age name weight 3 Wanda 300
    57. 57. Group IV orderof Picornavirales familyof Picornaviridae genusof Rhinovirus speciesof human rhinovirus A member 002
    58. 58. class Mammalia Group IV group orderof orderof Carnivora Picornavirales familyof familyof Felidae Picornaviridae subfamilyof Panthernae genusof genusof genusof Panthera Rhinovirus speciesof speciesof human tigris rhinovirus A member member 001 002
    59. 59. DC imprintof titleof DC Universe Green titleof 001 Lantern nameof genreof volumeof genreof Volume 1 Sci Fi Superhero genreof issueof genreof 002 precedes Issue #2 number coverof #1 003
    60. 60. require 'neo4j' Neo4j::Transaction.run do dc = Neo4j::Node.new dc[:name] = 'DC' dc_universe = Neo4j::Node.new dc_universe[:name] = 'DC Universe' dc.relationships.outgoing(:imprints) << dc_universe rel = dc.relationships.outgoing(:imprints).first rel[:started] = 1980 vol1 = Neo4j::Node.new vol1[:started] = 1941 vol1[:ended] = 1949 vol1[:name] = 'Green Lantern' dc.relationships.outgoing(:titles) << vol1 dc_universe.relationships.outgoing(:titles) << vol1 # ... end
    61. 61. other alternatives
    62. 62. column-oriented constant in-memory streaming temporal
    63. 63. selection
    64. 64. None Key-Value Many-One Document-Oriented Many-Many Relational Many-Many ++ Graph
    65. 65. polyglot persistence
    66. 66. { ‘title’:‘I Love Cheese’ ‘content’:‘Cheese is...’ ‘posted’:’24 Sept 2009’ ‘comments’:[{ ‘author’:‘Joe Schmoe’ ‘posted’:’24 Sept 2009’ ‘content’:‘First!’ }, {...}] }
    67. 67. Tag Tag Post General Life 1ec8264 Work Food 1ec8264 Fitness Writing bae294a Life Food Writing { ‘title’:‘I Love Cheese’ Family ‘content’:‘Cheese is...’ ‘posted’:’24 Sept 2009’ ‘comments’:[{ ‘author’:‘Joe Schmoe’ ‘posted’:’24 Sept 2009’ ‘content’:‘First!’ }, {...}] }
    68. 68. HTTP application application
    69. 69. HTTP application
    70. 70. application
    71. 71. application
    72. 72. Thank You ben sco eld - @bsco eld http://bensco eld.com http://www.viget.com/extend http://www.speakerrate.com/bsco eld
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×