SlideShare a Scribd company logo
1 of 35
SuRF – Tapping into the Web of Data Cosmin Basca Digital Enterprise Research Institute, Galway cosmin.basca@gmail.com Special Thanks to: Benjamin Heitman andUldis Bojars Digital Enterprise Research Institute, Galway firstname.lastname@deri.org
Outline About DERI Why Semantic Web? Linked Open Data (LOD) RDF (Resource Description Framework) SPARQL O-RDF Mapping (ActiveRDF / SuRF) How? Architecture Installation Examples Simple: access DBpedia (Semantic Wikipedia) More complex: create a blog on top of RDF 2
DERI – http://www.deri.ie/ Digital Enterprise Research Institute (DERI):  http://www.deri.ie/ main goal: enabling networked knowledge research about the future of the Web biggest Semantic Web research institute in the world 120 people part of the National University of Ireland, Galway 3
Outline About DERI Why Semantic Web? Linked Open Data (LOD) RDF (Resource Description Framework) SPARQL O-RDF Mapping (ActiveRDF / SuRF) How? Architecture Installation Examples Simple: access DBpedia (Semantic Wikipedia) More complex: create a blog on top of RDF 4
Why ? Develop Web applications that allow  Data Integration Flexibility Schema definition and modeling Schema evolution Robustness Support for new Data  Sources Types 5
There is a Wealth of (RDF) data out there 6
Popular Semantic Web Vocabularies FOAF = for describing people and social network connections between them   http://xmlns.com/foaf/spec/ SIOC = for describing Social Web content created by people   http://sioc-project.org/ DOAP = for describing software projects   http://trac.usefulinc.com/doap used by PyPi 7
Linked Open Data - Growth 8
Linked Open Data - Growth 9
Linked Open Data - Growth 10
The data model Traditional Approach use the Relational model Usually leads to big ugly Schemas 11
The RDF (Graph) Data model Flexible Support for both schema and data evolution during runtime Simple model Relations are represented explicitly Schema is a graph Can integrate data – union of two graphs 12
The RDF (Graph) Data model 13 Subject Object Predicate A triple is a  Eric Person
Example RDF graph describing Eric Miller (RDF Primer) – human readable format 14 Person is a  Eric has full name Eric Miller has e-mail em@w3.org has personal title Dr.
Example RDF graph describing Eric Miller (RDF Primer) – machine readable format 15 http://w3.org/2000/10/swap/pic/contact#Person http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://w3.org/People/EM/contact#me http://www.w3.org/2000/10/swap/pim/contact#fullName Eric Miller http://www.w3.org/2000/10/swap/pim/contact#mailbox mailto:em@w3.org http://www.w3.org/2000/10/swap/pim/contact#personalTitle Dr.
The RDF (Graph) Data model – Identification  URI’s provide strong references The URIref is a an unambiguous pointer to something of meaning Nodes (“Subjects”) 	connect via Links (“Predicates”) 	to Objects Can be Nodes or Literals (plain or typed strings) 16
SPARQL – Querying the Semantic Web SPARQL is to RDF what SQL is to Relational tables Expressive, designed with the Graph data model in mind 17 Carrie Fisher starred_in Star Wars starred_in Harrison Ford starred_in Blade Runner starred_in Darryl Hannah SELECT ?actor ?movie WHERE { ?actor starred_in ?movie }
Levels of Data abstraction 18 Direct SPARQL Access O-RDF Mapper  SuRF
O-RDF Mapper, Why? Clean OO design Increased productivity model is free from persistence constraints Separation of concerns and specialization ORMs often reduce the amount of code needed to be written, making the software more robust 20% to 30% less code needs to be written Less code – less testing – less errors 19
O-RDF Mapper, How? How do we see RDF data? As a SET of triples? As a SET of resources? The resource view is more suitable for the OO model How do we define an RDF resource ? All triples <S,P,O>with same subject (ActiveRDF, SuRF) And all triples <O,P,S> (SuRF) Apply Open World principles 20
Outline About DERI Why Semantic Web? Linked Open Data (LOD) RDF (Resource Description Framework) SPARQL O-RDF Mapping (ActiveRDF / SuRF) How? Architecture Installation Examples Simple: access DBpedia (Semantic Wikipedia) More complex: create a blog on top of RDF 21
SuRF – Semantic Resource Framework Inspired by ActiveRDF Developed in DERI for ruby Expose RDF as sets of resources Semantic attributes exposed as a “virtual API”, generated through introspection.  Naming convention: instance.namespace_attribute cosmin.foaf_knows Finder methods Retrieve resources by type or by attributes Session keeps track of resources, when calling session.commit() only dirty resources will be persisted 22
SuRF – Architecture 23
SuRF – Architecture – Currently supported plugins 24 Add your own plugins, extend: surf.store.plugins.RDFReader surf.store.plugins.RDFWriter Redefine the __type__ attribute This is the plugin identifier To install plugins import my_plugin
SuRF - installation Available on PyPi easy_install –U surf (to get the latest) Open-source available on Google Code, BSD licence http://code.google.com/p/surfrdf/ 25
Outline About DERI Why Semantic Web? Linked Open Data (LOD) RDF (Resource Description Framework) SPARQL O-RDF Mapping (ActiveRDF / SuRF) How? Architecture Installation Examples Simple: access DBpedia (Semantic Wikipedia) More complex: create a blog on top of RDF 26
DBpedia public SPARQL endpoint - read-only Create the store proxy from surf import* 	store = Store(reader='sparql-protocol',endpoint='http://dbpedia.org/sparql',                default_graph='http://dbpedia.org') Create the surf session print'Create the session'session =Session(store,{}) Map a dbpedia concept to an internal class PhilCollinsAlbums=session.get_class(ns.YAGO['PhilCollinsAlbums']) SuRF – simple example 27
SuRF – simple example DBpedia public SPARQL endpoint - read-only Get all Phill Collins albums all_albums=PhilCollinsAlbums.all() Do something with the albums (display the links to their covers) print'All covers'for a inall_albums:    ifa.dbpedia_name:        print'Cover %s for "%s"'%(a.dbpedia_cover,a.dbpedia_name) 28
Outline About DERI Why Semantic Web? Linked Open Data (LOD) RDF (Resource Description Framework) SPARQL O-RDF Mapping (ActiveRDF / SuRF) How? Architecture Installation Examples Simple: access DBpedia (Semantic Wikipedia) More complex: create a blog on top of RDF 29
SuRF – integrate into Pylons Create a blog on top of an RDF database Replace SQLAlchemy with SuRF Download and install either AllegroGraph Free Edition (preferred) or Sesame2 http://www.franz.com/downloads/clp/ag_survey Free for up to 50.000.000 triples (records) Install pylons: easy_install pylons Install SuRF: easy_install surf Create a pylons application: paster create -t pylons MyBlog cd MyBlog 30
SuRF – Pylons Blog  ~/MyBlog/development.ini: In the [app:main] section add rdf_store = localhost rdf_store_port = 6789 rdf_repository = tagbuilder rdf_catalog = repositories ~/MyBlog/myblog/config/environment.py from surf import * rdf_store = Store(  reader      =   'sparql-sesame2-api', 	                        writer      	=   'sesame2-api', 	                        server       =   config['rdf_store'], 	                        port           =   config['rdf_store_port'], 	                        catalog      =   config['rdf_catalog'], 	                        repository  =   config['rdf_repository']) rdf_session = Session(rdf_store, {}) 31
SuRF – Pylons Blog  ~/MyBlog/myblog/model/__ init __.py from surf import *	 definit_model(session): 			global rdf_session rdf_session = session 			# register a namespace for the concepts in my blog ns.register(myblog=‘http://example.url/myblog/namespace#’) Blog = rdf_session.get_class(ns.MYBLOG[‘Blog’]) Create the blog controllerpaster controller blog ~/MyBlog/myblog/controllers/blog.py import logging  frommyblog.lib.baseimport *  log = logging.getLogger(__name__)  classBlogController(BaseController):  def index(self):  c.posts = model.Blog.all(0,5) return render("/blog/index.html") 32
SuRF – Pylons Blog  Create the template mkdir ~/MyBlog/myblog/templates/blog ~/MyBlog/myblog/templates/blog/index.html  <%inherit file="site.html" />  <%def name="title()">MyBlog Home</%def>  <p>${len(c.posts)} new blog posts!</p>  % for post inc.posts:  <p class="content" style="border-style:solid;border-width:1px">  <span class="h3"> ${post.myblog_title} </span>  <span class="h4">Posted on: ${post.myblog_date} by ${post.myblog_author}</span>  <br> ${post.myblog_content}  </p>  % endfor ~/MyBlog/myblog/templates/blog/site.html Start the development built in server: paster serve --reload development.ini 33
SuRF – Tapping into the Web of Data Can tap into the web of Data SPARQL endpoints Local or remote RDF Stores Plugin framework, allows for more access protocols to be defined Code is generated dynamically (pragmatic bottom up approach): Introspection, meta-programming,  exposing a virtual API (defined by the data and the schema) to the developer Can easily be integrated into popular python frameworks pylons 34
exit() cosmin.basca@deri.prg http://code.google.com/p/surfrdf/ easy_install –U surf 35

