Glossary
Look up a course term, see it in a worked example, and return to the step where it matters.
Graphs and facts
- Knowledge graph
- Data organised around things and the relationships between them. The course graph connects people to universities, universities to campus cities, and cities to countries. Follow the campus graph.
- RDF
- Resource Description Framework, a data model for recording facts as triples. The course graph includes “Alice studies at U1” and “U1 has a campus in CityA”. See the RDF example.
- Node
- A point in a graph that stands for a thing or a value. Alice and U1 are the two nodes in the first study arrow. Read an arrow.
- Edge
- A labelled arrow that connects a starting node to a destination. The edge from Alice to U1 reads “studies at”. Compare relationship labels.
- RDF triple
- One recorded statement with a subject, a predicate and an object, written in that order. The study fact is
ex:Alice ex:studiedAt ex:U1. Build a triple. - Subject
- The starting point of a triple. In “Alice studies at U1”, the subject is Alice. See the three positions.
- Predicate
- The relationship in a triple. In the study example,
ex:studiedAtis the predicate and “studies at” is its readable label. Read the label precisely. - Object
- The destination of a triple. U1 is the object of “Alice studies at U1”. It can also be the subject of a different triple. Trace a shared node.
- IRI
- An internationalized resource identifier, often written like a web address. The course uses
ex:U1as shorthand forhttps://example.org/U1. Distinguish identities from labels. - Literal
- A data value such as text, a number or a date. The text “Central Library” and the desk count 40 are literals in the library example. See examples of literals.
Patterns and matches
- SPARQL
- The query language used here to ask questions of RDF data. A query can ask which university Alice studies at and return U1. Find the full study query.
WHERE- Introduces the part of a query that describes what to match. In the study query, the pattern inside
WHERE { … }asks for an arrow from Alice with the relationshipex:studiedAt. Read the full study query. - Triple pattern
- A template with the three positions of a triple that can contain variables.
ex:Alice ex:studiedAt ?university .fixes the first two positions and leaves the third to be found. Read a pattern by position. - Variable
- A named placeholder for a value the query can find. In the study pattern,
?universitycan take the value U1. Try a variable in a new position. - Binding
- The pairing of a variable with one value in a match. The study fact gives the binding
?university = ex:U1. See how a blank gets its value. - Match
- A way of filling the variables so that the relevant facts together satisfy the pattern. The campus query has a match with U1 and CityA, and another with U1 and CityB. SPARQL calls each assignment a solution mapping. See how a match becomes a row.
- A variable that appears in more than one part of a pattern. Each match gives it one value throughout, so both university positions use U1 in the campus example. Trace the shared university.
- Join
- The step that combines matches when they agree on the values they share. Alice’s study match and the CityA campus match combine through their U1 binding. Build a joined row.
- Separate variable
- A newly named placeholder that can take its own value. With
?otherUniversityon the campus line, a match can use U1 for Alice’s university and U2 for the campus university. Compare the two campus patterns.
Reading query results
SELECT- Specifies the values or expressions to return as columns. In
SELECT ?university, the displayed result has one column for the university value from each match. See how one column is selected. - Projection
- Keeping only the columns requested by the query. Selecting just
?universityturns the campus rows (U1, CityA) and (U1, CityB) into two rows that both show U1. Follow projection row by row. - Duplicate result row
- A repeated row with the same values in all the displayed columns. In the campus query, selecting the university column alone leaves two identical U1 rows. Trace each repeated row to its facts.
DISTINCT- A keyword that keeps one copy of each different row in the chosen result columns.
SELECT DISTINCT ?universitykeeps one U1 row in the campus example. See which rows are merged. COUNT- A function that counts how many times an expression successfully produces a value. Repeated values each contribute to the total.
COUNT(?university)gives 2 because both campus matches have a university value. Compare both counts. COUNT(DISTINCT …)- Counts each different bound value once. Lee borrowed two books by Maya, so the matches contain Lee twice and
COUNT(DISTINCT ?reader)gives 1. Use the distinct-reader count.
Checking answers
- Evidence
- The specific facts that support a result. Alice’s study edge and U1’s edge to CityA explain why CityA qualifies as one of her university’s campus cities. Trace the evidence behind a row.
- Counterexample
- A concrete case that disproves a general claim. In the country experiment, changing CityC to CountryY makes the two queries disagree, so the claim that they always agree fails. Try the country counterexample.