axiothOntology Hub

オントロジーとは何かを学ぶ / 第 5 部 活用 · レッスン 22 / 24

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

Putting it in a web page: JSON-LD and schema.org

Embed structured data in a page so search engines and programs can read what it says.

先に読む: 7. One graph, many file formats

The place ontologies are used most is, perhaps surprisingly, the ordinary web page. When a search result shows the date of an event or the rating of a product, it is because that page carries a small graph that people never see. This is called structured data.

A small graph inside the page

<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "Event",
  "name": "Cat adoption day",
  "startDate": "2026-05-09T10:00",
  "location": { "@type": "Place", "name": "Seoul Forest" },
  "organizer": { "@id": "https://shelter.example.org/#org" }
}
</script>

A browser does not draw this block. A search engine or another program reading the page takes it as data.

What @context does

KeyMeaning
@contextA dictionary turning short keys into IRIs. Here name becomes https://schema.org/name
@typeThe class of this thing. The same as a in Turtle
@idThe IRI of this thing. Left out, it is a blank node
A nested objectAnother node, and an arrow leading to it

As the formats lesson showed, a format is packaging. Read the JSON above and you get exactly the triples of the Turtle below.

@prefix schema: <https://schema.org/> .

[] a schema:Event ;                                   # no "@id", so a blank node
   schema:name "Cat adoption day" ;
   schema:startDate "2026-05-09T10:00" ;
   schema:location [ a schema:Place ; schema:name "Seoul Forest" ] ;
   schema:organizer <https://shelter.example.org/#org> .

The writer uses familiar JSON and the reader receives a graph. Change only the @context and the same JSON structure maps onto a different vocabulary, and several vocabularies can be mixed in one document.

Three ways to embed

MethodHow it is writtenCharacter
JSON-LDGathered in one script blockSeparate from the HTML and easy to maintain. Recommended by the major search engines
RDFaproperty and typeof attributes on HTML tagsThe visible text and the data sit in one place
Microdataitemscope and itemprop on HTML tagsThe method defined in the HTML standard

What kind of vocabulary schema.org is

schema.org was started jointly by search engine companies in 2011 and covers the common things of the web: events, products, people, organisations, articles. It chose wide and easy use over strict inference. So instead of domain and range it uses schema:domainIncludes and schema:rangeIncludes, meaning "this property is usually used on these kinds". No types are inferred from them.

This site uses it too

The source of the page you are reading contains JSON-LD. This lesson is marked up as a LearningResource, and each ontology page as a DefinedTermSet. Open the page source in your browser and look for application/ld+json.

よくある誤解

JSON-LD is JSON, so it has nothing to do with RDF.
JSON-LD is one of the formats for writing RDF. Converted to Turtle, the triples are the same.
Adding structured data raises the search ranking.
It is used for how a search engine understands and presents the content, not for ranking. Adding it does not guarantee it will be shown either.
Only schema.org terms can be used in a page.
Add another vocabulary to the @context and the two work together. Data portals mix in DCAT, and research data mixes in domain ontologies.

JSON-LD is RDF written in the shape of JSON. The @context turns keys into IRIs, and schema.org says what those IRIs mean.

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

仕様でさらに読む