SlideShare ist ein Scribd-Unternehmen logo
1 von 25
Downloaden Sie, um offline zu lesen
Got bored by the relational database?
       Switch to a RDF store!

           Fabrizio Giudici
           Tidalwave s.a.s.
Who I am
●   Java consultant since 1996
●   Senior architect
●   Java instructor for Sun since 1998
●   Member of the NetBeans Dream Team
●   Technical Writer, Blogger at Java.Net, DZone
●   http://weblogs.java.net/blog/fabriziogiudici/
●   http://www.tidalwave.it/people
Where I am using RDF stores




 http://bluemarine.tidalwave.it
Agenda
●   Why the RDBMs?
●   RDBMs issues
●   The Semantic Model
●   OpenSesame and Elmo
●   A few code samples
●   Conclusion
RDBMs are everywhere
What do we expect from a RDBM?
●   Persistence
●   Reliability
●   Transactions
●   Integrability
●   Manageability
Lack of cohesion
●   Do we really need a RDBM for those things?
●   No, we don't
       –   Persistence and transactions are good
       –   The specific relational schema is evil
●   RDBMs sell those stuff in a single package
ER-OO impedance
●   Entity-Relationship is different than OO
        –   Primary keys
        –   No inheritance
        –   No behaviour
        –   Normalization rules
        –   Relationship through external keys
ORMs
●   Tools to minimize the ER-OO impedance
●   Java has got a standard API: JPA
       –   Hibernate, TopLink, EclipseLink, OpenJPA
       –   Tries to abstract the database à la Java
●   Good, but the RDBM has still to be designed
●   And maintained
Can we get rid of the relational database?
The Semantic Model
●   Semantic Technology != Semantic Web
●   RDF: Resource Description Framework
●   “Triples” are the atomic information item
●   Subject / predicate / object
        –   Java / is-a / programming-language
        –   Fabrizio / is-member-of / NetBeans Dream Team
        –   Verona / is-part-of / Veneto
        –   Verona / has-plate / “VR”
The Semantic Model
●   The subject is a resource
●   The predicate is a property
●   The object is a value
●   A value is a resource or a primitive type
●   Resources, properties identified by URL/URN
        –   Just a naming scheme
        –   Not necessarily web-related
Formal representation
●   RDF is not related to XML
●   XML is just one of the way to represent RDF
        –   XML-RDF, unfortunately referred to as RDF
●   Notation 3 (N3), another popular representation
        –   Much more human-readable
●   Other formats exist
●   RDF representation is often referred to as
    “serialization”
(XML-)RDF is near to you
●   RSS/RDF
●   Dublin Core
●   XMP by Adobe
Compared to RDBMs
●   There's no fixed schema
         –   Everything is a triple
    –   “AAA slogan”: Anyone can say Anything
        about Any topic
●   Adding new data types is adding triples
         –   No need to add / alter tables
         –   Maintainance is just updating data
●   Databases can be distributed (federations)
         –   Can be merged by just copying triples together
What about performance?
●   Not as optimized as SQL
●   There's no spread knowledge about tuning as
    for SQL
●   Some missing parts
       –   E.g. Sesame still misses select count(*)
OpenSesame, Elmo
●   Popular Java infrastructure for RDF
       –   FLOSS
       –   http://www.openrdf.org
●   Elmo providers JPA-like operations
       –   Annotations
       –   Specific API or even subset of JPA
A simple code example
       import org.openrdf.elmo.annotations.rdf;

       @rdf(GeoVocabulary.URI_GEO_LOCATION)
       public class GeoLocation
        {
          @rdf("http://www.w3.org/2003/01/geo/wgs84_pos#lat")
          private Double latitude;

            @rdf("http://www.w3.org/2003/01/geo/wgs84_pos#long")
            private Double longitude;

            @rdf("http://www.w3.org/2003/01/geo/wgs84_pos#alt")
            private Double altitude;

            @rdf("http://www.tidalwave.it/rdf/geo/2009/02/22#code")
            private String code;
        }

●   Note the use of standard ontologies
A simple code example
●   Declare persistent classes in
    META-INF/org.openrdf.elmo.concepts
●   Choose a store
         –   Memory
         –   Memory backed by file
         –   Database (transactional)
    Repository repository = new SailRepository(
                             new MemoryStore(new File("/tmp/RDFStore")));
    repository.initialize();
    ElmoModule module = new ElmoModule();
    SesameManagerFactory factory = new SesameManagerFactory(module, repository);
    SesameManager em = factory.createElmoManager();
