For millennia, philosophers have worked to formalise methods of describing objects using ontologies.
In essence, these are the principles:
- Each object has certain properties.
- Each object can be given a name (eg "Bob"), as a shorthand for a description of all its properties.
- Each property is itself an object, has properties of its own, and can be given a name (eg "hair") as a shorthand for a description of its properties.
- Objects that share a set of properties can be defined as classes; those classes can be given names (eg "Human") as a shorthand for a description of their shared set of properties.
Referring to an object
An object can be referred to by its name ("Bob") or by a distinguishing combination of its properties ("the tall human with long hair, by the table").
Describing an object
In object notation, an object and its properties looks like this:
"Bob": { arms: 2, legs: 2, height: 190cm, weight: 80kg, hair-colour: brown, hair-length: 20cm, }
Classes as shorthand for shared properties
If objects share a common set of properties (eg 2 arms, 2 legs), then we can define a class, describe the properties of that class, and save some space by using the name of that class (eg "Human") as a shorthand for some of the object's properties:
"Bob": { a: "Human", height: 190cm, weight: 80kg, hair-colour: brown, hair-length: 40cm, }
The "Human" class, and its properties, need to be described in a separate object:
"Human": { arms: 2, legs: 2, }
Distributed ontologies
Referring to objects using names, as above, assumes that there's a shared ontology where each name is unique.
In a decentralised ontology (the web), the same object may be defined in multiple places using different names, and there may be several collisions where descriptions of different objects share the same name.
To avoid this, we refer to objects using "namespaced" names: adding a defined prefix, to produce a universally-unique name (URL) for the object:
http://people/bob: { name: "Bob", a: http://organisms/human, height: 190cm, weight: 80kg, hair-colour: brown, hair-length: 40cm, }
http://organisms/human: { name: "Human", legs: 2, arms: 2, }
Object representation
An object (resource) on the web can be represented in many formats:
JSON
"http://people/bob": { "name": "Bob", "a": "http://organisms/human", "height": "190cm", "weight": "80kg", "hair-colour": "brown", "hair-length": "40cm", }
HTML
<div itemscope itemtype="http://organisms/human"> <h1 itemprop="name"> <a href="http://people/bob" itemprop="url">Bob</a> </h1> <dl> <dt>height</dt> <dd itemprop="height">180cm</dd> <dt>weight</dt> <dd itemprop="weight">70kg</dd> <dt>hair colour</dt> <dd itemprop="hair-colour">brown</dd> <dt>hair length</dt> <dd itemprop="hair-length">20cm</dd> </dl> </div>
JSON-LD
If the properties of the object are not all defined in the same "namespace" as the object itself (they might, for example, be shared between different classes of objects), we can extend the same idea to property names and use URLs for those too:
"http://people/bob": { "http://terms/name": "Bob", "http://terms/a": "http://organisms/human", "http://people-properties/height": 190, "http://people-properties/weight": 80, "http://people-properties/hair-colour": "brown", "http://people-properties/hair-length": 20, }
JSON-LD "context documents" specify this mapping from local names to URLs.
Turtle
This principle of using universally-unique identifiers extends to also using URLs (or typed literal values) for all the property values:
<http://people/bob> <http://terms/name> "Bob"^^xsd:string ; <http://terms/a> <http://organisms/human> ; <http://people-properties/height> "190"^^xsd:integer ; <http://people-properties/weight> "80"^^xsd:integer ; <http://people-properties/hair-colour> <http://colours/brown> ; <http://people-properties/hair-length> "20"^^xsd:integer .
Linked data
At this point, every part of the object description is either a URL or a literal value. This allows us to join all the objects and properties together into a graph (specifically, a directed acyclic graph), where each object is a node and each property is a connection between nodes (an edge).