A tune is the same tune whether it is written in staff notation or tablature. RDF is like that. There is one graph, and several syntaxes for writing it to a file. Whichever format you save, reading it back gives the same triples.
| Format | Extension | When it is used |
|---|---|---|
| Turtle | .ttl | Easy for people to read and write. The most common way to publish an ontology |
| N-Triples | .nt | One triple per line, nothing abbreviated. Long, but good for bulk processing and diffing |
| JSON-LD | .jsonld | Plain JSON that drops into web development. Widely used for structured data in web pages |
| RDF/XML | .rdf, .owl | The oldest format. Common in OWL tools and OBO ontologies |
| TriG, N-Quads | .trig, .nq | Also carry named graphs (next lesson) |
The same two sentences, three ways
"Nabi is a cat. Nabi is called Nabi." N-Triples writes every IRI in full.
<https://example.org/nabi> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://example.org/Cat> .
<https://example.org/nabi> <http://www.w3.org/2000/01/rdf-schema#label> "Nabi"@en .JSON-LD is ordinary JSON plus an @context that says which IRI each short key stands for. @id is the subject and @type is rdf:type.
{
"@context": {
"ex": "https://example.org/",
"label": "http://www.w3.org/2000/01/rdf-schema#label"
},
"@id": "ex:nabi",
"@type": "ex:Cat",
"label": { "@value": "Nabi", "@language": "en" }
}A file format is only packaging. A .owl file contains RDF triples, and a .ttl file is not guaranteed to be an ontology. This site does not trust extensions; it records what actually parsed.