aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-03-19 17:55:11 +0100
committerDavid Robillard <d@drobilla.net>2020-03-28 17:10:05 +0100
commitb709e4ff1a10c26fc965ea9f9fc0d46b2cc7d9d5 (patch)
tree76474a3be75c5fbbbdb4e1215d0a91c625a58bea
parentb96839e61b21ae69becf52cebb42efe755ea9ad0 (diff)
downloadlv2-b709e4ff1a10c26fc965ea9f9fc0d46b2cc7d9d5.tar.xz
lv2specgen: Add list of subclasses to class documentation
-rwxr-xr-xlv2specgen/lv2specgen.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/lv2specgen/lv2specgen.py b/lv2specgen/lv2specgen.py
index d4d360a..fbecb23 100755
--- a/lv2specgen/lv2specgen.py
+++ b/lv2specgen/lv2specgen.py
@@ -460,7 +460,7 @@ def rdfsClassInfo(term, m):
global classdomains
doc = ""
- # Find subClassOf information
+ # Find superclasses
superclasses = set()
for st in findStatements(m, term, rdfs.subClassOf, None):
if not isBlank(getObject(st)):
@@ -474,6 +474,20 @@ def rdfsClassInfo(term, m):
doc += getProperty(getTermLink(superclass), first)
first = False
+ # Find subclasses
+ subclasses = set()
+ for st in findStatements(m, None, rdfs.subClassOf, term):
+ if not isBlank(getObject(st)):
+ uri = getSubject(st)
+ subclasses |= set([uri])
+
+ if len(subclasses) > 0:
+ doc += "\n<tr><th>Superclass of</th>"
+ first = True
+ for superclass in sorted(subclasses):
+ doc += getProperty(getTermLink(superclass), first)
+ first = False
+
# Find out about properties which have rdfs:domain of t
d = classdomains.get(str(term), "")
if d: