SlideShare a Scribd company logo
1 of 60
Download to read offline
An
                                  Introduction
                                            to
                                   Linked Data




                    Part 4 of 5              David Hyland-Wood
        SPARQL Query Language     University of Mary Washington

Monday, May 16, 2011
SPARQL:
                    A query
                language for RDF
Monday, May 16, 2011
SPARQL
                   • Query Language for RDF
                       http://www.w3.org/TR/rdf-sparql-query


                   • SPARQL Protocol and RDF Query
                       Language
                   • Graph pattern based language
                       written the same as Turtle


                   • Several queries — Ask; Select;
                       Describe; Construct
                   • Read Only
                       still vulnerable to injection, though not as bad as SQL



Monday, May 16, 2011
Queries
                   • ASK — True or False
                       Simple, Fast


                   • SELECT — Tabular data
                       easy to work with


                   • DESCRIBE — RDF
                       whatever the store has


                   • CONSTRUCT — RDF
                       Whatever you want




Monday, May 16, 2011
a              /discipline/            rdfs:label
            space:Discipline                                                                              Space Physics
                                                      spacephysics



                                                                              foaf:name
                                                                                                             Sputnik 1
                               space:discipline

                                                                            dc:description
                                                                                                  The Sputnik 1 spacecraft was ...


                                                                            space:agency
                                                                                                             U.S.S.R
                                        a              /spacecraft/
           space:Spacecraft
                                                       1957-001B             space:mass
                                                                                                               86.3




                                                                             foaf:depiction
                                                                                                /images/sputnik.jpg
                               space:spacecraft




                                                                            space:launched
                                                                                                            1957-10-04
                                        a
             space:Launch                           /launch/1957-001
                                                                          space:launchvehicle
                                                                                                     Modified SS-6 (Sapwood)


                                 space:launchsite


                                                                               rdfs:label
                                                                                                 Tyuratam (Baikonur Cosmodrome)
                                        a
           space:Launchsite                         /launchsite/tyurata
                                                                             space:country
                                                                                                             U.S.S.R




Monday, May 16, 2011
Triple Patterns




Monday, May 16, 2011
Triple Patterns

               <http://example.com/spacecraft/1957-001B>
                 foaf:name "Sputnik 1" .




Monday, May 16, 2011
Triple Patterns

               <http://example.com/spacecraft/1957-001B>
                 foaf:name "Sputnik 1" .


               ?something foaf:name "Sputnik 1" .




Monday, May 16, 2011
Triple Patterns

               <http://example.com/spacecraft/1957-001B>
                 foaf:name "Sputnik 1" .


               ?something foaf:name "Sputnik 1" .

               ?something foaf:name ?name .




Monday, May 16, 2011
Triple Patterns

               <http://example.com/spacecraft/1957-001B>
                 foaf:name "Sputnik 1" .


               ?something foaf:name "Sputnik 1" .

               ?something foaf:name ?name .

               ASK WHERE {
                 ?something foaf:name "Sputnik 1" .
               }




Monday, May 16, 2011
a             /discipline/            rdfs:label
            space:Discipline                                                                              Space Physics
                                                      spacephysics



                                                                              foaf:name
                                                                                                             Sputnik 1
                               space:discipline
                                                                            dc:description
                                                                                                  The Sputnik 1 spacecraft was ...


                                                                            space:agency
                                                                                                             U.S.S.R
                                         a             /spacecraft/
           space:Spacecraft
                                                       1957-001B             space:mass
                                                                                                               86.3




                                                                             foaf:depiction
                                                                                                /images/sputnik.jpg
                               space:spacecraft




                                                                            space:launched
                                                                                                            1957-10-04
                                         a
             space:Launch                           /launch/1957-001
                                                                          space:launchvehicle
                                                                                                     Modified SS-6 (Sapwood)


                                 space:launchsite


                                                                               rdfs:label
                                         a                                                       Tyuratam (Baikonur Cosmodrome)
           space:Launchsite                         /launchsite/tyurata
                                                                             space:country
                                                                                                             U.S.S.R




Monday, May 16, 2011
Triple Patterns
               PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

               ASK WHERE {
                 ?something rdfs:label ?label .
               }




Monday, May 16, 2011
a              /discipline/            rdfs:label
            space:Discipline                                                                              Space Physics
                                                      spacephysics



                                                                              foaf:name
                                                                                                             Sputnik 1
                               space:discipline

                                                                            dc:description
                                                                                                  The Sputnik 1 spacecraft was ...


                                                                            space:agency
                                                                                                             U.S.S.R
                                        a              /spacecraft/
           space:Spacecraft
                                                       1957-001B             space:mass
                                                                                                               86.3




                                                                             foaf:depiction
                                                                                                /images/sputnik.jpg
                               space:spacecraft




                                                                            space:launched
                                                                                                            1957-10-04
                                        a
             space:Launch                           /launch/1957-001
                                                                          space:launchvehicle
                                                                                                     Modified SS-6 (Sapwood)


                                 space:launchsite


                                                                               rdfs:label
                                                                                                 Tyuratam (Baikonur Cosmodrome)
                                        a
           space:Launchsite                         /launchsite/tyurata
                                                                             space:country
                                                                                                             U.S.S.R




Monday, May 16, 2011
a              /discipline/            rdfs:label
            space:Discipline                                                                              Space Physics
                                                      spacephysics



                                                                              foaf:name
                                                                                                             Sputnik 1
                               space:discipline

                                                                            dc:description
                                                                                                  The Sputnik 1 spacecraft was ...


                                                                            space:agency
                                                                                                             U.S.S.R
                                        a              /spacecraft/
           space:Spacecraft
                                                       1957-001B             space:mass
                                                                                                               86.3




                                                                             foaf:depiction
                                                                                                /images/sputnik.jpg
                               space:spacecraft




                                                                            space:launched
                                                                                                            1957-10-04
                                        a
             space:Launch                           /launch/1957-001
                                                                          space:launchvehicle
                                                                                                     Modified SS-6 (Sapwood)


                                 space:launchsite


                                                                               rdfs:label
                                                                                                 Tyuratam (Baikonur Cosmodrome)
                                        a
           space:Launchsite                         /launchsite/tyurata
                                                                             space:country
                                                                                                             U.S.S.R




Monday, May 16, 2011
Triple Patterns

               PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
               PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

               ASK WHERE {
                 ?something rdfs:label ?label ;
                   rdf:type space:Discipline .
               }




Monday, May 16, 2011
a              /discipline/            rdfs:label
            space:Discipline                                                                              Space Physics
                                                      spacephysics



                                                                              foaf:name
                                                                                                             Sputnik 1
                               space:discipline

                                                                            dc:description
                                                                                                  The Sputnik 1 spacecraft was ...


                                                                            space:agency
                                                                                                             U.S.S.R
                                        a              /spacecraft/
           space:Spacecraft
                                                       1957-001B             space:mass
                                                                                                               86.3




                                                                             foaf:depiction
                                                                                                /images/sputnik.jpg
                               space:spacecraft




                                                                            space:launched
                                                                                                            1957-10-04
                                        a
             space:Launch                           /launch/1957-001
                                                                          space:launchvehicle
                                                                                                     Modified SS-6 (Sapwood)


                                 space:launchsite


                                                                               rdfs:label
                                                                                                 Tyuratam (Baikonur Cosmodrome)
                                        a
           space:Launchsite                         /launchsite/tyurata
                                                                             space:country
                                                                                                             U.S.S.R




Monday, May 16, 2011
a              /discipline/            rdfs:label
            space:Discipline                                                                              Space Physics
                                                      spacephysics



                                                                              foaf:name
                                                                                                             Sputnik 1
                               space:discipline

                                                                            dc:description
                                                                                                  The Sputnik 1 spacecraft was ...


                                                                            space:agency
                                                                                                             U.S.S.R
                                        a              /spacecraft/
           space:Spacecraft
                                                       1957-001B             space:mass
                                                                                                               86.3




                                                                             foaf:depiction
                                                                                                /images/sputnik.jpg
                               space:spacecraft




                                                                            space:launched
                                                                                                            1957-10-04
                                        a
             space:Launch                           /launch/1957-001
                                                                          space:launchvehicle
                                                                                                     Modified SS-6 (Sapwood)


                                 space:launchsite


                                                                               rdfs:label
                                                                                                 Tyuratam (Baikonur Cosmodrome)
                                        a
           space:Launchsite                         /launchsite/tyurata
                                                                             space:country
                                                                                                             U.S.S.R




