SlideShare une entreprise Scribd logo
1  sur  23
XSLT+SPARQL: Scripting the
  Semantic Web with SPARQL
embedded into XSLT stylesheets
   Diego Berrueta, Jose E. Labra and Ivan Herman
       CTIC Foundation / Universidad de Oviedo / CWI


    Scripting for the Semantic Web (SFSW’08)
              Tenerife, 02/Jun/2008
Outline

1. Introduction
2. Description of XSLT+SPARQL
3. Implementation and examples
4. Conclusions


                                 2
The problem

Many applications need to transform
RDF into markup (e.g. XHTML)
In the XML world, we have XSLT (XML
transformations)
... what do we have in the RDF world?

                                        3
Why I cannot use XSLT?
RDF/XML is complex, messy,
cumbersome ⇒ non-standard XML
serializations are required
XPath expressions (and patterns) are
designed for trees, not graphs
XSLT is designed for a different data
model
                                        4
RDF is not XML, therefore...
RDF is not XML, therefore...
  I will not use XSLT to transform RDF/XML
  I will not use XSLT to transform RDF/XML
  I will not use XSLT to transform RDF/XML
  I will not use XSLT to transform RDF/XML
  I will not use XSLT to transform RDF/XML
  I will not use XSLT to transform RDF/XML
  I will not use XSLT to transform RDF/XML
  I will not use XSLT to transform RDF/XML
RDF is not XML, therefore...
  I will not use XSLT to transform RDF/XML
  I will not use XSLT to transform RDF/XML
  I will not use XSLT to transform RDF/XML
  I will not use XSLT to transform RDF/XML
  I will not use XSLT to transform RDF/XML
  I will not use XSLT to transform RDF/XML
  I will not use XSLT to transform RDF/XML
  I will not use XSLT to transform RDF/XML
Related work
TriX, RDFXSLT: “alternative” RDF
syntaxes in XML
RDF Twig, TreeHugger: add intelligence
to XSLT processors
Topia: XSLT functions to query Sesame
using pre-SPARQL languages
XSPARQL: unification of SPARQL
and XQuery in a single language
                                         6
Scripting RDF transformations

   Many scripting languages have RDF
   APIs, but they’re not standard
   Coding transformations in script
   languages leads is messy (e.g.: Vapour)


                                             7
XSLT+SPARQL
Two sets of XPath functions to query
RDF models using SPARQL
Intended to be used in @select
expressions of XSLT stylesheets
Return plain, standard XML easily
tractable with XSLT

                                       8
Query results XML syntax
<results>
   <result>
     <binding   name=quot;fnamequot;><value>Tom</value>/binding>
     <binding   name=quot;emailquot;><value>tom@example.org</value></binding>
   </result>
   <result>
     <binding   name=quot;fnamequot;><value>Dick</value></binding>
     <binding   name=quot;emailquot;><value>dick@example.org</value></binding>
   </result>
</results>




     W3C Recommendation (Jan 2008)
                                                                         9
Basic functions
sparql:sparql(query [, documentUrl, ...])
sparql:sparqlEndpoint(query, endpointUrl)



Execute SPARQL queries locally or
remotely (endpoint)
Model can be extended with “FROM”
clauses
                                            10
Advanced functions (I)
Retrieving and parsing RDF data is
expensive
Advanced functions designed for:
‣   Efficently query the same model
    multiple times
‣   Create custom models
    programatically
                                      11
Advanced functions (II)
sparql’:parseString(string, syntax)



Creates a model by parsing a string
containg serialized RDF
Support for different syntaxes: RDF/
XML, N3, TriX...

                                       12
Advanced functions (III)
sparql’:readModel(documentUrl, syntax)
sparql’:readModel(nodeset)

Create models by parsing:
1. A document retrieved from the web
2. An XML subtree (from the XSLT
   input document or even from the
   XSLT itself)
                                         13
Advanced functions (IV)
sparql’:mergeModels(model1, model2, ...)



Combines two or more RDF models into a
new one




                                           14
Advanced functions (V)
sparql’:sparqlModel(query, model)



Executes a SPARQL query against an
in-memory model




                                     15
Two implementations
1. Java-based extension to Apache Xalan
   using Jena
     Exploits the extensibility of XSLT
2. Pure XSLT implementation
     Incomplete, XSLT “document()”
     cannot perform conneg

                                          16
Applications of XSLT+SPARQL
   Transform RDF data for presentation in
   XHTML, SVG...
   Generate reports beyond SPARQL
   capabilities
   Develop scripts that retrieve and operate
   with RDF data from the (semantic) web

                                               17
