SlideShare une entreprise Scribd logo
1  sur  45
Télécharger pour lire hors ligne
Chad Davis
●   Java Software Engineer
●   Colorado Springs Open Source Meetup
●   Blackdog Software, Inc.
●   Author
          –   Struts 2 in Action
          –   Sun Certified Mobile Application Developer Exam Guide
●   Corporate Trainer – Struts 2
●   Content Management System
●   Am I a DBA?
Development without Constraint
       ( or Integrity? )

 An Introduction to the Content Repository API for Java (JCR)

                              &

           “RDBMS v. Object Storage” Discussion
Our Itinerary
●   Introduction to the Content Repository API
    for Java ( JCR )
●   Development without Constraint ( or
    Integrity? )
●   “Is my project a match for the JCR?”
The Java Content Repository
              ( JCR )
●   Java Specification
●   JSR 170 ( 1.x )
●   JSR 268 ( 2.x )
●   How did this come to be a part of Java?
Jackrabbit
●   Open Source (Apache Project)
●   Reference Implementation
●   “A content repository is a hierarchical content
    store . . .”
●   For “content-oriented” applications
●   Anybody want to take a stab at defining “content-
    oriented”?
Content?
●   Blame the Web
●   Blame the Scope Creep of IT
●   Documents
●   Binaries / Digital Assets
●   Unpredictable Structure
●   Meta-data
Bells and Whistles
●   Version Control
●   Full Text Search
●   Observation (Event Handling)
●   Unstructured / Structured Content
●   Transactions
●   Workspaces
●   And more . . .
Data Model
●   Hierarchical
●   Unstructured
●   Or Structured
Hierarchical Data is Natural
●   File Systems
●   XML
●   DNS
●   DOM
●   Biology
●   Taxonomy
The Hierachy
         ●   Full Paths are ID's
         ●   Hiearchy is Semantic

         ●   Fast Navigation/Location

         ●   Human Readable
JCR Node Trees
             ●   Nodes
             ●   Properties
             ●   Values
             ●   Names
             ●   Structure
Property Types
STRING
●




URI
●




BOOLEAN
●




LONG
●




DOUBLE
●




DECIMAL
●




BINARY
●




DATE
●




NAME, PATH
●




WEAKREFERENCE, REFERENCE
●
More Property Stuff
●   Multi-Valued
●   Value Constraints
Structural Constraints: Nodes
●   Node Types
         –   Primary
         –   Mixin
●   Child Nodes
         –   Name and Type
●   Properties
         –   Name and Type
●   Inheritance
Compact Namespace & Node
   Type Definition (CND)
<cd = 'http://chaddavis.com'>
[cd:contact] > nt:unstructured
 ­cd:email ( string ) multiple
 ­cd:pic ( binary ) mandatory
 
Referential Integrity
●   Contained in Structure
●   Use Properties
●   REFERENCE
●   WEAKREFERENCE
●   paths/UUID
API Tour: Main Classes
API Tour: Reading
●   Direct Access
    bobNode=session.getNode(“/contacts/personal/Bob Smith” );

    bobEmail = session.getProperty(“/contacts/personal/Bob 
    Smith/email”);

●   Retrieve by ID
    bobNode = session.getNodeByIdentifier(bobUUID);

●   By Relative Path
    bobNode = personalNode.getNode(“Bob Smith”);

    emailProperty = bobNode.getProperty(“email”);

●   Reading Values
    emailValue = emailProperty.getValue(); 

    emailValue.getString();

    inputStream = picValue.getBinary().getStream();    
JCR Node Trees
             ●   Nodes
             ●   Properties
             ●   Values
             ●   Names
             ●   Structure
API Tour: Navigation
●   Iterator Over Child Nodes
    NodeIterator personalContactsItty = personal.getNodes();

●   Iterator Over Properties
    PropertyIterator propItty = bobNode.getProperties;
API Tour: Creating
●   Create Node and Properties
    chadNode = personalContactsNode.addNode(“Chad Davis”);

    chadNode.setProperty ( “email”, “chad@mail.com”);

    //binaries

    Binary picBinary = valueFactory.createBinary(picInputStream);

    Value fileValue = valueFactory.createValue(picBinary);

    contentNode.setProperty("jcr:data", fileValue);