Monday, May 16, 2011
Triple Patterns

                       PREFIX space: <http://purl.org/net/schemas/space/>
                       PREFIX foaf: <http://xmlns.com/foaf/0.1/>

                       ASK WHERE {
                         ?spacecraft foaf:name “Sputnik 1” .
                         ?launch space:spacecraft ?spacecraft .
                         ?launch space:launched ?launchdate .
                       }




Monday, May 16, 2011
a              /discipline/            rdfs:label
            space:Discipline                                                                              Space Physics
                                                      spacephysics



                                                                              foaf:name
                                                                                                             Sputnik 1
                               space:discipline

                                                                            dc:description
                                                                                                  The Sputnik 1 spacecraft was ...


                                                                            space:agency
                                                                                                             U.S.S.R
                                        a              /spacecraft/
           space:Spacecraft
                                                       1957-001B             space:mass
                                                                                                               86.3




                                                                             foaf:depiction
                                                                                                /images/sputnik.jpg
                               space:spacecraft




                                                                            space:launched
                                                                                                            1957-10-04
                                        a
             space:Launch                           /launch/1957-001
                                                                          space:launchvehicle
                                                                                                     Modified SS-6 (Sapwood)


                                 space:launchsite


                                                                               rdfs:label
                                                                                                 Tyuratam (Baikonur Cosmodrome)
                                        a
           space:Launchsite                         /launchsite/tyurata
                                                                             space:country
                                                                                                             U.S.S.R




Monday, May 16, 2011
a              /discipline/            rdfs:label
            space:Discipline                                                                              Space Physics
                                                      spacephysics



                                                                              foaf:name
                                                                                                             Sputnik 1
                               space:discipline

                                                                            dc:description
                                                                                                  The Sputnik 1 spacecraft was ...


                                                                            space:agency
                                                                                                             U.S.S.R
                                        a              /spacecraft/
           space:Spacecraft
                                                       1957-001B             space:mass
                                                                                                               86.3




                                                                             foaf:depiction
                                                                                                /images/sputnik.jpg
                               space:spacecraft




                                                                            space:launched
                                                                                                            1957-10-04
                                        a
             space:Launch                           /launch/1957-001
                                                                          space:launchvehicle
                                                                                                     Modified SS-6 (Sapwood)


                                 space:launchsite


                                                                               rdfs:label
                                                                                                 Tyuratam (Baikonur Cosmodrome)
                                        a
           space:Launchsite                         /launchsite/tyurata
                                                                             space:country
                                                                                                             U.S.S.R




Monday, May 16, 2011
a              /discipline/            rdfs:label
            space:Discipline                                                                              Space Physics
                                                      spacephysics



                                                                              foaf:name
                                                                                                             Sputnik 1
                               space:discipline

                                                                            dc:description
                                                                                                  The Sputnik 1 spacecraft was ...


                                                                            space:agency
                                                                                                             U.S.S.R
                                        a              /spacecraft/
           space:Spacecraft
                                                       1957-001B             space:mass
                                                                                                               86.3




                                                                             foaf:depiction
                                                                                                /images/sputnik.jpg
                               space:spacecraft




                                                                            space:launched
                                                                                                            1957-10-04
                                        a
             space:Launch                           /launch/1957-001
                                                                          space:launchvehicle
                                                                                                     Modified SS-6 (Sapwood)


                                 space:launchsite


                                                                               rdfs:label
                                                                                                 Tyuratam (Baikonur Cosmodrome)
                                        a
           space:Launchsite                         /launchsite/tyurata
                                                                             space:country
                                                                                                             U.S.S.R




Monday, May 16, 2011
a              /discipline/            rdfs:label
            space:Discipline                                                                              Space Physics
                                                      spacephysics



                                                                              foaf:name
                                                                                                             Sputnik 1
                               space:discipline

                                                                            dc:description
                                                                                                  The Sputnik 1 spacecraft was ...


                                                                            space:agency
                                                                                                             U.S.S.R
                                        a              /spacecraft/
           space:Spacecraft
                                                       1957-001B             space:mass
                                                                                                               86.3




                                                                             foaf:depiction
                                                                                                /images/sputnik.jpg
                               space:spacecraft




                                                                            space:launched
                                                                                                            1957-10-04
                                        a
             space:Launch                           /launch/1957-001
                                                                          space:launchvehicle
                                                                                                     Modified SS-6 (Sapwood)


                                 space:launchsite


                                                                               rdfs:label
                                                                                                 Tyuratam (Baikonur Cosmodrome)
                                        a
           space:Launchsite                         /launchsite/tyurata
                                                                             space:country
                                                                                                             U.S.S.R




Monday, May 16, 2011
Example SELECT

               PREFIX space: <http://purl.org/net/schemas/space/>
               PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
               PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>


               SELECT ?subject ?label WHERE {

                       ?subject rdfs:label ?label ;
                                a space:Discipline .

               }




Monday, May 16, 2011
Example SELECT
               <sparql xmlns="http://www.w3.org/2005/sparql-results#">
                <head>
                 <variable name="subject"/>
                 <variable name="label"/>
                </head>
                <results>
                 <result>
                  <binding name="subject">
                    <uri>http://nasa.dataincubator.org/discipline/astronomy</
               uri>
                  </binding>
                  <binding name="label">
                    <literal>Astronomy</literal>
                  </binding>
                 </result>
                 <result>
                  <binding name="subject">
                    <uri>http://nasa.dataincubator.org/discipline/
               communications</uri>
                  </binding>
                  <binding name="label">
                    <literal>Communications</literal>
                  </binding>
                 </result>


Monday, May 16, 2011
Example SELECT

               PREFIX space: <http://purl.org/net/schemas/space/>
               PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
               PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>


               SELECT * WHERE {

                       ?subject rdfs:label ?label ;
                                a space:Discipline .

               }




Monday, May 16, 2011
a              /discipline/            rdfs:label
            space:Discipline                                                                              Space Physics
                                                      spacephysics



                                                                              foaf:name
                                                                                                             Sputnik 1
                               space:discipline

                                                                            dc:description
                                                                                                  The Sputnik 1 spacecraft was ...


                                                                            space:agency
                                                                                                             U.S.S.R
                                        a              /spacecraft/
           space:Spacecraft
                                                       1957-001B             space:mass
                                                                                                               86.3




                                                                             foaf:depiction
                                                                                                /images/sputnik.jpg
                               space:spacecraft




                                                                            space:launched
                                                                                                            1957-10-04
                                        a
             space:Launch                           /launch/1957-001
                                                                          space:launchvehicle
                                                                                                     Modified SS-6 (Sapwood)


                                 space:launchsite


                                                                               rdfs:label
                                                                                                 Tyuratam (Baikonur Cosmodrome)
                                        a
           space:Launchsite                         /launchsite/tyurata
                                                                             space:country
                                                                                                             U.S.S.R




Monday, May 16, 2011
Example SELECT DISTINCT

                       PREFIX space: <http://purl.org/net/schemas/space/>
                       PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
                       PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>


                       SELECT DISTINCT ?date WHERE {

                           ?launch space:launched ?date .

                       }




Monday, May 16, 2011
a              /discipline/            rdfs:label
            space:Discipline                                                                              Space Physics
                                                      spacephysics



                                                                              foaf:name
                                                                                                             Sputnik 1
                               space:discipline

                                                                            dc:description
                                                                                                  The Sputnik 1 spacecraft was ...


                                                                            space:agency
                                                                                                             U.S.S.R
                                        a              /spacecraft/
           space:Spacecraft
                                                       1957-001B             space:mass
                                                                                                               86.3




                                                                             foaf:depiction
                                                                                                /images/sputnik.jpg
                               space:spacecraft




                                                                            space:launched
                                                                                                            1957-10-04
                                        a
             space:Launch                           /launch/1957-001
                                                                          space:launchvehicle
                                                                                                     Modified SS-6 (Sapwood)


                                 space:launchsite


                                                                               rdfs:label
                                                                                                 Tyuratam (Baikonur Cosmodrome)
                                        a
           space:Launchsite                         /launchsite/tyurata
                                                                             space:country
                                                                                                             U.S.S.R




Monday, May 16, 2011
Example OPTIONAL

               PREFIX space: <http://purl.org/net/schemas/space/>
               PREFIX foaf: <http://xmlns.com/foaf/0.1/>


               SELECT ?name ?image WHERE {

                       ?spacecraft foaf:name ?name .

                       OPTIONAL {
                         ?spacecraft foaf:depiction ?image .
                       }
               }




