SlideShare a Scribd company logo
3. SPARQL Query Language Reference

SPARQL RDF Query Language Reference v1.8                                                            Based on SPARQL Query Language 23 November 2005
                                                                                                    <http://www.w3.org/TR/2005/WD-rdf-sparql-query-20051123/>.
Copyright © 2005, 2006 Dave Beckett.
Latest version: <http://www.dajobe.org/2005/04-sparql/>                                             RDF Term:                 A part of an RDF Triple. An IRI, Blank Node or a Literal.
                                                                                                                              <uri> _:b1 “Literal”@en “abc123”^^my:datatype
Comments to: dave@dajobe.org
                                                                                                    Query Variable:           Identifiers for binding to RDF Terms in matches.
                                                                                                                              ?a / $b or in lists: $name $title $place
1. RDF Model and SPARQL RDF Terms Syntax                                                            Anonymous                 Blank Nodes in a graph pattern act as variables that cannot be SELECTed
                                                                                                    Query Variable:           _:abc
                                                                                                    Triple Pattern:           An RDF Triple with Query Variables or blank nodes allowed in each term:
RDF Graph:                   A set of RDF Triples                                                                             <http://example.org/abc> ?x “Hello”
                                                                                                                              ?subject ?predicate ?object
RDF Triple:                  A triple (3-tuple) of:
                                                                                                                              Turtle abbreviations can be used for Triple Patterns, see Section 4.
                                                                                                    Graph Pattern:            A block that matches part of the queried RDF graph.
         Subject:            IRI
                                                                                                           Basic              A set of Triple Patterns binding RDF Terms in the graph to variables.
                             or Blank Node
                                                                                                           Graph Pattern:     Written as a {..} block with '.' separating the triple patterns:
                                                                                                                              { <http://example.org/abc> ?y “Hello” .
         Predicate:          IRI                                                                                                ?subject $predicate “Literal” }
                                                                                                            Group             A graph pattern containing multiple graph patterns which must all match
         Object:             IRI or Blank Node                                                              Graph Pattern:    { { ?person rdf:type foaf:Person }
                             or Literal                                                                                          { ?person foaf:name “Dave” } }
                                                                                                            Optional          A graph pattern which may fail to match and provide bindings but not
                                                                                                            Graph Pattern:    cause the entire query to fail. Written with OPTIONAL before a graph
URI:                An absolute IRI which may include a # fragment.                                                           pattern.
                    <http://www.w3.org/>                                                                                      OPTIONAL { ?person foaf:nick ?nick }
                    <http://example.org/#fragment>                                                          Union             A pair of graph patterns any of which may match and bind the same
                    <abc.rdf>         Relative IRI resolved against base IRI.                               Graph Pattern:    variables. Written with the UNION keyword between two graph patterns.
                    <>                Base IRI, usually the query document IRI                                                { ?node ex:name ?name } UNION
                    ex:name           IRI shorthand using XML-style prefix ex and local name.                                 { ?node vcard:FN ?name }
                                      Declared with PREFIX (SPARQL) or @prefix (Turtle)                     Graph             A keyword for specifying a graph name to use or to return a graph name
                                                                                                            Graph Pattern:    as a binding. Written with the GRAPH keyword before a graph pattern.
RDF Literal:        A Unicode string with an optional language tag.                                                           GRAPH <http://example.org/myfoaf>
                    “hello”           “bonjour”@fr                                                                               { ?person foaf:name ?name }
                                                                                                                              GRAPH ?graph { ?person foaf:name ?name }
RDF Typed           A Unicode string and datatype IRI for encoding datatypes.                       Value Constraints:        A boolean expression in a graph pattern over query variables that
Literal:            “abc”^^<http://example.org/myDatatype>                                                                    constrains matched graph patterns.
                    abbreviated with an XML QName style as:                                                                   { ?item ex:size $size . FILTER ($size < 10 ) }
                    “10”^^xsd:integer
                    Short forms for several common datatypes:                                       4. SPARQL Query Language Structure
                    -10                         “-10”^^xsd:integer
                    1.2345                      “1.2345”^^xsd:decimal                               Prologue (optional)                        BASE <iri>
                    true                        “true”^^xsd:boolean                                                                            PREFIX prefix: <iri> (repeatable)
                                                                                                    Query Result forms (required, pick 1)      SELECT (DISTINCT)sequence of ?variable
