Padārtha Ontology as a Knowledge Representation Model
Chapter Sixty-Four
Syllabus topic Module 2, "Padārtha (categorical ontology overview)", "Knowledge representation", "Algorithm Specification (Pseudo-code)"
Pages 221 to 225 of 378
In one line
Write the six categories as data, make inherence an entry rather than a line, and the scheme becomes something you can query.
In the wording you can write in an examination: a knowledge representation model built on the padārtha scheme assigns every entry to exactly one of the categories, represents attributes and actions as entries in their own right rather than as fields of a substance, and represents the inherence relation as a further entry linking an attribute to its substance. Queries are then answered by selecting entries of the appropriate category, and the scheme can be checked for well-formedness by confirming that every entry has a category and every reference resolves.
Problem statement, in MU's own form
IKS concept as CS concept: the padārtha scheme of the Vaiśeṣika system as an ontology, with queries and a well-formedness check.
Statement. Represent a small domain as entries each assigned to one of the seven padārthas. Represent inherence as its own entry rather than as a field, so that the relation is first class. Answer queries that select by category, and check that the whole is well formed.
Conceptual mapping table
| Classical element | Computer science element |
|---|---|
| dravya, substance | an instance that exists independently |
| guṇa, attribute | a property value, held as an entry of its own |
| karma, action | an event, held the same way |
| sāmānya, genus | a class, with its extension recorded |
| viśeṣa, particularity | an identity, distinguishing indistinguishable instances |
| samavāya, inherence | a link entry joining an attribute to a substance |
| abhāva, non-existence | an explicitly recorded absence |
| "everything nameable falls under one of the six" | the well-formedness condition |
Algorithm specification, in pseudo-code
STRUCTURE
every entry has a NAME, a CATEGORY drawn from the seven, and its own facts
QUERY attributes_of(substance)
return the attribute of every samavaya entry whose substance is this one
QUERY bearers_of(attribute)
return the substance of every samavaya entry whose attribute is this one
QUERY instances_of(genus)
return what the genus entry records itself as holding of
QUERY known_absent(substance)
return what every abhava entry records as absent from this one
CHECK well_formed
for every entry:
its category must be one of the seven
every reference it makes to an entry must name an entry that exists
The design point is in the first two queries. Because inherence is an entry, the same relation can be walked in both directions with no extra structure. If the colour were a field on the pot, finding what bears the colour red would need a scan of every substance.
Working code
"""Padartha ontology as a knowledge representation model. MU's topic 7."""
PADARTHA = ["dravya", "guna", "karma", "samanya", "visesa", "samavaya", "abhava"]
# Each entry: (padartha, the facts that entry carries)
ONTOLOGY = {
# substances: they bear attributes and actions
"pot1": ("dravya", {"kind": "pot", "made_of": "earth"}),
"pot2": ("dravya", {"kind": "pot", "made_of": "earth"}),
"lamp1": ("dravya", {"kind": "lamp", "made_of": "fire"}),
# genera: what many substances share
"potness": ("samanya", {"holds_of": ["pot1", "pot2"]}),
"lampness": ("samanya", {"holds_of": ["lamp1"]}),
# particularities: what makes two otherwise identical substances two
"this1": ("visesa", {"of": "pot1"}),
"this2": ("visesa", {"of": "pot2"}),
# attributes, each inhering in a substance by an inherence relation
"red": ("guna", {"value": "red", "of_kind": "colour"}),
"blue": ("guna", {"value": "blue", "of_kind": "colour"}),
"bright": ("guna", {"value": "bright", "of_kind": "luminosity"}),
# actions
"falling": ("karma", {"of_kind": "motion"}),
# inherence: the relation itself is an entry, which is the design point
"inh1": ("samavaya", {"attribute": "red", "substance": "pot1"}),
"inh2": ("samavaya", {"attribute": "blue", "substance": "pot2"}),
"inh3": ("samavaya", {"attribute": "bright", "substance": "lamp1"}),
"inh4": ("samavaya", {"attribute": "falling", "substance": "pot2"}),
# non-existence, recorded explicitly rather than by silence
"no_colour_on_lamp": ("abhava", {"absent": "colour", "from": "lamp1"}),
}
def category(name):
return ONTOLOGY[name][0] if name in ONTOLOGY else None
def facts(name):
return ONTOLOGY[name][1] if name in ONTOLOGY else {}
def attributes_of(substance):
"""Every attribute or action inhering in a substance, via samavaya."""
out = []
for name, (cat, f) in ONTOLOGY.items():
if cat == "samavaya" and f.get("substance") == substance:
out.append(f["attribute"])
return sorted(out)
def bearers_of(attribute):
return sorted(f["substance"] for cat, f in
(ONTOLOGY[n] for n in ONTOLOGY)
if cat == "samavaya" and f.get("attribute") == attribute)
def instances_of(genus):
return sorted(facts(genus).get("holds_of", []))
def known_absent(substance):
return sorted(f["absent"] for cat, f in
(ONTOLOGY[n] for n in ONTOLOGY)
if cat == "abhava" and f.get("from") == substance)
def identity_of(substance):
for name, (cat, f) in ONTOLOGY.items():
if cat == "visesa" and f.get("of") == substance:
return name
return None
def check_well_formed():
"""Every entry is in exactly one category, and every reference resolves."""
problems = []
for name, (cat, f) in ONTOLOGY.items():
if cat not in PADARTHA:
problems.append("%s: unknown category %s" % (name, cat))
for key in ("of", "substance", "attribute", "from"):
ref = f.get(key)
if ref is not None and ref not in ONTOLOGY:
problems.append("%s: %s points at %s, which is not in the ontology"
% (name, key, ref))
for ref in f.get("holds_of", []):
if ref not in ONTOLOGY:
problems.append("%s: holds_of names %s, which is not in the ontology" % (name, ref))
return problems
QUERIES = [
("what inheres in pot1?", lambda: attributes_of("pot1")),
("what inheres in pot2?", lambda: attributes_of("pot2")),
("what bears the attribute red?", lambda: bearers_of("red")),
("what falls under potness?", lambda: instances_of("potness")),
("what distinguishes pot1 from pot2?", lambda: [identity_of("pot1"), identity_of("pot2")]),
("what is KNOWN to be absent from lamp1?", lambda: known_absent("lamp1")),
("what is known to be absent from pot1?", lambda: known_absent("pot1")),
("category of samavaya entry inh1", lambda: [category("inh1")]),
("category of potness", lambda: [category("potness")]),
("category of an unknown name", lambda: [category("nothing")]),
]
print("%-42s %s" % ("query", "answer"))
for q, fn in QUERIES:
print("%-42s %s" % (q, fn() or "(nothing)"))
print()
print("entries by category")
for p in PADARTHA:
names = sorted(n for n in ONTOLOGY if category(n) == p)
print(" %-10s %d %s" % (p, len(names), ", ".join(names)))
print()
bad = check_well_formed()
print("well-formedness:", "%d problem(s)" % len(bad) if bad else "every entry is in one "
"category and every reference resolves")
for b in bad:
print(" " + b)Padārtha Ontology as a Knowledge Representation Model
query answer
what inheres in pot1? ['red']
what inheres in pot2? ['blue', 'falling']
what bears the attribute red? ['pot1']
what falls under potness? ['pot1', 'pot2']
what distinguishes pot1 from pot2? ['this1', 'this2']
what is KNOWN to be absent from lamp1? ['colour']
what is known to be absent from pot1? (nothing)
category of samavaya entry inh1 ['samavaya']
category of potness ['samanya']
category of an unknown name [None]
entries by category
dravya 3 lamp1, pot1, pot2
guna 3 blue, bright, red
karma 1 falling
samanya 2 lampness, potness
visesa 2 this1, this2
samavaya 4 inh1, inh2, inh3, inh4
abhava 1 no_colour_on_lamp
well-formedness: every entry is in one category and every reference resolvesPadārtha Ontology as a Knowledge Representation Model
Reading the output
The two inherence queries run in opposite directions over the same entries. Nothing was added to make the reverse query possible; it is a consequence of making the relation an entry.
"What distinguishes pot1 from pot2?" returns two viśeṣa entries. Both pots are pots made of earth, so their substance facts are identical; the two particularities are what makes them two. That is object identity, and it is the modern problem viśeṣa was invented for.
"Known to be absent from lamp1" returns colour, and the same query on pot1 returns nothing. Those are two DIFFERENT answers: the lamp is recorded as having no colour, and nothing at all is recorded about the pot's. A representation that returned the same answer for both would have lost the distinction abhāva exists to preserve.
And the last query returns None for a name that is not in the ontology, which is a third state again: not an entry at all.
Three states, and why they must be three
This is the most useful thing in the chapter and it is a lesson people relearn every year.
| The question | The answer here | What it means |
|---|---|---|
| does lamp1 have a colour? | abhāva entry: colour is absent from lamp1 | we know it does not |
| does pot1 have a colour recorded as absent? | nothing | we have not said |
| is "nothing" an entry? | None | it is not in the ontology at all |
Collapse the first two and a system cannot distinguish "known to be none" from "not recorded". Every database that uses a null for both meets this, and every reporting system built on one gets a wrong total eventually. Kaṇāda's seventh category is exactly the fix, and Sinha records that Kaṇāda does not deny it.
Padārtha Ontology as a Knowledge Representation Model
The well-formedness check, and its declared hole
The check confirms two things: every entry's category is one of the seven, and every reference to an entry names an entry that exists. It reports no problems on this ontology.
And it does not check one field. The abhāva entry records that "colour" is absent from lamp1, and colour is a KIND of attribute rather than an entry: the entries are red, blue and bright, each of which has colour or luminosity as its kind. So "absent" names a kind and the reference check, which looks for entries, does not apply to it.
That is a real limitation and it is stated here rather than hidden. A fuller implementation would have kinds as entries too, probably as sāmānya, and then the check would cover it. As written, a typo in an abhāva entry's "absent" field would pass.
Saying so is the point. A check whose limits are not declared is worse than no check, because it is trusted. This is the same discipline as [Śāstra Rule Precedence as a Deterministic Finite Rewrite System] reporting which precedence branches its tests exercise.
Complexity and limitations
Time. Every query is a scan of the entries, so it is proportional to the size of the ontology. A real system would index the samavāya entries by substance and by attribute, turning each scan into a lookup, which is the standard move and the reason triple stores exist.
Space. One entry per thing, per attribute, per action, per genus, per identity, per inherence and per recorded absence. Making inherence an entry costs one entry per attribute held, which is the price of the reverse query.
Limitation: the ontology has no reasoner. Nothing infers that because pot1 falls under potness and potness is a genus, pot1 is a substance. Every fact is stated. Adding inference is what [Inference Engines: Forward and Backward Chaining] does, and combining the two is what a modern ontology system is.
Limitation: sāmānya is recorded extensionally. The genus entry lists the substances it holds of, rather than stating a condition they satisfy. That works for three pots and not for a million, and the alternative, a condition, is what a class definition in a modern ontology gives you.
Limitation: it is not Kaṇāda's own domain. Pots and lamps are the tradition's standard examples, and the ontology here is small enough to read. Nothing about the size of the example bears on whether the scheme is sound.
Quick revision
- Every entry carries exactly one of the seven padārthas, which is the well-formedness condition.
- Inherence is an entry, not a link in the notation, so the relation is queryable in both directions for free.
- Viśeṣa gives object identity: two pots with identical facts are two because two particularities say so.
- Abhāva gives an explicit absence, and the three states are known-absent, not-recorded, and not-an-entry. Collapsing the first two is a standard and expensive mistake.
- The well-formedness check covers categories and entry references, and does NOT cover the field that names a kind, which is stated on the page.
- Limitations: no reasoner, genus recorded extensionally, and every query is a scan without indexes.
Padārtha Ontology as a Knowledge Representation Model
Test yourself
1. Why is inherence represented as an entry rather than as a field on the substance?
Because a relation held as an entry can be walked in both directions with no additional structure: the same entries answer "what inheres in this substance" and "what bears this attribute". As a field, the reverse query would need a scan of every substance.
2. Distinguish the three answers the ontology can give about an attribute of a thing.
An abhāva entry records that the attribute is known to be absent. No entry at all means nothing has been recorded. A name not in the ontology means the thing is not represented. A system that collapses the first two loses the distinction that abhāva exists to preserve.
3. What does the well-formedness check NOT cover, and why does saying so matter?
It does not check the field of an abhāva entry that names a kind of attribute rather than an entry, so a typo there would pass. It matters because a check whose limits are undeclared is trusted beyond what it establishes.
4. Give two limitations of this ontology as a knowledge representation.
It has no reasoner, so every fact must be stated rather than derived; and a genus records its extension, the list of things it holds of, rather than a condition those things satisfy, which does not scale.
The rest of this subject
These notes are cut from the University's printed syllabus. Open the syllabus itself for the same subject.