Notes from the Library Juice Academy courses on “SPARQL Fundamentals”: University of Florida Libraries, Linked Data Working Group, Tech Talk, 15 March 2016
Designing Metadata to Meet User Needs for Special Collections
Similar to Notes from the Library Juice Academy courses on “SPARQL Fundamentals”: University of Florida Libraries, Linked Data Working Group, Tech Talk, 15 March 2016
Similar to Notes from the Library Juice Academy courses on “SPARQL Fundamentals”: University of Florida Libraries, Linked Data Working Group, Tech Talk, 15 March 2016 (20)
Predictive Analysis for Loan Default Presentation : Data Analysis Project PPT
Notes from the Library Juice Academy courses on “SPARQL Fundamentals”: University of Florida Libraries, Linked Data Working Group, Tech Talk, 15 March 2016
1. Tech Talk
BIBFRAMEWorking Group
15 March 2016
Notes from the Library Juice Academy courses on
“SPARQL Fundamentals”
Allison Jai O’Dell | AJODELL@ufl.edu
2. SPARQL
The SPARQL Protocol and RDF Query Language (SPARQL) is “a semantic query
language for databases, able to retrieve and manipulate data stored in Resource
Description Framework (RDF) format” --Wikipedia
3. Turtle Syntax
SPARQL uses the triple pattern and Turtle syntax
Turtle: Terse RDF Triple Language
<http://www.example.com/uri> namespace:element “literal” .
“literal”@en Literal with a language tag
“literal”^^xsd:integer Typed literal
4. Basic SPARQL Query
PREFIX dct: <http://purl.org/dc/terms/>
SELECT ?subject
WHERE
{
<http://www.worldcat.org/oclc/704257552> dct:creator ?subject .
}
PREFIX specifies namespaces
SELECT specifies solutions to return
WHERE specifies triple & graph patterns to query
6. More Modifiers
PREFIX dct: <http://purl.org/dc/terms/>
SELECT ?title ?subject
WHERE { ?title dct:subject ?subject . }
ORDER BY ?subject
LIMIT 5
OFFSET 10
ORDER BY specifies how to sort solutions.
OFFSET causes the solutions generated to start after the specified
number of solutions.
LIMIT puts an upper bound on the number of solutions returned.
7. Federated Queries
PREFIX dct: <http://purl.org/dc/terms/>
SELECT DISTINCT ?subject
WHERE
{
SERVICE <http://dbpedia.org/snorql>
{
?title dct:subject ?subject .
}
}
SERVICE lets you run federated queries over multiple endpoints
9. Property Paths
• path1/path2 Sequence path (pipe)
• ^path1 Inverse path (object to subject)
• path1|path2 Alternative path (either path1 or path2)
• path1* path1 repeated zero or more times
• path1+ path1 repeated one or more times
• path1? Zero or one, e.g., path1 is optional
• !(set) Negation
11. Four Query Forms
• SELECT
• CONSTRUCT
Construct new RDF triples & graphs based on patterns and existing data
• ASK
Ask whether or not a pattern matches the data; result is true or false
• DESCRIBE
Describe the resources matched by given variables