More Related Content

What's hot

A Hands On Overview Of The Semantic Web
A Hands On Overview Of The Semantic WebA Hands On Overview Of The Semantic Web
A Hands On Overview Of The Semantic WebShamod Lacoul
 
The Semantic Web #10 - SPARQL
The Semantic Web #10 - SPARQLThe Semantic Web #10 - SPARQL
The Semantic Web #10 - SPARQLMyungjin Lee
 
Linked Open Communism - c4l13
Linked Open Communism - c4l13Linked Open Communism - c4l13
Linked Open Communism - c4l13charper
 
Intro to Linked, Dutch Ships and Sailors and SPARQL handson
Intro to Linked, Dutch Ships and Sailors and SPARQL handson Intro to Linked, Dutch Ships and Sailors and SPARQL handson
Intro to Linked, Dutch Ships and Sailors and SPARQL handson Victor de Boer
 
20100614 ISWSA Keynote
20100614 ISWSA Keynote20100614 ISWSA Keynote
20100614 ISWSA KeynoteAxel Polleres
 
Mon norton tut_queryinglinkeddata02
Mon norton tut_queryinglinkeddata02Mon norton tut_queryinglinkeddata02
Mon norton tut_queryinglinkeddata02eswcsummerschool
 
Introduction to RDFa
Introduction to RDFaIntroduction to RDFa
Introduction to RDFaIvan Herman
 
