Ontologies in Knowledge Graphs: Classes, Properties, OWL & SKOS

An ontology is a formal, machine-readable definition of the types of things in a domain, the properties those things can have, and the rules that govern how they relate. In a knowledge graph, the ontology is the schema layer: it states that a Person can have a birthPlace, that a birthPlace must be a Place, and that a Professor is a kind of Person. The data layer (the individual entities and their triples) is then interpreted against those definitions.

What an ontology is in information science

The word comes from philosophy, where ontology is the study of what exists. Information science borrowed it in the 1990s for a narrower idea: an explicit specification of a shared conceptualization. It is explicit because it is written down in a formal language rather than assumed, and shared because its value comes from more than one system or team agreeing to use it.

An ontology states which categories of thing a domain contains, which relationships can hold between them, and which statements would be contradictory. A university ontology might define Student, Course, Department and Professor as classes; enrolledIn, teaches and memberOf as relationships; and a rule that a Course is taught by at least one Professor.

On the Semantic Web, the two standard ontology languages are RDF Schema (RDFS) and the Web Ontology Language (OWL), both W3C Recommendations. Their syntax is covered on /languages/owl/ and /languages/rdf/; this page stays at the conceptual level.

Building blocks of an ontology

Every ontology language shares a small set of constructs. The names below follow RDFS and OWL, but the concepts appear in labeled property graph (LPG) schemas and relational data models under other names.

Classes. A class is a category of entity: Person, Organization, City. In RDF, an individual is assigned to a class with rdf:type. A class is a set defined by membership, not a template with fixed fields, so an individual can belong to several classes at once.

Subclass hierarchy. rdfs:subClassOf states that every member of one class is also a member of another. Professor is a subclass of Person; City is a subclass of Place. Hierarchies can be many levels deep and a class can have more than one superclass.

Properties. Properties are the named relationships and attributes. OWL separates object properties, which link an individual to another individual (teaches, locatedIn), from datatype properties, which link an individual to a literal such as a string, number or date (birthDate, population). Properties form hierarchies through rdfs:subPropertyOf.

Domain and range. rdfs:domain states which class the subject of a property belongs to; rdfs:range states the class or datatype of the object. Declaring that teaches has domain Professor and range Course tells a reasoner that anything appearing as the subject of teaches is a Professor, whether or not it was typed explicitly.

Individuals. Individuals are the actual entities: Marie Curie, the University of Paris, the Eiffel Tower. In most deployments the individuals live in the data and the ontology defines only classes and properties, though OWL allows individuals to be declared inside the ontology as well.

Axioms and constraints. Axioms are the logical statements that make an ontology more than a list of names. OWL can express that two classes are disjoint (nothing is both a Person and an Organization), that a property is functional (at most one birthDate), that a property is transitive (partOf), or that a class is equivalent to a restriction (a Parent is exactly a Person with at least one child). These statements are themselves stored as triples; see /concepts/triples-subject-predicate-object/.

Taxonomy vs thesaurus vs ontology vs knowledge graph

These four terms are often used interchangeably, and the confusion is worth clearing up because each adds expressive power to the one before it.

ArtifactWhat it containsTypical relationship typesExample
TaxonomyTerms arranged in a single hierarchybroader / narrower (is-a or part-of)Library of Congress Classification
ThesaurusTerms with hierarchy plus associative and synonym linksbroader, narrower, related, preferred and alternate labelsGetty Art & Architecture Thesaurus
OntologyClasses, properties, and logical axioms about a domainAny user-defined relationship, with domain, range and constraintsFOAF, the Gene Ontology, FIBO
Knowledge graphInstance data (entities and their facts) usually organized by an ontologyWhatever the ontology allowsWikidata, the Google Knowledge Graph

A taxonomy says only that Cardiology is narrower than Medicine. A thesaurus adds that “heart disease” and “cardiac disease” label the same concept and that Cardiology is related to Cardiac Surgery. An ontology says that a Cardiologist is a Physician, that a Physician treats Patients, and that nothing is both a Physician and a Hospital. A knowledge graph then records that a specific person, identified by a URI, is a Cardiologist at a specific hospital. The last distinction is covered on /concepts/knowledge-graph-vs-ontology/.

RDFS vs OWL

RDFS and OWL both define ontologies over RDF data, but they sit at different points on the expressivity scale.

RDFS provides classes, subclasses, properties, subproperties, domain and range. That is enough to build a useful vocabulary and to support simple inference: if Professor is a subclass of Person and Marie Curie has type Professor, an RDFS reasoner concludes that Marie Curie has type Person.

