SlideShare a Scribd company logo
Leigh Dodds @ldodds http://kasabi.com Creating APIs over RDF Data Sources 8 th  June 2011. SemTech 2011
The Trouble with SPARQL
Try our SPARQL Endpoint! Run Query
http://dbpedia.org/sparql?default-graph-uri=http%3A%2F%2Fdbpedia.org&query=SELECT+%3Fresult+FROM+%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FBMW_Z8%3E+WHERE+{+%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FBMW_Z8%3E+dbpprop%3Aname+%3Fresult+.+FILTER+%28LANG%28%3Fresult%29+%3D+%27en%27%29+.}&debug=on&timeout=&format=text%2Fhtml&save=display&fname= Trial and error experiments aren't easy
APIs have Affordance They're like pulling a thread The URLs unravel into useful data
http://api.simplegeo.com/1.0/context/{lat},{lon}.json Trial and error experiments are easy
SPARQL is for Power Users
How can we give RDF datasets more affordance?
Linked Data? Typically not expressive enough to support all useful interactions Expensive to materialize all useful data partitions E.g. by date-time, location, top ranking, etc
Build Custom APIs? Write custom code against your graph store Can be expensive to build & maintain Undermines power of web of data
OData? Standard data API from Microsoft Very similar to RDF & Linked Data approach Can be implemented over SPARQL endpoint
SPARQL Stored Procedures & The Linked Data API
SPARQL “Stored Procedures”
Bind SPARQL query to a URL http://api.kasabi.com/api/find-recipe-ingredient?ingredient={x}
More than just a URL shortener 1. Identify query bound to URL 2. Inject parameters from URL & config 3. Apply paging/sorting options 4. Execute query 5. Optionally, apply post-processing transformations
Parameter Passing Optional and Required Parameters Mapping to a particular type of RDF Term, e.g. literal, URI May have a default value May have a default prefix, e.g. base URL
Post-Processing Named transformations that generate a specific mime-type Supports generating custom output formats Currently just XSLT. Could support JS
Stored Procedure Benefits Declarative approach Offers simpler interface to developers Retains RDF output, but supports custom formats
The Linked Data API
Linked Data API http://purl.org/linked-data/api/spec Jeni Tennison (TSO), Dave Reynolds (Epimorphics), Leigh Dodds
Linked Data API Map parameterised URLs to graph queries to extract data views
Linked Data API Optimize for common query patterns Prioritize simple RESTful interactions not complex queries Provide pathway to exploring RDF and SPARQL
Processing Model Select View Request Response Format SPARQL Endpoint SELECT ?item  WHERE { … } Endpoint DESCRIBE <x> <y>  API Config
Selecting Resources URL mapped to query patterns by API configuration Query variables injected from URL path or query string Simple path expressions for traversing graph Support for sorting and paging
Viewing Resources Default “view” is Concise Bounded Description Can specify arbitrary collections of properties in config or URL
Output Formats Simple JSON and XML formats Standard RDF serializations Custom formats, including HTML, via XSLT
@prefix spec:   <http://api.kasabi.com/api/foodista-lda/> . @prefix api:  <http://purl.org/linked-data/api/vocab#> . @prefix rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> . @prefix recipe:  <http://linkedrecipes.org/schema/> . spec:api a api:API ; api:defaultPageSize &quot;10&quot; ; api:endpoint spec:foods . spec:foods a api:ListEndpoint ; api:uriTemplate &quot;/foods&quot; ; api:selector [  api:filter &quot;type=Food&quot; ]; api:defaultViewer api:describeViewer . rdf:type api:label &quot;type&quot; . recipe:Food api:label &quot;Food&quot; .
{ &quot;format&quot;: &quot;linked-data-api&quot;, &quot;version&quot;: &quot;0.2&quot; &quot;result&quot;: { &quot;items&quot;: [ { &quot;label&quot;: &quot;Balsamic Vinegar&quot;, &quot;isPrimaryTopicOf&quot;: &quot;http://www.foodista.com/food/23HWFLXY &quot;type&quot;: &quot;http://linkedrecipes.org/schema/Food&quot;, &quot;_about&quot;: &quot;http://data.kasabi.com/dataset/foodista/food/23HWFLXY&quot;, &quot;description&quot;: &quot;Balsamic Vinegar is...&quot; },   ... ], &quot;modified&quot;: &quot;Monday, 06-Jun-11 19:15:43 UTC&quot;, &quot;itemsPerPage&quot;: 10, &quot;startIndex&quot;: 0, &quot;type&quot;: &quot;http://purl.org/linked-data/api/vocab#Page&quot;, &quot;first&quot;: &quot;/api/foodista-linked-data-api/foods.json?_page=1&quot;, &quot;_about&quot;: &quot;/api/foodista-linked-data-api/foods.json?_page=1&quot;, &quot;next&quot;: &quot;/api/foodista-linked-data-api/foods.json?_page=2&quot;, ... }
Open Source Implementations Puelia (PHP) http://code.google.com/p/puelia-php/ Elda (Java) http://code.google.com/p/elda/
Linked Data API Summary Declarative configuration-driven approach More sophisticated than SSPs Integrates well with Linked Data publishing Slightly higher learning curve
Summary
Adopt hybrid approach to encourage adoption Combine Linked Data with SPARQL  powered  APIs Recognise need for bridging, adapting between tools/systems/communities
Support a “view source” approach  Enable Crowd-Sourcing of APIs by sharing configuration & queries
Try It For Yourself! http://beta.kasabi.com Linked Data, RDF and API hosting Demo: 9.30 tomorrow
 

More Related Content

PPT
W3 C Specification For Interoperability And Accessibility For Ajax, Dhtml, Xm...
PDF
쉽게 이해하는 LOD
PDF
Linking the world with Python and Semantics
PDF
Querying Linked Data with SPARQL
PPTX
Semantic web meetup – sparql tutorial
PDF
WebTech Tutorial Querying DBPedia
PPTX
SPARQL Cheat Sheet
ODP
SPARQL 1.1 Update (2013-03-05)
W3 C Specification For Interoperability And Accessibility For Ajax, Dhtml, Xm...
쉽게 이해하는 LOD
Linking the world with Python and Semantics
Querying Linked Data with SPARQL
Semantic web meetup – sparql tutorial
WebTech Tutorial Querying DBPedia
SPARQL Cheat Sheet
SPARQL 1.1 Update (2013-03-05)

What's hot (20)

PDF
RDF Tutorial - SPARQL 20091031
PPT
Introduction To Xml
PPTX
Parsing strange v1.1
KEY
Switching search to SOLR
PPT
KEY
Semantic web application architecture
ODP
NoSQL and Triple Stores
PDF
An Introduction to SPARQL
PPTX
SPARQL-DL - Theory & Practice
PPTX
SPARQL 1.1 Status
ODP
Graph Data -- RDF and Property Graphs
PPTX
4 sw architectures and sparql
PPTX
Federated SPARQL query processing over the Web of Data
PPTX
How to do Keyword Research: 7 Techniques & Tools
PDF
Xml
PDF
PPT
2008 11 13 Hcls Call
PDF
Attention Profiling Markup Language Presentation For Xtech08
PPTX
Consuming Linked Data 4/5 Semtech2011
PPTX
FedX - Optimization Techniques for Federated Query Processing on Linked Data
RDF Tutorial - SPARQL 20091031
Introduction To Xml
Parsing strange v1.1
Switching search to SOLR
Semantic web application architecture
NoSQL and Triple Stores
An Introduction to SPARQL
SPARQL-DL - Theory & Practice
SPARQL 1.1 Status
Graph Data -- RDF and Property Graphs
4 sw architectures and sparql
Federated SPARQL query processing over the Web of Data
How to do Keyword Research: 7 Techniques & Tools
Xml
2008 11 13 Hcls Call
Attention Profiling Markup Language Presentation For Xtech08
Consuming Linked Data 4/5 Semtech2011
FedX - Optimization Techniques for Federated Query Processing on Linked Data
Ad

Similar to Creating APIs over RDF (20)

ODP
SPARQLing Services
PPT
Twinkle: A SPARQL Query Tool
PPTX
The Semantic Web #10 - SPARQL
PPT
From SQL to SPARQL
PPT
Facet: Building Web Pages with SPARQL
ODP
Slug: A Semantic Web Crawler
PDF
Sparql a simple knowledge query
ODP
Architecting Web Services
PPT
Getting Started With The Talis Platform
ODP
Web Scraping with PHP
PPT
Semantic Web
PDF
03 form-data
PPTX
working with PHP & DB's
PPT
ODP
An Overview on PROV-AQ: Provenance Access and Query
PPTX
Oracle APEX URLs Untangled & SEOptimized
PPT
Building linked data apps
ODP
RestFull Webservices with JAX-RS
PPT
Querying the Semantic Web with SPARQL
PPTX
Spring Surf 101
SPARQLing Services
Twinkle: A SPARQL Query Tool
The Semantic Web #10 - SPARQL
From SQL to SPARQL
Facet: Building Web Pages with SPARQL
Slug: A Semantic Web Crawler
Sparql a simple knowledge query
Architecting Web Services
Getting Started With The Talis Platform
Web Scraping with PHP
Semantic Web
03 form-data
working with PHP & DB's
An Overview on PROV-AQ: Provenance Access and Query
Oracle APEX URLs Untangled & SEOptimized
Building linked data apps
RestFull Webservices with JAX-RS
Querying the Semantic Web with SPARQL
Spring Surf 101
Ad

More from Leigh Dodds (20)

PDF
Being a data magpie
PDF
How you (yes, you!) can contribute to open data
ODP
Accessible Bath Training
ODP
Accessible Bath
PDF
Cheap bots done quick lightning talk
PDF
Open data in bath
PDF
Bath: Hacked Learning Night: Introduction to CartoDB
ODP
Dungeons and Dragons and Data
ODP
Love the Environment Pre-Meetup
PPT
Why I love open data and you should too
ODP
Introduction to Open Data & Bath: Hacked
ODP
Bath: Hacked: open data, the arts and cultural heritage
PDF
Introduction to Open Data & Linked Data
PDF
Time Travelling with Open Data
PPT
Ignite for Good: Why I Love Open Data and You Should Too
ODP
Oil and Water: When Data Licences Don't Mix
PDF
Linked Data Patterns
PDF
Digital Grafitti for Digital Cities
PDF
Layered Data: An Example
PDF
Data Foundations for Digital Cities
Being a data magpie
How you (yes, you!) can contribute to open data
Accessible Bath Training
Accessible Bath
Cheap bots done quick lightning talk
Open data in bath
Bath: Hacked Learning Night: Introduction to CartoDB
Dungeons and Dragons and Data
Love the Environment Pre-Meetup
Why I love open data and you should too
Introduction to Open Data & Bath: Hacked
Bath: Hacked: open data, the arts and cultural heritage
Introduction to Open Data & Linked Data
Time Travelling with Open Data
Ignite for Good: Why I Love Open Data and You Should Too
Oil and Water: When Data Licences Don't Mix
Linked Data Patterns
Digital Grafitti for Digital Cities
Layered Data: An Example
Data Foundations for Digital Cities

Recently uploaded (20)

PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Approach and Philosophy of On baking technology
PDF
Review of recent advances in non-invasive hemoglobin estimation
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
Cloud computing and distributed systems.
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Encapsulation theory and applications.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
KodekX | Application Modernization Development
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Spectral efficient network and resource selection model in 5G networks
Approach and Philosophy of On baking technology
Review of recent advances in non-invasive hemoglobin estimation
The AUB Centre for AI in Media Proposal.docx
Chapter 3 Spatial Domain Image Processing.pdf
Cloud computing and distributed systems.
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Programs and apps: productivity, graphics, security and other tools
The Rise and Fall of 3GPP – Time for a Sabbatical?
Diabetes mellitus diagnosis method based random forest with bat algorithm
Advanced methodologies resolving dimensionality complications for autism neur...
sap open course for s4hana steps from ECC to s4
Encapsulation theory and applications.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
KodekX | Application Modernization Development
20250228 LYD VKU AI Blended-Learning.pptx

Creating APIs over RDF

  • 1. Leigh Dodds @ldodds http://kasabi.com Creating APIs over RDF Data Sources 8 th June 2011. SemTech 2011
  • 3. Try our SPARQL Endpoint! Run Query
  • 5. APIs have Affordance They're like pulling a thread The URLs unravel into useful data
  • 7. SPARQL is for Power Users
  • 8. How can we give RDF datasets more affordance?
  • 9. Linked Data? Typically not expressive enough to support all useful interactions Expensive to materialize all useful data partitions E.g. by date-time, location, top ranking, etc
  • 10. Build Custom APIs? Write custom code against your graph store Can be expensive to build & maintain Undermines power of web of data
  • 11. OData? Standard data API from Microsoft Very similar to RDF & Linked Data approach Can be implemented over SPARQL endpoint
  • 12. SPARQL Stored Procedures & The Linked Data API
  • 14. Bind SPARQL query to a URL http://api.kasabi.com/api/find-recipe-ingredient?ingredient={x}
  • 15. More than just a URL shortener 1. Identify query bound to URL 2. Inject parameters from URL & config 3. Apply paging/sorting options 4. Execute query 5. Optionally, apply post-processing transformations
  • 16. Parameter Passing Optional and Required Parameters Mapping to a particular type of RDF Term, e.g. literal, URI May have a default value May have a default prefix, e.g. base URL
  • 17. Post-Processing Named transformations that generate a specific mime-type Supports generating custom output formats Currently just XSLT. Could support JS
  • 18. Stored Procedure Benefits Declarative approach Offers simpler interface to developers Retains RDF output, but supports custom formats
  • 20. Linked Data API http://purl.org/linked-data/api/spec Jeni Tennison (TSO), Dave Reynolds (Epimorphics), Leigh Dodds
  • 21. Linked Data API Map parameterised URLs to graph queries to extract data views
  • 22. Linked Data API Optimize for common query patterns Prioritize simple RESTful interactions not complex queries Provide pathway to exploring RDF and SPARQL
  • 23. Processing Model Select View Request Response Format SPARQL Endpoint SELECT ?item WHERE { … } Endpoint DESCRIBE <x> <y> API Config
  • 24. Selecting Resources URL mapped to query patterns by API configuration Query variables injected from URL path or query string Simple path expressions for traversing graph Support for sorting and paging
  • 25. Viewing Resources Default “view” is Concise Bounded Description Can specify arbitrary collections of properties in config or URL
  • 26. Output Formats Simple JSON and XML formats Standard RDF serializations Custom formats, including HTML, via XSLT
  • 27. @prefix spec: <http://api.kasabi.com/api/foodista-lda/> . @prefix api: <http://purl.org/linked-data/api/vocab#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix recipe: <http://linkedrecipes.org/schema/> . spec:api a api:API ; api:defaultPageSize &quot;10&quot; ; api:endpoint spec:foods . spec:foods a api:ListEndpoint ; api:uriTemplate &quot;/foods&quot; ; api:selector [ api:filter &quot;type=Food&quot; ]; api:defaultViewer api:describeViewer . rdf:type api:label &quot;type&quot; . recipe:Food api:label &quot;Food&quot; .
  • 28. { &quot;format&quot;: &quot;linked-data-api&quot;, &quot;version&quot;: &quot;0.2&quot; &quot;result&quot;: { &quot;items&quot;: [ { &quot;label&quot;: &quot;Balsamic Vinegar&quot;, &quot;isPrimaryTopicOf&quot;: &quot;http://www.foodista.com/food/23HWFLXY &quot;type&quot;: &quot;http://linkedrecipes.org/schema/Food&quot;, &quot;_about&quot;: &quot;http://data.kasabi.com/dataset/foodista/food/23HWFLXY&quot;, &quot;description&quot;: &quot;Balsamic Vinegar is...&quot; }, ... ], &quot;modified&quot;: &quot;Monday, 06-Jun-11 19:15:43 UTC&quot;, &quot;itemsPerPage&quot;: 10, &quot;startIndex&quot;: 0, &quot;type&quot;: &quot;http://purl.org/linked-data/api/vocab#Page&quot;, &quot;first&quot;: &quot;/api/foodista-linked-data-api/foods.json?_page=1&quot;, &quot;_about&quot;: &quot;/api/foodista-linked-data-api/foods.json?_page=1&quot;, &quot;next&quot;: &quot;/api/foodista-linked-data-api/foods.json?_page=2&quot;, ... }
  • 29. Open Source Implementations Puelia (PHP) http://code.google.com/p/puelia-php/ Elda (Java) http://code.google.com/p/elda/
  • 30. Linked Data API Summary Declarative configuration-driven approach More sophisticated than SSPs Integrates well with Linked Data publishing Slightly higher learning curve
  • 32. Adopt hybrid approach to encourage adoption Combine Linked Data with SPARQL powered APIs Recognise need for bridging, adapting between tools/systems/communities
  • 33. Support a “view source” approach Enable Crowd-Sourcing of APIs by sharing configuration & queries
  • 34. Try It For Yourself! http://beta.kasabi.com Linked Data, RDF and API hosting Demo: 9.30 tomorrow
  • 35.