Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Facet Building Web Pages With SPARQL SWIG-UK Event, HP Labs November 23 rd  2007 Leigh Dodds Chief Technology Officer, Ing...
Problem Statement
Where’s my RDF-native Web Framework?! There is no good system for integrating RDF repositories with existing an web framew...
Design Constraints
 
 
 
 
 
 
 
 
Design Constraints <ul><li>A web page presents data that is a sub-graph (i.e. a view) over a larger RDF store, (the  data ...
Facet Request Handling <ul><li>To return a response we need to answer three questions… </li></ul><ul><li>What  lens  are w...
Lenses Describing views of RDF data
A Simple Lens <ul><li>PREFIX dc:  <http://purl.org/dc/elements/1.1/> </li></ul><ul><li>CONSTRUCT { </li></ul><ul><li>?item...
Configuring Lenses <ul><li><rdf:RDF  </li></ul><ul><li>xmlns:rdf=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot;  ...
Data Model Configuring RDF graphs
Data Model Configuration <ul><li>Jena Assembler API </li></ul><ul><li>Add notion of application level default data model <...
Resource Identifiers
Mapping Resource Identifiers <ul><li>In a RESTful application, each resource should have a single primary location </li></...
Serialization Mapping an RDF sub-graph to a Java object model
Serialization <ul><li>Primary resource is a  ContentItem </li></ul><ul><ul><li>Has an identifier and  Map  of properties <...
Serialization (special cases) <ul><li>Multilingual properties </li></ul><ul><ul><li>Special casing (i.e. a hack!) to modif...
Additional Features <ul><li>“ MultiLens”, applying multiple queries in series to build results </li></ul><ul><li>Automatic...
Summary <ul><li>Pros </li></ul><ul><li>By embracing a few limitations on RDF modelling, e.g. identifiers provides a very f...
Upcoming SlideShare
Loading in …5
×

Facet: Building Web Pages with SPARQL

8,436 views

Published on

Introduces the high-level design of an web templating API for providing read-only access to RDF data using SPARQL.

Published in: Technology, Education
  • Be the first to comment

Facet: Building Web Pages with SPARQL

  1. 1. Facet Building Web Pages With SPARQL SWIG-UK Event, HP Labs November 23 rd 2007 Leigh Dodds Chief Technology Officer, Ingenta
  2. 2. Problem Statement
  3. 3. Where’s my RDF-native Web Framework?! There is no good system for integrating RDF repositories with existing an web framework (in Java)
  4. 4. Design Constraints
  5. 13. Design Constraints <ul><li>A web page presents data that is a sub-graph (i.e. a view) over a larger RDF store, (the data model) </li></ul><ul><li>The extent of the sub-graph may vary for different presentations of the data, and may contain arbitrary properties </li></ul><ul><li>The description of the sub-graph (a lens) should be declarative </li></ul><ul><li>That sub-graph is “rooted” on a single primary resource (e.g. a Journal) </li></ul><ul><li>The identifier of the primary resource can be derived from the request URL, e.g. by rewriting the URI. And vice versa </li></ul><ul><ul><li>Therefore, we don’t support blank nodes as primary resources </li></ul></ul><ul><ul><li>Or fragment identifiers in URIs! </li></ul></ul><ul><li>The sub-graph should be serializable into an object graph for presentation to the templating system </li></ul>
  6. 14. Facet Request Handling <ul><li>To return a response we need to answer three questions… </li></ul><ul><li>What lens are we going to apply? </li></ul><ul><li>What data model are we going to apply it to? </li></ul><ul><li>What’s the identifier of the primary resource ? </li></ul>
  7. 15. Lenses Describing views of RDF data
  8. 16. A Simple Lens <ul><li>PREFIX dc: <http://purl.org/dc/elements/1.1/> </li></ul><ul><li>CONSTRUCT { </li></ul><ul><li>?item dc:title ?title . </li></ul><ul><li>?item dc:language ?language . </li></ul><ul><li>} </li></ul><ul><li>WHERE { </li></ul><ul><li>?item dc:title ?title . </li></ul><ul><li>OPTIONAL { ?item dc:language ?language . } </li></ul><ul><li>} </li></ul>
  9. 17. Configuring Lenses <ul><li><rdf:RDF </li></ul><ul><li>xmlns:rdf=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot; </li></ul><ul><li>xmlns:ja=&quot;http://jena.hpl.hp.com/2005/11/Assembler#&quot; </li></ul><ul><li> xmlns:view=&quot;http://metastore.ingenta.com/facet/lens/&quot;> </li></ul><ul><li><rdf:Description </li></ul><ul><li>rdf:about=&quot;http://metastore.ingenta.com/facet/lens/Sparql&quot;> <ja:assembler>com.ingenta.facet….</ja:assembler> </li></ul><ul><li></rdf:Description> </li></ul><ul><li><view:Sparql </li></ul><ul><li>rdf:about=&quot; http://oecd.metastore.ingenta.com/views/just-the-title &quot;> </li></ul><ul><li><view:query> sparql/just-the-title.rq </view:query> </li></ul><ul><li></view:Sparql> </li></ul><ul><li></rdf:RDF> </li></ul>
  10. 18. Data Model Configuring RDF graphs
  11. 19. Data Model Configuration <ul><li>Jena Assembler API </li></ul><ul><li>Add notion of application level default data model </li></ul><ul><ul><li>Uses well-known URI </li></ul></ul><ul><li>Lenses may be configured to apply to a specific data model </li></ul><ul><ul><li>Allows “sharding” of data models </li></ul></ul><ul><li><view:Sparql </li></ul><ul><li>rdf:about=&quot; http://oecd.metastore.ingenta.com/views/just-the-title &quot;> </li></ul><ul><li><view:appliesTo rdf:resource=“…”/> </li></ul><ul><li></view:Sparql> </li></ul>
  12. 20. Resource Identifiers
  13. 21. Mapping Resource Identifiers <ul><li>In a RESTful application, each resource should have a single primary location </li></ul><ul><li>Allows resource identifiers to be derived using URL rewriting </li></ul><ul><li>http://test.sourceoecd.org/oecd/content/journal/18168116 </li></ul><ul><li>http://oecd.metastore.ingenta.com/content/journal/18168116 </li></ul>
  14. 22. Serialization Mapping an RDF sub-graph to a Java object model
  15. 23. Serialization <ul><li>Primary resource is a ContentItem </li></ul><ul><ul><li>Has an identifier and Map of properties </li></ul></ul><ul><li>Walk through graph, beginning at “root” resource, mapping RDF statements to Map entries </li></ul><ul><li>Mapping of property names is configurable. </li></ul><ul><ul><li>Default based on namespace prefix, E.g. dc_title </li></ul></ul><ul><li>Mapping of objects of each statement to a suitable Java object </li></ul><ul><ul><li>ContentItem, Map, List, Integer , etc </li></ul></ul>
  16. 24. Serialization (special cases) <ul><li>Multilingual properties </li></ul><ul><ul><li>Special casing (i.e. a hack!) to modify naming, e.g. dc_title_fr </li></ul></ul><ul><li>Repeated properties, e.g. dc:subject </li></ul><ul><ul><li>Use schema annotation to indicate these, and then Serialize to a List </li></ul></ul><ul><li>XML Literals & Multi-lingual data </li></ul><ul><ul><li>E.g. multi-lingual abstracts ( dc:description ) that contain XHTML markup </li></ul></ul><ul><ul><li>Use schema annotation, parse and create separate Map entries </li></ul></ul>
  17. 25. Additional Features <ul><li>“ MultiLens”, applying multiple queries in series to build results </li></ul><ul><li>Automatic availability of URL parameters as SPARQL query parameters </li></ul><ul><li>Integral API support </li></ul><ul><ul><li>RDF output for free; JSON output trivial </li></ul></ul><ul><li>Simple content lifecycle, mapping to HTTP resource statuses </li></ul><ul><ul><li>E.g. Content Not Found, Moved, Gone </li></ul></ul><ul><ul><li>Add type ( life:Deleted ) and properties ( life:newLocation ) to data </li></ul></ul><ul><li>Support for URL Aliasing based on property values </li></ul><ul><ul><li>/content/issn/1234-5678 -> /content/journal/abcdef </li></ul></ul><ul><ul><li><prism:issn> </li></ul></ul>
  18. 26. Summary <ul><li>Pros </li></ul><ul><li>By embracing a few limitations on RDF modelling, e.g. identifiers provides a very flexible means of building web pages from an RDF repository </li></ul><ul><li>Reliance on SPARQL and Jena API features provides great deal of configuration options </li></ul><ul><li>Good integration with existing web templating environments </li></ul><ul><li>Quick to learn </li></ul><ul><li>Cons </li></ul><ul><li>Model limitations mean its not suited to all RDF “in the wild” </li></ul>

×