Django Files — A Short Talk (slides only)
Django Files — A Short Talk (slides only)Django Files — A Short Talk (slides only)
Django Files — A Short Talk (slides only)James Aylett
 
GDG Meets U event - Big data & Wikidata - no lies codelab
GDG Meets U event - Big data & Wikidata -  no lies codelabGDG Meets U event - Big data & Wikidata -  no lies codelab
GDG Meets U event - Big data & Wikidata - no lies codelabCAMELIA BOBAN
 
DHWI Linked Open Data - Show and Tell
DHWI Linked Open Data - Show and TellDHWI Linked Open Data - Show and Tell
DHWI Linked Open Data - Show and TellGeorgina Goodlander
 
Bigdive 2014 - RDF, principles and case studies
Bigdive 2014 - RDF, principles and case studiesBigdive 2014 - RDF, principles and case studies
Bigdive 2014 - RDF, principles and case studiesDiego Valerio Camarda
 
Lucene's Latest (for Libraries)
Lucene's Latest (for Libraries)Lucene's Latest (for Libraries)
Lucene's Latest (for Libraries)Erik Hatcher
 
Django Files — A Short Talk
Django Files — A Short TalkDjango Files — A Short Talk
Django Files — A Short TalkJames Aylett
 
Linked data: spreading data over the web
Linked data: spreading data over the webLinked data: spreading data over the web
Linked data: spreading data over the webshellac
 

