SlideShare une entreprise Scribd logo
1  sur  14
Motorbike & Sidecar

                XML DATABASES AND TRIPLESTORES

                      PETER WINSTANLEY

                  SCOTTISH GOVERNMENT




peter.winstanley@scotland.gsi.gov.uk
XML
                                    2


 There is a lot of it already available
 It has a structure
 People “out there” know how to use it
 There is a lot of great functionality in the
   XML stack




Dr Peter Winstanley: OKF meeting            5 March 2013
Native XML Databases
                                    3


 No longer something new and esoteric
 Schema-free, so you don‟t need to know
  what you are storing before you do so
 A bit like a file system
 Accessible via several modalities
  (Native protocols (xmldb), http REST
  and WebDAV)

Dr Peter Winstanley: OKF meeting                  5 March 2013
XPath & XQuery
                                         4


 2 ways of computing over XML
 XPath works over paths
  (facets/axis)
 XQuery works over sequences




Dr Peter Winstanley: OKF meeting                    5 March 2013
XPath
                                     5


 Used for querying:
  //xml/indicator[code=„ABC‟]
 ...and computing:
  distinct-values(
  //xml/indicator/code
  )
Dr Peter Winstanley: OKF meeting           5 March 2013
XQuery
                                     6


 XQuery example
   for $i in doc(„mydoc.xml‟)
   where $i//xml/indicator/code = „ABC‟
   return <result>{$i}</result>




Dr Peter Winstanley: OKF meeting            5 March 2013
RESTXQ
                                     7


 XQuery over http
 Parameterised (REST) URLs
 http://server/indicator/code/ABC




Dr Peter Winstanley: OKF meeting            5 March 2013
What about triplestores?
                                    8


 Store whatever RDF you give them
 So, how about:
   http://server/indicator/code/ABC
   a qb:Slice;
   skos:prefLabel „ABC‟ .



Dr Peter Winstanley: OKF meeting                    5 March 2013
The Plan
                                       9




                                                          H
                      H                                   T
                      T                                   T
                      T                                   P
                      P



                                    HTTP




  See also: http://www.xmltoday.org/content/fuseki-using-jena-
  semantic-web-platform-marklogic Kurt Cagle, June 2012
Dr Peter Winstanley: OKF meeting                                 5 March 2013
Motorbike & Sidecar
                                       10




Dr Peter Winstanley: OKF meeting                    5 March 2013
Demo
                                    11


 NXD = BaseX
  http://basex.org
 Triplestore = Fuseki
  http://jena.apache.org/
 Data = Scottish Neighborhood Stats
  http://www.sns.gov.uk/BulkDownloads
   /SNS_FullData_XML_20_2_2013.zip

Dr Peter Winstanley: OKF meeting          5 March 2013
General Instructions
                                       12

 Fuseki ; vanilla install. Startup – should be available on
    localhost:3030
   BaseX; install, edit the web.xml to allow rest, webdav and
    restxq. Create a database (“SNS_ALL”) and add the SNS
    data
   Put the restxq *.xqm module into the BaseX restxq
    directory
   Startup and check availability on localhost:8984
   Run the script to load the triplestore (can be done using
    XQDT in Eclipse)
   Query Fuseki ... select * {?s ?p ?o .}


Dr Peter Winstanley: OKF meeting                      5 March 2013
XQuery to construct and add RDF
                                                                                         13
xquery version "3.0";
(: XQuery main module to load Fuseki with some RDF derived from the SNS_ALL dataset :)

