Theory
Before Level 1 asks you to write triples, let's read them.
Every Turtle file starts with a tiny header of prefixes. A prefix is just an abbreviation for a long URL so you don't have to type the whole thing every time:
@prefix : <http://academy.org/ninja/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
Now :Alice is shorthand for <http://academy.org/ninja/Alice> — a full IRI but written in one breath. The empty prefix : is your own namespace; foaf:, xsd:, rdf: etc. are vocabularies you borrow from the Web (we'll explore them in the next lesson).
Then comes the fact itself — three slots, a period to end it:
:Alice :knows :Bob .
# ^subject ^predicate ^object ^end-of-statement
The four rules you need for Level 1:
- A Turtle file starts with
@prefixlines (we provide them — you'll > rarely need to change them).- Use
:Local(with a leading colon) to name things in your own > namespace.- Use
prefix:Local(e.g.foaf:name) to use a borrowed vocabulary.- Every fact ends with a single period
.— forget it and the parser > will complain.