What's hot (20)

A Hands On Overview Of The Semantic Web
A Hands On Overview Of The Semantic WebA Hands On Overview Of The Semantic Web
A Hands On Overview Of The Semantic Web
 
The Semantic Web #10 - SPARQL
The Semantic Web #10 - SPARQLThe Semantic Web #10 - SPARQL
The Semantic Web #10 - SPARQL
 
Linked Open Communism - c4l13
Linked Open Communism - c4l13Linked Open Communism - c4l13
Linked Open Communism - c4l13
 
Intro to Linked, Dutch Ships and Sailors and SPARQL handson
Intro to Linked, Dutch Ships and Sailors and SPARQL handson Intro to Linked, Dutch Ships and Sailors and SPARQL handson
Intro to Linked, Dutch Ships and Sailors and SPARQL handson
 
20100614 ISWSA Keynote
20100614 ISWSA Keynote20100614 ISWSA Keynote
20100614 ISWSA Keynote
 
Mon norton tut_queryinglinkeddata02
Mon norton tut_queryinglinkeddata02Mon norton tut_queryinglinkeddata02
Mon norton tut_queryinglinkeddata02
 
Jena Programming
Jena ProgrammingJena Programming
Jena Programming
 
RDFa Tutorial
RDFa TutorialRDFa Tutorial
RDFa Tutorial
 
Introduction to RDFa
Introduction to RDFaIntroduction to RDFa
Introduction to RDFa
 
2007 03 12 Swecr 2
2007 03 12 Swecr 22007 03 12 Swecr 2
2007 03 12 Swecr 2
 
Tutorial for RDF Graphs
Tutorial for RDF GraphsTutorial for RDF Graphs
Tutorial for RDF Graphs
 
Django Files — A Short Talk (slides only)
Django Files — A Short Talk (slides only)Django Files — A Short Talk (slides only)
Django Files — A Short Talk (slides only)
 
GDG Meets U event - Big data & Wikidata - no lies codelab
GDG Meets U event - Big data & Wikidata -  no lies codelabGDG Meets U event - Big data & Wikidata -  no lies codelab
GDG Meets U event - Big data & Wikidata - no lies codelab
 
DHWI Linked Open Data - Show and Tell
DHWI Linked Open Data - Show and TellDHWI Linked Open Data - Show and Tell
DHWI Linked Open Data - Show and Tell
 
Bigdive 2014 - RDF, principles and case studies
Bigdive 2014 - RDF, principles and case studiesBigdive 2014 - RDF, principles and case studies
Bigdive 2014 - RDF, principles and case studies
 
Lucene's Latest (for Libraries)
Lucene's Latest (for Libraries)Lucene's Latest (for Libraries)
Lucene's Latest (for Libraries)
 
Apache Solr
Apache SolrApache Solr
Apache Solr
 
Ruby openfest
Ruby openfestRuby openfest
Ruby openfest
 
Django Files — A Short Talk
Django Files — A Short TalkDjango Files — A Short Talk
Django Files — A Short Talk
 
Linked data: spreading data over the web
Linked data: spreading data over the webLinked data: spreading data over the web
Linked data: spreading data over the web
 

Similar to SuRf – Tapping Into The Web Of Data

Virtuoso Sponger - RDFizer Middleware for creating RDF from non RDF Data Sources
Virtuoso Sponger - RDFizer Middleware for creating RDF from non RDF Data SourcesVirtuoso Sponger - RDFizer Middleware for creating RDF from non RDF Data Sources
Virtuoso Sponger - RDFizer Middleware for creating RDF from non RDF Data Sourcesrumito
 
High quality ap is with api platform
High quality ap is with api platformHigh quality ap is with api platform
High quality ap is with api platformNelson Kopliku
 
Semantic web and Drupal: an introduction
Semantic web and Drupal: an introductionSemantic web and Drupal: an introduction
Semantic web and Drupal: an introductionKristof Van Tomme
 