Monday, May 16, 2011
Example OPTIONAL
               <?xml version="1.0"?>
               <sparql xmlns="http://www.w3.org/2005/sparql-results#">
                <head>
                 <variable name="name"/>
                 <variable name="image"/>
                </head>
                <results>
                 <result>
                  <binding name="name">
                   <literal>Soyuz 2</literal>
                  </binding>
                 </result>
                 <result>
                  <binding name="name">
                   <literal>Apollo 10</literal>
                  </binding>
                  <binding name="image">
                   <uri>http://nssdc.gsfc.nasa.gov/image/spacecraft/
               apollo_10_cm.jpg</uri>
                  </binding>
                 </result>




Monday, May 16, 2011
Example UNION

               PREFIX space: <http://purl.org/net/schemas/space/>
               PREFIX foaf: <http://xmlns.com/foaf/0.1/>
               PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>


               SELECT ?subject ?displayLabel WHERE {
                 {
                   ?subject foaf:name ?displayLabel .
                 }
                 UNION
                 {
                   ?subject rdfs:label ?displayLabel .
                 }
               }



Monday, May 16, 2011
Example UNION
               <?xml version="1.0"?>
               <sparql xmlns="http://www.w3.org/2005/sparql-results#">
                 <head>
                   <variable name="subject"/>
                   <variable name="displayLabel"/>
                 </head>
                 <results>
                   <result>
                     <binding name="subject">
                        <uri>http://nasa.dataincubator.org/spacecraft/ATLAS2</uri>
                     </binding>
                     <binding name="displayLabel">
                        <literal>Atlas 2</literal>
                     </binding>
                   </result>
                   <result>
                     <binding name="subject">
                        <uri>http://nasa.dataincubator.org/spacecraft/ATLAS3</uri>
                     </binding>
                     <binding name="displayLabel">
                        <literal>Atlas 3</literal>
                     </binding>
                   </result>




Monday, May 16, 2011
Example ORDER BY

               PREFIX space: <http://purl.org/net/schemas/space/>
               PREFIX foaf: <http://xmlns.com/foaf/0.1/>
               PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>


               SELECT ?name ?launchdate WHERE {
                 ?spacecraft foaf:name ?name .
                 ?launch space:spacecraft ?spacecraft .
                 ?launch space:launched ?launchdate .
               }




Monday, May 16, 2011
Example ORDER BY

               PREFIX space: <http://purl.org/net/schemas/space/>
               PREFIX foaf: <http://xmlns.com/foaf/0.1/>
               PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>


               SELECT ?name ?launchdate WHERE {
                 ?spacecraft foaf:name ?name .
                 ?launch space:spacecraft ?spacecraft .
                 ?launch space:launched ?launchdate .
               }
               ORDER BY DESC(?launchdate)




Monday, May 16, 2011
Example ORDER BY

               PREFIX space: <http://purl.org/net/schemas/space/>
               PREFIX foaf: <http://xmlns.com/foaf/0.1/>
               PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>


               SELECT ?name ?launchdate WHERE {
                 ?spacecraft foaf:name ?name .
                 ?launch space:spacecraft ?spacecraft .
                 ?launch space:launched ?launchdate .
               }
               ORDER BY DESC(?launchdate)
               LIMIT 10




Monday, May 16, 2011
Example ORDER BY

               PREFIX space: <http://purl.org/net/schemas/space/>
               PREFIX foaf: <http://xmlns.com/foaf/0.1/>
               PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>


               SELECT ?name ?launchdate WHERE {
                 ?spacecraft foaf:name ?name .
                 ?launch space:spacecraft ?spacecraft .
                 ?launch space:launched ?launchdate .
               }
               ORDER BY DESC(?launchdate)
               LIMIT 10
               OFFSET 10




Monday, May 16, 2011
Example FILTER

               PREFIX space: <http://purl.org/net/schemas/space/>
               PREFIX foaf: <http://xmlns.com/foaf/0.1/>
               PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>


               SELECT ?name WHERE {
                 ?launch space:launched ?date ;
                         space:spacecraft ?spacecraft .
                 ?spacecraft foaf:name ?name .

               FILTER (
                 ?date >= "1969-01-01"^^xsd:date &&
                 ?date <= "1969-12-31"^^xsd:date
                 )
               }


Monday, May 16, 2011
Example FILTER

               PREFIX space: <http://purl.org/net/schemas/space/>
               PREFIX foaf: <http://xmlns.com/foaf/0.1/>
               PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>


               SELECT ?spacecraft ?name WHERE {
                 ?spacecraft foaf:name ?name ;
                             space:mass ?mass .

                       FILTER( xsd:double(?mass) < 90.0 )
               }




Monday, May 16, 2011
Example FILTER

               PREFIX space: <http://purl.org/net/schemas/space/>
               PREFIX foaf: <http://xmlns.com/foaf/0.1/>
               PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>


               SELECT ?name WHERE {

                       ?spacecraft foaf:name ?name .

                       FILTER( regex(?name, “ollo”, “i” ) )
               }




Monday, May 16, 2011
Built-in Filters
                   •   Logical (!, &&, ||)
                   •   Math (+, -, *, /)
                   •   Comparison (=, !=, >, <, ...)
                   •   Tests
                       isURI, isBlank, isLiteral, bound, sameTerm, langMatches, regex


                   • Accessors
                       str, lang, datatype




Monday, May 16, 2011
Example NOT

               PREFIX space: <http://purl.org/net/schemas/space/>
               PREFIX foaf: <http://xmlns.com/foaf/0.1/>


               SELECT ?s WHERE {

                       ?s a space:Spacecraft .

                       OPTIONAL {
                         ?s foaf:depiction ?image .
                       }

                       FILTER ( !bound(?image) )
               }



Monday, May 16, 2011
Queries
                   • ASK — True or False
                       Simple, Fast


                   • SELECT — Tabular data
                       easy to work with


                   • DESCRIBE — RDF
                       whatever the store has


                   • CONSTRUCT — RDF
                       Whatever you want




Monday, May 16, 2011
Example DESCRIBE



    DESCRIBE <http://example.com/launch/1969-059>




Monday, May 16, 2011
Example DESCRIBE
    <rdf:RDF
        xmlns:space="http://purl.org/net/schemas/space/"
        xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" >

    <rdf:Description
      rdf:about="http://nasa.dataincubator.org/launch/1969-059">
     <space:spacecraft
      rdf:resource="http://nasa.dataincubator.org/spacecraft/1969-059C"/>
     <space:spacecraft
      rdf:resource="http://nasa.dataincubator.org/spacecraft/1969-059B"/>
     <space:spacecraft
      rdf:resource="http://nasa.dataincubator.org/spacecraft/1969-059A"/>
     <space:launchvehicle>Saturn 5</space:launchvehicle>
     <space:launchsite
      rdf:resource="http://nasa.dataincubator.org/launchsite/capecana..."/>
     <space:launched
      rdf:datatype="http://www.w3.org/2001/XMLSchema#date">
        1969-07-16
     </space:launched>
     <rdf:type
      rdf:resource="http://purl.org/net/schemas/space/Launch"/>
    </rdf:Description>
    </rdf:RDF>



Monday, May 16, 2011
Example DESCRIBE

    PREFIX space: <http://purl.org/net/schemas/space/>
    PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>


    DESCRIBE ?spacecraft WHERE {

          ?launch space:launched "1969-07-16"^^xsd:date .
          ?spacecraft space:launch ?launch .

    }




Monday, May 16, 2011
Example DESCRIBE
    <rdf:RDF
        xmlns:space="http://purl.org/net/schemas/space/"
        xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
        xmlns:foaf="http://xmlns.com/foaf/0.1/"
        xmlns:dc="http://purl.org/dc/elements/1.1/"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema#" >
      <rdf:Description rdf:about="http://nasa.dataincubator.org/spacecraft/1969-059B">
        <foaf:homepage rdf:resource="http://nssdc.gsfc.nasa.gov/database/MasterCatalog?
    sc=1969-059B"/>
        <dc:description>The...</dc:description>
        <space:mission rdf:resource="http://nasa.dataincubator.org/mission/apollo-11"/>
        <space:agency>United States</space:agency>
        <rdf:type rdf:resource="http://purl.org/net/schemas/space/Spacecraft"/>
        <space:launch rdf:resource="http://nasa.dataincubator.org/launch/1969-059"/>
        <space:discipline rdf:resource="http://nasa.dataincubator.org/discipline/
    planetaryscience"/>
        <space:alternateName>04040</space:alternateName>
        <space:alternateName>Apollo 11 Saturn V third stage</space:alternateName>
        <foaf:name>Apollo 11 SIVB</foaf:name>
        <space:internationalDesignator>1969-059B</space:internationalDesignator>
        <space:mass>13300.0</space:mass>
      </rdf:Description>

    ...




