Upload
steve-speicher
View
273
Download
2
Tags:
Embed Size (px)
DESCRIPTION
Charts from 10/8/2014 RTP meetup
Citation preview
REST meets Semantic Web
REST meets Semantic Webby Steve Speicher @sspeiche
©Steve Speicher @sspeiche. All rights reserved.
Areas to explore…
RESTperts
Semantic What?
Case Study
BEvERages
Look at a real cases
“Without data you’re just another person with an opinion”
W. Edwards Deming
Case Study(show me)
Problem:From some known issues, find out
how long they have been open per assignee.
Case Study
Oh, based on GitHub issues.
GitHub IssuesThere’s an API for that…
Case Study
GET /repos/:owner/:repo/issues/:number
Case Study
$curl https://api.github.com/repos/w3c/ldp-testsuite/issues/17 { "created_at": "2014-05-27T20:06:49Z", "updated_at": "2014-06-30T01:37:00Z", "closed_at": "2014-06-30T01:37:00Z", "state": "closed", "assignee": { "login": "sspeiche", "id": 727196, "avatar_url": "https://avatars.githubusercontent.com/u/727196?v=2", "url": "https://api.github.com/users/sspeiche", "followers_url": "https://api.github.com/users/sspeiche/followers", "following_url": "https://api.github.com/users/sspeiche/following{/other_user}", "gists_url": "https://api.github.com/users/sspeiche/gists{/gist_id}” },}
Case Study
if (val.state == "closed” && val.assignee.login == assignee) { computeCloseTime(assignee, val.closed_at, val.created_at);}
Simple enough code, right?
Case Study
Case Study
$curl https://issues.apache.org/jira/rest/api/2/issue/IO-147
{ "created": "2007-12-18T13:04:55.320+0000”, "updated": "2008-08-22T07:36:50.877+0000", "resolutiondate": "2008-01-04T12:32:51.403+0000”, "customfield_12310220": "2007-12-18 18:19:12.648", "status": { "self": "https://issues.apache.org/jira/rest/api/2/status/6", "name": "Closed", "id": "6", }, "assignee": { "self": "https://issues.apache.org/jira/rest/api/2/user?username=steves", "name": ”steves", "emailAddress": ”steves at apache dot org", "displayName": ”Steve S” },}
Case Study
if (val.state == "closed” && val.assignee.login == assignee) { computeCloseTime(assignee, val.closed_at, val.created_at);} else if (val.status.name == "Closed” && val.assignee.name == assignee) { computeCloseTime(assignee, val.resolutiondate, val.created);}
Code becomes this….
…not so simple anymore, but wait!
Case Study
Case Study
©Steve Speicher @sspeiche. All rights reserved.
REST meets Semantic Web
Case Study
if (val.state == "closed” && val.assignee.login == assignee) { computeCloseTime(assignee, val.closed_at, val.created_at);} else if (val.status.name == "Closed” && val.assignee.name == assignee) { computeCloseTime(assignee, val.resolutiondate, val.created);} else if (val.issueState != “Opened” && val.owner.login.id == assignee) { computeCloseTime(assignee, convertDateTime(val.end.date, val.end.time), convertDateTime(val.start.date, val.start.time));} else if (val.status != “Opened” && val.status != “InProgress” && val.status != “InReview” && matchAssignee(val.assignee.mbox, assignee)) { computeCloseTime(assignee, val.lastUpdated, val.creationDate);}
THEN code becomes this….
Case Study
$curl https://magical.unicorns.org/nonissue4
Link: </issue.jsonld>; rel=“context”
{ "created": "2008-08-18T13:04:55.320+0000”, "updated": "2008-09-04T12:32:51.403+0000", ”closed” : "2008-09-04T12:32:51.403+0000”, “status” : “closed”, "assignee": { ”@id” : "https://stevespeicher.me", ”login” : ”sspeiche", ”mbox” : ”[email protected]", ”title": ”Steve S” },}
Ideal
Case Study
var issue = parseIssue(val);if (issue.status == “closed” && issue.assignee.login == assignee) { computeCloseTime(assignee, issue.closed, issue.created);}
This initial code sample could be the complex case too…
Case Study
var issue = parseIssue(val);if (issue.closed && issue.assignee.login == assignee) { computeCloseTime(assignee, issue.closed, issue.created);}
…and even simpler
PRACTICAL APPLICATIONS OF SEMANTICS IN RETAILA YEAR OF EXPERIMENTATIONJay Myers, Best Buy @jaymyers
Borrowed From
COMMON DATA FLOW INTO CMS/ PIM
Data Source(s) PIM/ CMSwith
schema
Accepted data
Discardeddata
RDBMS
COMPLETE DATA + SEMANTICS = DISCOVERY
+ +
CONVERSION
11x 5x9x
* vs. standard site conversion
“Stocking Stuffers” Valentine’s Day St Patrick’s Day
What is REST?Ask the…
RESTafarians, RESTperts, …
REST(web services)
REST(web
services)
Resource GET POST PUT DELETE
Collection URIhttp://ex.com/resources
fetch create element
create / replace
rm *
Element URIhttp://ex.com/resources/item17
fetch open create / replace
rm
HTTP/1.1 201 CREATEDContent-Location: http://example.org/container1/member4
Create and addPOST /container1 HTTP/1.1Host: example.orgContent-length: 324Link: <http://schema.org/context.jsonld>; rel=“context”
{ ”@type" : ”http://schema.org/Product", ”name" : ”White microwave", ”productId" : ”w2134"}
Request
Resp
onse
http://example.org
container1
member1
member2
member3
+member4
POST
Fetch updated collectionGET /container1 HTTP/1.1Host: example.orgAccept: application/ld+json, application/json, */*;q=0.1
Reques
t
http://example.org
container1
member1
member2
member3
member4
GET
Removed HTTP headers to save some space
Link: </cat.jsonld>; rel=“context”
{ "@id" : "http://example.org/container1", "@type" : ”http://www.w3c.org/ns/ldp#Container", "title" : ”Product catalog", "member" : [ "member2", "member1", "member3", "member4" ]}R
esp
onse
SemanticsSo I have some representation, now what?
Semantics
(understanding)
hypermediaREST
+ =
<a href=“/item47” type=“product”>Product A</a>
or
“productId” : “w2134” “name” : “Product B”
REST
What about the hypermedia?
Semantics
“productId” : “w2134”
or
“product” : “http://ex.com/resources/item47”
Are we talking about the same thing?
Semantics
“productId” : “w2134”or“@type” : “http://schema.org/Product”
What are we talking about?
“isCatalog” : trueor“@type” : “http://www.w3.org/ns/ldp#Container”
What went wrong?
Did a small part of Roy T. Fielding die?
Wrap it up
Discovery DocsURL templates - https://tools.ietf.org/html/rfc6570JSON-Home - http://tools.ietf.org/html/draft-nottingham-json-home-03stacker.io - http://petstore.swagger.wordnik.com/
Wrap it up
© your company name. All rights reserved. Title of your presentation
http://w3.org/TR/ldp
W3C Linked Data Platform