Blank Node:         A node in a graph with a local name. The scope of the name is the RDF graph.
                                                                                                                                               SELECT (DISTINCT)*
                    _:node
                                                                                                                                               DESCRIBE sequence of ?variable or <iri>
                                                                                                                                               DESCRIBE *
2. Common RDF Namespaces and Prefixes                                                                                                          CONSTRUCT { graph pattern }
                                                                                                                                               ASK
Namespace                   Common Prefix             Namespace URI
RDF                         rdf:                      http://www.w3.org/1999/02/22-rdf-syntax-ns#   Query Dataset Sources (optional)           Add triples to the background graph (repeatable):
Dublin Core                 dc:                       http://purl.org/dc/elements/1.1/                                                         FROM <iri>
FOAF                        foaf:                     http://xmlns.com/foaf/0.1/                                                               Add a named graph (repeatable):
XML Schema Datatypes        xsd:                      http://www.w3.org/2001/XMLSchema#                                                        FROM NAMED <iri>
RDFS                        rdfs:                     http://www.w3.org/2000/01/rdf-schema#         Graph Pattern (optional, required for ASK) WHERE { graph pattern [ FILTER expression ]}
OWL                         owl:                      http://www.w3.org/2002/07/owl#                Query Results Ordering (optional)          ORDER BY ...
                                                                                                    Query Results Selection (optional)         LIMIT n, OFFSET m