Use as JPA EntityManager


 em.getTransaction().begin();
 GeoLocation genova = new GeoLocation();
 genova.setLatitude(45.0);
 genova.setLongitude(9.0);
 genova.setCode("GE");

 em.persist(genova);
 em.getTransaction().commit();
Queries
●    There are specific query languages
●    SPARQL is one of the most popular
●    Similar to SQL, but triples in place of tables


    PREFIX wgs84: <http://www.w3.org/2003/01/geo/wgs84_pos#>
    SELECT ?location WHERE
     {
       ?location wgs84:lat ?lat
     }
Running a query
em.getTransaction().begin();
String queryString = "PREFIX wgs84: <http://www.w3.org/2003/01/geo/wgs84_pos#>n" +
             "SELECT ?location WHERE n" +
             " {n" +
             " ?location a ?type.n" +
             " ?location wgs84:lat ?latn" +
             " }";
final ElmoQuery query = em.createQuery(queryString).
                 setType("type", GeoLocation.class).
                 setParameter("lat", 45.0);

final List<GeoLocation> result = query.getResultList();

for (GeoLocation l : result)
 {
     System.err.println(l);
 }

em.getTransaction().commit();
Scratching the surface
●   Elmo is powerful
●   Supports advanced constructs
       –   Objects with “multiple personality”
       –   Mixins
Open issues
●   OpenSesame doesn't support all databases
●   Lack of experience
       –   Programming skills
       –   Maintainance
       –   Tuning
       –   Managerial culture
●   Not widespread
●   Performance?
Conclusion
●   RDBMs are mainstream, but old
●   They lead to rigid schemata, don't fit the OO
●   It's possible to use something different
●   RDF stores can be a viable alternative




                               Fabrizio.Giudici@tidalwave.it

Weitere ähnliche Inhalte

Was ist angesagt?

Scala the good and bad parts
Scala the good and bad partsScala the good and bad parts
Scala the good and bad parts
benewu
 
RDF_API_Java_Stefan_Apostoaie
RDF_API_Java_Stefan_ApostoaieRDF_API_Java_Stefan_Apostoaie
RDF_API_Java_Stefan_Apostoaie
iosstef
 

Was ist angesagt? (20)

Working with jpa
Working with jpaWorking with jpa
Working with jpa
 
Java and Java platforms
Java and Java platformsJava and Java platforms
Java and Java platforms
 
Stay fresh
Stay freshStay fresh
Stay fresh
 
Object Oriented Programming : Part 2
Object Oriented Programming : Part 2Object Oriented Programming : Part 2
Object Oriented Programming : Part 2
 
Scala the good and bad parts
Scala the good and bad partsScala the good and bad parts
Scala the good and bad parts
 
Session 01 - Introduction to Java
Session 01 - Introduction to JavaSession 01 - Introduction to Java
Session 01 - Introduction to Java
 
Session 02 - Elements of Java Language
Session 02 - Elements of Java LanguageSession 02 - Elements of Java Language
Session 02 - Elements of Java Language
 
OOP in Java
OOP in JavaOOP in Java
OOP in Java
 
RDF_API_Java_Stefan_Apostoaie
RDF_API_Java_Stefan_ApostoaieRDF_API_Java_Stefan_Apostoaie
RDF_API_Java_Stefan_Apostoaie
 
Polyglot and functional (Devoxx Nov/2011)
Polyglot and functional (Devoxx Nov/2011)Polyglot and functional (Devoxx Nov/2011)
Polyglot and functional (Devoxx Nov/2011)
 
Polyglot and Functional Programming (OSCON 2012)
Polyglot and Functional Programming (OSCON 2012)Polyglot and Functional Programming (OSCON 2012)
Polyglot and Functional Programming (OSCON 2012)
 
Functional OOP, Clojure style
Functional OOP, Clojure styleFunctional OOP, Clojure style
Functional OOP, Clojure style
 
Presentation on java
Presentation  on  javaPresentation  on  java
Presentation on java
 
Java Starting
Java StartingJava Starting
Java Starting
 
Core java lessons
Core java lessonsCore java lessons
Core java lessons
 
Java OOP s concepts and buzzwords
Java OOP s concepts and buzzwordsJava OOP s concepts and buzzwords
Java OOP s concepts and buzzwords
 
Paython courses in pune ppt
Paython courses in pune pptPaython courses in pune ppt
Paython courses in pune ppt
 
