개발

Ontology: a practical guide—from concepts to design and use in data and AI

What ontologies are in data and AI, and how we designed and applied them in reward and event domains, grounded in real delivery work. Covers concepts, relations, properties, JSON-LD and RDF examples, failure modes, and references.

Ontology: a practical guide—from concepts to design and use in data and AI

Key takeaway

In one line: An ontology fixes concepts, relations, and properties in a shared vocabulary so API, database, and docs do not drift apart in meaning. The payoff is especially high in terminology-heavy domains such as rewards and events.

ElementReward domain example
ClassesUser, Reward, Campaign
RelationsUser earns Reward

The diagram in this article visualizes an ontology from the perspective of RDF triples (subject–predicate–object).


Why learn about ontologies?

When you work with reward, event, and user-behavior data, the same questions keep coming up: should “points” and “miles” be treated as the same thing? How do we separate “event” from “campaign”? When each team uses different terms, APIs, databases, and documentation diverge—and later integration and analytics get expensive. As we connected multiple services, we needed a single place to define domain terms and relationships; this article summarizes what we learned introducing ontologies in that context.


1. What is an ontology?

An ontology is an explicit model of concepts (classes), relations between them, and properties those concepts have, for a given domain. The term comes from philosophy; in computer science, AI, and the semantic web it means representing knowledge in a form machines can process.

Diagram of ontology core elements

An ontology defines concepts, relations, properties, and instances clearly so people and systems communicate with aligned meaning.

1.1 Four core building blocks

ElementDescriptionExamples (reward domain)
Class (concept)A “kind of thing” in the domainUser, Reward, Event, Action
RelationLinks between conceptsUser earns Reward, Event triggers Action
PropertyAttributes of a conceptReward.pointValue, Event.startDate
InstanceA concrete individualuser_123, reward_daily_login

When we designed a reward engine, code and tables alone were not enough to pin down “which Action produces which Reward.” We sketched an ontology first, then aligned tables and APIs to it.


2. Why use an ontology (practitioner view)

2.1 Align language and meaning across teams and systems

  • Problem: Team A uses “event” for user behavior; Team B uses it for planned campaigns—metrics, APIs, and docs no longer match.
  • Response: Split concepts in the ontology (e.g. UserAction, Campaign) and define relations (User performs UserAction, Campaign contains UserAction). New hires and integrations then inherit one shared meaning.

2.2 Feed search, recommendations, and AI

  • When concepts and relations are explicit, rules like “when this user does X, grant reward Y” can be expressed as a knowledge graph, not only as imperative code.
  • When we structured reward rules as trigger → condition → reward, we reused ontology terms (Action, Condition, Reward) so the rules engine and documentation spoke the same language.

2.3 Semantic web, SEO, and structured data

  • JSON-LD or RDF markup grounded in an ontology helps search engines understand what a page is about.
  • Using BlogPosting, Organization, or Event on the web follows shared “web ontologies” such as Schema.org.

3. Ontology design process (practical checklist)

This is the order we followed for reward and event domains.

3.1 Scope the domain

  • Question: How much do we define in one pass?
  • Example: Only “reward issuance,” or the full arc from campaign design through participation, payout, and settlement.
  • Tip: Start narrow; stabilize 5–10 core concepts, then expand.

3.2 Identify core classes

  • Question: Which nouns must we be able to talk about?
  • Example: User, Reward, RewardType (points / miles / coupon), Action, Event, Campaign, Rule, …
  • Caution: Ambiguous words like “event” are easier to manage as separate types such as UserAction and Campaign.

3.3 Define relations

  • Question: How do A and B connect?
  • Example:
    • User earns Reward
    • Event triggers Action
    • Rule grants Reward when Action
  • Tip: Verb-like relation names read naturally as “who does what to whom.”

3.4 Choose properties

  • Question: What do we need to distinguish, search, or compute?
  • Example: Reward.pointValue, Reward.currency, Event.startDate, Event.endDate, User.id …
  • Caution: Too many “maybe later” properties create maintenance load—prioritize what you need for v1 and extend deliberately.

4. A minimal ontology example (reward domain)

Below is a small sketch of rewards, actions, and events. Extend or split classes and relations to fit your product.

4.1 Class and relation sketch

User --(performs)--> Action Action --(type)--> ActionType // login, purchase, share ... Event --(contains)--> Action Rule --(when)--> Action Rule --(then)--> Reward User --(earns)--> Reward Reward --(type)--> RewardType // point, mileage, coupon

4.2 JSON-LD sketch

JSON-LD is a convenient shape for web and API use.

Anchoring DB tables, API specs, and docs to a schema like this reduces mistakes such as mixing “points” and “miles” in the same field with unclear semantics.


5. Common failure modes and what to do

5.1 Trying to finish the ontology in one shot

  • Problem: Defining every concept and relation upfront stretches timelines and falls out of sync with shipping software.
  • Response: Model one flow (e.g. reward payout) end to end, reflect it in code and data, then broaden to events, campaigns, and settlement.

5.2 The team ignores the definitions

  • Problem: An ontology in a wiki while product, engineering, and ops keep old vocabulary halves the value.
  • Response: Keep the ontology in a shared repository; align API and DB field names and doc links to it; use reviews to check terminology consistency.

5.3 Many relations, weak rationale

  • Problem: Relation sprawl without a clear “which business logic uses this?” story.
  • Response: For each relation, add a one-line use case (e.g. payout rule evaluation, dashboard aggregation) to guide maintenance and extension.

6. References

📚 Materials worth reading for a deeper dive.


7. Closing thoughts

An ontology is a knowledge model that makes domain concepts and relations explicit so people and systems share meaning. In domains where many teams and systems meet—rewards and events are classic examples—agreeing on terms and relationships keeps APIs, databases, documentation, and rule engines coherent. We saw clear benefits for semantic alignment and rule design when we connected a reward engine and event stack to a small ontology first. Start with a narrow scope, define roughly 5–10 core concepts and their relations, reflect that in code and data, and grow iteratively.


This article was written and reviewed by the itemSCV team. For questions on rewards, events, or data modeling, use Contact us.

Share

Related posts