Your SlideShare is downloading. ×
Creating web applications with LODSPeaKr
Creating web applications with LODSPeaKr
Creating web applications with LODSPeaKr
Creating web applications with LODSPeaKr
Creating web applications with LODSPeaKr
Creating web applications with LODSPeaKr
Creating web applications with LODSPeaKr
Creating web applications with LODSPeaKr
Creating web applications with LODSPeaKr
Creating web applications with LODSPeaKr
Creating web applications with LODSPeaKr
Creating web applications with LODSPeaKr
Creating web applications with LODSPeaKr
Creating web applications with LODSPeaKr
Creating web applications with LODSPeaKr
Creating web applications with LODSPeaKr
Creating web applications with LODSPeaKr
Creating web applications with LODSPeaKr
Creating web applications with LODSPeaKr
Creating web applications with LODSPeaKr
Creating web applications with LODSPeaKr
Creating web applications with LODSPeaKr
Creating web applications with LODSPeaKr
Creating web applications with LODSPeaKr
Creating web applications with LODSPeaKr
Creating web applications with LODSPeaKr
Creating web applications with LODSPeaKr
Creating web applications with LODSPeaKr
Creating web applications with LODSPeaKr
Creating web applications with LODSPeaKr
Creating web applications with LODSPeaKr
Creating web applications with LODSPeaKr
Creating web applications with LODSPeaKr
Creating web applications with LODSPeaKr
Creating web applications with LODSPeaKr
Creating web applications with LODSPeaKr
Creating web applications with LODSPeaKr
Creating web applications with LODSPeaKr
Creating web applications with LODSPeaKr
Creating web applications with LODSPeaKr
Creating web applications with LODSPeaKr
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Creating web applications with LODSPeaKr

2,245