01 introduction to oop and java
01 introduction to oop and java01 introduction to oop and java
01 introduction to oop and java
 
Comp102 lec 3
Comp102   lec 3Comp102   lec 3
Comp102 lec 3
 
NUS Hackers Club Mar 21 - Whats New in JavaSE 8?
NUS Hackers Club Mar 21 - Whats New in JavaSE 8?NUS Hackers Club Mar 21 - Whats New in JavaSE 8?
NUS Hackers Club Mar 21 - Whats New in JavaSE 8?
 

Andere mochten auch

Knowledge base – direc tv’s naso development
Knowledge base – direc tv’s naso developmentKnowledge base – direc tv’s naso development
Knowledge base – direc tv’s naso development
jericbd
 
Digital Cartel (D.C) Corporate Profile
Digital Cartel (D.C) Corporate ProfileDigital Cartel (D.C) Corporate Profile
Digital Cartel (D.C) Corporate Profile
Hammad Khan
 

Andere mochten auch (9)

Parancoe and Lambico
Parancoe and LambicoParancoe and Lambico
Parancoe and Lambico
 
Knowledge base – direc tv’s naso development
Knowledge base – direc tv’s naso developmentKnowledge base – direc tv’s naso development
Knowledge base – direc tv’s naso development
 
Java e i database: da JDBC a JPA
Java e i database: da JDBC a JPAJava e i database: da JDBC a JPA
Java e i database: da JDBC a JPA
 
Annotated controllers with Spring MVC 2.5
Annotated controllers with Spring MVC 2.5Annotated controllers with Spring MVC 2.5
Annotated controllers with Spring MVC 2.5
 
Java Persistence 2.0
Java Persistence 2.0Java Persistence 2.0
Java Persistence 2.0
 
Applicazione JavaFX – CORSA DI AUTO SU TRACCIATI REALI
Applicazione JavaFX – CORSA DI AUTO SU TRACCIATI REALIApplicazione JavaFX – CORSA DI AUTO SU TRACCIATI REALI
Applicazione JavaFX – CORSA DI AUTO SU TRACCIATI REALI
 
Steve Jobs
Steve JobsSteve Jobs
Steve Jobs
 
Digital Cartel (D.C) Corporate Profile
Digital Cartel (D.C) Corporate ProfileDigital Cartel (D.C) Corporate Profile
Digital Cartel (D.C) Corporate Profile
 
Milieu
MilieuMilieu
Milieu
 

Ähnlich wie Got bored by the relational database? Switch to a RDF store!

Slides semantic web and Drupal 7 NYCCamp 2012
Slides semantic web and Drupal 7 NYCCamp 2012Slides semantic web and Drupal 7 NYCCamp 2012
Slides semantic web and Drupal 7 NYCCamp 2012
scorlosquet
 
Rdf Processing Tools In Java
Rdf Processing Tools In JavaRdf Processing Tools In Java
Rdf Processing Tools In Java
DicusarCorneliu
 
1 Introduction to JAVA.pptx
1 Introduction to JAVA.pptx1 Introduction to JAVA.pptx
1 Introduction to JAVA.pptx
Kabiles07
 
Comparative Study That Aims Rdf Processing For The Java Platform
Comparative Study That Aims Rdf Processing For The Java PlatformComparative Study That Aims Rdf Processing For The Java Platform
Comparative Study That Aims Rdf Processing For The Java Platform
Computer Science
 
Unit 1 Core Java for Compter Science 3rd
Unit 1 Core Java for Compter Science 3rdUnit 1 Core Java for Compter Science 3rd
Unit 1 Core Java for Compter Science 3rd
prat0ham
 

Ähnlich wie Got bored by the relational database? Switch to a RDF store! (20)

Reactive Software Systems
Reactive Software SystemsReactive Software Systems
Reactive Software Systems
 
Achieve the norm with Idiorm
Achieve the norm with IdiormAchieve the norm with Idiorm
Achieve the norm with Idiorm
 
Dart the Better JavaScript
Dart the Better JavaScriptDart the Better JavaScript
Dart the Better JavaScript
 
Java SE 8
Java SE 8Java SE 8
Java SE 8
 
Enhancing Domain Specific Language Implementations Through Ontology
Enhancing Domain Specific Language Implementations Through OntologyEnhancing Domain Specific Language Implementations Through Ontology
Enhancing Domain Specific Language Implementations Through Ontology
 
