schema.org.ai
Schema.org vocabulary integration for semantic type systems
schema.org.ai
Integration of Schema.org vocabulary (817 types, 1,518 properties) for semantic type systems and structured data.
Overview
The schema.org.ai package provides a complete TypeScript implementation of the Schema.org vocabulary, enabling semantic type safety and structured data generation for Business-as-Code applications.
Quick Example
import { schema } from 'schema.org.ai'
// Create typed schema objects
const person = schema.Person({
name: 'Jane Doe',
email: '[email protected]',
jobTitle: 'Software Engineer',
})
const organization = schema.Organization({
name: 'Acme Inc',
employees: [person],
foundingDate: '2020-01-01',
})Core Features
- 817 Schema.org Types - Complete coverage of Schema.org vocabulary
- 1,518 Properties - Full property definitions with validation
- Type Safety - Full TypeScript types for all schemas
- JSON-LD Output - Generate valid JSON-LD structured data
- Validation - Runtime validation of schema objects
- Semantic Search - Enable rich semantic search capabilities
Common Schemas
Business Types
import { schema } from 'schema.org.ai'
// Organization
const org = schema.Organization({
name: 'Acme Inc',
legalName: 'Acme Incorporated',
url: 'https://acme.com',
})
// LocalBusiness
const business = schema.LocalBusiness({
name: 'Acme Store',
address: schema.PostalAddress({
streetAddress: '123 Main St',
addressLocality: 'San Francisco',
postalCode: '94102',
}),
})Person Types
// Person
const person = schema.Person({
givenName: 'Jane',
familyName: 'Doe',
email: '[email protected]',
telephone: '+1-555-1234',
})
// Employee
const employee = schema.Employee({
...person,
employmentType: 'FULL_TIME',
jobTitle: 'Software Engineer',
worksFor: org,
})Product Types
// Product
const product = schema.Product({
name: 'Widget Pro',
description: 'Professional widget for businesses',
brand: schema.Brand({ name: 'Acme' }),
offers: schema.Offer({
price: '99.99',
priceCurrency: 'USD',
}),
})
// Service
const service = schema.Service({
name: 'Consulting Services',
provider: org,
areaServed: 'United States',
})JSON-LD Generation
Generate valid JSON-LD for SEO and structured data:
import { toJsonLd } from 'schema.org.ai'
const jsonLd = toJsonLd(organization)
// Output:
// {
// "@context": "https://schema.org",
// "@type": "Organization",
// "name": "Acme Inc",
// ...
// }Validation
Validate schema objects at runtime:
import { validate } from 'schema.org.ai'
const result = validate(schema.Person, personData)
if (!result.valid) {
console.error('Validation errors:', result.errors)
}Access Methods
SDK
import { schema } from 'schema.org.ai'
const person = schema.Person({ name: 'Jane Doe' })CLI
do schema create Person --name "Jane Doe"API
curl -X POST https://api.do/v1/schema/Person \
-d '{"name": "Jane Doe"}'MCP
Create a Person schema with name Jane DoeAvailable Types
Browse all 817 Schema.org types:
- Creative Works - Article, Book, Movie, MusicRecording, etc.
- Events - Event, BusinessEvent, SocialEvent, etc.
- Organizations - Organization, Corporation, LocalBusiness, etc.
- People - Person, Patient, Employee, etc.
- Places - Place, LocalBusiness, Restaurant, etc.
- Products - Product, Offer, AggregateOffer, etc.
- Actions - Action, SearchAction, CreateAction, etc.
- Intangibles - Service, Rating, Review, etc.
Integration with .do Primitives
Use Schema.org types with .do primitives:
import { $ } from 'sdk.do'
import { schema } from 'schema.org.ai'
// Create business with schema metadata
await $.Business.create({
name: 'Acme Inc',
schema: schema.Organization({
name: 'Acme Inc',
legalName: 'Acme Incorporated',
}),
})
// Create product with schema
await $.Product.create({
name: 'Widget Pro',
schema: schema.Product({
name: 'Widget Pro',
brand: 'Acme',
}),
})Related
- GraphDL - Semantic graph definition language
- MDXLD - MDX + Linked Data
- Core Concepts - Platform fundamentals
- Semantics - Semantic patterns