Programming the Semantic Web
Programming the Semantic WebProgramming the Semantic Web
Programming the Semantic WebLuigi De Russis
 
Triplestore and SPARQL
Triplestore and SPARQLTriplestore and SPARQL
Triplestore and SPARQLLino Valdivia
 
A hands on overview of the semantic web
A hands on overview of the semantic webA hands on overview of the semantic web
A hands on overview of the semantic webMarakana Inc.
 
Plugin-based software design with Ruby and RubyGems
Plugin-based software design with Ruby and RubyGemsPlugin-based software design with Ruby and RubyGems
Plugin-based software design with Ruby and RubyGemsSadayuki Furuhashi
 
RDFa Introductory Course Session 2/4 How RDFa
RDFa Introductory Course Session 2/4 How RDFaRDFa Introductory Course Session 2/4 How RDFa
RDFa Introductory Course Session 2/4 How RDFaPlatypus
 
Producing, publishing and consuming linked data - CSHALS 2013
Producing, publishing and consuming linked data - CSHALS 2013Producing, publishing and consuming linked data - CSHALS 2013
Producing, publishing and consuming linked data - CSHALS 2013François Belleau
 
Semantic Web
Semantic WebSemantic Web
Semantic Webhardchiu
 
RDF APIs for .NET Framework
RDF APIs for .NET FrameworkRDF APIs for .NET Framework
RDF APIs for .NET FrameworkAdriana Ivanciu
 
Mashups MAX 360|MAX 2008 Unconference
Mashups MAX 360|MAX 2008 UnconferenceMashups MAX 360|MAX 2008 Unconference
Mashups MAX 360|MAX 2008 UnconferenceElad Elrom
 
Web data from R
Web data from RWeb data from R
Web data from Rschamber
 
WWW09 - Triplify Light-Weight Linked Data Publication from Relational Databases
WWW09 - Triplify Light-Weight Linked Data Publication from Relational DatabasesWWW09 - Triplify Light-Weight Linked Data Publication from Relational Databases
WWW09 - Triplify Light-Weight Linked Data Publication from Relational DatabasesSören Auer
 
2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIs
2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIs2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIs
2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIsJosef Petrák
 

Similar to SuRf – Tapping Into The Web Of Data (20)

Virtuoso Sponger - RDFizer Middleware for creating RDF from non RDF Data Sources
Virtuoso Sponger - RDFizer Middleware for creating RDF from non RDF Data SourcesVirtuoso Sponger - RDFizer Middleware for creating RDF from non RDF Data Sources
Virtuoso Sponger - RDFizer Middleware for creating RDF from non RDF Data Sources
 
Data in RDF
Data in RDFData in RDF
Data in RDF
 
High quality ap is with api platform
High quality ap is with api platformHigh quality ap is with api platform
High quality ap is with api platform
 
Semantic web and Drupal: an introduction
Semantic web and Drupal: an introductionSemantic web and Drupal: an introduction
Semantic web and Drupal: an introduction
 
Programming the Semantic Web
Programming the Semantic WebProgramming the Semantic Web
Programming the Semantic Web
 
Triplestore and SPARQL
Triplestore and SPARQLTriplestore and SPARQL
Triplestore and SPARQL
 
A hands on overview of the semantic web
A hands on overview of the semantic webA hands on overview of the semantic web
A hands on overview of the semantic web
 
Plugin-based software design with Ruby and RubyGems
Plugin-based software design with Ruby and RubyGemsPlugin-based software design with Ruby and RubyGems
Plugin-based software design with Ruby and RubyGems
 
How RDFa works
How RDFa worksHow RDFa works
How RDFa works
 
RDFa Introductory Course Session 2/4 How RDFa
RDFa Introductory Course Session 2/4 How RDFaRDFa Introductory Course Session 2/4 How RDFa
RDFa Introductory Course Session 2/4 How RDFa
 
Semantic Web talk TEMPLATE
Semantic Web talk TEMPLATESemantic Web talk TEMPLATE
Semantic Web talk TEMPLATE
 