Example: Ivan’s acquittances
  <xsl:template match=quot;/quot;>
    <xsl:apply-templates
      select=quot;sparql:sparql(concat(sparql:commonPrefixes(),
         'SELECT ?name ?mbox_sha1sum ?homepage
          FROM &lt;http://www.ivan-herman.net/foaf.rdf&gt;
          WHERE {
             &lt;http://www.ivan-herman.net/Ivan_Herman&gt; foaf:knows ?x .

            ?x foaf:name ?name .

   
        OPTIONAL {
                  ?x foaf:mbox_sha1sum ?mbox_sha1sum .
                  ?x foaf:homepage ?homepage

            }}'))quot;/>
  </xsl:template>

  <xsl:template match=quot;results:resultsquot;>
    <html>
       ...
    </html>
  </xsl:template>

                                                                              18
Advanced examples

Querying DBPedia endpoint
HTML displays of SKOS thesauri
  Alphabetic display
  Systematic display (tree-like)
“Spider” agent for LoD

                                   19
Conclusions and future work

  XSLT+SPARQL overcomes the
  limitations of XSLT to process RDF
  XSLT+SPARQL can be used to write
  declarative scripts for the semantic web
  Future extensions: inference support

                                             20
Thank you for your
    attention
 diego.berrueta@fundacionctic.org

Contenu connexe

Tendances

WebTech Tutorial Querying DBPedia
WebTech Tutorial Querying DBPediaWebTech Tutorial Querying DBPedia
WebTech Tutorial Querying DBPediaKatrien Verbert
 
A Little SPARQL in your Analytics
A Little SPARQL in your AnalyticsA Little SPARQL in your Analytics
A Little SPARQL in your AnalyticsDr. Neil Brittliff
 
RDF APIs for .NET Framework
RDF APIs for .NET FrameworkRDF APIs for .NET Framework
RDF APIs for .NET FrameworkAdriana Ivanciu
 
Jena – A Semantic Web Framework for Java
Jena – A Semantic Web Framework for JavaJena – A Semantic Web Framework for Java
Jena – A Semantic Web Framework for JavaAleksander Pohl
 
Graph Data -- RDF and Property Graphs
Graph Data -- RDF and Property GraphsGraph Data -- RDF and Property Graphs
Graph Data -- RDF and Property Graphsandyseaborne
 
Two graph data models : RDF and Property Graphs
Two graph data models : RDF and Property GraphsTwo graph data models : RDF and Property Graphs
Two graph data models : RDF and Property Graphsandyseaborne
 
Tutorial "An Introduction to SPARQL and Queries over Linked Data" Chapter 2 (...
Tutorial "An Introduction to SPARQL and Queries over Linked Data" Chapter 2 (...Tutorial "An Introduction to SPARQL and Queries over Linked Data" Chapter 2 (...
Tutorial "An Introduction to SPARQL and Queries over Linked Data" Chapter 2 (...Olaf Hartig
 
SPARQL 1.1 Update (2013-03-05)
SPARQL 1.1 Update (2013-03-05)SPARQL 1.1 Update (2013-03-05)
SPARQL 1.1 Update (2013-03-05)andyseaborne
 
Sesam4 project presentation sparql - april 2011
Sesam4   project presentation sparql - april 2011Sesam4   project presentation sparql - april 2011
Sesam4 project presentation sparql - april 2011Robert Engels
 
Лев Валкин — Программируем функционально
Лев Валкин — Программируем функциональноЛев Валкин — Программируем функционально
Лев Валкин — Программируем функциональноDaria Oreshkina
 
A year on the Semantic Web @ W3C
A year on the Semantic Web @ W3CA year on the Semantic Web @ W3C
A year on the Semantic Web @ W3CIvan Herman
 
Intro to OWL & Ontology
Intro to OWL & OntologyIntro to OWL & Ontology
Intro to OWL & OntologyNarni Rajesh
 
Facet: Building Web Pages with SPARQL
Facet: Building Web Pages with SPARQLFacet: Building Web Pages with SPARQL
Facet: Building Web Pages with SPARQLLeigh Dodds
 

Tendances (20)

WebTech Tutorial Querying DBPedia
WebTech Tutorial Querying DBPediaWebTech Tutorial Querying DBPedia
WebTech Tutorial Querying DBPedia
 
A Little SPARQL in your Analytics
A Little SPARQL in your AnalyticsA Little SPARQL in your Analytics
A Little SPARQL in your Analytics
 
Jena framework
Jena frameworkJena framework
Jena framework
 
RDF APIs for .NET Framework
RDF APIs for .NET FrameworkRDF APIs for .NET Framework
RDF APIs for .NET Framework
 
Jena – A Semantic Web Framework for Java
Jena – A Semantic Web Framework for JavaJena – A Semantic Web Framework for Java
Jena – A Semantic Web Framework for Java
 
Jena
JenaJena
Jena
 
Graph Data -- RDF and Property Graphs
Graph Data -- RDF and Property GraphsGraph Data -- RDF and Property Graphs
Graph Data -- RDF and Property Graphs
 
Two graph data models : RDF and Property Graphs
Two graph data models : RDF and Property GraphsTwo graph data models : RDF and Property Graphs
Two graph data models : RDF and Property Graphs
 
SPARQL Cheat Sheet
SPARQL Cheat SheetSPARQL Cheat Sheet
SPARQL Cheat Sheet
 
Tutorial "An Introduction to SPARQL and Queries over Linked Data" Chapter 2 (...
Tutorial "An Introduction to SPARQL and Queries over Linked Data" Chapter 2 (...Tutorial "An Introduction to SPARQL and Queries over Linked Data" Chapter 2 (...
Tutorial "An Introduction to SPARQL and Queries over Linked Data" Chapter 2 (...
 
SPARQL 1.1 Update (2013-03-05)
SPARQL 1.1 Update (2013-03-05)SPARQL 1.1 Update (2013-03-05)
SPARQL 1.1 Update (2013-03-05)
 
Sesam4 project presentation sparql - april 2011
Sesam4   project presentation sparql - april 2011Sesam4   project presentation sparql - april 2011
Sesam4 project presentation sparql - april 2011
 
Лев Валкин — Программируем функционально
Лев Валкин — Программируем функциональноЛев Валкин — Программируем функционально
Лев Валкин — Программируем функционально
 
Data shapes-test-suite
Data shapes-test-suiteData shapes-test-suite
Data shapes-test-suite
 
A year on the Semantic Web @ W3C
A year on the Semantic Web @ W3CA year on the Semantic Web @ W3C
A year on the Semantic Web @ W3C
 
Intro to OWL & Ontology
Intro to OWL & OntologyIntro to OWL & Ontology
Intro to OWL & Ontology
 
SPIN in Five Slides
SPIN in Five SlidesSPIN in Five Slides
SPIN in Five Slides
 
RDF briefing
RDF briefingRDF briefing
RDF briefing
 
What's New in RDF 1.1?
What's New in RDF 1.1?What's New in RDF 1.1?
What's New in RDF 1.1?
 
Facet: Building Web Pages with SPARQL
Facet: Building Web Pages with SPARQLFacet: Building Web Pages with SPARQL
Facet: Building Web Pages with SPARQL
 

En vedette (6)

Learning XSLT
Learning XSLTLearning XSLT
Learning XSLT
 
XSLT and XPath - without the pain!
XSLT and XPath - without the pain!XSLT and XPath - without the pain!
XSLT and XPath - without the pain!
 
Lit 20170306
Lit 20170306Lit 20170306
Lit 20170306
 
XSLT for Web Developers
XSLT for Web DevelopersXSLT for Web Developers
XSLT for Web Developers
 
XSLT
XSLTXSLT
XSLT
 
XML/XSLT
XML/XSLTXML/XSLT
XML/XSLT
 

Similaire à XSLT+SPARQL: Scripting the Semantic Web with SPARQL embedded into XSLT stylesheets

Syntax Reuse: XSLT as a Metalanguage for Knowledge Representation Languages
Syntax Reuse: XSLT as a Metalanguage for Knowledge Representation LanguagesSyntax Reuse: XSLT as a Metalanguage for Knowledge Representation Languages
Syntax Reuse: XSLT as a Metalanguage for Knowledge Representation LanguagesTara Athan
 
Apache Spark Introduction
Apache Spark IntroductionApache Spark Introduction
Apache Spark Introductionsudhakara st
 
Sesam4 project presentation sparql - april 2011
Sesam4   project presentation sparql - april 2011Sesam4   project presentation sparql - april 2011
Sesam4 project presentation sparql - april 2011sesam4able
 
MLlib sparkmeetup_8_6_13_final_reduced
MLlib sparkmeetup_8_6_13_final_reducedMLlib sparkmeetup_8_6_13_final_reduced
MLlib sparkmeetup_8_6_13_final_reducedChao Chen
 
Triplestore and SPARQL
Triplestore and SPARQLTriplestore and SPARQL
Triplestore and SPARQLLino Valdivia
 
Introduction to RDFa
Introduction to RDFaIntroduction to RDFa
Introduction to RDFaIvan Herman
 
An Introduction to Spark
An Introduction to SparkAn Introduction to Spark
An Introduction to Sparkjlacefie
 
An Introduct to Spark - Atlanta Spark Meetup
An Introduct to Spark - Atlanta Spark MeetupAn Introduct to Spark - Atlanta Spark Meetup
An Introduct to Spark - Atlanta Spark Meetupjlacefie
 
State of the Semantic Web
State of the Semantic WebState of the Semantic Web
State of the Semantic WebIvan Herman
 
Spark - The Ultimate Scala Collections by Martin Odersky
Spark - The Ultimate Scala Collections by Martin OderskySpark - The Ultimate Scala Collections by Martin Odersky
Spark - The Ultimate Scala Collections by Martin OderskySpark Summit
 
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
 
SPARQLing Services
SPARQLing ServicesSPARQLing Services
SPARQLing ServicesLeigh Dodds
 
Querying Linked Data with SPARQL (2010)
Querying Linked Data with SPARQL (2010)Querying Linked Data with SPARQL (2010)
Querying Linked Data with SPARQL (2010)Olaf Hartig
 
Comparative study on the processing of RDF in PHP
Comparative study on the processing of RDF in PHPComparative study on the processing of RDF in PHP
Comparative study on the processing of RDF in PHPMSGUNC
 
Using Apache Spark as ETL engine. Pros and Cons
Using Apache Spark as ETL engine. Pros and Cons          Using Apache Spark as ETL engine. Pros and Cons
Using Apache Spark as ETL engine. Pros and Cons Provectus
 
Quadrupling your elephants - RDF and the Hadoop ecosystem
Quadrupling your elephants - RDF and the Hadoop ecosystemQuadrupling your elephants - RDF and the Hadoop ecosystem
Quadrupling your elephants - RDF and the Hadoop ecosystemRob Vesse
 
Apache spark - Architecture , Overview & libraries
Apache spark - Architecture , Overview & librariesApache spark - Architecture , Overview & libraries
Apache spark - Architecture , Overview & librariesWalaa Hamdy Assy
 

Similaire à XSLT+SPARQL: Scripting the Semantic Web with SPARQL embedded into XSLT stylesheets (20)

Syntax Reuse: XSLT as a Metalanguage for Knowledge Representation Languages
Syntax Reuse: XSLT as a Metalanguage for Knowledge Representation LanguagesSyntax Reuse: XSLT as a Metalanguage for Knowledge Representation Languages
Syntax Reuse: XSLT as a Metalanguage for Knowledge Representation Languages
 
Web Spa
Web SpaWeb Spa
Web Spa
 
Apache Spark Introduction
Apache Spark IntroductionApache Spark Introduction
Apache Spark Introduction
 
Sesam4 project presentation sparql - april 2011
Sesam4   project presentation sparql - april 2011Sesam4   project presentation sparql - april 2011
Sesam4 project presentation sparql - april 2011
 
MLlib sparkmeetup_8_6_13_final_reduced
MLlib sparkmeetup_8_6_13_final_reducedMLlib sparkmeetup_8_6_13_final_reduced
MLlib sparkmeetup_8_6_13_final_reduced
 
Triplestore and SPARQL
Triplestore and SPARQLTriplestore and SPARQL
Triplestore and SPARQL
 
Introduction to RDFa
Introduction to RDFaIntroduction to RDFa
Introduction to RDFa
 
RDFa Tutorial
RDFa TutorialRDFa Tutorial
RDFa Tutorial
 
An Introduction to Spark
An Introduction to SparkAn Introduction to Spark
An Introduction to Spark
 
An Introduct to Spark - Atlanta Spark Meetup
An Introduct to Spark - Atlanta Spark MeetupAn Introduct to Spark - Atlanta Spark Meetup
An Introduct to Spark - Atlanta Spark Meetup
 
State of the Semantic Web
State of the Semantic WebState of the Semantic Web
State of the Semantic Web
 
Spark - The Ultimate Scala Collections by Martin Odersky
Spark - The Ultimate Scala Collections by Martin OderskySpark - The Ultimate Scala Collections by Martin Odersky
Spark - The Ultimate Scala Collections by Martin Odersky
 
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
 
SPARQLing Services
SPARQLing ServicesSPARQLing Services
SPARQLing Services
 
Querying Linked Data with SPARQL (2010)
Querying Linked Data with SPARQL (2010)Querying Linked Data with SPARQL (2010)
Querying Linked Data with SPARQL (2010)
 
Comparative study on the processing of RDF in PHP
Comparative study on the processing of RDF in PHPComparative study on the processing of RDF in PHP
Comparative study on the processing of RDF in PHP
 
Using Apache Spark as ETL engine. Pros and Cons
Using Apache Spark as ETL engine. Pros and Cons          Using Apache Spark as ETL engine. Pros and Cons
Using Apache Spark as ETL engine. Pros and Cons
 
Empire: JPA for RDF & SPARQL
Empire: JPA for RDF & SPARQLEmpire: JPA for RDF & SPARQL
Empire: JPA for RDF & SPARQL
 
Quadrupling your elephants - RDF and the Hadoop ecosystem
Quadrupling your elephants - RDF and the Hadoop ecosystemQuadrupling your elephants - RDF and the Hadoop ecosystem
Quadrupling your elephants - RDF and the Hadoop ecosystem
 
Apache spark - Architecture , Overview & libraries
Apache spark - Architecture , Overview & librariesApache spark - Architecture , Overview & libraries
Apache spark - Architecture , Overview & libraries
 

Plus de Diego Berrueta

Scaling towards a thousand micro services
Scaling towards a thousand micro servicesScaling towards a thousand micro services
Scaling towards a thousand micro servicesDiego Berrueta
 
Linked Data en España
Linked Data en EspañaLinked Data en España
Linked Data en EspañaDiego Berrueta
 
Aplicaciones de la web semántica
Aplicaciones de la web semánticaAplicaciones de la web semántica
Aplicaciones de la web semánticaDiego Berrueta
 
GnuPG: criptografía para todos
GnuPG: criptografía para todosGnuPG: criptografía para todos
GnuPG: criptografía para todosDiego Berrueta
 
Introducción al Software Libre
Introducción al Software LibreIntroducción al Software Libre
Introducción al Software LibreDiego Berrueta
 

Plus de Diego Berrueta (7)

Scaling towards a thousand micro services
Scaling towards a thousand micro servicesScaling towards a thousand micro services
Scaling towards a thousand micro services
 
Linked Data en España
Linked Data en EspañaLinked Data en España
Linked Data en España
 
Introducción a RDFa
Introducción a RDFaIntroducción a RDFa
Introducción a RDFa
 
Aplicaciones de la web semántica
Aplicaciones de la web semánticaAplicaciones de la web semántica
Aplicaciones de la web semántica
 
GnuPG: criptografía para todos
GnuPG: criptografía para todosGnuPG: criptografía para todos
GnuPG: criptografía para todos
 
XPath
XPathXPath
XPath
 
Introducción al Software Libre
Introducción al Software LibreIntroducción al Software Libre
Introducción al Software Libre
 

Dernier

VIP Call Girls In Saharaganj ( Lucknow ) 🔝 8923113531 🔝 Cash Payment (COD) 👒
VIP Call Girls In Saharaganj ( Lucknow  ) 🔝 8923113531 🔝  Cash Payment (COD) 👒VIP Call Girls In Saharaganj ( Lucknow  ) 🔝 8923113531 🔝  Cash Payment (COD) 👒
VIP Call Girls In Saharaganj ( Lucknow ) 🔝 8923113531 🔝 Cash Payment (COD) 👒anilsa9823
 
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876dlhescort
 
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...amitlee9823
 
Insurers' journeys to build a mastery in the IoT usage
Insurers' journeys to build a mastery in the IoT usageInsurers' journeys to build a mastery in the IoT usage
Insurers' journeys to build a mastery in the IoT usageMatteo Carbone
 
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best ServicesMysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best ServicesDipal Arora
 
Pharma Works Profile of Karan Communications
Pharma Works Profile of Karan CommunicationsPharma Works Profile of Karan Communications
Pharma Works Profile of Karan Communicationskarancommunications
 
Best VIP Call Girls Noida Sector 40 Call Me: 8448380779
Best VIP Call Girls Noida Sector 40 Call Me: 8448380779Best VIP Call Girls Noida Sector 40 Call Me: 8448380779
Best VIP Call Girls Noida Sector 40 Call Me: 8448380779Delhi Call girls
 
Creating Low-Code Loan Applications using the Trisotech Mortgage Feature Set
Creating Low-Code Loan Applications using the Trisotech Mortgage Feature SetCreating Low-Code Loan Applications using the Trisotech Mortgage Feature Set
Creating Low-Code Loan Applications using the Trisotech Mortgage Feature SetDenis Gagné
 
Understanding the Pakistan Budgeting Process: Basics and Key Insights
Understanding the Pakistan Budgeting Process: Basics and Key InsightsUnderstanding the Pakistan Budgeting Process: Basics and Key Insights
Understanding the Pakistan Budgeting Process: Basics and Key Insightsseri bangash
 
Monthly Social Media Update April 2024 pptx.pptx
Monthly Social Media Update April 2024 pptx.pptxMonthly Social Media Update April 2024 pptx.pptx
Monthly Social Media Update April 2024 pptx.pptxAndy Lambert
 
0183760ssssssssssssssssssssssssssss00101011 (27).pdf
0183760ssssssssssssssssssssssssssss00101011 (27).pdf0183760ssssssssssssssssssssssssssss00101011 (27).pdf
0183760ssssssssssssssssssssssssssss00101011 (27).pdfRenandantas16
 
RSA Conference Exhibitor List 2024 - Exhibitors Data
RSA Conference Exhibitor List 2024 - Exhibitors DataRSA Conference Exhibitor List 2024 - Exhibitors Data
RSA Conference Exhibitor List 2024 - Exhibitors DataExhibitors Data
 
VIP Call Girls Gandi Maisamma ( Hyderabad ) Phone 8250192130 | ₹5k To 25k Wit...
VIP Call Girls Gandi Maisamma ( Hyderabad ) Phone 8250192130 | ₹5k To 25k Wit...VIP Call Girls Gandi Maisamma ( Hyderabad ) Phone 8250192130 | ₹5k To 25k Wit...
VIP Call Girls Gandi Maisamma ( Hyderabad ) Phone 8250192130 | ₹5k To 25k Wit...Suhani Kapoor
 
9599632723 Top Call Girls in Delhi at your Door Step Available 24x7 Delhi
9599632723 Top Call Girls in Delhi at your Door Step Available 24x7 Delhi9599632723 Top Call Girls in Delhi at your Door Step Available 24x7 Delhi
9599632723 Top Call Girls in Delhi at your Door Step Available 24x7 DelhiCall Girls in Delhi
 
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...Dave Litwiller
 
Ensure the security of your HCL environment by applying the Zero Trust princi...
Ensure the security of your HCL environment by applying the Zero Trust princi...Ensure the security of your HCL environment by applying the Zero Trust princi...
Ensure the security of your HCL environment by applying the Zero Trust princi...Roland Driesen
 
Event mailer assignment progress report .pdf
Event mailer assignment progress report .pdfEvent mailer assignment progress report .pdf
Event mailer assignment progress report .pdftbatkhuu1
 
Mondelez State of Snacking and Future Trends 2023
Mondelez State of Snacking and Future Trends 2023Mondelez State of Snacking and Future Trends 2023
Mondelez State of Snacking and Future Trends 2023Neil Kimberley
 
Unlocking the Secrets of Affiliate Marketing.pdf
Unlocking the Secrets of Affiliate Marketing.pdfUnlocking the Secrets of Affiliate Marketing.pdf
Unlocking the Secrets of Affiliate Marketing.pdfOnline Income Engine
 
B.COM Unit – 4 ( CORPORATE SOCIAL RESPONSIBILITY ( CSR ).pptx
B.COM Unit – 4 ( CORPORATE SOCIAL RESPONSIBILITY ( CSR ).pptxB.COM Unit – 4 ( CORPORATE SOCIAL RESPONSIBILITY ( CSR ).pptx
B.COM Unit – 4 ( CORPORATE SOCIAL RESPONSIBILITY ( CSR ).pptxpriyanshujha201
 

Dernier (20)

VIP Call Girls In Saharaganj ( Lucknow ) 🔝 8923113531 🔝 Cash Payment (COD) 👒
VIP Call Girls In Saharaganj ( Lucknow  ) 🔝 8923113531 🔝  Cash Payment (COD) 👒VIP Call Girls In Saharaganj ( Lucknow  ) 🔝 8923113531 🔝  Cash Payment (COD) 👒
VIP Call Girls In Saharaganj ( Lucknow ) 🔝 8923113531 🔝 Cash Payment (COD) 👒
 
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
 
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
 
Insurers' journeys to build a mastery in the IoT usage
Insurers' journeys to build a mastery in the IoT usageInsurers' journeys to build a mastery in the IoT usage
Insurers' journeys to build a mastery in the IoT usage
 
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best ServicesMysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
 
Pharma Works Profile of Karan Communications
Pharma Works Profile of Karan CommunicationsPharma Works Profile of Karan Communications
Pharma Works Profile of Karan Communications
 
Best VIP Call Girls Noida Sector 40 Call Me: 8448380779
Best VIP Call Girls Noida Sector 40 Call Me: 8448380779Best VIP Call Girls Noida Sector 40 Call Me: 8448380779
Best VIP Call Girls Noida Sector 40 Call Me: 8448380779
 
Creating Low-Code Loan Applications using the Trisotech Mortgage Feature Set
Creating Low-Code Loan Applications using the Trisotech Mortgage Feature SetCreating Low-Code Loan Applications using the Trisotech Mortgage Feature Set
Creating Low-Code Loan Applications using the Trisotech Mortgage Feature Set
 
Understanding the Pakistan Budgeting Process: Basics and Key Insights
Understanding the Pakistan Budgeting Process: Basics and Key InsightsUnderstanding the Pakistan Budgeting Process: Basics and Key Insights
Understanding the Pakistan Budgeting Process: Basics and Key Insights
 
Monthly Social Media Update April 2024 pptx.pptx
Monthly Social Media Update April 2024 pptx.pptxMonthly Social Media Update April 2024 pptx.pptx
Monthly Social Media Update April 2024 pptx.pptx
 
0183760ssssssssssssssssssssssssssss00101011 (27).pdf
0183760ssssssssssssssssssssssssssss00101011 (27).pdf0183760ssssssssssssssssssssssssssss00101011 (27).pdf
0183760ssssssssssssssssssssssssssss00101011 (27).pdf
 
RSA Conference Exhibitor List 2024 - Exhibitors Data
RSA Conference Exhibitor List 2024 - Exhibitors DataRSA Conference Exhibitor List 2024 - Exhibitors Data
RSA Conference Exhibitor List 2024 - Exhibitors Data
 
VIP Call Girls Gandi Maisamma ( Hyderabad ) Phone 8250192130 | ₹5k To 25k Wit...
VIP Call Girls Gandi Maisamma ( Hyderabad ) Phone 8250192130 | ₹5k To 25k Wit...VIP Call Girls Gandi Maisamma ( Hyderabad ) Phone 8250192130 | ₹5k To 25k Wit...
VIP Call Girls Gandi Maisamma ( Hyderabad ) Phone 8250192130 | ₹5k To 25k Wit...
 
9599632723 Top Call Girls in Delhi at your Door Step Available 24x7 Delhi
9599632723 Top Call Girls in Delhi at your Door Step Available 24x7 Delhi9599632723 Top Call Girls in Delhi at your Door Step Available 24x7 Delhi
9599632723 Top Call Girls in Delhi at your Door Step Available 24x7 Delhi
 
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...
 
Ensure the security of your HCL environment by applying the Zero Trust princi...
Ensure the security of your HCL environment by applying the Zero Trust princi...Ensure the security of your HCL environment by applying the Zero Trust princi...
Ensure the security of your HCL environment by applying the Zero Trust princi...
 
Event mailer assignment progress report .pdf
Event mailer assignment progress report .pdfEvent mailer assignment progress report .pdf
Event mailer assignment progress report .pdf
 
Mondelez State of Snacking and Future Trends 2023
Mondelez State of Snacking and Future Trends 2023Mondelez State of Snacking and Future Trends 2023
Mondelez State of Snacking and Future Trends 2023
 
Unlocking the Secrets of Affiliate Marketing.pdf
Unlocking the Secrets of Affiliate Marketing.pdfUnlocking the Secrets of Affiliate Marketing.pdf
Unlocking the Secrets of Affiliate Marketing.pdf
 
B.COM Unit – 4 ( CORPORATE SOCIAL RESPONSIBILITY ( CSR ).pptx
B.COM Unit – 4 ( CORPORATE SOCIAL RESPONSIBILITY ( CSR ).pptxB.COM Unit – 4 ( CORPORATE SOCIAL RESPONSIBILITY ( CSR ).pptx
B.COM Unit – 4 ( CORPORATE SOCIAL RESPONSIBILITY ( CSR ).pptx
 

XSLT+SPARQL: Scripting the Semantic Web with SPARQL embedded into XSLT stylesheets

  • 1. XSLT+SPARQL: Scripting the Semantic Web with SPARQL embedded into XSLT stylesheets Diego Berrueta, Jose E. Labra and Ivan Herman CTIC Foundation / Universidad de Oviedo / CWI Scripting for the Semantic Web (SFSW’08) Tenerife, 02/Jun/2008
  • 2. Outline 1. Introduction 2. Description of XSLT+SPARQL 3. Implementation and examples 4. Conclusions 2
  • 3. The problem Many applications need to transform RDF into markup (e.g. XHTML) In the XML world, we have XSLT (XML transformations) ... what do we have in the RDF world? 3
  • 4. Why I cannot use XSLT? RDF/XML is complex, messy, cumbersome ⇒ non-standard XML serializations are required XPath expressions (and patterns) are designed for trees, not graphs XSLT is designed for a different data model 4
  • 5. RDF is not XML, therefore...
  • 6. RDF is not XML, therefore... I will not use XSLT to transform RDF/XML I will not use XSLT to transform RDF/XML I will not use XSLT to transform RDF/XML I will not use XSLT to transform RDF/XML I will not use XSLT to transform RDF/XML I will not use XSLT to transform RDF/XML I will not use XSLT to transform RDF/XML I will not use XSLT to transform RDF/XML
  • 7. RDF is not XML, therefore... I will not use XSLT to transform RDF/XML I will not use XSLT to transform RDF/XML I will not use XSLT to transform RDF/XML I will not use XSLT to transform RDF/XML I will not use XSLT to transform RDF/XML I will not use XSLT to transform RDF/XML I will not use XSLT to transform RDF/XML I will not use XSLT to transform RDF/XML
  • 8. Related work TriX, RDFXSLT: “alternative” RDF syntaxes in XML RDF Twig, TreeHugger: add intelligence to XSLT processors Topia: XSLT functions to query Sesame using pre-SPARQL languages XSPARQL: unification of SPARQL and XQuery in a single language 6
  • 9. Scripting RDF transformations Many scripting languages have RDF APIs, but they’re not standard Coding transformations in script languages leads is messy (e.g.: Vapour) 7
  • 10. XSLT+SPARQL Two sets of XPath functions to query RDF models using SPARQL Intended to be used in @select expressions of XSLT stylesheets Return plain, standard XML easily tractable with XSLT 8
  • 11. Query results XML syntax <results> <result> <binding name=quot;fnamequot;><value>Tom</value>/binding> <binding name=quot;emailquot;><value>tom@example.org</value></binding> </result> <result> <binding name=quot;fnamequot;><value>Dick</value></binding> <binding name=quot;emailquot;><value>dick@example.org</value></binding> </result> </results> W3C Recommendation (Jan 2008) 9
  • 12. Basic functions sparql:sparql(query [, documentUrl, ...]) sparql:sparqlEndpoint(query, endpointUrl) Execute SPARQL queries locally or remotely (endpoint) Model can be extended with “FROM” clauses 10
  • 13. Advanced functions (I) Retrieving and parsing RDF data is expensive Advanced functions designed for: ‣ Efficently query the same model multiple times ‣ Create custom models programatically 11
  • 14. Advanced functions (II) sparql’:parseString(string, syntax) Creates a model by parsing a string containg serialized RDF Support for different syntaxes: RDF/ XML, N3, TriX... 12
  • 15. Advanced functions (III) sparql’:readModel(documentUrl, syntax) sparql’:readModel(nodeset) Create models by parsing: 1. A document retrieved from the web 2. An XML subtree (from the XSLT input document or even from the XSLT itself) 13
  • 16. Advanced functions (IV) sparql’:mergeModels(model1, model2, ...) Combines two or more RDF models into a new one 14
  • 17. Advanced functions (V) sparql’:sparqlModel(query, model) Executes a SPARQL query against an in-memory model 15
  • 18. Two implementations 1. Java-based extension to Apache Xalan using Jena Exploits the extensibility of XSLT 2. Pure XSLT implementation Incomplete, XSLT “document()” cannot perform conneg 16
  • 19. Applications of XSLT+SPARQL Transform RDF data for presentation in XHTML, SVG... Generate reports beyond SPARQL capabilities Develop scripts that retrieve and operate with RDF data from the (semantic) web 17
  • 20. Example: Ivan’s acquittances <xsl:template match=quot;/quot;> <xsl:apply-templates select=quot;sparql:sparql(concat(sparql:commonPrefixes(), 'SELECT ?name ?mbox_sha1sum ?homepage FROM &lt;http://www.ivan-herman.net/foaf.rdf&gt; WHERE { &lt;http://www.ivan-herman.net/Ivan_Herman&gt; foaf:knows ?x . ?x foaf:name ?name . OPTIONAL { ?x foaf:mbox_sha1sum ?mbox_sha1sum . ?x foaf:homepage ?homepage }}'))quot;/> </xsl:template> <xsl:template match=quot;results:resultsquot;> <html> ... </html> </xsl:template> 18
  • 21. Advanced examples Querying DBPedia endpoint HTML displays of SKOS thesauri Alphabetic display Systematic display (tree-like) “Spider” agent for LoD 19
  • 22. Conclusions and future work XSLT+SPARQL overcomes the limitations of XSLT to process RDF XSLT+SPARQL can be used to write declarative scripts for the semantic web Future extensions: inference support 20
  • 23. Thank you for your attention diego.berrueta@fundacionctic.org

Notes de l'éditeur

  1. Good morning. My name is Diego Berrueta and I&#x2019;ll present an idea to extend XSLT with some functions that allow developers to query RDF graphs using SPARQL.
  2. These are the main points that will be covered in this presentation. I&#x2019;ll start by introducing the motivation for this work.
  3. We have observed that a number of semantic web applications need a means to transform RDF data to other formats. The semantic web is all about finding RDF data from the web, combining it, querying it, reasoning with it, but at the end, the data must be presented to the user. In the XML world, there a wonderful technology called XSLT (or &#x201C;XML Transformations&#x201D;), which is a W3C standard, and that is designed to take some data in XML and to transform it. The result is usually other XML file, but it can also be plain text. But when it turns to RDF, which is the equivalent to XSLT?
  4. Hey, wait a moment! Some of you may think that we don&#x2019;t need a technology equivalent to XSLT in the RDF world because we can write RDF in XML. That&#x2019;s the purpose of the RDF/XML syntax, isn&#x2019;t it? If we want to transform RDF data, we can serialize it as RDF/XML and apply XSLT to it. Well, there are some problems with this idea. In the first place, the RDF/XML syntax is very complex: there are a lot of different ways to serialize even the simplest RDF graph. As XSLT is syntax-driven, this means that is incredibly difficult to write a XSLT stylesheet to transform data in RDF/XML. In the second place, XSLT internally uses XPath to select fragments of the input data. But XPath was designed to work on tree structures, not in graphs. Actually, what we have here is an impedance mismatch between a tool that was designed to work on data structured as trees, and the RDF data model, which is a more general data structure, a graph. Therefore, let me emphasize this point:
  5. ... even if there is a syntax to serialize RDF as XML, this doesn&#x2019;t mean that RDF *is* XML. It is not. Therefore, although at a first glance it may seem feasible, in practice, we cannot use XML tools for RDF data. In particular, XSLT is not a good option to transform RDF graphs.
  6. ... even if there is a syntax to serialize RDF as XML, this doesn&#x2019;t mean that RDF *is* XML. It is not. Therefore, although at a first glance it may seem feasible, in practice, we cannot use XML tools for RDF data. In particular, XSLT is not a good option to transform RDF graphs.
  7. Now, let&#x2019;s take a look at how others are tackling this problem. There are some proposals to create other serialization syntaxes for RDF in XML which are simpler than RDF/XML. Unfortunately, they are not standard, and they are very verbose. Other approach is to add some intelligence to the XSLT processors, so when they evaluate an XPath expression against an RDF graph, they flatten the graph to a dynamic tree. The third proposal here is the closest to our work, but it has become obsolete by SPARQL. Finally, Axel Polleres and others have recently proposed a clever method to unify SPARQL and XQuery in a single language, and they will present their work tomorrow in the main track, so if you&#x2019;re interested, I recommend you to attend to their presentation. By the way, their paper is one of the candidates for the best paper award.
  8. Finally, there is another way to transform the RDF data. We can write the transformation logic using our favorite scripting language: PHP, Python, whatever. But this way is not without problems. On the one hand, there is not an standarized API to access RDF data yet. Compare this with the situation in the XML world, where they have DOM and SAX. On the other hand, codifying transformation logic in conventional scripting languages usually leads to messy programs. This is one of the reasons that make XSLT so popular in the XML world. Most people don&#x2019;t want to write transformation logic in Java or Python.
  9. Therefore, let me introduce you to XSLT+SPARQL. The idea is quite simple: we defined two small sets of XPath extension functions that allow to make queries against RDF models using SPARQL. These functions are intended to be used in the &#x201C;select&#x201D; attributes of XSLT stylesheets. In this way, instead of selecting fragments of the XML input data, the developer can select fragments of an RDF graph. These functions return very simple XML documents that contain the result of the SPARQL query. For this purpose, we use...
  10. ... the W3C has defined a very simple XML syntax. The result of a SELECT query in SPARQL is a table with bindings for the query variables. In this syntax, each row of the table produces a &#x201C;result&#x201D; element, and each column produces a variable binding. In summary, we took three W3C technologies, namely XSLT, SPARQL, and the XML syntax for SPARQL results; and we defined two sets of functions that allow to bridge between RDF and XML.
  11. As this is a workshop of developers, I&#x2019;ll spend some time describing these functions, that is, I&#x2019;ll explain the XSLT+SPARQL API. The first set of functions, which we call &#x201C;basic functions&#x201D;, contains just these two functions. They allow the developer to execute a query and they return the results. The difference between the first one and the second one is that the first one retrieves the RDF data from anywhere in the web and executes the query locally, while the second one uses a SPARQL endpoint to execute the query remotely. The first one can be used, for instance, to query the contents of a FOAF file, while the second one can be used against the DBPedia endpoint.
  12. The second set of functions are the advanced ones. They allow to be write more efficient programs by avoiding parsing repeatedly the same RDF graph, and they also allow to build custom RDF models by merging information from different sources.
  13. The first function of the advanced set can parse a string that contains serialized RDF data. This function does not return the results of any query, but a handler to an in-memory model.
  14. There are two other functions to read RDF data and create handlers. The one that receives a URL fetchs the document and parse it as RDF. The last one parses a XSLT nodeset as if it was RDF/XML. This nodeset can be a fragment of the XSLT input document, but it can even be a part of the XSLT stylesheet.
  15. This fourth function has the ability to merge two or more in-memory RDF models, identified by their handlers, into a new one. It allows the developer to build custom RDF models by picking and joining different pieces, which are parsed with the three previous functions.
  16. Finally, the last function executes a SPARQL query against an in-memory RDF model. Note that this function does not parse any file, nor it retrieves data from the web. Therefore, it is much quicker than the two query functions we described in the basic set of functions.
  17. How can you use these functions? We have two implementations. The first one is written in Java, and it uses the extensibility mechanism supported by the XSLT language, namely, the ability to define new user functions in a new namespace. Our code uses the Jena library to load and query RDF, and it is specific to Apache Xalan (which is an XSLT processor), although it should be easily portable to other XSLT processors. In parallel, we have a partial implementation of the basic functions written in pure XSLT. The main limitation of this portable implementation is that the document() function of XSLT lacks the ability to perform content negotiation.
  18. The main application of XSLT+SPARQL is the transformation of RDF data to other formats, mainly to XML, and in particular, to presentational formats such a XHTML and SVG. In such role, XSLT+SPARQL works as the last step of a Semantic Web application. But there are other possibilities. For instance, the current version of SPARQL is somewhat limited with respect to its ability to generate reports, specially if you compare it with SQL. With XSLT+SPARQL, however, it is possible to do aggregation functions and grouping of the results of a query. Finally, it also possible to use XSLT+SPARQL as a language to implement some simple scripts for the semantic web.
  19. In this example, we embed a SPARQL query within an XSLT stylesheet. This query simply fetches the FOAF file of Ivan Herman and returns the list of his friends, possibly with their mailbox and the URI of their webpage. The results are inside of a select attribute in an apply-templates element, so the XSLT processor will search for a template that matches the root element of the results. We can write one and continue the processing of the query results, for instance, to render an HTML table with the information.
  20. This is a simple example, but we have some others which are more complex and can provide a better insight of the features of XSLT+SPARQL. For instance, we created one that does something similar to the example of Ivan&#x2019;s friends, but it uses the DBPedia SPARQL endpoint to get any kind of data, for instance, a list of German cities. Other examples can produce two kinds of ISO standarized displays for thesauri from SKOS data. One of them is simply an alphabetical listing, but the second one is a hierarchal display that looks like a tree. To build it, we simply used recursive XSLT templates. Finally, we wrote an &#x201C;spider&#x201D; agent that has the ability to retrieve data from the web on-demand. For instance, if Ivan&#x2019;s FOAF file does not contain the name of his friends, the script can de-reference the URIs and progressively build a richer RDF model.
  21. We can summarize two conclusions. Firstly, our work can overcome the limitations of XSLT to process RDF data, regardless of its serialization format. Note that we can address RDF data from XSLT+SPARQL even if it is available in other syntaxes, such as N3. Secondly, these functions give you, the developers of scripts for the semantic web, a new language to write such scripts. And this platform still has the potential to grow, for instance, by introducing functions to perform reasoning and inference.