Monday, May 16, 2011
Example DESCRIBE

    PREFIX space: <http://purl.org/net/schemas/space/>
    PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>


    DESCRIBE ?spacecraft ?launch WHERE {

          ?launch space:launched "1969-07-16"^^xsd:date .
          ?spacecraft space:launch ?launch .

    }




Monday, May 16, 2011
Example CONSTRUCT

    PREFIX space: <http://purl.org/net/schemas/space/>
    PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
    PREFIX foaf: <http://xmlns.com/foaf/0.1/>


    CONSTRUCT {
      ?spacecraft foaf:name ?name ;
                  space:agency ?agency ;
                  space:launched ?launchdate .
    }
    WHERE {
      ?spacecraft foaf:name ?name ;
                  space:agency ?agency .
      ?launch space:spacecraft ?spacecraft .
      ?launch space:launched ?launchdate .
    }




Monday, May 16, 2011
a              /discipline/            rdfs:label
            space:Discipline                                                                              Space Physics
                                                      spacephysics



                                                                              foaf:name
                                                                                                             Sputnik 1
                               space:discipline

                                                                            dc:description
                                                                                                  The Sputnik 1 spacecraft was ...


                                                                            space:agency
                                                                                                             U.S.S.R
                                        a              /spacecraft/
           space:Spacecraft
                                                       1957-001B             space:mass
                                                                                                               86.3




                                                                             foaf:depiction
                                                                                                /images/sputnik.jpg
                               space:spacecraft




                                                                            space:launched
                                                                                                            1957-10-04
                                        a
             space:Launch                           /launch/1957-001
                                                                          space:launchvehicle
                                                                                                     Modified SS-6 (Sapwood)


                                 space:launchsite


                                                                               rdfs:label
                                                                                                 Tyuratam (Baikonur Cosmodrome)
                                        a
           space:Launchsite                         /launchsite/tyurata
                                                                             space:country
                                                                                                             U.S.S.R




Monday, May 16, 2011
a             /discipline/            rdfs:label
            space:Discipline                                                                               Space Physics
                                                       spacephysics



                                                                               foaf:name
                                space:discipline                                                              Sputnik 1


                                                                             dc:description
                                                                                                   The Sputnik 1 spacecraft was ...


                                                                             space:agency
                                                                                                              U.S.S.R
                                          a             /spacecraft/
           space:Spacecraft
                                                        1957-001B             space:mass
                                                                                                                86.3




                                                                              foaf:depiction
                                                                                                 /images/sputnik.jpg
                               space:spacecraft




                                                                             space:launched
                                                                                                             1957-10-04
                                          a
             space:Launch                            /launch/1957-001
                                                                           space:launchvehicle
                                                                                                      Modified SS-6 (Sapwood)


                                  space:launchsite


                                                                                rdfs:label
                                                                                                  Tyuratam (Baikonur Cosmodrome)
                                          a
           space:Launchsite                          /launchsite/tyurata
                                                                              space:country
                                                                                                              U.S.S.R




Monday, May 16, 2011
a              /discipline/               rdfs:label
            space:Discipline                                                                                 Space Physics
                                                       spacephysics



                                                                                  foaf:name
                                                                                                                Sputnik 1
                               space:discipline
                                                                                dc:description
                                                                                                     The Sputnik 1 spacecraft was ...


                                                                                space:agency
                                                                                                                U.S.S.R
                                         a              /spacecraft/
           space:Spacecraft
                                                        1957-001B                space:mass
                                                                                                                  86.3




                                                                                 foaf:depiction
                                                                                                   /images/sputnik.jpg
                               space:spacecraft
                                                                           space:launched



                                                                               space:launched
                                                                                                               1957-10-04
                                         a
             space:Launch                            /launch/1957-001
                                                                             space:launchvehicle
                                                                                                        Modified SS-6 (Sapwood)


                                  space:launchsite


                                                                                   rdfs:label
                                         a                                                          Tyuratam (Baikonur Cosmodrome)
           space:Launchsite                          /launchsite/tyurata
                                                                                space:country
                                                                                                                U.S.S.R




Monday, May 16, 2011
Common Problems
                   • Typos
                       wrong case for property or class name


                   • wrong prefix URI
                       missing # or / or the URI for the web page


                   • Missing OPTIONAL
                       you won't even notice...


                   • Comparing Literals
                       Literals are compared on all of value, type and language




Monday, May 16, 2011
Tip 1: Find all the Properties

    SELECT DISTINCT ?p WHERE {

          ?s ?p ?o .

    }




Monday, May 16, 2011
a            /discipline/            rdfs:label
            space:Discipline                                                                             Space Physics
                                                     spacephysics



                                                                             foaf:name
                                                                                                            Sputnik 1
                               space:discipline

                                                                           dc:description
                                                                                                 The Sputnik 1 spacecraft was ...


                                                                           space:agency
                                                                                                            U.S.S.R
                                         a            /spacecraft/
           space:Spacecraft
                                                      1957-001B             space:mass
                                                                                                              86.3




                                                                            foaf:depiction
                                                                                               /images/sputnik.jpg
                               space:spacecraft




                                                                           space:launched
                                                                                                           1957-10-04
                                         a
             space:Launch                          /launch/1957-001
                                                                         space:launchvehicle
                                                                                                    Modified SS-6 (Sapwood)


                                space:launchsite


                                                                              rdfs:label
                                         a                                                      Tyuratam (Baikonur Cosmodrome)
           space:Launchsite                        /launchsite/tyurata
                                                                            space:country
                                                                                                            U.S.S.R




Monday, May 16, 2011
a                                    rdfs:label
                                                       /discipline/
            space:Discipline                                                                              Space Physics
                                                      spacephysics



                                                                              foaf:name
                                                                                                             Sputnik 1
                               space:discipline
                                                                            dc:description
                                                                                                  The Sputnik 1 spacecraft was ...


                                                                            space:agency
                                                                                                             U.S.S.R
                                          a            /spacecraft/
           space:Spacecraft
                                                       1957-001B             space:mass
                                                                                                               86.3




                                                                             foaf:depiction
                                                                                                /images/sputnik.jpg
                               space:spacecraft




                                                                            space:launched
                                          a                                                                 1957-10-04
             space:Launch                           /launch/1957-001
                                                                          space:launchvehicle
                                                                                                     Modified SS-6 (Sapwood)


                                 space:launchsite


                                                                               rdfs:label
                                          a                                                      Tyuratam (Baikonur Cosmodrome)
           space:Launchsite                         /launchsite/tyurata
                                                                             space:country
                                                                                                             U.S.S.R




Monday, May 16, 2011
Tip 2: Find all the Classes

    SELECT DISTINCT ?type WHERE {

          ?s a ?type .

    }




Monday, May 16, 2011
a            /discipline/            rdfs:label
            space:Discipline                                                                             Space Physics
                                                     spacephysics



                                                                             foaf:name
                                                                                                            Sputnik 1
                               space:discipline

                                                                           dc:description
                                                                                                 The Sputnik 1 spacecraft was ...


                                                                           space:agency
                                                                                                            U.S.S.R
                                         a            /spacecraft/
           space:Spacecraft
                                                      1957-001B             space:mass
                                                                                                              86.3




                                                                            foaf:depiction
                                                                                               /images/sputnik.jpg
                               space:spacecraft




                                                                           space:launched
                                                                                                           1957-10-04
                                         a
             space:Launch                          /launch/1957-001
                                                                         space:launchvehicle
                                                                                                    Modified SS-6 (Sapwood)


                                space:launchsite


                                                                              rdfs:label
                                         a                                                      Tyuratam (Baikonur Cosmodrome)
           space:Launchsite                        /launchsite/tyurata
                                                                            space:country
                                                                                                            U.S.S.R




Monday, May 16, 2011
a             /discipline/            rdfs:label
            space:Discipline                                                                               Space Physics
                                                       spacephysics



                                                                               foaf:name
                                                                                                              Sputnik 1
                                space:discipline

                                                                             dc:description
                                                                                                   The Sputnik 1 spacecraft was ...


                                                                             space:agency
                                                                                                              U.S.S.R
                                          a             /spacecraft/
           space:Spacecraft
                                                        1957-001B             space:mass
                                                                                                                86.3




                                                                              foaf:depiction
                                                                                                 /images/sputnik.jpg
                               space:spacecraft




                                                                             space:launched
                                                                                                             1957-10-04
                                          a
             space:Launch                            /launch/1957-001
                                                                           space:launchvehicle
                                                                                                      Modified SS-6 (Sapwood)


                                  space:launchsite


                                                                                rdfs:label
                                          a                                                       Tyuratam (Baikonur Cosmodrome)
           space:Launchsite                          /launchsite/tyurata
                                                                              space:country
                                                                                                              U.S.S.R