Drupal and the Semantic Web
Drupal and the Semantic WebDrupal and the Semantic Web
Drupal and the Semantic Web
 
Producing, publishing and consuming linked data - CSHALS 2013
Producing, publishing and consuming linked data - CSHALS 2013Producing, publishing and consuming linked data - CSHALS 2013
Producing, publishing and consuming linked data - CSHALS 2013
 
Semantic Web
Semantic WebSemantic Web
Semantic Web
 
RDF APIs for .NET Framework
RDF APIs for .NET FrameworkRDF APIs for .NET Framework
RDF APIs for .NET Framework
 
Mashups MAX 360|MAX 2008 Unconference
Mashups MAX 360|MAX 2008 UnconferenceMashups MAX 360|MAX 2008 Unconference
Mashups MAX 360|MAX 2008 Unconference
 
Web data from R
Web data from RWeb data from R
Web data from R
 
Web Frameworks
Web FrameworksWeb Frameworks
Web Frameworks
 
WWW09 - Triplify Light-Weight Linked Data Publication from Relational Databases
WWW09 - Triplify Light-Weight Linked Data Publication from Relational DatabasesWWW09 - Triplify Light-Weight Linked Data Publication from Relational Databases
WWW09 - Triplify Light-Weight Linked Data Publication from Relational Databases
 
2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIs
2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIs2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIs
2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIs
 

Recently uploaded

Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationdeepaannamalai16
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptxDhatriParmar
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Projectjordimapav
 
Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1GloryAnnCastre1
 
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxMan or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxDhatriParmar
 
Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfPrerana Jadhav
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptxmary850239
 
week 1 cookery 8 fourth - quarter .pptx
week 1 cookery 8  fourth  -  quarter .pptxweek 1 cookery 8  fourth  -  quarter .pptx
week 1 cookery 8 fourth - quarter .pptxJonalynLegaspi2
 
How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseCeline George
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxSayali Powar
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operationalssuser3e220a
 
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Association for Project Management
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQuiz Club NITW
 
Using Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea DevelopmentUsing Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea Developmentchesterberbo7
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxDIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxMichelleTuguinay1
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvRicaMaeCastro1
 
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQ-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQuiz Club NITW
 

Recently uploaded (20)

Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentation
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Project
 
Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1
 
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxMan or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
 
Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdf
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx
 
week 1 cookery 8 fourth - quarter .pptx
week 1 cookery 8  fourth  -  quarter .pptxweek 1 cookery 8  fourth  -  quarter .pptx
week 1 cookery 8 fourth - quarter .pptx
 
How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 Database
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operational
 
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
 
Using Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea DevelopmentUsing Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea Development
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxDIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
 
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQ-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
 