FregeDay: Design and Implementation of the language (Ingo Wechsung)
FregeDay: Design and Implementation of the language (Ingo Wechsung)FregeDay: Design and Implementation of the language (Ingo Wechsung)
FregeDay: Design and Implementation of the language (Ingo Wechsung)
 
Object Relational Mapping with Dapper (Micro ORM)
Object Relational Mapping with Dapper (Micro ORM)Object Relational Mapping with Dapper (Micro ORM)
Object Relational Mapping with Dapper (Micro ORM)
 
Ontology Access Kit_ Workshop Intro Slides.pptx
Ontology Access Kit_ Workshop Intro Slides.pptxOntology Access Kit_ Workshop Intro Slides.pptx
Ontology Access Kit_ Workshop Intro Slides.pptx
 
Java Closures
Java ClosuresJava Closures
Java Closures
 
Slides semantic web and Drupal 7 NYCCamp 2012
Slides semantic web and Drupal 7 NYCCamp 2012Slides semantic web and Drupal 7 NYCCamp 2012
Slides semantic web and Drupal 7 NYCCamp 2012
 
Functional Solid, Aleksandr Sugak
Functional Solid, Aleksandr SugakFunctional Solid, Aleksandr Sugak
Functional Solid, Aleksandr Sugak
 
Functional solid
Functional solidFunctional solid
Functional solid
 
XSLT+SPARQL: Scripting the Semantic Web with SPARQL embedded into XSLT styles...
XSLT+SPARQL: Scripting the Semantic Web with SPARQL embedded into XSLT styles...XSLT+SPARQL: Scripting the Semantic Web with SPARQL embedded into XSLT styles...
XSLT+SPARQL: Scripting the Semantic Web with SPARQL embedded into XSLT styles...
 
Rdf Processing Tools In Java
Rdf Processing Tools In JavaRdf Processing Tools In Java
Rdf Processing Tools In Java
 
1 Introduction to JAVA.pptx
1 Introduction to JAVA.pptx1 Introduction to JAVA.pptx
1 Introduction to JAVA.pptx
 
Apache Jena Elephas and Friends
Apache Jena Elephas and FriendsApache Jena Elephas and Friends
Apache Jena Elephas and Friends
 
Thinking Functionally
Thinking FunctionallyThinking Functionally
Thinking Functionally
 
Comparative Study That Aims Rdf Processing For The Java Platform
Comparative Study That Aims Rdf Processing For The Java PlatformComparative Study That Aims Rdf Processing For The Java Platform
Comparative Study That Aims Rdf Processing For The Java Platform
 
Ruby on Rails (RoR) as a back-end processor for Apex
Ruby on Rails (RoR) as a back-end processor for Apex Ruby on Rails (RoR) as a back-end processor for Apex
Ruby on Rails (RoR) as a back-end processor for Apex
 
Unit 1 Core Java for Compter Science 3rd
Unit 1 Core Java for Compter Science 3rdUnit 1 Core Java for Compter Science 3rd
Unit 1 Core Java for Compter Science 3rd
 

Kürzlich hochgeladen

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Kürzlich hochgeladen (20)

AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 