OWL adds the logical machinery: class intersections and unions, disjointness, cardinality restrictions, property characteristics (functional, inverse, symmetric, transitive), equivalence between classes and between individuals, and the ability to define a class by the properties its members have. OWL 2, the current version, became a W3C Recommendation in 2009 (second edition 2012) and includes profiles (OWL 2 EL, QL and RL) that trade expressivity for guaranteed reasoning performance.

The cost of expressivity is computational. Full OWL 2 DL reasoning is decidable but can be slow on large graphs, so many production knowledge graphs use RDFS plus a few OWL constructs and enforce data quality with SHACL shapes rather than OWL axioms. OWL describes what is logically true about a domain; SHACL checks whether data conforms to an expected shape. They are often used together.

SKOS for thesauri and controlled vocabularies

The Simple Knowledge Organization System (SKOS), a W3C Recommendation from 2009, is an RDF vocabulary for publishing taxonomies and thesauri. Where OWL models a domain, SKOS models a vocabulary of concepts and the lightweight relationships librarians and indexers use.

The core class is skos:Concept. Concepts are grouped into a skos:ConceptScheme. Hierarchy is expressed with skos:broader and skos:narrower, associative links with skos:related. Labels are split into skos:prefLabel (one per language), skos:altLabel for synonyms and variants, and skos:hiddenLabel for misspellings that should be searchable but never displayed. Documentation goes in skos:definition, skos:scopeNote and similar properties.

@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix ex:   <https://example.org/vocab/> .

ex:Chemistry a skos:Concept ;
    skos:prefLabel "Chemistry"@en ;
    skos:altLabel  "Chemical science"@en ;
    skos:inScheme  ex:Disciplines .

ex:Radiochemistry a skos:Concept ;
    skos:prefLabel "Radiochemistry"@en ;
    skos:broader   ex:Chemistry ;
    skos:related   ex:NuclearPhysics ;
    skos:definition "The chemistry of radioactive materials."@en ;
    skos:inScheme  ex:Disciplines .

SKOS deliberately avoids OWL’s logical commitments. skos:broader is not rdfs:subClassOf; it carries no entailment that members of the narrower concept are members of the broader one. This makes SKOS the right choice for subject headings, product categories and tagging vocabularies, where the hierarchy is a navigational aid rather than a logical claim. Many national libraries and thesaurus publishers distribute their vocabularies in SKOS.

Well-known ontologies and vocabularies

A handful of published ontologies are reused across thousands of datasets. Knowing them saves design time and improves interoperability.

  • schema.org: a lightweight vocabulary of roughly 800 types and 1,500 properties, founded in 2011 by Google, Microsoft, Yahoo and Yandex and now developed through a W3C community group. It has a class hierarchy (Thing, Person, Organization, LocalBusiness, and so on) and property definitions with expected types, but few axioms. It is the vocabulary behind most structured data on the web. See /ecosystems/schema-org/.
  • FOAF (Friend of a Friend): an early RDF vocabulary for describing people, their relationships and their online accounts. foaf:Person, foaf:knows and foaf:name still appear widely in linked data.
  • Dublin Core: fifteen core metadata elements (title, creator, date, subject, and others) from the Dublin Core Metadata Initiative, extended in the DCMI Metadata Terms. Used for describing documents and digital resources.
  • SKOS: described above; the standard for controlled vocabularies.
  • Gene Ontology (GO): a large biomedical ontology describing gene product function, cellular components and biological processes. It is one of the most heavily used scientific ontologies and a common example of OWL at scale.
  • FIBO (Financial Industry Business Ontology): an OWL ontology from the EDM Council covering financial instruments, legal entities and contracts, used for regulatory reporting and data integration in banking.

How ontologies drive inference

The practical payoff of an ontology is that a reasoner can derive triples that were never asserted. Take a small set of definitions and one fact:

@prefix ex:   <https://example.org/univ/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
ex:Professor rdfs:subClassOf ex:Person .
ex:worksAt   rdfs:domain ex:Person ;
             rdfs:range  ex:Organization .
ex:MarieCurie a ex:Professor ;
              ex:worksAt ex:UniversityOfParis .

From these, an RDFS reasoner concludes that Marie Curie is a Person (via subClassOf) and that the University of Paris is an Organization (via the range of worksAt). A SPARQL query for all Persons returns Marie Curie even though no triple types her as one, and every property defined for Person (birthDate, nationality) applies to her. The Professor inherits everything defined for Person without duplication in the data.