5. SPARQL Query Result Forms                                                                       8. Turtle RDF Syntax Reference (Turtle 2006-01-2121 <http://www.dajobe.org/2004/01/turtle/>)
Variable Bindings:        A sequence of (set of variable bindings) for each query pattern match.   Turtle (Terse RDF Triple Language) describes triples in an RDF graph and allows abbreviations.
                          SELECT *                                                                 Triple Patterns in SPARQL can use the same abbreviations.
                          WHERE { $a rdf:type $b }
                          to ask for bindings for all variables mentioned in the query and         RDF Terms:
                          SELECT $a ?b                                                                    IRI                    < IRI >            (<> is the base IRI, often the document IRI)
                          WHERE { $a rdf:type ?b }                                                        Literal:               ”string” or ”string”@language or ^^< datatype IRI >
                          to list them explicitly                                                         Blank Node:            _: name or [] for an anonymous blank node
RDF Graph:
        Describe          An RDF graph describing resources either given by URI                    @prefix operator: IRIs can be written as XML-style QNames by defining a prefix / IRI binding:
        Resources:        DESCRIBE <http://example.org/thing>                                             @prefix dc: <http://purl.org/dc/elements/1.1/> .
                          or by binding variables using the same syntax as SELECT.
                          DESCRIBE ?person                                                         Triples: 3 RDF terms with whitespace separating them as necessary, and '.' between triples:
                          WHERE { ?person foaf:name “Dave” }                                                 <> dc:title "SPARQL Reference" .
           Build an       An RDF graph made by substituting variables into a triple template.                <> dc:date “2006-02-06”^^xsd:dateTime .
           RDF graph      CONSTRUCT { ?a foaf:knows ?b }
                                                                                                   , operator: Triples with the same subject and predicate may be abbreviated with ',':
                          WHERE { ?a ex:KnowsQuiteWell ?b }
Boolean:                  True if the query pattern could be answered.                                      <http://example.org/book> dc:title “My Book”, “Mein Buch”@de .
                          ASK                                                                      ; operator: Triples with the same subject may be abbreviated with ';':
                          WHERE { ?a rdf:type foaf:Person }                                                 <http://work.example.org/> dc:title “My Workplace”;
                                                                                                                                                    dc:publisher “My Employer” .
6. Query Results Ordering and Modifying
                                                                                                   [ ... ] operator: A sequence of (predicate object) pairs may be put inside [ ... ] and a blank node
The optional modifications on query results are performed in the following order:                  subject will be assigned to them:
1. DISTINCT to ensure solutions in the sequence are unique                                                   <> dc:creator [ foaf:name “Dave”; foaf:homePage <http:...> ] .
1. ORDER BY ordering solutions sequences by variable, expression or extension function call:       [] operator: A blank node:
   ORDER BY DESC(?date) ?title ASC(?familyName) my:fn(?a)                                                    [] a ex:Book [ dc:title “Thing”; dc:description “On shelf” ] .
   in descending order by date, by ascending title order, by familyName ascending, by extension    a predicate: The common rdf:type QName may be abbreviated by the keyword a as a predicate:
   function                                                                                                  <> a Foaf:Document .
2. LIMIT n to restrict the number of solutions to n
3. OFFSET m to start the results in the solution from item m                                       Decimal integers: Positive or negative decimal integers can be written as (type xsd:integer)
                                                                                                            <> ex:sizeInBytes 12345 .
7. Values – datatypes, expressions and operators                                                   Decimal numbers: Positive or negative decimal numbers can be written as (type xsd:decimal)
                                                                                                           <> ex:shoeSize 8.5 .
Supported datatypes: RDF Terms, xsd:boolean, xsd:string, xsd:double,
xsd:float, xsd:decimal, xsd:integer and xsd:dateTime                                               ( ... ) collections: RDF collections can be written inside ( ... ) as space-separated lists of contents:
                                                                                                             <> ex:contents ( ex:apple ex:banana ex:pear ) .
Logical operators:      Logical:             A|| B, A && B, !A, (A)
                        Comparison (A op B): =, !=, <, >, <=, >=                                   9. Example SPARQL Query
Arithmetic operators: Unary:                  +A, -A                                                    BASE <http://example.org/>
                        Binary (A op B):      +, -, *, /                                                PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
RDF operators:          Boolean:             BOUND(A), isIRI(A) / isURI(A),                             PREFIX foaf: <http://xmlns.com/foaf/0.1/>
                                             isBlank(A), isLiteral(A)                                   # This is a relative IRI to BASE above
                        String:              STR(A), LANG(A), DATATYPE(A)                               PREFIX ex: <properties/1.0#>
String Match operator:                       REGEX(string expression, pattern expression
                                                         [,flags expression] )                          SELECT DISTINCT $person ?name $age
                                             pattern syntax is from XQuery 1.0 / XPath 2.0,             FROM <http://rdf.example.org/personA.rdf>
                                                                                                        FROM <http://rdf.example.org/personB.rdf>
                                             XML Schema, similar to Perl. flags are s, m, i, x          WHERE { $person a foaf:Person ;
Extension Functions and                      QName( expression, expression, ...)                                         foaf:name ?name.
Explicit Type Casting:                                                                                           OPTIONAL { $person ex:age $age } .
Automatic Type          from xsd:decimal to xsd:float                                                            FILTER (!REGEX(?name, “Bob”))
Promotion:              from xsd:float       to xsd:double                                                     }
                                                                                                        ORDER BY ASC(?name) LIMIT 10 OFFSET 20

More Related Content

PDF
A First Analysis of String APIs: the Case of Pharo
ZIP
The design, architecture, and tradeoffs of FluidDB
PDF
Regular expressions
PDF
Boogie 2011 Hi-Lite
PDF
RDF Analytics... SPARQL and Beyond
PDF
Introdution to Landsat and Google Earth Engine
PPTX
Data Visualization in R
A First Analysis of String APIs: the Case of Pharo
The design, architecture, and tradeoffs of FluidDB
Regular expressions
Boogie 2011 Hi-Lite
RDF Analytics... SPARQL and Beyond
Introdution to Landsat and Google Earth Engine
Data Visualization in R

Viewers also liked (6)

PPTX
R programming Language , Rahul Singh
PDF
Performance data visualization with r and tableau
PPTX
A Few Interesting Things in Apple's Swift Programming Language
PDF
Querying Linked Data with SPARQL
PDF
Introduction to Swift programming language.
PDF
Class ppt intro to r
R programming Language , Rahul Singh
Performance data visualization with r and tableau
A Few Interesting Things in Apple's Swift Programming Language
Querying Linked Data with SPARQL
Introduction to Swift programming language.
Class ppt intro to r
Ad

Similar to Sparq lreference 1.8-us (20)

PPTX
Semantic web meetup – sparql tutorial
PDF
RDF and Java
PPT
RDF briefing
PPT
BLOGIC. (ISWC 2009 Invited Talk)
PPTX
SPIN in Five Slides
PDF
A Hands On Overview Of The Semantic Web
PPT
LarKC Tutorial at ISWC 2009 - Data Model
PPT
Semantic web
PPTX
SWT Lecture Session 3 - SPARQL
PDF
Transforming Your Data with GraphDB: GraphDB Fundamentals, Jan 2018
PPTX
SWT Lecture Session 2 - RDF
PPT
Rdf And Rdf Schema For Ontology Specification
PPTX
Semantic web for ontology chapter4 bynk
PPTX
Sparql
PDF
XML Bible
PPTX
Triplestore and SPARQL
PPT
PPT
SPARQL Query Forms
PPTX
Jena Programming
PPTX
Introduction to RDF Data Model
Semantic web meetup – sparql tutorial
RDF and Java
RDF briefing
BLOGIC. (ISWC 2009 Invited Talk)
SPIN in Five Slides
A Hands On Overview Of The Semantic Web
LarKC Tutorial at ISWC 2009 - Data Model
Semantic web
SWT Lecture Session 3 - SPARQL
Transforming Your Data with GraphDB: GraphDB Fundamentals, Jan 2018
SWT Lecture Session 2 - RDF
Rdf And Rdf Schema For Ontology Specification
Semantic web for ontology chapter4 bynk
Sparql
XML Bible
Triplestore and SPARQL
SPARQL Query Forms
Jena Programming
Introduction to RDF Data Model
Ad

More from Ajay Ohri (20)

PDF
Introduction to R ajay Ohri
PPTX
Introduction to R
PDF
Social Media and Fake News in the 2016 Election
PDF
Pyspark
PDF
Download Python for R Users pdf for free
PDF
Install spark on_windows10
DOCX
Ajay ohri Resume
PDF
Statistics for data scientists
PPTX
National seminar on emergence of internet of things (io t) trends and challe...
PDF
Tools and techniques for data science
PPTX
How Big Data ,Cloud Computing ,Data Science can help business
PDF
Training in Analytics and Data Science
PDF
Tradecraft
PDF
Software Testing for Data Scientists
PDF
Craps
PDF
A Data Science Tutorial in Python
PDF
How does cryptography work? by Jeroen Ooms
PDF
Using R for Social Media and Sports Analytics
PDF
Kush stats alpha
PPTX
Analyze this
Introduction to R ajay Ohri
Introduction to R
Social Media and Fake News in the 2016 Election
Pyspark
Download Python for R Users pdf for free
Install spark on_windows10
Ajay ohri Resume
Statistics for data scientists
National seminar on emergence of internet of things (io t) trends and challe...
Tools and techniques for data science
How Big Data ,Cloud Computing ,Data Science can help business
Training in Analytics and Data Science
Tradecraft
Software Testing for Data Scientists
Craps
A Data Science Tutorial in Python
How does cryptography work? by Jeroen Ooms
Using R for Social Media and Sports Analytics
Kush stats alpha
Analyze this

Sparq lreference 1.8-us

  • 1. 3. SPARQL Query Language Reference SPARQL RDF Query Language Reference v1.8 Based on SPARQL Query Language 23 November 2005 <http://www.w3.org/TR/2005/WD-rdf-sparql-query-20051123/>. Copyright © 2005, 2006 Dave Beckett. Latest version: <http://www.dajobe.org/2005/04-sparql/> RDF Term: A part of an RDF Triple. An IRI, Blank Node or a Literal. <uri> _:b1 “Literal”@en “abc123”^^my:datatype Comments to: dave@dajobe.org Query Variable: Identifiers for binding to RDF Terms in matches. ?a / $b or in lists: $name $title $place 1. RDF Model and SPARQL RDF Terms Syntax Anonymous Blank Nodes in a graph pattern act as variables that cannot be SELECTed Query Variable: _:abc Triple Pattern: An RDF Triple with Query Variables or blank nodes allowed in each term: RDF Graph: A set of RDF Triples <http://example.org/abc> ?x “Hello” ?subject ?predicate ?object RDF Triple: A triple (3-tuple) of: Turtle abbreviations can be used for Triple Patterns, see Section 4. Graph Pattern: A block that matches part of the queried RDF graph. Subject: IRI Basic A set of Triple Patterns binding RDF Terms in the graph to variables. or Blank Node Graph Pattern: Written as a {..} block with '.' separating the triple patterns: { <http://example.org/abc> ?y “Hello” . Predicate: IRI ?subject $predicate “Literal” } Group A graph pattern containing multiple graph patterns which must all match Object: IRI or Blank Node Graph Pattern: { { ?person rdf:type foaf:Person } or Literal { ?person foaf:name “Dave” } } Optional A graph pattern which may fail to match and provide bindings but not Graph Pattern: cause the entire query to fail. Written with OPTIONAL before a graph URI: An absolute IRI which may include a # fragment. pattern. <http://www.w3.org/> OPTIONAL { ?person foaf:nick ?nick } <http://example.org/#fragment> Union A pair of graph patterns any of which may match and bind the same <abc.rdf> Relative IRI resolved against base IRI. Graph Pattern: variables. Written with the UNION keyword between two graph patterns. <> Base IRI, usually the query document IRI { ?node ex:name ?name } UNION ex:name IRI shorthand using XML-style prefix ex and local name. { ?node vcard:FN ?name } Declared with PREFIX (SPARQL) or @prefix (Turtle) Graph A keyword for specifying a graph name to use or to return a graph name Graph Pattern: as a binding. Written with the GRAPH keyword before a graph pattern. RDF Literal: A Unicode string with an optional language tag. GRAPH <http://example.org/myfoaf> “hello” “bonjour”@fr { ?person foaf:name ?name } GRAPH ?graph { ?person foaf:name ?name } RDF Typed A Unicode string and datatype IRI for encoding datatypes. Value Constraints: A boolean expression in a graph pattern over query variables that Literal: “abc”^^<http://example.org/myDatatype> constrains matched graph patterns. abbreviated with an XML QName style as: { ?item ex:size $size . FILTER ($size < 10 ) } “10”^^xsd:integer Short forms for several common datatypes: 4. SPARQL Query Language Structure -10 “-10”^^xsd:integer 1.2345 “1.2345”^^xsd:decimal Prologue (optional) BASE <iri> true “true”^^xsd:boolean PREFIX prefix: <iri> (repeatable) Query Result forms (required, pick 1) SELECT (DISTINCT)sequence of ?variable Blank Node: A node in a graph with a local name. The scope of the name is the RDF graph. SELECT (DISTINCT)* _:node DESCRIBE sequence of ?variable or <iri> DESCRIBE * 2. Common RDF Namespaces and Prefixes CONSTRUCT { graph pattern } ASK Namespace Common Prefix Namespace URI RDF rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns# Query Dataset Sources (optional) Add triples to the background graph (repeatable): Dublin Core dc: http://purl.org/dc/elements/1.1/ FROM <iri> FOAF foaf: http://xmlns.com/foaf/0.1/ Add a named graph (repeatable): XML Schema Datatypes xsd: http://www.w3.org/2001/XMLSchema# FROM NAMED <iri> RDFS rdfs: http://www.w3.org/2000/01/rdf-schema# Graph Pattern (optional, required for ASK) WHERE { graph pattern [ FILTER expression ]} OWL owl: http://www.w3.org/2002/07/owl# Query Results Ordering (optional) ORDER BY ... Query Results Selection (optional) LIMIT n, OFFSET m
  • 2. 5. SPARQL Query Result Forms 8. Turtle RDF Syntax Reference (Turtle 2006-01-2121 <http://www.dajobe.org/2004/01/turtle/>) Variable Bindings: A sequence of (set of variable bindings) for each query pattern match. Turtle (Terse RDF Triple Language) describes triples in an RDF graph and allows abbreviations. SELECT * Triple Patterns in SPARQL can use the same abbreviations. WHERE { $a rdf:type $b } to ask for bindings for all variables mentioned in the query and RDF Terms: SELECT $a ?b IRI < IRI > (<> is the base IRI, often the document IRI) WHERE { $a rdf:type ?b } Literal: ”string” or ”string”@language or ^^< datatype IRI > to list them explicitly Blank Node: _: name or [] for an anonymous blank node RDF Graph: Describe An RDF graph describing resources either given by URI @prefix operator: IRIs can be written as XML-style QNames by defining a prefix / IRI binding: Resources: DESCRIBE <http://example.org/thing> @prefix dc: <http://purl.org/dc/elements/1.1/> . or by binding variables using the same syntax as SELECT. DESCRIBE ?person Triples: 3 RDF terms with whitespace separating them as necessary, and '.' between triples: WHERE { ?person foaf:name “Dave” } <> dc:title "SPARQL Reference" . Build an An RDF graph made by substituting variables into a triple template. <> dc:date “2006-02-06”^^xsd:dateTime . RDF graph CONSTRUCT { ?a foaf:knows ?b } , operator: Triples with the same subject and predicate may be abbreviated with ',': WHERE { ?a ex:KnowsQuiteWell ?b } Boolean: True if the query pattern could be answered. <http://example.org/book> dc:title “My Book”, “Mein Buch”@de . ASK ; operator: Triples with the same subject may be abbreviated with ';': WHERE { ?a rdf:type foaf:Person } <http://work.example.org/> dc:title “My Workplace”; dc:publisher “My Employer” . 6. Query Results Ordering and Modifying [ ... ] operator: A sequence of (predicate object) pairs may be put inside [ ... ] and a blank node The optional modifications on query results are performed in the following order: subject will be assigned to them: 1. DISTINCT to ensure solutions in the sequence are unique <> dc:creator [ foaf:name “Dave”; foaf:homePage <http:...> ] . 1. ORDER BY ordering solutions sequences by variable, expression or extension function call: [] operator: A blank node: ORDER BY DESC(?date) ?title ASC(?familyName) my:fn(?a) [] a ex:Book [ dc:title “Thing”; dc:description “On shelf” ] . in descending order by date, by ascending title order, by familyName ascending, by extension a predicate: The common rdf:type QName may be abbreviated by the keyword a as a predicate: function <> a Foaf:Document . 2. LIMIT n to restrict the number of solutions to n 3. OFFSET m to start the results in the solution from item m Decimal integers: Positive or negative decimal integers can be written as (type xsd:integer) <> ex:sizeInBytes 12345 . 7. Values – datatypes, expressions and operators Decimal numbers: Positive or negative decimal numbers can be written as (type xsd:decimal) <> ex:shoeSize 8.5 . Supported datatypes: RDF Terms, xsd:boolean, xsd:string, xsd:double, xsd:float, xsd:decimal, xsd:integer and xsd:dateTime ( ... ) collections: RDF collections can be written inside ( ... ) as space-separated lists of contents: <> ex:contents ( ex:apple ex:banana ex:pear ) . Logical operators: Logical: A|| B, A && B, !A, (A) Comparison (A op B): =, !=, <, >, <=, >= 9. Example SPARQL Query Arithmetic operators: Unary: +A, -A BASE <http://example.org/> Binary (A op B): +, -, *, / PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> RDF operators: Boolean: BOUND(A), isIRI(A) / isURI(A), PREFIX foaf: <http://xmlns.com/foaf/0.1/> isBlank(A), isLiteral(A) # This is a relative IRI to BASE above String: STR(A), LANG(A), DATATYPE(A) PREFIX ex: <properties/1.0#> String Match operator: REGEX(string expression, pattern expression [,flags expression] ) SELECT DISTINCT $person ?name $age pattern syntax is from XQuery 1.0 / XPath 2.0, FROM <http://rdf.example.org/personA.rdf> FROM <http://rdf.example.org/personB.rdf> XML Schema, similar to Perl. flags are s, m, i, x WHERE { $person a foaf:Person ; Extension Functions and QName( expression, expression, ...) foaf:name ?name. Explicit Type Casting: OPTIONAL { $person ex:age $age } . Automatic Type from xsd:decimal to xsd:float FILTER (!REGEX(?name, “Bob”)) Promotion: from xsd:float to xsd:double } ORDER BY ASC(?name) LIMIT 10 OFFSET 20