Monday, May 16, 2011
Thanks to


               • Rob Styles, Talis Group Ltd for his CC-BY
                 licensed “Two Day Introduction to the Web of
                 Data” slides and spacecraft example data.




Monday, May 16, 2011
This work is Copyright © 2010 David Hyland-Wood
                       Based partially on CC-BY licensed content Copyright © 2010 Talis Systems Limited by Rob Styles.
                       It is licensed under the Creative Commons Attribution 3.0 Unported License.
                       Full details at: http://creativecommons.org/licenses/by/3.0/


                       You are free:

                                  to Share — to copy, distribute and transmit the work




                                  to Remix — to adapt the work




                       Under the following conditions:
                                  Attribution. You must attribute the work in the manner specified by the author or licensor (but
                                  not in any way that suggests that they endorse you or your use of the work).



                       •   For any reuse or distribution, you must make clear to others the license terms of this work.
                       •   Any of the above conditions can be waived if you get permission from the copyright holder.
                       •   Nothing in this license impairs or restricts the author's moral rights.
                       •   Some Content in the work may be licensed under different terms, this is noted separately.




Monday, May 16, 2011

More Related Content

More from David Wood

Internet of Things (IoT) two-factor authentication using blockchain
Internet of Things (IoT) two-factor authentication using blockchainInternet of Things (IoT) two-factor authentication using blockchain
Internet of Things (IoT) two-factor authentication using blockchainDavid Wood
 
Returning to Online Privacy?
Returning to Online Privacy?Returning to Online Privacy?
Returning to Online Privacy?David Wood
 
Methods for Securing Spacecraft Tasking and Control via an Enterprise Ethereu...
Methods for Securing Spacecraft Tasking and Control via an Enterprise Ethereu...Methods for Securing Spacecraft Tasking and Control via an Enterprise Ethereu...
Methods for Securing Spacecraft Tasking and Control via an Enterprise Ethereu...David Wood
 
BlockSW 2019 Keynote
BlockSW 2019 KeynoteBlockSW 2019 Keynote
BlockSW 2019 KeynoteDavid Wood
 
Returning to Online Privacy - W3C/ANU Future of the Web Roadshow 20190221
Returning to Online Privacy - W3C/ANU Future of the Web Roadshow 20190221Returning to Online Privacy - W3C/ANU Future of the Web Roadshow 20190221
Returning to Online Privacy - W3C/ANU Future of the Web Roadshow 20190221David Wood
 
Privacy in the Smart City
Privacy in the Smart CityPrivacy in the Smart City
Privacy in the Smart CityDavid Wood
 
Controlling Complexities in Software Development
Controlling Complexities in Software DevelopmentControlling Complexities in Software Development
Controlling Complexities in Software DevelopmentDavid Wood
 
Privacy Concerns related to Verifiable Claims
Privacy Concerns related to Verifiable ClaimsPrivacy Concerns related to Verifiable Claims
Privacy Concerns related to Verifiable ClaimsDavid Wood
 
Implementing the Verifiable Claims data model
Implementing the Verifiable Claims data modelImplementing the Verifiable Claims data model
Implementing the Verifiable Claims data modelDavid Wood
 
So You Wanna be a Startup CTO 20170301
So You Wanna be a Startup CTO 20170301So You Wanna be a Startup CTO 20170301
So You Wanna be a Startup CTO 20170301David Wood
 
Functional manipulations of large data graphs 20160601
Functional manipulations of large data graphs 20160601Functional manipulations of large data graphs 20160601
Functional manipulations of large data graphs 20160601David Wood
 
When Metaphors Kill
When Metaphors KillWhen Metaphors Kill
When Metaphors KillDavid Wood
 
Secularism in Australia
Secularism in AustraliaSecularism in Australia
Secularism in AustraliaDavid Wood
 
Meditations on Writing in Paradoxes, Oxymorons, and Pleonasms
Meditations on Writing in Paradoxes, Oxymorons, and PleonasmsMeditations on Writing in Paradoxes, Oxymorons, and Pleonasms
Meditations on Writing in Paradoxes, Oxymorons, and PleonasmsDavid Wood
 
Building a writer's platform with social media
Building a writer's platform with social mediaBuilding a writer's platform with social media
Building a writer's platform with social mediaDavid Wood
 
Summary of the Hero's Journey
Summary of the Hero's JourneySummary of the Hero's Journey
Summary of the Hero's JourneyDavid Wood
 
Open by Default
Open by DefaultOpen by Default
Open by DefaultDavid Wood
 
Lod Then, Now and Next 20110926
Lod Then, Now and Next 20110926Lod Then, Now and Next 20110926
Lod Then, Now and Next 20110926David Wood
 
Linked Data ROI 20110426
Linked Data ROI 20110426Linked Data ROI 20110426
Linked Data ROI 20110426David Wood
 
Introduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF VocabulariesIntroduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF VocabulariesDavid Wood
 

More from David Wood (20)

Internet of Things (IoT) two-factor authentication using blockchain
Internet of Things (IoT) two-factor authentication using blockchainInternet of Things (IoT) two-factor authentication using blockchain
Internet of Things (IoT) two-factor authentication using blockchain
 
Returning to Online Privacy?
Returning to Online Privacy?Returning to Online Privacy?
Returning to Online Privacy?
 
Methods for Securing Spacecraft Tasking and Control via an Enterprise Ethereu...
Methods for Securing Spacecraft Tasking and Control via an Enterprise Ethereu...Methods for Securing Spacecraft Tasking and Control via an Enterprise Ethereu...
Methods for Securing Spacecraft Tasking and Control via an Enterprise Ethereu...
 
BlockSW 2019 Keynote
BlockSW 2019 KeynoteBlockSW 2019 Keynote
BlockSW 2019 Keynote
 
Returning to Online Privacy - W3C/ANU Future of the Web Roadshow 20190221
Returning to Online Privacy - W3C/ANU Future of the Web Roadshow 20190221Returning to Online Privacy - W3C/ANU Future of the Web Roadshow 20190221
Returning to Online Privacy - W3C/ANU Future of the Web Roadshow 20190221
 
Privacy in the Smart City
Privacy in the Smart CityPrivacy in the Smart City
Privacy in the Smart City
 
Controlling Complexities in Software Development
Controlling Complexities in Software DevelopmentControlling Complexities in Software Development
Controlling Complexities in Software Development
 
Privacy Concerns related to Verifiable Claims
Privacy Concerns related to Verifiable ClaimsPrivacy Concerns related to Verifiable Claims
Privacy Concerns related to Verifiable Claims
 
Implementing the Verifiable Claims data model
Implementing the Verifiable Claims data modelImplementing the Verifiable Claims data model
Implementing the Verifiable Claims data model
 
So You Wanna be a Startup CTO 20170301
So You Wanna be a Startup CTO 20170301So You Wanna be a Startup CTO 20170301
So You Wanna be a Startup CTO 20170301
 
Functional manipulations of large data graphs 20160601
Functional manipulations of large data graphs 20160601Functional manipulations of large data graphs 20160601
Functional manipulations of large data graphs 20160601
 
When Metaphors Kill
When Metaphors KillWhen Metaphors Kill
When Metaphors Kill
 
Secularism in Australia
Secularism in AustraliaSecularism in Australia
Secularism in Australia
 
Meditations on Writing in Paradoxes, Oxymorons, and Pleonasms
Meditations on Writing in Paradoxes, Oxymorons, and PleonasmsMeditations on Writing in Paradoxes, Oxymorons, and Pleonasms
Meditations on Writing in Paradoxes, Oxymorons, and Pleonasms
 
Building a writer's platform with social media
Building a writer's platform with social mediaBuilding a writer's platform with social media
Building a writer's platform with social media
 
Summary of the Hero's Journey
Summary of the Hero's JourneySummary of the Hero's Journey
Summary of the Hero's Journey
 
Open by Default
Open by DefaultOpen by Default
Open by Default
 
Lod Then, Now and Next 20110926
Lod Then, Now and Next 20110926Lod Then, Now and Next 20110926
Lod Then, Now and Next 20110926
 