OWL extends this further. If hasSupervisor is declared the inverse of supervises, asserting one direction yields the other. If partOf is transitive, a query for everything inside France returns the Eiffel Tower via Paris. If Person and Organization are disjoint, a reasoner flags any entity typed as both, a common error when merging sources.

Design guidance

Ontology design has accumulated some settled advice.

Reuse before inventing. Check schema.org, Wikidata properties, Dublin Core and the Linked Open Vocabularies index before defining a new class or property. A new term isolates data; a reused one connects it.

Start from competency questions. Write down the specific questions the graph must answer (“Which professors taught courses in the Chemistry department before 1930?”) and derive the classes and properties needed to answer them, rather than attempting to model everything.

Keep the ontology small and the data large. Most working knowledge graphs have tens to a few hundred classes. Use OWL or RDFS for the logical structure and SKOS for the controlled lists (countries, product categories, subject headings) that hang off it. Document every term with rdfs:label and rdfs:comment, and publish the ontology at a stable, dereferenceable URI (see /concepts/linked-data/).

For developers

In practice an ontology is a file (Turtle, RDF/XML or OWL functional syntax) loaded into a triple store alongside the data. Stores such as GraphDB, Stardog and Apache Jena support RDFS and OWL reasoning at load or query time. Editing is usually done in Protégé, a free ontology editor from Stanford. In LPG databases such as Neo4j the ontology is informal (node labels and relationship types) unless a tool such as neosemantics imports RDFS or OWL; see /concepts/property-graph-vs-rdf/.

For SEOs

SEOs already work with an ontology every day: schema.org. Its types are classes (Organization, LocalBusiness, Article), its properties have expected types that function as ranges, and its hierarchy means a LocalBusiness inherits every property of Organization and Thing. Choosing the most specific applicable type, linking to Wikidata with sameAs, and staying inside the documented property definitions are all ontology decisions. Google’s documentation defines which subset of schema.org drives rich results; the full vocabulary defines how the entities on a site relate to each other. See /seo/entity-seo/ and /seo/sameas-schema/.

Common misconceptions

An ontology is not a database schema. A relational schema constrains what can be stored; an OWL ontology describes what is true, and a reasoner infers new facts rather than rejecting data. Validation is SHACL’s job.

An ontology is not a taxonomy with extra fields. The defining feature is the relationships between classes and the axioms about them, not the depth of the hierarchy.

Bigger is not better. A small, well-documented ontology that answers the competency questions is more useful than a comprehensive one nobody can maintain.

Related pages

FAQ

What is an ontology in simple terms?

An ontology is a formal description of the kinds of things in a subject area and how they relate. It names the categories (Person, Organization, Place), the relationships and attributes those categories can have (worksAt, birthDate), and the rules that apply (a Professor is a Person). Software uses it to interpret data consistently and to infer facts that were never stated directly.

What is the difference between a taxonomy and an ontology?

A taxonomy arranges terms in a hierarchy using a single relationship, usually broader and narrower. An ontology defines classes, many kinds of relationships between them, and logical constraints such as domain, range, disjointness and cardinality. Every taxonomy can be expressed inside an ontology, but an ontology can also state that a Physician treats Patients or that nothing is both a Person and a Company.

What is the difference between RDFS and OWL?

RDFS provides the basics: classes, subclasses, properties, subproperties, domain and range. OWL builds on RDFS with richer logic, including disjoint classes, cardinality restrictions, inverse and transitive properties, and class definitions built from restrictions. RDFS is enough for simple vocabularies and inheritance; OWL is needed when the ontology must support consistency checking or more complex inference.

Is schema.org an ontology?

Yes, in a lightweight sense. schema.org defines a hierarchy of types, properties with expected types, and documentation for each term, which makes it a vocabulary or lightweight ontology. It contains few formal axioms compared with OWL ontologies such as FIBO or the Gene Ontology, so it supports inheritance and typing but not heavy reasoning. It is the most widely deployed vocabulary on the web.

Sources and further reading

  • W3C, OWL 2 Web Ontology Language Primer: https://www.w3.org/TR/owl2-primer/
  • W3C, RDF Schema 1.1: https://www.w3.org/TR/rdf-schema/
  • W3C, SKOS Simple Knowledge Organization System Primer: https://www.w3.org/TR/skos-primer/
  • W3C, SHACL Shapes Constraint Language: https://www.w3.org/TR/shacl/
  • schema.org full hierarchy: https://schema.org/docs/full.html
  • Hogan et al., Knowledge Graphs (Chapter 4, Schema, Identity, Context): https://kgbook.org/