Published on

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,245
On Slideshare
0
From Embeds
0
Number of Embeds
6
Actions
Shares
0
Downloads
16
Comments
0
Likes
2
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Transcript

    • 1. Creating web applications with LODSPeaKr Alvaro Graves Tetherless World Constellation Rensselaer Polytechnic Institute gravea3@rpi.edu @alvarograves 1
    • 2. Agenda• What is Linked Data?• Why LODSPeaKr?• Installation and setting up• Building an app • Features of LODSPeaKr• Future work and Conclusions 2
    • 3. What is Linked Data? (you should know by now) 3
    • 4. What is Linked Data?• Set of best practices (based on Semantic Web technologies) to publish structured data on the Web • Use of Web technologies (RDF, HTTP, URIs) • Connect my data to other people’s data by links 4
    • 5. What is Linked Data? (2)• Use (HTTP) URIs to identify things• When somebody lookup those URIs, provide useful information • HTML for humans • RDF for machines• Link to other relevant URIs so people can discover more data 5
    • 6. Why do we need a XXX framework?• Lack of tools for using Linked Data • Exploring data • Publishing data • Create applications• High quality data is available • Lots of cases where computational complexity is low • Data management complexity is high 6
    • 7. Linked Open Data Simple Publishing Kit 7
    • 8. Installation 8
    • 9. Requirements• git• cURL• SQLite3• PHP > 5.2 (+ bindings to curl and sqlite)• Apache mod_rewrite• bash 9
    • 10. Installation (the easy way)cd /var/www/myappbash < <(curl -s http://lodspeakr.org/install)•Where is LODSPK located? (e.g., http://localhost/myapp/)•What is the default namespace? (e.g., http://tw.rpi.edu/)•Where is your endpoint? (http://logd.tw.rpi.edu/sparql) 10
    • 11. Permissions• Let apache write in • cache/ • meta/ • meta/db.sqlite chown -R www-data cache meta 11
    • 12. Exploring data• By default LODSPeaKr allow users to • Find named graphs in sparql endpoint • Classes available • Instances available for each class • All predicates from/to a URI 12
    • 13. LODSPeaKr installed, no further configuration
    • 14. By default LODSPeaKr serves• HTML+RDFa• RDF/XML• Turtle• N-Triples• RDFJSON
    • 15. Content negotiationProvides a mechanism for serving documents according to what the client accepts GET http://example.org/resource HTTP Accept: application/rdf+xml HTTP Status: 303 See Other Location: http://example.org/resource.rdf Server GET http://example.org/resource.rdf HTTP Accept: application/rdf+xml User http://example.org/resource.rdf Content-type: application/rdf+xml
    • 16. Building a webappusing LODSPeaKr 16
    • 17. Data: TWC People• Information about • People • Meetings • Publications • Projects • etc. 17
    • 18. URI Mirroring• http://theirdomain/data => http://mydomain/data• Provides dereferenceable URIs in own domain• Can reuse data structure in a different domain• When serving RDF, LODSPeaKr provides • Data in original form • owl:sameAs and con:preferredUri that links original and new URI 18
    • 19. Modules in LODSPeaKr StaticModule css, js files URIModule matches particular URIs Execution order TypeModule matches URIs of a certain type ServiceModule creates new services 19
    • 20. Basic file structure 20
    • 21. Model queriesLODSPeaKr uses sp.queryHaanga, a Django-style SELECT ?s ?p { WHERE {template engine that GRAPH ?g{ ?s ?p <{{uri}}> .allow developers to } }UNION{include values in specific ?s ?p <{{uri}}> . }parts of a document. } 21
    • 22. View templates Templates also uses Haanga for filling results. Results are accessed via models.[query]+.variable.[value|curie] <table> {% for row in models.main %} <tr> <td><a href={{row.p1.value}}>{{row.p1.curie}}</a></td> <td><a href={{row.s1.value}}>{{row.s1.curie}}</a></td> </tr> {% endfor %} </table><table> <tr> <td><a href=http://www.w3.org/1999/02/22-rdf-syntax-ns#type>rdf:type</a></td> <td><a rel=rdf:type href=http://www.w3.org/2000/01/rdf-schema#Resource>rdfs:Resource</a></td> </tr> <tr> <td><a href=http://www.w3.org/1999/02/22-rdf-syntax-ns#type>rdf:type</a></td> <td><a rel=rdf:type href=http://xmlns.com/foaf/0.1/Person>foaf:Person</a></td> </tr></table> 22
    • 23. View templates (2)When you know there is only one row of results (oryou will only use the first) you can access it via first.[query]+.variable.[value|curie] <h1>{{first.main.name.value}}</h1> <h1>Foo Bar</h1> 23
    • 24. Templating typesIn LODSPeaKr we can define special templates for URIsof a certain rdf:type (if multiple types you can definepriorities) $ utils/lodspk.sh create type foaf:Person will produce compponents/types/foaf:Person/ |-> html.template |-> queries/ |-> main.queryFor specific URIs$ utils/lodspk.sh create uri local:AlvaroGraves 24
    • 25. Customizing types• You can add all thequeries you want• You can specify newendpoints where datacan be fetched from• Adding a lower level(subdir) can usepreviously fetchedresults in their queries
    • 26. Workflow creationLODSPeaKr allow users to execute queries to multiple endpoints using previously retrieved values. It can be multiple queries at each step LOCAL 3 1 2 2 DBPEDIA LOGD 26
    • 27. Text 27
    • 28. $ curl http://alia/twcpeople/instances/AlvaroGraves.ttl@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .@prefix ns0: <http://dbpedia.org/ontology/> .@prefix ns1: <http://xmlns.com/foaf/0.1/> .@prefix ns2: <http://purl.org/dc/terms/> .@prefix ns3: <http://tw.rpi.edu/schema/> .@prefix ns4: <http://www.w3.org/2002/07/owl#> .@prefix ns5: <http://www.w3.org/2000/10/swap/pim/contact#> .<http://tw.rpi.edu/instances/AlvaroGraves> ns0:birthPlace <http://dbpedia.org/resource/Santiago> ; ns1:name "Alvaro Graves"@en ; ns1:depiction <http://tw.rpi.edu/wiki.tw/images/2/21/Alvaro.jpg> ; ns2:description "PhD student in Cognitive Science. My interests areSemantic Web, Web Science and cognitive and behavioral aspects of the Web.Also interested in application of semantic technologies ineGovernment."@en .<http://tw.rpi.edu/instances/VIVOHackathon2011> ns3:hasAttendee <http://tw.rpi.edu/instances/AlvaroGraves> , <http://tw.rpi.edu/instances/TimLebo> ; ns1:name "VIVO Hackathon 2011"^^<http://www.w3.org/2001/XMLSchema#string> .<http://tw.rpi.edu/instances/TWCSpring2011BBQ> ns3:hasAttendee <http://tw.rpi.edu/instances/AlvaroGraves> , <http://tw.rpi.edu/instances/DominicDiFranzo> , <http://tw.rpi.edu/instances/CameronHelm> , <http://tw.rpi.edu/instances/PeterFox> , <http://tw.rpi.edu/instances/ScottYaninas> , <http://tw.rpi.edu/instances/DanielSouza> , <http://tw.rpi.edu/instances/PatrickWest> , 28
    • 29. Serving multiple representations• LODSPeaKr will convert SELECT DISTINCT ?person ?email ?name WHERE { your SELECT query(*) in GRAPH ?g { ?person a foaf:Person ; HTML to a CONSTRUCT foaf:name ?name ; foaf:mbox ?email . query for serving RDF } FILTER(regex(?name, "^y", "i" )) }order by ?name• You shouldn’t have to worry about it, unless you explicitly want something different in CONSTRUCT { other representations ?person a foaf:Person . ?person foaf:name ?name . ?person foaf:mbox ?email . } WHERE ...
    • 30. Services • Allow developers to provide aggregated content • Similar structure to types • class, instance and namedGraph are services$ utils/lodspk.sh create service peoplewill producecomponents/services/people/ |-> html.template |-> queries/ |-> main.query
    • 31. Same features as in typeModule• Multiple representations, based on Accept HTTP header• Workflow with multiple queries and SPARQL endpoints
    • 32. http://alia/twcpeople/peoplemain.querySELECT DISTINCT ?person ?email ?nameWHERE { GRAPH ?g { ?person a foaf:Person ; foaf:name ?name ; foaf:mbox ?email . }}order by ?namehtml.template<ul> {% for row in models.main %} <li> <a href="{{row.people.value}}">{{row.name.value}} - {{row.email.value}}</a> </li> {% endfor %}</ul>
    • 33. Arguments in servicesArguments can be passed to a service after its name, separated by slasheshttp://example.org/myService/arg0/arg1/.... main.query SELECT DISTINCT ?person ?email ?name WHERE { GRAPH ?g { ?person a foaf:Person ; foaf:name ?name ; foaf:mbox ?email . FILTER(regex(?name, "^{{lodspk.args.arg0}}", "i" )) } }order by ?name http://alia/twcpeople/peopleByName/c
    • 34. Creating APIs based on services We can reuse the service to provide a JSON-friendly version of the documentjson.template{ "people": [ {% for row in models.main %} { "uri": "{{row.person.value}}", "name": "{{row.name.value}}", "email": "{{row.email.value}}" }{%if ! forloop.last%},{%endif%} {% endfor %} ]}
    • 35. Use of filters• Haanga provides lots of useful filters • Capitalize, urlescape, etc.• LODSPeaKr includes some handy filters • Right now: Google maps, Google table, D3 graphs, gRaphael • Not all are working 100% yet
    • 36. geo.querySELECT distinct ?lat ?lon ?nameWHERE {<{{uri}}> rdfs:label ?name ; geo:lat ?lat; geo:long ?lon.}{{models.geo|googlemaps:"lat,lon,name"}}
    • 37. Applications• Farmers Market data • http://graves.cl/ farmersmarket• ESSI mobile webapp • http://essi-lod.org/• DataFAQs • http://bit.ly/datafaqs
    • 38. Conclusions• LODSPeaKr allows developers build Linked Data- based applications in a rapid, simple way• It also provides useful features as Content- negotiation, workflow execution, filters, etc.• You can create Open Data portals, APIs, mobile webapps, etc. 38
    • 39. Future work• Improve crawling (single URIs, flow control)• Add controller for more control over data management and flow• Improve documentation!• Comments, suggestions and bug reports are welcome 39
    • 40. Thanks for testing!• Eric Rozell• Tim Lebo 40
    • 41. Useful Links• LODSpeaKr • http://lodspeakr.org•Github • http://github.com/alangrafu/lodspeakr Contact gravea3@rpi.edu - @alvarograves 41

    ×