Linked Data ROI 20110426
Linked Data ROI 20110426Linked Data ROI 20110426
Linked Data ROI 20110426
 
Introduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF VocabulariesIntroduction to Linked Data: RDF Vocabularies
Introduction to Linked Data: RDF Vocabularies
 

Recently uploaded

Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxnelietumpap1
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 

Recently uploaded (20)

Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptx
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 

An Introduction to Linked Data: SPARQL Query Language

  • 1. An Introduction to Linked Data Part 4 of 5 David Hyland-Wood SPARQL Query Language University of Mary Washington Monday, May 16, 2011
  • 2. SPARQL: A query language for RDF Monday, May 16, 2011
  • 3. SPARQL • Query Language for RDF http://www.w3.org/TR/rdf-sparql-query • SPARQL Protocol and RDF Query Language • Graph pattern based language written the same as Turtle • Several queries — Ask; Select; Describe; Construct • Read Only still vulnerable to injection, though not as bad as SQL Monday, May 16, 2011
  • 4. Queries • ASK — True or False Simple, Fast • SELECT — Tabular data easy to work with • DESCRIBE — RDF whatever the store has • CONSTRUCT — RDF Whatever you want Monday, May 16, 2011
  • 5. a /discipline/ rdfs:label space:Discipline Space Physics spacephysics foaf:name Sputnik 1 space:discipline dc:description The Sputnik 1 spacecraft was ... space:agency U.S.S.R a /spacecraft/ space:Spacecraft 1957-001B space:mass 86.3 foaf:depiction /images/sputnik.jpg space:spacecraft space:launched 1957-10-04 a space:Launch /launch/1957-001 space:launchvehicle Modified SS-6 (Sapwood) space:launchsite rdfs:label Tyuratam (Baikonur Cosmodrome) a space:Launchsite /launchsite/tyurata space:country U.S.S.R Monday, May 16, 2011
  • 7. Triple Patterns <http://example.com/spacecraft/1957-001B> foaf:name "Sputnik 1" . Monday, May 16, 2011
  • 8. Triple Patterns <http://example.com/spacecraft/1957-001B> foaf:name "Sputnik 1" . ?something foaf:name "Sputnik 1" . Monday, May 16, 2011
  • 9. Triple Patterns <http://example.com/spacecraft/1957-001B> foaf:name "Sputnik 1" . ?something foaf:name "Sputnik 1" . ?something foaf:name ?name . Monday, May 16, 2011
  • 10. Triple Patterns <http://example.com/spacecraft/1957-001B> foaf:name "Sputnik 1" . ?something foaf:name "Sputnik 1" . ?something foaf:name ?name . ASK WHERE { ?something foaf:name "Sputnik 1" . } Monday, May 16, 2011
  • 11. a /discipline/ rdfs:label space:Discipline Space Physics spacephysics foaf:name Sputnik 1 space:discipline dc:description The Sputnik 1 spacecraft was ... space:agency U.S.S.R a /spacecraft/ space:Spacecraft 1957-001B space:mass 86.3 foaf:depiction /images/sputnik.jpg space:spacecraft space:launched 1957-10-04 a space:Launch /launch/1957-001 space:launchvehicle Modified SS-6 (Sapwood) space:launchsite rdfs:label a Tyuratam (Baikonur Cosmodrome) space:Launchsite /launchsite/tyurata space:country U.S.S.R Monday, May 16, 2011
  • 12. Triple Patterns PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> ASK WHERE { ?something rdfs:label ?label . } Monday, May 16, 2011
  • 13. a /discipline/ rdfs:label space:Discipline Space Physics spacephysics foaf:name Sputnik 1 space:discipline dc:description The Sputnik 1 spacecraft was ... space:agency U.S.S.R a /spacecraft/ space:Spacecraft 1957-001B space:mass 86.3 foaf:depiction /images/sputnik.jpg space:spacecraft space:launched 1957-10-04 a space:Launch /launch/1957-001 space:launchvehicle Modified SS-6 (Sapwood) space:launchsite rdfs:label Tyuratam (Baikonur Cosmodrome) a space:Launchsite /launchsite/tyurata space:country U.S.S.R Monday, May 16, 2011
  • 14. a /discipline/ rdfs:label space:Discipline Space Physics spacephysics foaf:name Sputnik 1 space:discipline dc:description The Sputnik 1 spacecraft was ... space:agency U.S.S.R a /spacecraft/ space:Spacecraft 1957-001B space:mass 86.3 foaf:depiction /images/sputnik.jpg space:spacecraft space:launched 1957-10-04 a space:Launch /launch/1957-001 space:launchvehicle Modified SS-6 (Sapwood) space:launchsite rdfs:label Tyuratam (Baikonur Cosmodrome) a space:Launchsite /launchsite/tyurata space:country U.S.S.R Monday, May 16, 2011
  • 15. Triple Patterns PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> ASK WHERE { ?something rdfs:label ?label ; rdf:type space:Discipline . } Monday, May 16, 2011
  • 16. a /discipline/ rdfs:label space:Discipline Space Physics spacephysics foaf:name Sputnik 1 space:discipline dc:description The Sputnik 1 spacecraft was ... space:agency U.S.S.R a /spacecraft/ space:Spacecraft 1957-001B space:mass 86.3 foaf:depiction /images/sputnik.jpg space:spacecraft space:launched 1957-10-04 a space:Launch /launch/1957-001 space:launchvehicle Modified SS-6 (Sapwood) space:launchsite rdfs:label Tyuratam (Baikonur Cosmodrome) a space:Launchsite /launchsite/tyurata space:country U.S.S.R Monday, May 16, 2011
  • 17. a /discipline/ rdfs:label space:Discipline Space Physics spacephysics foaf:name Sputnik 1 space:discipline dc:description The Sputnik 1 spacecraft was ... space:agency U.S.S.R a /spacecraft/ space:Spacecraft 1957-001B space:mass 86.3 foaf:depiction /images/sputnik.jpg space:spacecraft space:launched 1957-10-04 a space:Launch /launch/1957-001 space:launchvehicle Modified SS-6 (Sapwood) space:launchsite rdfs:label Tyuratam (Baikonur Cosmodrome) a space:Launchsite /launchsite/tyurata space:country U.S.S.R Monday, May 16, 2011
  • 18. Triple Patterns PREFIX space: <http://purl.org/net/schemas/space/> PREFIX foaf: <http://xmlns.com/foaf/0.1/> ASK WHERE { ?spacecraft foaf:name “Sputnik 1” . ?launch space:spacecraft ?spacecraft . ?launch space:launched ?launchdate . } Monday, May 16, 2011
  • 19. a /discipline/ rdfs:label space:Discipline Space Physics spacephysics foaf:name Sputnik 1 space:discipline dc:description The Sputnik 1 spacecraft was ... space:agency U.S.S.R a /spacecraft/ space:Spacecraft 1957-001B space:mass 86.3 foaf:depiction /images/sputnik.jpg space:spacecraft space:launched 1957-10-04 a space:Launch /launch/1957-001 space:launchvehicle Modified SS-6 (Sapwood) space:launchsite rdfs:label Tyuratam (Baikonur Cosmodrome) a space:Launchsite /launchsite/tyurata space:country U.S.S.R Monday, May 16, 2011
  • 20. a /discipline/ rdfs:label space:Discipline Space Physics spacephysics foaf:name Sputnik 1 space:discipline dc:description The Sputnik 1 spacecraft was ... space:agency U.S.S.R a /spacecraft/ space:Spacecraft 1957-001B space:mass 86.3 foaf:depiction /images/sputnik.jpg space:spacecraft space:launched 1957-10-04 a space:Launch /launch/1957-001 space:launchvehicle Modified SS-6 (Sapwood) space:launchsite rdfs:label Tyuratam (Baikonur Cosmodrome) a space:Launchsite /launchsite/tyurata space:country U.S.S.R Monday, May 16, 2011
  • 21. a /discipline/ rdfs:label space:Discipline Space Physics spacephysics foaf:name Sputnik 1 space:discipline dc:description The Sputnik 1 spacecraft was ... space:agency U.S.S.R a /spacecraft/ space:Spacecraft 1957-001B space:mass 86.3 foaf:depiction /images/sputnik.jpg space:spacecraft space:launched 1957-10-04 a space:Launch /launch/1957-001 space:launchvehicle Modified SS-6 (Sapwood) space:launchsite rdfs:label Tyuratam (Baikonur Cosmodrome) a space:Launchsite /launchsite/tyurata space:country U.S.S.R Monday, May 16, 2011
  • 22. a /discipline/ rdfs:label space:Discipline Space Physics spacephysics foaf:name Sputnik 1 space:discipline dc:description The Sputnik 1 spacecraft was ... space:agency U.S.S.R a /spacecraft/ space:Spacecraft 1957-001B space:mass 86.3 foaf:depiction /images/sputnik.jpg space:spacecraft space:launched 1957-10-04 a space:Launch /launch/1957-001 space:launchvehicle Modified SS-6 (Sapwood) space:launchsite rdfs:label Tyuratam (Baikonur Cosmodrome) a space:Launchsite /launchsite/tyurata space:country U.S.S.R Monday, May 16, 2011
  • 23. Example SELECT PREFIX space: <http://purl.org/net/schemas/space/> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT ?subject ?label WHERE { ?subject rdfs:label ?label ; a space:Discipline . } Monday, May 16, 2011
  • 24. Example SELECT <sparql xmlns="http://www.w3.org/2005/sparql-results#"> <head> <variable name="subject"/> <variable name="label"/> </head> <results> <result> <binding name="subject"> <uri>http://nasa.dataincubator.org/discipline/astronomy</ uri> </binding> <binding name="label"> <literal>Astronomy</literal> </binding> </result> <result> <binding name="subject"> <uri>http://nasa.dataincubator.org/discipline/ communications</uri> </binding> <binding name="label"> <literal>Communications</literal> </binding> </result> Monday, May 16, 2011
  • 25. Example SELECT PREFIX space: <http://purl.org/net/schemas/space/> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT * WHERE { ?subject rdfs:label ?label ; a space:Discipline . } Monday, May 16, 2011
  • 26. a /discipline/ rdfs:label space:Discipline Space Physics spacephysics foaf:name Sputnik 1 space:discipline dc:description The Sputnik 1 spacecraft was ... space:agency U.S.S.R a /spacecraft/ space:Spacecraft 1957-001B space:mass 86.3 foaf:depiction /images/sputnik.jpg space:spacecraft space:launched 1957-10-04 a space:Launch /launch/1957-001 space:launchvehicle Modified SS-6 (Sapwood) space:launchsite rdfs:label Tyuratam (Baikonur Cosmodrome) a space:Launchsite /launchsite/tyurata space:country U.S.S.R Monday, May 16, 2011
  • 27. Example SELECT DISTINCT PREFIX space: <http://purl.org/net/schemas/space/> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT DISTINCT ?date WHERE { ?launch space:launched ?date . } Monday, May 16, 2011
  • 28. a /discipline/ rdfs:label space:Discipline Space Physics spacephysics foaf:name Sputnik 1 space:discipline dc:description The Sputnik 1 spacecraft was ... space:agency U.S.S.R a /spacecraft/ space:Spacecraft 1957-001B space:mass 86.3 foaf:depiction /images/sputnik.jpg space:spacecraft space:launched 1957-10-04 a space:Launch /launch/1957-001 space:launchvehicle Modified SS-6 (Sapwood) space:launchsite rdfs:label Tyuratam (Baikonur Cosmodrome) a space:Launchsite /launchsite/tyurata space:country U.S.S.R Monday, May 16, 2011
  • 29. Example OPTIONAL PREFIX space: <http://purl.org/net/schemas/space/> PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?name ?image WHERE { ?spacecraft foaf:name ?name . OPTIONAL { ?spacecraft foaf:depiction ?image . } } Monday, May 16, 2011
  • 30. Example OPTIONAL <?xml version="1.0"?> <sparql xmlns="http://www.w3.org/2005/sparql-results#"> <head> <variable name="name"/> <variable name="image"/> </head> <results> <result> <binding name="name"> <literal>Soyuz 2</literal> </binding> </result> <result> <binding name="name"> <literal>Apollo 10</literal> </binding> <binding name="image"> <uri>http://nssdc.gsfc.nasa.gov/image/spacecraft/ apollo_10_cm.jpg</uri> </binding> </result> Monday, May 16, 2011
  • 31. Example UNION PREFIX space: <http://purl.org/net/schemas/space/> PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT ?subject ?displayLabel WHERE { { ?subject foaf:name ?displayLabel . } UNION { ?subject rdfs:label ?displayLabel . } } Monday, May 16, 2011
  • 32. Example UNION <?xml version="1.0"?> <sparql xmlns="http://www.w3.org/2005/sparql-results#"> <head> <variable name="subject"/> <variable name="displayLabel"/> </head> <results> <result> <binding name="subject"> <uri>http://nasa.dataincubator.org/spacecraft/ATLAS2</uri> </binding> <binding name="displayLabel"> <literal>Atlas 2</literal> </binding> </result> <result> <binding name="subject"> <uri>http://nasa.dataincubator.org/spacecraft/ATLAS3</uri> </binding> <binding name="displayLabel"> <literal>Atlas 3</literal> </binding> </result> Monday, May 16, 2011
  • 33. Example ORDER BY PREFIX space: <http://purl.org/net/schemas/space/> PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT ?name ?launchdate WHERE { ?spacecraft foaf:name ?name . ?launch space:spacecraft ?spacecraft . ?launch space:launched ?launchdate . } Monday, May 16, 2011
  • 34. Example ORDER BY PREFIX space: <http://purl.org/net/schemas/space/> PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT ?name ?launchdate WHERE { ?spacecraft foaf:name ?name . ?launch space:spacecraft ?spacecraft . ?launch space:launched ?launchdate . } ORDER BY DESC(?launchdate) Monday, May 16, 2011
  • 35. Example ORDER BY PREFIX space: <http://purl.org/net/schemas/space/> PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT ?name ?launchdate WHERE { ?spacecraft foaf:name ?name . ?launch space:spacecraft ?spacecraft . ?launch space:launched ?launchdate . } ORDER BY DESC(?launchdate) LIMIT 10 Monday, May 16, 2011
  • 36. Example ORDER BY PREFIX space: <http://purl.org/net/schemas/space/> PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT ?name ?launchdate WHERE { ?spacecraft foaf:name ?name . ?launch space:spacecraft ?spacecraft . ?launch space:launched ?launchdate . } ORDER BY DESC(?launchdate) LIMIT 10 OFFSET 10 Monday, May 16, 2011
  • 37. Example FILTER PREFIX space: <http://purl.org/net/schemas/space/> PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> SELECT ?name WHERE { ?launch space:launched ?date ; space:spacecraft ?spacecraft . ?spacecraft foaf:name ?name . FILTER ( ?date >= "1969-01-01"^^xsd:date && ?date <= "1969-12-31"^^xsd:date ) } Monday, May 16, 2011
  • 38. Example FILTER PREFIX space: <http://purl.org/net/schemas/space/> PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> SELECT ?spacecraft ?name WHERE { ?spacecraft foaf:name ?name ; space:mass ?mass . FILTER( xsd:double(?mass) < 90.0 ) } Monday, May 16, 2011
  • 39. Example FILTER PREFIX space: <http://purl.org/net/schemas/space/> PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> SELECT ?name WHERE { ?spacecraft foaf:name ?name . FILTER( regex(?name, “ollo”, “i” ) ) } Monday, May 16, 2011
  • 40. Built-in Filters • Logical (!, &&, ||) • Math (+, -, *, /) • Comparison (=, !=, >, <, ...) • Tests isURI, isBlank, isLiteral, bound, sameTerm, langMatches, regex • Accessors str, lang, datatype Monday, May 16, 2011
  • 41. Example NOT PREFIX space: <http://purl.org/net/schemas/space/> PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?s WHERE { ?s a space:Spacecraft . OPTIONAL { ?s foaf:depiction ?image . } FILTER ( !bound(?image) ) } Monday, May 16, 2011
  • 42. Queries • ASK — True or False Simple, Fast • SELECT — Tabular data easy to work with • DESCRIBE — RDF whatever the store has • CONSTRUCT — RDF Whatever you want Monday, May 16, 2011
  • 43. Example DESCRIBE DESCRIBE <http://example.com/launch/1969-059> Monday, May 16, 2011
  • 44. Example DESCRIBE <rdf:RDF xmlns:space="http://purl.org/net/schemas/space/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" > <rdf:Description rdf:about="http://nasa.dataincubator.org/launch/1969-059"> <space:spacecraft rdf:resource="http://nasa.dataincubator.org/spacecraft/1969-059C"/> <space:spacecraft rdf:resource="http://nasa.dataincubator.org/spacecraft/1969-059B"/> <space:spacecraft rdf:resource="http://nasa.dataincubator.org/spacecraft/1969-059A"/> <space:launchvehicle>Saturn 5</space:launchvehicle> <space:launchsite rdf:resource="http://nasa.dataincubator.org/launchsite/capecana..."/> <space:launched rdf:datatype="http://www.w3.org/2001/XMLSchema#date"> 1969-07-16 </space:launched> <rdf:type rdf:resource="http://purl.org/net/schemas/space/Launch"/> </rdf:Description> </rdf:RDF> Monday, May 16, 2011
  • 45. Example DESCRIBE PREFIX space: <http://purl.org/net/schemas/space/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> DESCRIBE ?spacecraft WHERE { ?launch space:launched "1969-07-16"^^xsd:date . ?spacecraft space:launch ?launch . } Monday, May 16, 2011
  • 46. Example DESCRIBE <rdf:RDF xmlns:space="http://purl.org/net/schemas/space/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" > <rdf:Description rdf:about="http://nasa.dataincubator.org/spacecraft/1969-059B"> <foaf:homepage rdf:resource="http://nssdc.gsfc.nasa.gov/database/MasterCatalog? sc=1969-059B"/> <dc:description>The...</dc:description> <space:mission rdf:resource="http://nasa.dataincubator.org/mission/apollo-11"/> <space:agency>United States</space:agency> <rdf:type rdf:resource="http://purl.org/net/schemas/space/Spacecraft"/> <space:launch rdf:resource="http://nasa.dataincubator.org/launch/1969-059"/> <space:discipline rdf:resource="http://nasa.dataincubator.org/discipline/ planetaryscience"/> <space:alternateName>04040</space:alternateName> <space:alternateName>Apollo 11 Saturn V third stage</space:alternateName> <foaf:name>Apollo 11 SIVB</foaf:name> <space:internationalDesignator>1969-059B</space:internationalDesignator> <space:mass>13300.0</space:mass> </rdf:Description> ... Monday, May 16, 2011
  • 47. Example DESCRIBE PREFIX space: <http://purl.org/net/schemas/space/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> DESCRIBE ?spacecraft ?launch WHERE { ?launch space:launched "1969-07-16"^^xsd:date . ?spacecraft space:launch ?launch . } Monday, May 16, 2011
  • 48. Example CONSTRUCT PREFIX space: <http://purl.org/net/schemas/space/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX foaf: <http://xmlns.com/foaf/0.1/> CONSTRUCT { ?spacecraft foaf:name ?name ; space:agency ?agency ; space:launched ?launchdate . } WHERE { ?spacecraft foaf:name ?name ; space:agency ?agency . ?launch space:spacecraft ?spacecraft . ?launch space:launched ?launchdate . } Monday, May 16, 2011
  • 49. a /discipline/ rdfs:label space:Discipline Space Physics spacephysics foaf:name Sputnik 1 space:discipline dc:description The Sputnik 1 spacecraft was ... space:agency U.S.S.R a /spacecraft/ space:Spacecraft 1957-001B space:mass 86.3 foaf:depiction /images/sputnik.jpg space:spacecraft space:launched 1957-10-04 a space:Launch /launch/1957-001 space:launchvehicle Modified SS-6 (Sapwood) space:launchsite rdfs:label Tyuratam (Baikonur Cosmodrome) a space:Launchsite /launchsite/tyurata space:country U.S.S.R Monday, May 16, 2011
  • 50. a /discipline/ rdfs:label space:Discipline Space Physics spacephysics foaf:name space:discipline Sputnik 1 dc:description The Sputnik 1 spacecraft was ... space:agency U.S.S.R a /spacecraft/ space:Spacecraft 1957-001B space:mass 86.3 foaf:depiction /images/sputnik.jpg space:spacecraft space:launched 1957-10-04 a space:Launch /launch/1957-001 space:launchvehicle Modified SS-6 (Sapwood) space:launchsite rdfs:label Tyuratam (Baikonur Cosmodrome) a space:Launchsite /launchsite/tyurata space:country U.S.S.R Monday, May 16, 2011
  • 51. a /discipline/ rdfs:label space:Discipline Space Physics spacephysics foaf:name Sputnik 1 space:discipline dc:description The Sputnik 1 spacecraft was ... space:agency U.S.S.R a /spacecraft/ space:Spacecraft 1957-001B space:mass 86.3 foaf:depiction /images/sputnik.jpg space:spacecraft space:launched space:launched 1957-10-04 a space:Launch /launch/1957-001 space:launchvehicle Modified SS-6 (Sapwood) space:launchsite rdfs:label a Tyuratam (Baikonur Cosmodrome) space:Launchsite /launchsite/tyurata space:country U.S.S.R Monday, May 16, 2011
  • 52. Common Problems • Typos wrong case for property or class name • wrong prefix URI missing # or / or the URI for the web page • Missing OPTIONAL you won't even notice... • Comparing Literals Literals are compared on all of value, type and language Monday, May 16, 2011
  • 53. Tip 1: Find all the Properties SELECT DISTINCT ?p WHERE { ?s ?p ?o . } Monday, May 16, 2011
  • 54. a /discipline/ rdfs:label space:Discipline Space Physics spacephysics foaf:name Sputnik 1 space:discipline dc:description The Sputnik 1 spacecraft was ... space:agency U.S.S.R a /spacecraft/ space:Spacecraft 1957-001B space:mass 86.3 foaf:depiction /images/sputnik.jpg space:spacecraft space:launched 1957-10-04 a space:Launch /launch/1957-001 space:launchvehicle Modified SS-6 (Sapwood) space:launchsite rdfs:label a Tyuratam (Baikonur Cosmodrome) space:Launchsite /launchsite/tyurata space:country U.S.S.R Monday, May 16, 2011
  • 55. a rdfs:label /discipline/ space:Discipline Space Physics spacephysics foaf:name Sputnik 1 space:discipline dc:description The Sputnik 1 spacecraft was ... space:agency U.S.S.R a /spacecraft/ space:Spacecraft 1957-001B space:mass 86.3 foaf:depiction /images/sputnik.jpg space:spacecraft space:launched a 1957-10-04 space:Launch /launch/1957-001 space:launchvehicle Modified SS-6 (Sapwood) space:launchsite rdfs:label a Tyuratam (Baikonur Cosmodrome) space:Launchsite /launchsite/tyurata space:country U.S.S.R Monday, May 16, 2011
  • 56. Tip 2: Find all the Classes SELECT DISTINCT ?type WHERE { ?s a ?type . } Monday, May 16, 2011
  • 57. a /discipline/ rdfs:label space:Discipline Space Physics spacephysics foaf:name Sputnik 1 space:discipline dc:description The Sputnik 1 spacecraft was ... space:agency U.S.S.R a /spacecraft/ space:Spacecraft 1957-001B space:mass 86.3 foaf:depiction /images/sputnik.jpg space:spacecraft space:launched 1957-10-04 a space:Launch /launch/1957-001 space:launchvehicle Modified SS-6 (Sapwood) space:launchsite rdfs:label a Tyuratam (Baikonur Cosmodrome) space:Launchsite /launchsite/tyurata space:country U.S.S.R Monday, May 16, 2011
  • 58. a /discipline/ rdfs:label space:Discipline Space Physics spacephysics foaf:name Sputnik 1 space:discipline dc:description The Sputnik 1 spacecraft was ... space:agency U.S.S.R a /spacecraft/ space:Spacecraft 1957-001B space:mass 86.3 foaf:depiction /images/sputnik.jpg space:spacecraft space:launched 1957-10-04 a space:Launch /launch/1957-001 space:launchvehicle Modified SS-6 (Sapwood) space:launchsite rdfs:label a Tyuratam (Baikonur Cosmodrome) space:Launchsite /launchsite/tyurata space:country U.S.S.R Monday, May 16, 2011
  • 59. Thanks to • Rob Styles, Talis Group Ltd for his CC-BY licensed “Two Day Introduction to the Web of Data” slides and spacecraft example data. Monday, May 16, 2011
  • 60. This work is Copyright © 2010 David Hyland-Wood Based partially on CC-BY licensed content Copyright © 2010 Talis Systems Limited by Rob Styles. It is licensed under the Creative Commons Attribution 3.0 Unported License. Full details at: http://creativecommons.org/licenses/by/3.0/ You are free: to Share — to copy, distribute and transmit the work to Remix — to adapt the work Under the following conditions: Attribution. You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work). • For any reuse or distribution, you must make clear to others the license terms of this work. • Any of the above conditions can be waived if you get permission from the copyright holder. • Nothing in this license impairs or restricts the author's moral rights. • Some Content in the work may be licensed under different terms, this is noted separately. Monday, May 16, 2011