declare function local:load(){

let $i := distinct-values(collection("SNS_ALL")//code)

let $z := for $x in $i

       let $s :=     concat('prefix skos: <http://www.w3.org/2004/02/skos/core#> ',
              'prefix qb: <http://purl.org/linked-data/cube#> ',
              'insert data {<http://localhost:8984/restxq/sns/indicator/code/',
               $x,
              '> a qb:Slice; skos:prefLabel "',
               $x,
              '" .}'
       )

       let $request :=
            <http:request method="post" http-version="1.0">
            <http:body media-type="application/x-www-form-urlencoded">
            {
               concat("update=",
               encode-for-uri($s))
              }
            </http:body>
            </http:request>

       let $upd := http:send-request($request, "http://localhost:3030/DatabasePathname/update")

        return <ret>
            <x>{$x}</x>
            <resp>{$upd}</resp>
           </ret>
return
   <out>
   {$z}
   </out>
};

local:load()




Dr Peter Winstanley: OKF meeting                                                                  5 March 2013
RESTXQ counterpart for URI resolution
                                     14

xquery version "3.0";
(:~
a RESTXQ interface to the SNS data
:)
module namespace page = 'http://basex.org/modules/web-page';
declare namespace sns = "urn:sns-scotexec-gov-uk/schemas/indicators/0.1";


declare
%restxq:path("sns/indicator/code/{$code}")
 function page:indicator($code as xs:string) {
let $r := collection('SNS_ALL')//indicator[code=$code]
return
<SNS1>{$r}</SNS1>
};


Dr Peter Winstanley: OKF meeting                                5 March 2013

Contenu connexe

En vedette

Philippe. Chanson Et Laure Cazabat
Philippe. Chanson Et Laure CazabatPhilippe. Chanson Et Laure Cazabat
Philippe. Chanson Et Laure Cazabatendocrinologie
 
Hoja de vida jonatan rivas octubre 2015
Hoja de vida jonatan rivas octubre  2015  Hoja de vida jonatan rivas octubre  2015
Hoja de vida jonatan rivas octubre 2015 jonabatero
 
MN5501 - Dissertation - 1124765 - Neal Coope
MN5501 - Dissertation - 1124765 - Neal CoopeMN5501 - Dissertation - 1124765 - Neal Coope
MN5501 - Dissertation - 1124765 - Neal CoopeNeal Coope
 
HOJA DE VIDA EFRAIN LAY 25agost15
HOJA DE VIDA EFRAIN LAY 25agost15HOJA DE VIDA EFRAIN LAY 25agost15
HOJA DE VIDA EFRAIN LAY 25agost15Efrain Martin
 

En vedette (6)

Philippe. Chanson Et Laure Cazabat
Philippe. Chanson Et Laure CazabatPhilippe. Chanson Et Laure Cazabat
Philippe. Chanson Et Laure Cazabat
 
Hypophyse
HypophyseHypophyse
Hypophyse
 
Hoja de vida jonatan rivas octubre 2015
Hoja de vida jonatan rivas octubre  2015  Hoja de vida jonatan rivas octubre  2015
Hoja de vida jonatan rivas octubre 2015
 
MN5501 - Dissertation - 1124765 - Neal Coope
MN5501 - Dissertation - 1124765 - Neal CoopeMN5501 - Dissertation - 1124765 - Neal Coope
MN5501 - Dissertation - 1124765 - Neal Coope
 
HOJA DE VIDA EFRAIN LAY 25agost15
HOJA DE VIDA EFRAIN LAY 25agost15HOJA DE VIDA EFRAIN LAY 25agost15
HOJA DE VIDA EFRAIN LAY 25agost15
 
ادارة المعرفة للقيادات
  ادارة المعرفة للقيادات  ادارة المعرفة للقيادات
ادارة المعرفة للقيادات
 

Plus de PeterWinstanley1

W3C Data Exchange Working Group - an update
W3C Data Exchange Working Group - an updateW3C Data Exchange Working Group - an update
W3C Data Exchange Working Group - an updatePeterWinstanley1
 
2015-10-07 isko winstanley
2015-10-07 isko winstanley2015-10-07 isko winstanley
2015-10-07 isko winstanleyPeterWinstanley1
 
2015-10-07 isko winstanley
2015-10-07 isko winstanley2015-10-07 isko winstanley
2015-10-07 isko winstanleyPeterWinstanley1
 
2014 11-17 crichton institute talk on open data
2014 11-17 crichton institute talk on open data2014 11-17 crichton institute talk on open data
2014 11-17 crichton institute talk on open dataPeterWinstanley1
 
2014 11-17 crichton institute talk on open data
2014 11-17 crichton institute talk on open data2014 11-17 crichton institute talk on open data
2014 11-17 crichton institute talk on open dataPeterWinstanley1
 
ICEGOV 2014: introduction to "Data For Development" track
ICEGOV 2014: introduction to "Data For Development" trackICEGOV 2014: introduction to "Data For Development" track
ICEGOV 2014: introduction to "Data For Development" trackPeterWinstanley1
 
2014 09-10 Share PSI 2.0 talk: Scottish Linked Data Interest Group
2014 09-10 Share PSI 2.0 talk: Scottish Linked Data Interest Group2014 09-10 Share PSI 2.0 talk: Scottish Linked Data Interest Group
2014 09-10 Share PSI 2.0 talk: Scottish Linked Data Interest GroupPeterWinstanley1
 
Publishing "5 star" data: the case for RDF
Publishing "5 star" data: the case for RDFPublishing "5 star" data: the case for RDF
Publishing "5 star" data: the case for RDFPeterWinstanley1
 
2013 08-27 okfn-glasgow_uk_gov_open_standards
2013 08-27 okfn-glasgow_uk_gov_open_standards2013 08-27 okfn-glasgow_uk_gov_open_standards
2013 08-27 okfn-glasgow_uk_gov_open_standardsPeterWinstanley1
 
Notes for talk on 12th June 2013 to Open Innovation meeting, Glasgow
Notes for talk on 12th June 2013 to Open Innovation meeting, GlasgowNotes for talk on 12th June 2013 to Open Innovation meeting, Glasgow
Notes for talk on 12th June 2013 to Open Innovation meeting, GlasgowPeterWinstanley1
 
Interconnecting Belgian national and regional address data using EC ISA "Loca...
Interconnecting Belgian national and regional address data using EC ISA "Loca...Interconnecting Belgian national and regional address data using EC ISA "Loca...
Interconnecting Belgian national and regional address data using EC ISA "Loca...PeterWinstanley1
 

Plus de PeterWinstanley1 (12)

W3C Data Exchange Working Group - an update
W3C Data Exchange Working Group - an updateW3C Data Exchange Working Group - an update
W3C Data Exchange Working Group - an update
 
2015-10-07 isko winstanley
2015-10-07 isko winstanley2015-10-07 isko winstanley
2015-10-07 isko winstanley
 
2015-10-07 isko winstanley
2015-10-07 isko winstanley2015-10-07 isko winstanley
2015-10-07 isko winstanley
 
2014 11-17 crichton institute talk on open data
2014 11-17 crichton institute talk on open data2014 11-17 crichton institute talk on open data
2014 11-17 crichton institute talk on open data
 
2014 11-17 crichton institute talk on open data
2014 11-17 crichton institute talk on open data2014 11-17 crichton institute talk on open data
2014 11-17 crichton institute talk on open data
 
ICEGOV 2014: introduction to "Data For Development" track
ICEGOV 2014: introduction to "Data For Development" trackICEGOV 2014: introduction to "Data For Development" track
ICEGOV 2014: introduction to "Data For Development" track
 
2014 09-10 Share PSI 2.0 talk: Scottish Linked Data Interest Group
2014 09-10 Share PSI 2.0 talk: Scottish Linked Data Interest Group2014 09-10 Share PSI 2.0 talk: Scottish Linked Data Interest Group
2014 09-10 Share PSI 2.0 talk: Scottish Linked Data Interest Group
 
Xml pres 1
Xml pres 1 Xml pres 1
Xml pres 1
 
Publishing "5 star" data: the case for RDF
Publishing "5 star" data: the case for RDFPublishing "5 star" data: the case for RDF
Publishing "5 star" data: the case for RDF
 
2013 08-27 okfn-glasgow_uk_gov_open_standards
2013 08-27 okfn-glasgow_uk_gov_open_standards2013 08-27 okfn-glasgow_uk_gov_open_standards
2013 08-27 okfn-glasgow_uk_gov_open_standards
 
Notes for talk on 12th June 2013 to Open Innovation meeting, Glasgow
Notes for talk on 12th June 2013 to Open Innovation meeting, GlasgowNotes for talk on 12th June 2013 to Open Innovation meeting, Glasgow
Notes for talk on 12th June 2013 to Open Innovation meeting, Glasgow
 
Interconnecting Belgian national and regional address data using EC ISA "Loca...
Interconnecting Belgian national and regional address data using EC ISA "Loca...Interconnecting Belgian national and regional address data using EC ISA "Loca...
Interconnecting Belgian national and regional address data using EC ISA "Loca...
 

Dernier

WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 

Dernier (20)

WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 

Open data edinburgh-napier-2013-03-05

  • 1. Motorbike & Sidecar XML DATABASES AND TRIPLESTORES PETER WINSTANLEY SCOTTISH GOVERNMENT peter.winstanley@scotland.gsi.gov.uk
  • 2. XML 2  There is a lot of it already available  It has a structure  People “out there” know how to use it  There is a lot of great functionality in the XML stack Dr Peter Winstanley: OKF meeting 5 March 2013
  • 3. Native XML Databases 3  No longer something new and esoteric  Schema-free, so you don‟t need to know what you are storing before you do so  A bit like a file system  Accessible via several modalities (Native protocols (xmldb), http REST and WebDAV) Dr Peter Winstanley: OKF meeting 5 March 2013
  • 4. XPath & XQuery 4  2 ways of computing over XML  XPath works over paths (facets/axis)  XQuery works over sequences Dr Peter Winstanley: OKF meeting 5 March 2013
  • 5. XPath 5  Used for querying: //xml/indicator[code=„ABC‟]  ...and computing: distinct-values( //xml/indicator/code ) Dr Peter Winstanley: OKF meeting 5 March 2013
  • 6. XQuery 6  XQuery example for $i in doc(„mydoc.xml‟) where $i//xml/indicator/code = „ABC‟ return <result>{$i}</result> Dr Peter Winstanley: OKF meeting 5 March 2013
  • 7. RESTXQ 7  XQuery over http  Parameterised (REST) URLs  http://server/indicator/code/ABC Dr Peter Winstanley: OKF meeting 5 March 2013
  • 8. What about triplestores? 8  Store whatever RDF you give them  So, how about: http://server/indicator/code/ABC a qb:Slice; skos:prefLabel „ABC‟ . Dr Peter Winstanley: OKF meeting 5 March 2013
  • 9. The Plan 9 H H T T T T P P HTTP See also: http://www.xmltoday.org/content/fuseki-using-jena- semantic-web-platform-marklogic Kurt Cagle, June 2012 Dr Peter Winstanley: OKF meeting 5 March 2013
  • 10. Motorbike & Sidecar 10 Dr Peter Winstanley: OKF meeting 5 March 2013
  • 11. Demo 11  NXD = BaseX http://basex.org  Triplestore = Fuseki http://jena.apache.org/  Data = Scottish Neighborhood Stats http://www.sns.gov.uk/BulkDownloads /SNS_FullData_XML_20_2_2013.zip Dr Peter Winstanley: OKF meeting 5 March 2013
  • 12. General Instructions 12  Fuseki ; vanilla install. Startup – should be available on localhost:3030  BaseX; install, edit the web.xml to allow rest, webdav and restxq. Create a database (“SNS_ALL”) and add the SNS data  Put the restxq *.xqm module into the BaseX restxq directory  Startup and check availability on localhost:8984  Run the script to load the triplestore (can be done using XQDT in Eclipse)  Query Fuseki ... select * {?s ?p ?o .} Dr Peter Winstanley: OKF meeting 5 March 2013
  • 13. XQuery to construct and add RDF 13 xquery version "3.0"; (: XQuery main module to load Fuseki with some RDF derived from the SNS_ALL dataset :) declare function local:load(){ let $i := distinct-values(collection("SNS_ALL")//code) let $z := for $x in $i let $s := concat('prefix skos: <http://www.w3.org/2004/02/skos/core#> ', 'prefix qb: <http://purl.org/linked-data/cube#> ', 'insert data {<http://localhost:8984/restxq/sns/indicator/code/', $x, '> a qb:Slice; skos:prefLabel "', $x, '" .}' ) let $request := <http:request method="post" http-version="1.0"> <http:body media-type="application/x-www-form-urlencoded"> { concat("update=", encode-for-uri($s)) } </http:body> </http:request> let $upd := http:send-request($request, "http://localhost:3030/DatabasePathname/update") return <ret> <x>{$x}</x> <resp>{$upd}</resp> </ret> return <out> {$z} </out> }; local:load() Dr Peter Winstanley: OKF meeting 5 March 2013
  • 14. RESTXQ counterpart for URI resolution 14 xquery version "3.0"; (:~ a RESTXQ interface to the SNS data :) module namespace page = 'http://basex.org/modules/web-page'; declare namespace sns = "urn:sns-scotexec-gov-uk/schemas/indicators/0.1"; declare %restxq:path("sns/indicator/code/{$code}") function page:indicator($code as xs:string) { let $r := collection('SNS_ALL')//indicator[code=$code] return <SNS1>{$r}</SNS1> }; Dr Peter Winstanley: OKF meeting 5 March 2013