API Tour: Query
●   SQL, XPath, JQOM
●   Full Text Search
    xpathExp = “/contacts/personal/element(*,nt:unstructured[jcr:contains(.,'hotmail')]";

    queryMng = session.getWorkspace().getQueryManager();

    query = QueryMng.createQuery(xpathExp, Query.XPATH);

    results = query.execute();

●   All Properties and Node Names Included in Full Text Search
●   Binaries Too!
API Tour: Query
●   Saving Queries to Repo

    query.storeAsNode(“/queries/chad/query1”);
API Tour: Version Control
●   Labels
●   Merge
●   Check In New Version
    versionMngr = session.getWorkspace().getVersionManager();

    newVersion = versionManager.checkin( nodeToCommit.getPath() );

    versionHist = versionMngr.getVersionHistory( nodeToCommit.getPath() );

    versionHistory.addVersionLabel( newVersion.getName(), label, false );
API Tour: Version Control
●   Restore to Other Version
    versionMngr = session.getWorkspace().getVersionManager();

    VersionHistory = versionMngr.getVersionHistory( targetNode.getPath());

    targetVersion = versionHistory.getVersionByLabel(versionLabel);

    versionManager.restore(targetVersion, false);
End of JCR Tour
●   Jackrabbit
●   Content Management Systems
●   Artifact Management
●   Operations Management
RDBMS v. Object Storage

“Schema-less databases and document-oriented databases are a
paradigm shift, and it provides bigger programmer challenges than
something like picking up a new language. I would liken it to the
transition from procedural to object oriented programming.”

                                --Scott Swigart, “How Software is Built”
Paradigm Shift?
The Relational Model
●   Hegemonic Concept
●   Mathematical
●   Taught in Every DB Course
●   1970's
Edgar Frank "Ted" Codd
           ●
               IBM
           ●
               Invented the Relational 
               Model
           ●
               "A Relational Model of Data 
               for Large Shared Data Banks"
           ●
               1970
           ●
               “Is Your DBMS Really 
               Relational?"
           ●
               “Does Your DBMS Run By the 
               Rules?”
Goals of Relational Model
●   Mathematical
       –   Efficiency
       –   Resource Friendly
       –   Powerful Operations
●   Program-Data Independence
       –   More than one app can access data
       –   Consider file based data persistence
Goals of Relational Model
●   Data Integrity
●   Column Constraints
●   Referential Integrity
●   Normalization
        –   Insert, Update and Delete Anomalies
        –   Data redundancy
        –   3NF
Structure Driven Development
●   Database Design
●   Upfront Concretization of Data Model
●   DDL
●   Tables
●   Structure Comes Before Data
●   Heavy Weight
●   Formal
Does Your DBMS Run By the Rules?
Impedance Mismatch
●   Object-Relational
           –   Hibernate
●   Data Types
           –   1970 – No Web
           –   2010 – Content, Documents, Tweets
           –   JSON As Storage Format?
●   Structure First
           –   Data First
           –   Agile Development
●   Program-Data independence
           –   This architectural imperitive has also shifted, but I can't quite
                 express it . . .
New Stuff
●   NoSQL
●   Schemaless DB
●   Object DB
●   Content Repository
●   Document-Oriented DB
Some Offerings
●   CouchDB
●   MongoDB
●   Hadoop
●   SimpleDB ( Amazon )
The Case for Jackrabbit
●   Coy Data
        –   Data Driven Development
        –   Agile
●   Naturally Hierarchical Data
●   “Content” Oriented Data
●   Navigation / Query
●   Integrity?
The Case for RDBMS
●   Interrelated Data
●   Lots of Joins
●   Flat Data
●   Operations
R U Relaxed?
References
●   Database:Principles, Programming, Performance. Patrick O'Neil and
    Elizabeth O'Neil.
●   JCR or RDBMS: Why, When, How? Bertil Chapuis
●   Interview with CouchDB's Damien Katz
●   CouchDB Rap

Contenu connexe

Tendances

Sharing data on the web (2013)
Sharing data on the web (2013)Sharing data on the web (2013)
Sharing data on the web (2013)3 Round Stones
 
Magic of assets pipeline
Magic of assets pipelineMagic of assets pipeline
Magic of assets pipelinekotharidarshi
 
MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB AtlasMongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB AtlasMongoDB
 
Mongo DB: Operational Big Data Database
Mongo DB: Operational Big Data DatabaseMongo DB: Operational Big Data Database
Mongo DB: Operational Big Data DatabaseXpand IT
 
Datomic – A Modern Database - StampedeCon 2014
Datomic – A Modern Database - StampedeCon 2014Datomic – A Modern Database - StampedeCon 2014
Datomic – A Modern Database - StampedeCon 2014StampedeCon
 
A Presentation on MongoDB Introduction - Habilelabs
A Presentation on MongoDB Introduction - HabilelabsA Presentation on MongoDB Introduction - Habilelabs
A Presentation on MongoDB Introduction - HabilelabsHabilelabs
 
Practical Ruby Projects With Mongo Db
Practical Ruby Projects With Mongo DbPractical Ruby Projects With Mongo Db
Practical Ruby Projects With Mongo DbAlex Sharp
 
Conceptos básicos. Seminario web 1: Introducción a NoSQL
Conceptos básicos. Seminario web 1: Introducción a NoSQLConceptos básicos. Seminario web 1: Introducción a NoSQL
Conceptos básicos. Seminario web 1: Introducción a NoSQLMongoDB
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDBJustin Smestad
 
MongoDB Schema Design (Richard Kreuter's Mongo Berlin preso)
MongoDB Schema Design (Richard Kreuter's Mongo Berlin preso)MongoDB Schema Design (Richard Kreuter's Mongo Berlin preso)
MongoDB Schema Design (Richard Kreuter's Mongo Berlin preso)MongoDB
 
The Real-time Web in the Age of Agents
The Real-time Web in the Age of AgentsThe Real-time Web in the Age of Agents
The Real-time Web in the Age of AgentsJoshua Shinavier
 

Tendances (20)

Sharing data on the web (2013)
Sharing data on the web (2013)Sharing data on the web (2013)
Sharing data on the web (2013)
 
Mongo DB
Mongo DBMongo DB
Mongo DB
 
Magic of assets pipeline
Magic of assets pipelineMagic of assets pipeline
Magic of assets pipeline
 
MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB AtlasMongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
 
Mongo DB: Operational Big Data Database
Mongo DB: Operational Big Data DatabaseMongo DB: Operational Big Data Database
Mongo DB: Operational Big Data Database
 
CouchDB introduction
CouchDB introductionCouchDB introduction
CouchDB introduction
 
Datomic – A Modern Database - StampedeCon 2014
Datomic – A Modern Database - StampedeCon 2014Datomic – A Modern Database - StampedeCon 2014
Datomic – A Modern Database - StampedeCon 2014
 
A Presentation on MongoDB Introduction - Habilelabs
A Presentation on MongoDB Introduction - HabilelabsA Presentation on MongoDB Introduction - Habilelabs
A Presentation on MongoDB Introduction - Habilelabs
 
Practical Ruby Projects With Mongo Db
Practical Ruby Projects With Mongo DbPractical Ruby Projects With Mongo Db
Practical Ruby Projects With Mongo Db
 
Conceptos básicos. Seminario web 1: Introducción a NoSQL
Conceptos básicos. Seminario web 1: Introducción a NoSQLConceptos básicos. Seminario web 1: Introducción a NoSQL
Conceptos básicos. Seminario web 1: Introducción a NoSQL
 
Mongo DB
Mongo DB Mongo DB
Mongo DB
 
SQL vs NoSQL
SQL vs NoSQLSQL vs NoSQL
SQL vs NoSQL
 
Introduction to datomic
Introduction to datomicIntroduction to datomic
Introduction to datomic
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
MongoDB Schema Design (Richard Kreuter's Mongo Berlin preso)
MongoDB Schema Design (Richard Kreuter's Mongo Berlin preso)MongoDB Schema Design (Richard Kreuter's Mongo Berlin preso)
MongoDB Schema Design (Richard Kreuter's Mongo Berlin preso)
 
Mongo DB
Mongo DBMongo DB
Mongo DB
 
The Real-time Web in the Age of Agents
The Real-time Web in the Age of AgentsThe Real-time Web in the Age of Agents
The Real-time Web in the Age of Agents
 
Mongo db intro.pptx
Mongo db intro.pptxMongo db intro.pptx
Mongo db intro.pptx
 
MongoDB
MongoDBMongoDB
MongoDB
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 

En vedette

A. piwowarczyk lahtine aken
A. piwowarczyk lahtine akenA. piwowarczyk lahtine aken
A. piwowarczyk lahtine akenMae Mees
 
Pommiheitmisest
PommiheitmisestPommiheitmisest
PommiheitmisestMae Mees
 
Pommid öisest taevast
Pommid öisest taevastPommid öisest taevast
Pommid öisest taevastMae Mees
 
A.conan doyle Jutustused sherlock holmesist
A.conan doyle Jutustused sherlock holmesistA.conan doyle Jutustused sherlock holmesist
A.conan doyle Jutustused sherlock holmesistMae Mees
 
Mõrvakatse
MõrvakatseMõrvakatse
MõrvakatseMae Mees
 
Kadunud maailm/Maracoti sügavik
Kadunud maailm/Maracoti sügavikKadunud maailm/Maracoti sügavik
Kadunud maailm/Maracoti sügavikMae Mees
 
80 päevaga ümber maailma
80 päevaga ümber maailma80 päevaga ümber maailma
80 päevaga ümber maailmaMae Mees
 
220 päeva tähelaevas
220 päeva tähelaevas220 päeva tähelaevas
220 päeva tähelaevasMae Mees
 
Eesti lendurid lahingute tules
Eesti lendurid lahingute tulesEesti lendurid lahingute tules
Eesti lendurid lahingute tulesMae Mees
 
Aarete saar r.l
Aarete saar r.lAarete saar r.l
Aarete saar r.lMae Mees
 
2009 Broker Demo Rev 1
2009 Broker Demo Rev 12009 Broker Demo Rev 1
2009 Broker Demo Rev 1erikcoop0206
 

En vedette (17)

A. piwowarczyk lahtine aken
A. piwowarczyk lahtine akenA. piwowarczyk lahtine aken
A. piwowarczyk lahtine aken
 
Pommiheitmisest
PommiheitmisestPommiheitmisest
Pommiheitmisest
 
Pommid öisest taevast
Pommid öisest taevastPommid öisest taevast
Pommid öisest taevast
 
A.conan doyle Jutustused sherlock holmesist
A.conan doyle Jutustused sherlock holmesistA.conan doyle Jutustused sherlock holmesist
A.conan doyle Jutustused sherlock holmesist
 
Cabello quinones am
Cabello quinones amCabello quinones am
Cabello quinones am
 
Mõrvakatse
MõrvakatseMõrvakatse
Mõrvakatse
 
Kadunud maailm/Maracoti sügavik
Kadunud maailm/Maracoti sügavikKadunud maailm/Maracoti sügavik
Kadunud maailm/Maracoti sügavik
 
Peace Project
Peace ProjectPeace Project
Peace Project
 
80 päevaga ümber maailma
80 päevaga ümber maailma80 päevaga ümber maailma
80 päevaga ümber maailma
 
220 päeva tähelaevas
220 päeva tähelaevas220 päeva tähelaevas
220 päeva tähelaevas
 
Eesti lendurid lahingute tules
Eesti lendurid lahingute tulesEesti lendurid lahingute tules
Eesti lendurid lahingute tules
 
Format Blog
Format BlogFormat Blog
Format Blog
 
Aarete saar r.l
Aarete saar r.lAarete saar r.l
Aarete saar r.l
 
2009 Broker Demo Rev 1
2009 Broker Demo Rev 12009 Broker Demo Rev 1
2009 Broker Demo Rev 1
 
Ajax ons2
Ajax ons2Ajax ons2
Ajax ons2
 
Serve
ServeServe
Serve
 
unidad de formacion 9
unidad de formacion 9unidad de formacion 9
unidad de formacion 9
 

Similaire à Development without Constraint

ORMs heróis ou vilões dentro da arquitetura de dados? - Otávio gonçalves
ORMs heróis ou vilões dentro da arquitetura de dados? - Otávio gonçalvesORMs heróis ou vilões dentro da arquitetura de dados? - Otávio gonçalves
ORMs heróis ou vilões dentro da arquitetura de dados? - Otávio gonçalvesiMasters
 
ORMs: Heroes or Villains Inside the Architecture?
ORMs: Heroes or Villains Inside the Architecture?ORMs: Heroes or Villains Inside the Architecture?
ORMs: Heroes or Villains Inside the Architecture?Otávio Santana
 
An Introduction to Big Data, NoSQL and MongoDB
An Introduction to Big Data, NoSQL and MongoDBAn Introduction to Big Data, NoSQL and MongoDB
An Introduction to Big Data, NoSQL and MongoDBWilliam LaForest
 
Using Spring with NoSQL databases (SpringOne China 2012)
Using Spring with NoSQL databases (SpringOne China 2012)Using Spring with NoSQL databases (SpringOne China 2012)
Using Spring with NoSQL databases (SpringOne China 2012)Chris Richardson
 
Data analysis with Pandas and Spark
Data analysis with Pandas and SparkData analysis with Pandas and Spark
Data analysis with Pandas and SparkFelix Crisan
 
Evolution of the DBA to Data Platform Administrator/Specialist
Evolution of the DBA to Data Platform Administrator/SpecialistEvolution of the DBA to Data Platform Administrator/Specialist
Evolution of the DBA to Data Platform Administrator/SpecialistTony Rogerson
 
NoSQL for great good [hanoi.rb talk]
NoSQL for great good [hanoi.rb talk]NoSQL for great good [hanoi.rb talk]
NoSQL for great good [hanoi.rb talk]Huy Do
 
JPoint'15 Mom, I so wish Hibernate for my NoSQL database...
JPoint'15 Mom, I so wish Hibernate for my NoSQL database...JPoint'15 Mom, I so wish Hibernate for my NoSQL database...
JPoint'15 Mom, I so wish Hibernate for my NoSQL database...Alexey Zinoviev
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDBRavi Teja
 
MongoDB by Emroz sardar.
MongoDB by Emroz sardar.MongoDB by Emroz sardar.
MongoDB by Emroz sardar.Emroz Sardar
 
MongoDB in FS
MongoDB in FSMongoDB in FS
MongoDB in FSMongoDB
 
Your Database Cannot Do this (well)
Your Database Cannot Do this (well)Your Database Cannot Do this (well)
Your Database Cannot Do this (well)javier ramirez
 

Similaire à Development without Constraint (20)

MongoDB
MongoDBMongoDB
MongoDB
 
ORMs heróis ou vilões dentro da arquitetura de dados? - Otávio gonçalves
ORMs heróis ou vilões dentro da arquitetura de dados? - Otávio gonçalvesORMs heróis ou vilões dentro da arquitetura de dados? - Otávio gonçalves
ORMs heróis ou vilões dentro da arquitetura de dados? - Otávio gonçalves
 
ORMs: Heroes or Villains Inside the Architecture?
ORMs: Heroes or Villains Inside the Architecture?ORMs: Heroes or Villains Inside the Architecture?
ORMs: Heroes or Villains Inside the Architecture?
 
An Introduction to Big Data, NoSQL and MongoDB
An Introduction to Big Data, NoSQL and MongoDBAn Introduction to Big Data, NoSQL and MongoDB
An Introduction to Big Data, NoSQL and MongoDB
 
Using Spring with NoSQL databases (SpringOne China 2012)
Using Spring with NoSQL databases (SpringOne China 2012)Using Spring with NoSQL databases (SpringOne China 2012)
Using Spring with NoSQL databases (SpringOne China 2012)
 
MongoDB Basics
MongoDB BasicsMongoDB Basics
MongoDB Basics
 
Relational vs. Non-Relational
Relational vs. Non-RelationalRelational vs. Non-Relational
Relational vs. Non-Relational
 
Data analysis with Pandas and Spark
Data analysis with Pandas and SparkData analysis with Pandas and Spark
Data analysis with Pandas and Spark
 
Evolution of the DBA to Data Platform Administrator/Specialist
Evolution of the DBA to Data Platform Administrator/SpecialistEvolution of the DBA to Data Platform Administrator/Specialist
Evolution of the DBA to Data Platform Administrator/Specialist
 
NoSQL for great good [hanoi.rb talk]
NoSQL for great good [hanoi.rb talk]NoSQL for great good [hanoi.rb talk]
NoSQL for great good [hanoi.rb talk]
 
In-memory Databases
In-memory DatabasesIn-memory Databases
In-memory Databases
 
JPoint'15 Mom, I so wish Hibernate for my NoSQL database...
JPoint'15 Mom, I so wish Hibernate for my NoSQL database...JPoint'15 Mom, I so wish Hibernate for my NoSQL database...
JPoint'15 Mom, I so wish Hibernate for my NoSQL database...
 
mongodb_DS.pptx
mongodb_DS.pptxmongodb_DS.pptx
mongodb_DS.pptx
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
MongoDB by Emroz sardar.
MongoDB by Emroz sardar.MongoDB by Emroz sardar.
MongoDB by Emroz sardar.
 
MongoDB in FS
MongoDB in FSMongoDB in FS
MongoDB in FS
 
Your Database Cannot Do this (well)
Your Database Cannot Do this (well)Your Database Cannot Do this (well)
Your Database Cannot Do this (well)
 
Mongodb my
Mongodb myMongodb my
Mongodb my
 
MongoDB
MongoDBMongoDB
MongoDB
 
MongoDB
MongoDBMongoDB
MongoDB
 

Development without Constraint

  • 1.
  • 2. Chad Davis ● Java Software Engineer ● Colorado Springs Open Source Meetup ● Blackdog Software, Inc. ● Author – Struts 2 in Action – Sun Certified Mobile Application Developer Exam Guide ● Corporate Trainer – Struts 2 ● Content Management System ● Am I a DBA?
  • 3. Development without Constraint ( or Integrity? ) An Introduction to the Content Repository API for Java (JCR) & “RDBMS v. Object Storage” Discussion
  • 4. Our Itinerary ● Introduction to the Content Repository API for Java ( JCR ) ● Development without Constraint ( or Integrity? ) ● “Is my project a match for the JCR?”
  • 5. The Java Content Repository ( JCR ) ● Java Specification ● JSR 170 ( 1.x ) ● JSR 268 ( 2.x ) ● How did this come to be a part of Java?
  • 6. Jackrabbit ● Open Source (Apache Project) ● Reference Implementation ● “A content repository is a hierarchical content store . . .” ● For “content-oriented” applications ● Anybody want to take a stab at defining “content- oriented”?
  • 7. Content? ● Blame the Web ● Blame the Scope Creep of IT ● Documents ● Binaries / Digital Assets ● Unpredictable Structure ● Meta-data
  • 8. Bells and Whistles ● Version Control ● Full Text Search ● Observation (Event Handling) ● Unstructured / Structured Content ● Transactions ● Workspaces ● And more . . .
  • 9. Data Model ● Hierarchical ● Unstructured ● Or Structured
  • 10. Hierarchical Data is Natural ● File Systems ● XML ● DNS ● DOM ● Biology ● Taxonomy
  • 11.
  • 12.
  • 13. The Hierachy ● Full Paths are ID's ● Hiearchy is Semantic ● Fast Navigation/Location ● Human Readable
  • 14. JCR Node Trees ● Nodes ● Properties ● Values ● Names ● Structure
  • 16. More Property Stuff ● Multi-Valued ● Value Constraints
  • 17. Structural Constraints: Nodes ● Node Types – Primary – Mixin ● Child Nodes – Name and Type ● Properties – Name and Type ● Inheritance
  • 18. Compact Namespace & Node Type Definition (CND) <cd = 'http://chaddavis.com'> [cd:contact] > nt:unstructured  ­cd:email ( string ) multiple  ­cd:pic ( binary ) mandatory  
  • 19. Referential Integrity ● Contained in Structure ● Use Properties ● REFERENCE ● WEAKREFERENCE ● paths/UUID
  • 20. API Tour: Main Classes
  • 21. API Tour: Reading ● Direct Access bobNode=session.getNode(“/contacts/personal/Bob Smith” ); bobEmail = session.getProperty(“/contacts/personal/Bob  Smith/email”); ● Retrieve by ID bobNode = session.getNodeByIdentifier(bobUUID); ● By Relative Path bobNode = personalNode.getNode(“Bob Smith”); emailProperty = bobNode.getProperty(“email”); ● Reading Values emailValue = emailProperty.getValue();  emailValue.getString(); inputStream = picValue.getBinary().getStream();    
  • 22. JCR Node Trees ● Nodes ● Properties ● Values ● Names ● Structure
  • 23. API Tour: Navigation ● Iterator Over Child Nodes NodeIterator personalContactsItty = personal.getNodes(); ● Iterator Over Properties PropertyIterator propItty = bobNode.getProperties;
  • 24. API Tour: Creating ● Create Node and Properties chadNode = personalContactsNode.addNode(“Chad Davis”); chadNode.setProperty ( “email”, “chad@mail.com”); //binaries Binary picBinary = valueFactory.createBinary(picInputStream); Value fileValue = valueFactory.createValue(picBinary); contentNode.setProperty("jcr:data", fileValue);
  • 25. API Tour: Query ● SQL, XPath, JQOM ● Full Text Search xpathExp = “/contacts/personal/element(*,nt:unstructured[jcr:contains(.,'hotmail')]"; queryMng = session.getWorkspace().getQueryManager(); query = QueryMng.createQuery(xpathExp, Query.XPATH); results = query.execute(); ● All Properties and Node Names Included in Full Text Search ● Binaries Too!
  • 26. API Tour: Query ● Saving Queries to Repo query.storeAsNode(“/queries/chad/query1”);
  • 27. API Tour: Version Control ● Labels ● Merge ● Check In New Version versionMngr = session.getWorkspace().getVersionManager(); newVersion = versionManager.checkin( nodeToCommit.getPath() ); versionHist = versionMngr.getVersionHistory( nodeToCommit.getPath() ); versionHistory.addVersionLabel( newVersion.getName(), label, false );
  • 28. API Tour: Version Control ● Restore to Other Version versionMngr = session.getWorkspace().getVersionManager(); VersionHistory = versionMngr.getVersionHistory( targetNode.getPath()); targetVersion = versionHistory.getVersionByLabel(versionLabel); versionManager.restore(targetVersion, false);
  • 29. End of JCR Tour ● Jackrabbit ● Content Management Systems ● Artifact Management ● Operations Management
  • 30. RDBMS v. Object Storage “Schema-less databases and document-oriented databases are a paradigm shift, and it provides bigger programmer challenges than something like picking up a new language. I would liken it to the transition from procedural to object oriented programming.” --Scott Swigart, “How Software is Built”
  • 32. The Relational Model ● Hegemonic Concept ● Mathematical ● Taught in Every DB Course ● 1970's
  • 33. Edgar Frank "Ted" Codd ● IBM ● Invented the Relational  Model ● "A Relational Model of Data  for Large Shared Data Banks" ● 1970 ● “Is Your DBMS Really  Relational?" ● “Does Your DBMS Run By the  Rules?”
  • 34. Goals of Relational Model ● Mathematical – Efficiency – Resource Friendly – Powerful Operations ● Program-Data Independence – More than one app can access data – Consider file based data persistence
  • 35. Goals of Relational Model ● Data Integrity ● Column Constraints ● Referential Integrity ● Normalization – Insert, Update and Delete Anomalies – Data redundancy – 3NF
  • 36. Structure Driven Development ● Database Design ● Upfront Concretization of Data Model ● DDL ● Tables ● Structure Comes Before Data ● Heavy Weight ● Formal
  • 37.
  • 39. Impedance Mismatch ● Object-Relational – Hibernate ● Data Types – 1970 – No Web – 2010 – Content, Documents, Tweets – JSON As Storage Format? ● Structure First – Data First – Agile Development ● Program-Data independence – This architectural imperitive has also shifted, but I can't quite express it . . .
  • 40. New Stuff ● NoSQL ● Schemaless DB ● Object DB ● Content Repository ● Document-Oriented DB
  • 41. Some Offerings ● CouchDB ● MongoDB ● Hadoop ● SimpleDB ( Amazon )
  • 42. The Case for Jackrabbit ● Coy Data – Data Driven Development – Agile ● Naturally Hierarchical Data ● “Content” Oriented Data ● Navigation / Query ● Integrity?
  • 43. The Case for RDBMS ● Interrelated Data ● Lots of Joins ● Flat Data ● Operations
  • 45. References ● Database:Principles, Programming, Performance. Patrick O'Neil and Elizabeth O'Neil. ● JCR or RDBMS: Why, When, How? Bertil Chapuis ● Interview with CouchDB's Damien Katz ● CouchDB Rap