Knowledge and Data 2
• Recap RDF
• RDF ➔ graph data model for the web
• Uses triples:
• RDF triple ➔ <subject><predicate><object>
• <thing><relationship><thing>
• Resources: things about which we want to make statements
• URl's
• Literals: values like strings, numbers, dates, booleans
• Subjects and predicates are alwayd resources
• Objects can be resources or literals
• SPARQL
• SELECT clause:
• SELECT*: select all rows that match the where clause
• SELECT ?thing: select a column ?
• SELECT DISTINCT: each result row must be unique
, • ASK ➔ returns true if there is a match, false otherwise
• CONSTRUCT ➔ returns an RDF graph based on the matching
CONSTRUCT clause.
• DESCRIBE ➔ returns an RDF graph 'describing the returned results.'
• WHERE clause: specifies what to match in the data
• Triple pattern ➔ a triple with O or more variables. One or more variables
can be a wildcard (e.g. ?star)
•
PREFIX ex: <http://ex.org/voc#>
SELECT*
= =
WHERE { ======================== ====
}
• Basic graph pattern ➔ a set of triple patterns
• "What movies did the stars of 'Sharknado' also star in? "
•
Query:
PREFIX ex: <http://ex.org/voc#>
SELECT *
WHERE { ei:eu.u
"Basic Graph Pattern"
(a set of triple patterns)
• Join variable ➔ a variable appearing in more than one triple pattern
• Recap RDF
• RDF ➔ graph data model for the web
• Uses triples:
• RDF triple ➔ <subject><predicate><object>
• <thing><relationship><thing>
• Resources: things about which we want to make statements
• URl's
• Literals: values like strings, numbers, dates, booleans
• Subjects and predicates are alwayd resources
• Objects can be resources or literals
• SPARQL
• SELECT clause:
• SELECT*: select all rows that match the where clause
• SELECT ?thing: select a column ?
• SELECT DISTINCT: each result row must be unique
, • ASK ➔ returns true if there is a match, false otherwise
• CONSTRUCT ➔ returns an RDF graph based on the matching
CONSTRUCT clause.
• DESCRIBE ➔ returns an RDF graph 'describing the returned results.'
• WHERE clause: specifies what to match in the data
• Triple pattern ➔ a triple with O or more variables. One or more variables
can be a wildcard (e.g. ?star)
•
PREFIX ex: <http://ex.org/voc#>
SELECT*
= =
WHERE { ======================== ====
}
• Basic graph pattern ➔ a set of triple patterns
• "What movies did the stars of 'Sharknado' also star in? "
•
Query:
PREFIX ex: <http://ex.org/voc#>
SELECT *
WHERE { ei:eu.u
"Basic Graph Pattern"
(a set of triple patterns)
• Join variable ➔ a variable appearing in more than one triple pattern