SuRf – Tapping Into The Web Of Data

  • 1. SuRF – Tapping into the Web of Data Cosmin Basca Digital Enterprise Research Institute, Galway cosmin.basca@gmail.com Special Thanks to: Benjamin Heitman andUldis Bojars Digital Enterprise Research Institute, Galway firstname.lastname@deri.org
  • 2. Outline About DERI Why Semantic Web? Linked Open Data (LOD) RDF (Resource Description Framework) SPARQL O-RDF Mapping (ActiveRDF / SuRF) How? Architecture Installation Examples Simple: access DBpedia (Semantic Wikipedia) More complex: create a blog on top of RDF 2
  • 3. DERI – http://www.deri.ie/ Digital Enterprise Research Institute (DERI): http://www.deri.ie/ main goal: enabling networked knowledge research about the future of the Web biggest Semantic Web research institute in the world 120 people part of the National University of Ireland, Galway 3
  • 4. Outline About DERI Why Semantic Web? Linked Open Data (LOD) RDF (Resource Description Framework) SPARQL O-RDF Mapping (ActiveRDF / SuRF) How? Architecture Installation Examples Simple: access DBpedia (Semantic Wikipedia) More complex: create a blog on top of RDF 4
  • 5. Why ? Develop Web applications that allow Data Integration Flexibility Schema definition and modeling Schema evolution Robustness Support for new Data Sources Types 5
  • 6. There is a Wealth of (RDF) data out there 6
  • 7. Popular Semantic Web Vocabularies FOAF = for describing people and social network connections between them   http://xmlns.com/foaf/spec/ SIOC = for describing Social Web content created by people   http://sioc-project.org/ DOAP = for describing software projects   http://trac.usefulinc.com/doap used by PyPi 7
  • 8. Linked Open Data - Growth 8
  • 9. Linked Open Data - Growth 9
  • 10. Linked Open Data - Growth 10
  • 11. The data model Traditional Approach use the Relational model Usually leads to big ugly Schemas 11
  • 12. The RDF (Graph) Data model Flexible Support for both schema and data evolution during runtime Simple model Relations are represented explicitly Schema is a graph Can integrate data – union of two graphs 12
  • 13. The RDF (Graph) Data model 13 Subject Object Predicate A triple is a Eric Person
  • 14. Example RDF graph describing Eric Miller (RDF Primer) – human readable format 14 Person is a Eric has full name Eric Miller has e-mail em@w3.org has personal title Dr.
  • 15. Example RDF graph describing Eric Miller (RDF Primer) – machine readable format 15 http://w3.org/2000/10/swap/pic/contact#Person http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://w3.org/People/EM/contact#me http://www.w3.org/2000/10/swap/pim/contact#fullName Eric Miller http://www.w3.org/2000/10/swap/pim/contact#mailbox mailto:em@w3.org http://www.w3.org/2000/10/swap/pim/contact#personalTitle Dr.
  • 16. The RDF (Graph) Data model – Identification URI’s provide strong references The URIref is a an unambiguous pointer to something of meaning Nodes (“Subjects”) connect via Links (“Predicates”) to Objects Can be Nodes or Literals (plain or typed strings) 16
  • 17. SPARQL – Querying the Semantic Web SPARQL is to RDF what SQL is to Relational tables Expressive, designed with the Graph data model in mind 17 Carrie Fisher starred_in Star Wars starred_in Harrison Ford starred_in Blade Runner starred_in Darryl Hannah SELECT ?actor ?movie WHERE { ?actor starred_in ?movie }
  • 18. Levels of Data abstraction 18 Direct SPARQL Access O-RDF Mapper SuRF
  • 19. O-RDF Mapper, Why? Clean OO design Increased productivity model is free from persistence constraints Separation of concerns and specialization ORMs often reduce the amount of code needed to be written, making the software more robust 20% to 30% less code needs to be written Less code – less testing – less errors 19
  • 20. O-RDF Mapper, How? How do we see RDF data? As a SET of triples? As a SET of resources? The resource view is more suitable for the OO model How do we define an RDF resource ? All triples <S,P,O>with same subject (ActiveRDF, SuRF) And all triples <O,P,S> (SuRF) Apply Open World principles 20
  • 21. Outline About DERI Why Semantic Web? Linked Open Data (LOD) RDF (Resource Description Framework) SPARQL O-RDF Mapping (ActiveRDF / SuRF) How? Architecture Installation Examples Simple: access DBpedia (Semantic Wikipedia) More complex: create a blog on top of RDF 21
  • 22. SuRF – Semantic Resource Framework Inspired by ActiveRDF Developed in DERI for ruby Expose RDF as sets of resources Semantic attributes exposed as a “virtual API”, generated through introspection. Naming convention: instance.namespace_attribute cosmin.foaf_knows Finder methods Retrieve resources by type or by attributes Session keeps track of resources, when calling session.commit() only dirty resources will be persisted 22
  • 24. SuRF – Architecture – Currently supported plugins 24 Add your own plugins, extend: surf.store.plugins.RDFReader surf.store.plugins.RDFWriter Redefine the __type__ attribute This is the plugin identifier To install plugins import my_plugin
  • 25. SuRF - installation Available on PyPi easy_install –U surf (to get the latest) Open-source available on Google Code, BSD licence http://code.google.com/p/surfrdf/ 25
  • 26. Outline About DERI Why Semantic Web? Linked Open Data (LOD) RDF (Resource Description Framework) SPARQL O-RDF Mapping (ActiveRDF / SuRF) How? Architecture Installation Examples Simple: access DBpedia (Semantic Wikipedia) More complex: create a blog on top of RDF 26
  • 27. DBpedia public SPARQL endpoint - read-only Create the store proxy from surf import* store = Store(reader='sparql-protocol',endpoint='http://dbpedia.org/sparql',                default_graph='http://dbpedia.org') Create the surf session print'Create the session'session =Session(store,{}) Map a dbpedia concept to an internal class PhilCollinsAlbums=session.get_class(ns.YAGO['PhilCollinsAlbums']) SuRF – simple example 27
  • 28. SuRF – simple example DBpedia public SPARQL endpoint - read-only Get all Phill Collins albums all_albums=PhilCollinsAlbums.all() Do something with the albums (display the links to their covers) print'All covers'for a inall_albums:    ifa.dbpedia_name:        print'Cover %s for "%s"'%(a.dbpedia_cover,a.dbpedia_name) 28
  • 29. Outline About DERI Why Semantic Web? Linked Open Data (LOD) RDF (Resource Description Framework) SPARQL O-RDF Mapping (ActiveRDF / SuRF) How? Architecture Installation Examples Simple: access DBpedia (Semantic Wikipedia) More complex: create a blog on top of RDF 29
  • 30. SuRF – integrate into Pylons Create a blog on top of an RDF database Replace SQLAlchemy with SuRF Download and install either AllegroGraph Free Edition (preferred) or Sesame2 http://www.franz.com/downloads/clp/ag_survey Free for up to 50.000.000 triples (records) Install pylons: easy_install pylons Install SuRF: easy_install surf Create a pylons application: paster create -t pylons MyBlog cd MyBlog 30
  • 31. SuRF – Pylons Blog ~/MyBlog/development.ini: In the [app:main] section add rdf_store = localhost rdf_store_port = 6789 rdf_repository = tagbuilder rdf_catalog = repositories ~/MyBlog/myblog/config/environment.py from surf import * rdf_store = Store( reader = 'sparql-sesame2-api', writer = 'sesame2-api', server = config['rdf_store'], port = config['rdf_store_port'], catalog = config['rdf_catalog'], repository = config['rdf_repository']) rdf_session = Session(rdf_store, {}) 31
  • 32. SuRF – Pylons Blog ~/MyBlog/myblog/model/__ init __.py from surf import * definit_model(session): global rdf_session rdf_session = session # register a namespace for the concepts in my blog ns.register(myblog=‘http://example.url/myblog/namespace#’) Blog = rdf_session.get_class(ns.MYBLOG[‘Blog’]) Create the blog controllerpaster controller blog ~/MyBlog/myblog/controllers/blog.py import logging frommyblog.lib.baseimport * log = logging.getLogger(__name__) classBlogController(BaseController): def index(self): c.posts = model.Blog.all(0,5) return render("/blog/index.html") 32
  • 33. SuRF – Pylons Blog Create the template mkdir ~/MyBlog/myblog/templates/blog ~/MyBlog/myblog/templates/blog/index.html <%inherit file="site.html" /> <%def name="title()">MyBlog Home</%def> <p>${len(c.posts)} new blog posts!</p> % for post inc.posts: <p class="content" style="border-style:solid;border-width:1px"> <span class="h3"> ${post.myblog_title} </span> <span class="h4">Posted on: ${post.myblog_date} by ${post.myblog_author}</span> <br> ${post.myblog_content} </p> % endfor ~/MyBlog/myblog/templates/blog/site.html Start the development built in server: paster serve --reload development.ini 33
  • 34. SuRF – Tapping into the Web of Data Can tap into the web of Data SPARQL endpoints Local or remote RDF Stores Plugin framework, allows for more access protocols to be defined Code is generated dynamically (pragmatic bottom up approach): Introspection, meta-programming, exposing a virtual API (defined by the data and the schema) to the developer Can easily be integrated into popular python frameworks pylons 34