axiothOntology Hub

オントロジーとは何かを学ぶ / 第 2 部 データの表現と接続 · レッスン 7 / 16

選択した言語の翻訳がないため、Englishの内容を表示しています。

One graph, many file formats

Turtle, JSON-LD, RDF/XML and N-Triples are different notations for the same triples.

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.

FormatExtensionWhen it is used
Turtle.ttlEasy for people to read and write. The most common way to publish an ontology
N-Triples.ntOne triple per line, nothing abbreviated. Long, but good for bulk processing and diffing
JSON-LD.jsonldPlain JSON that drops into web development. Widely used for structured data in web pages
RDF/XML.rdf, .owlThe oldest format. Common in OWL tools and OBO ontologies
TriG, N-Quads.trig, .nqAlso 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.

実際のオントロジーで確認する

仕様でさらに読む