Got bored by the relational database? Switch to a RDF store!

  • 1. Got bored by the relational database? Switch to a RDF store! Fabrizio Giudici Tidalwave s.a.s.
  • 2. Who I am ● Java consultant since 1996 ● Senior architect ● Java instructor for Sun since 1998 ● Member of the NetBeans Dream Team ● Technical Writer, Blogger at Java.Net, DZone ● http://weblogs.java.net/blog/fabriziogiudici/ ● http://www.tidalwave.it/people
  • 3. Where I am using RDF stores http://bluemarine.tidalwave.it
  • 4. Agenda ● Why the RDBMs? ● RDBMs issues ● The Semantic Model ● OpenSesame and Elmo ● A few code samples ● Conclusion
  • 6. What do we expect from a RDBM? ● Persistence ● Reliability ● Transactions ● Integrability ● Manageability
  • 7. Lack of cohesion ● Do we really need a RDBM for those things? ● No, we don't – Persistence and transactions are good – The specific relational schema is evil ● RDBMs sell those stuff in a single package
  • 8. ER-OO impedance ● Entity-Relationship is different than OO – Primary keys – No inheritance – No behaviour – Normalization rules – Relationship through external keys
  • 9. ORMs ● Tools to minimize the ER-OO impedance ● Java has got a standard API: JPA – Hibernate, TopLink, EclipseLink, OpenJPA – Tries to abstract the database à la Java ● Good, but the RDBM has still to be designed ● And maintained
  • 10. Can we get rid of the relational database?
  • 11. The Semantic Model ● Semantic Technology != Semantic Web ● RDF: Resource Description Framework ● “Triples” are the atomic information item ● Subject / predicate / object – Java / is-a / programming-language – Fabrizio / is-member-of / NetBeans Dream Team – Verona / is-part-of / Veneto – Verona / has-plate / “VR”
  • 12. The Semantic Model ● The subject is a resource ● The predicate is a property ● The object is a value ● A value is a resource or a primitive type ● Resources, properties identified by URL/URN – Just a naming scheme – Not necessarily web-related
  • 13. Formal representation ● RDF is not related to XML ● XML is just one of the way to represent RDF – XML-RDF, unfortunately referred to as RDF ● Notation 3 (N3), another popular representation – Much more human-readable ● Other formats exist ● RDF representation is often referred to as “serialization”
  • 14. (XML-)RDF is near to you ● RSS/RDF ● Dublin Core ● XMP by Adobe
  • 15. Compared to RDBMs ● There's no fixed schema – Everything is a triple – “AAA slogan”: Anyone can say Anything about Any topic ● Adding new data types is adding triples – No need to add / alter tables – Maintainance is just updating data ● Databases can be distributed (federations) – Can be merged by just copying triples together
  • 16. What about performance? ● Not as optimized as SQL ● There's no spread knowledge about tuning as for SQL ● Some missing parts – E.g. Sesame still misses select count(*)
  • 17. OpenSesame, Elmo ● Popular Java infrastructure for RDF – FLOSS – http://www.openrdf.org ● Elmo providers JPA-like operations – Annotations – Specific API or even subset of JPA
  • 18. A simple code example import org.openrdf.elmo.annotations.rdf; @rdf(GeoVocabulary.URI_GEO_LOCATION) public class GeoLocation { @rdf("http://www.w3.org/2003/01/geo/wgs84_pos#lat") private Double latitude; @rdf("http://www.w3.org/2003/01/geo/wgs84_pos#long") private Double longitude; @rdf("http://www.w3.org/2003/01/geo/wgs84_pos#alt") private Double altitude; @rdf("http://www.tidalwave.it/rdf/geo/2009/02/22#code") private String code; } ● Note the use of standard ontologies
  • 19. A simple code example ● Declare persistent classes in META-INF/org.openrdf.elmo.concepts ● Choose a store – Memory – Memory backed by file – Database (transactional) Repository repository = new SailRepository( new MemoryStore(new File("/tmp/RDFStore"))); repository.initialize(); ElmoModule module = new ElmoModule(); SesameManagerFactory factory = new SesameManagerFactory(module, repository); SesameManager em = factory.createElmoManager();
  • 20. Use as JPA EntityManager em.getTransaction().begin(); GeoLocation genova = new GeoLocation(); genova.setLatitude(45.0); genova.setLongitude(9.0); genova.setCode("GE"); em.persist(genova); em.getTransaction().commit();
  • 21. Queries ● There are specific query languages ● SPARQL is one of the most popular ● Similar to SQL, but triples in place of tables PREFIX wgs84: <http://www.w3.org/2003/01/geo/wgs84_pos#> SELECT ?location WHERE { ?location wgs84:lat ?lat }
  • 22. Running a query em.getTransaction().begin(); String queryString = "PREFIX wgs84: <http://www.w3.org/2003/01/geo/wgs84_pos#>n" + "SELECT ?location WHERE n" + " {n" + " ?location a ?type.n" + " ?location wgs84:lat ?latn" + " }"; final ElmoQuery query = em.createQuery(queryString). setType("type", GeoLocation.class). setParameter("lat", 45.0); final List<GeoLocation> result = query.getResultList(); for (GeoLocation l : result) { System.err.println(l); } em.getTransaction().commit();
  • 23. Scratching the surface ● Elmo is powerful ● Supports advanced constructs – Objects with “multiple personality” – Mixins
  • 24. Open issues ● OpenSesame doesn't support all databases ● Lack of experience – Programming skills – Maintainance – Tuning – Managerial culture ● Not widespread ● Performance?
  • 25. Conclusion ● RDBMs are mainstream, but old ● They lead to rigid schemata, don't fit the OO ● It's possible to use something different ● RDF stores can be a viable alternative Fabrizio.Giudici@tidalwave.it