# `mix schema_org.build_types`
[🔗](https://github.com/mike-kostov/schema_org/blob/v0.2.0/lib/mix/tasks/schema_org.build_types.ex#L1)

Regenerates the `SchemaOrg.*` type modules from the official Schema.org JSON-LD graph.

This task is for **library maintainers only**. It is not part of the runtime
and is not shipped in the Hex package. It reads the vendored graph, maps every
Property onto the Classes in its `domainIncludes` (plus inherited Classes via
`subClassOf`), and renders one Elixir module per Class through an EEx template.

    mix schema_org.build_types
    mix schema_org.build_types --file priv/schemaorg-current-https.jsonld --out lib/schema_org/types

## Options

  * `--file` - path to the Schema.org JSON-LD graph (default:
    `priv/schemaorg-current-https.jsonld`)
  * `--out`  - output directory for generated modules (default:
    `lib/schema_org/types`)

Download the graph with:

    curl -L https://schema.org/version/latest/schemaorg-current-https.jsonld \
      -o priv/schemaorg-current-https.jsonld

# `ancestors`

Transitive ancestor class ids of `class_id`, cycle-safe.

# `build_modules`

Turns a decoded JSON-LD graph into a sorted list of module specs, each ready to
render: `%{module_name, schema_type, moduledoc, filename, properties}`.

# `class?`

# `comment_text`

Normalises an `rdfs:comment` (string, list, or `@value` map) to clean Markdown.

Schema.org comments embed raw HTML (`<p>`, `<br/>`, `<a href>`, `<code>`) and
`[[wiki]]` cross-references. Left as-is they render badly — and an unbalanced
tag makes ExDoc emit "Failed to find closing <p>". This converts the useful
markup to Markdown and strips the rest so generated `@moduledoc`s are clean.

# `descriptor`

Builds the render descriptor for a single property node.

# `direct_properties`

Builds `%{class_id => [property_id, ...]}` from each property's `domainIncludes`.

# `field_name`

Maps a Schema.org property local name to a snake_case field name, suffixing any
Elixir keyword with `_` (e.g. `"dateModified"` → `:date_modified`, `"in"` → `:in_`).

# `local_name`

Strips the `schema:` prefix from an `@id` (e.g. `"schema:Product"` → `"Product"`).

# `module_name`

Maps a Schema.org local name to a valid Elixir module alias.

PascalCase names pass through. A leading-lowercase name is capitalised. Names
that are not valid aliases (e.g. `"3DModel"`, which starts with a digit) are
prefixed with `Type` and stripped of non-alphanumerics — while `schema_type`
keeps the exact original, so the emitted JSON-LD `@type` stays correct.

# `normalize_list`

Normalises a polymorphic Schema.org field into a flat list of id strings.

Handles all four shapes the spec uses interchangeably: `nil` (absent), a bare
string (e.g. an `@type` value), a single `%{"@id" => id}` object, and a list of
any of the above.

# `parent_map`

Builds `%{class_id => [parent_class_id, ...]}` from each class's `subClassOf`.

# `partition_graph`

Splits the graph's `@graph` into `{classes, properties}`.

# `property?`

# `property_ids_for_class`

All property ids valid on a class: its own (via `domainIncludes`) plus every
property inherited from a transitive `subClassOf` ancestor. Deduplicated.

# `render_module`

Renders a module spec to formatted Elixir source via the EEx template.

Raises if the generated code is not valid Elixir (the format pass parses it),
which surfaces template/sanitiser bugs immediately instead of writing junk.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
