0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Schema.orgを使ってデータ構造を標準化する

0
Last updated at Posted at 2026-02-18

概要

GoogleやMiscrosoftが推進するSchema.orgに掲載されているデータ構造に基づいて、データ構造を標準化します。
データが標準化されていると、slugusernameの読み替えなど、プロジェクト間の定義語による齟齬を減らすことができます。

Schema.orgとは?

Schema.orgは、検索エンジンを開発する

  • Google
  • Microsoft
  • Yahoo!
  • Yandex

が共同で開発したデータ構造の規格で、人や組織に関する構造化データをはじめとして、

The vocabulary currently consists of 827 Types, 1528 Properties 14 Datatypes, 94 Enumerations and 522 Enumeration members.

のデータが存在するそうです(2026/02/18時点)。
企業の顔ぶれからわかる通り、検索エンジンに対して最適化を行うことができるため、SEOの面でも適しています。
例えば、

<div itemscope itemtype="http://schema.org/Movie">
  <h1 itemprop="name">Avatar</h1>
  <span>
    Director:
    <span itemprop="director">James Cameron</span>
    (born August 16, 1954)
  </span>
  <span itemprop="genre">Science fiction</span>
  <a href="../movies/avatar-theatrical-trailer.html" itemprop="trailer">
    Trailer
  </a>
</div>

のように値を渡せば、クローラーに属性値を認識させることができます。
(参考: HTML itemprop グローバル属性 - HTML | MDN)

また、類似のものとして、JSON-LDといった構造化フォーマットも存在しますが、いずれもSchema.orgの構造化データをもとにしています。

使用例: 授業を表現したい

Courseは、学習者が特定の知識やスキルを習得するために提供される、一連の学習ユニットを示します。
Syllabusは、詳細な計画や内容の目録を示します。
授業を表現する場合は、Courseを親としながら、Syllabusを紐づける方法を取ることが一つの方法です。

これらから、以下のような定義を考えます。
以下の例では、"データ構造とアルゴリズム"という仮想の授業を想定しました。

{
  "@context": "https://schema.org",
  "@type": "Course",
  "name": "データ構造とアルゴリズム",
  "courseCredits": "2",
  "description": "データ構造とアルゴリズムの考え方について学ぶ",
  "syllabusSections": [
    {
      "@type": "Syllabus",
      "name": "第1週: ガイダンス",
      "description": "本授業の進め方・評価方法・課題について説明する"
    },
    {
      "@type": "Syllabus",
      "name": "第2週: 線形構造",
      "description": "線形リスト、キューとスタックについて学ぶ"
    }
  ]
}

授業自体の内容の他にも、単位数なども記述できるため、汎用的です。
DBスキーマもSchema.orgに合わせて構築するといいかもしれません。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?