Turtle/RDF language preview
1. A basic graph
@prefix, prefixed names, and the a shorthand
horizon-dark
@prefix ex: <http://example.org/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
ex:alice a ex:Person ;
ex:name "Alice"@en ;
ex:age "30"^^xsd:integer ;
ex:knows _:b1 .
_:b1 ex:name "Bob" .
atom-one-dark
@prefix ex: <http://example.org/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
ex:alice a ex:Person ;
ex:name "Alice"@en ;
ex:age "30"^^xsd:integer ;
ex:knows _:b1 .
_:b1 ex:name "Bob" .
github-dark
@prefix ex: <http://example.org/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
ex:alice a ex:Person ;
ex:name "Alice"@en ;
ex:age "30"^^xsd:integer ;
ex:knows _:b1 .
_:b1 ex:name "Bob" .
dracula
@prefix ex: <http://example.org/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
ex:alice a ex:Person ;
ex:name "Alice"@en ;
ex:age "30"^^xsd:integer ;
ex:knows _:b1 .
_:b1 ex:name "Bob" .
nord
@prefix ex: <http://example.org/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
ex:alice a ex:Person ;
ex:name "Alice"@en ;
ex:age "30"^^xsd:integer ;
ex:knows _:b1 .
_:b1 ex:name "Bob" .
github
@prefix ex: <http://example.org/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
ex:alice a ex:Person ;
ex:name "Alice"@en ;
ex:age "30"^^xsd:integer ;
ex:knows _:b1 .
_:b1 ex:name "Bob" .
2. Blank node property lists
nested [ ... ] blank nodes and collections
horizon-dark
@prefix ex: <http://example.org/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
ex:alice foaf:knows [
a foaf:Person ;
foaf:name "Carol"
] .
ex:alice ex:favoriteColors ( "red" "green" "blue" ) .
atom-one-dark
@prefix ex: <http://example.org/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
ex:alice foaf:knows [
a foaf:Person ;
foaf:name "Carol"
] .
ex:alice ex:favoriteColors ( "red" "green" "blue" ) .
github-dark
@prefix ex: <http://example.org/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
ex:alice foaf:knows [
a foaf:Person ;
foaf:name "Carol"
] .
ex:alice ex:favoriteColors ( "red" "green" "blue" ) .
dracula
@prefix ex: <http://example.org/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
ex:alice foaf:knows [
a foaf:Person ;
foaf:name "Carol"
] .
ex:alice ex:favoriteColors ( "red" "green" "blue" ) .
nord
@prefix ex: <http://example.org/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
ex:alice foaf:knows [
a foaf:Person ;
foaf:name "Carol"
] .
ex:alice ex:favoriteColors ( "red" "green" "blue" ) .
github
@prefix ex: <http://example.org/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
ex:alice foaf:knows [
a foaf:Person ;
foaf:name "Carol"
] .
ex:alice ex:favoriteColors ( "red" "green" "blue" ) .
3. Multiple graphs (TriG)
GRAPH blocks and base IRIs
horizon-dark
@base <http://example.org/> .
PREFIX ex: <http://example.org/>
GRAPH ex:graph1 {
ex:alice ex:knows ex:bob .
}
atom-one-dark
@base <http://example.org/> .
PREFIX ex: <http://example.org/>
GRAPH ex:graph1 {
ex:alice ex:knows ex:bob .
}
github-dark
@base <http://example.org/> .
PREFIX ex: <http://example.org/>
GRAPH ex:graph1 {
ex:alice ex:knows ex:bob .
}
dracula
@base <http://example.org/> .
PREFIX ex: <http://example.org/>
GRAPH ex:graph1 {
ex:alice ex:knows ex:bob .
}
nord
@base <http://example.org/> .
PREFIX ex: <http://example.org/>
GRAPH ex:graph1 {
ex:alice ex:knows ex:bob .
}
github
@base <http://example.org/> .
PREFIX ex: <http://example.org/>
GRAPH ex:graph1 {
ex:alice ex:knows ex:bob .
}