diff options
-rwxr-xr-x | lv2specgen/lv2specgen.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lv2specgen/lv2specgen.py b/lv2specgen/lv2specgen.py index 79c33e5..24cacd2 100755 --- a/lv2specgen/lv2specgen.py +++ b/lv2specgen/lv2specgen.py @@ -429,13 +429,16 @@ def getTermLink(uri, subject=None, predicate=None): def owlRestrictionInfo(term, m): """Generate OWL restriction information for Classes""" - doc = "" - restrictions = [] for s in findStatements(m, term, rdfs.subClassOf, None): if findOne(m, getObject(s), rdf.type, owl.Restriction): restrictions.append(getObject(s)) + if not restrictions: + return '' + + doc = '<dl>' + for r in sorted(restrictions): props = findStatements(m, r, None, None) onProp = None @@ -446,7 +449,7 @@ def owlRestrictionInfo(term, m): elif getPredicate(p) == rdfs.comment: comment = getObject(p) if onProp is not None: - doc += '<dl><dt>Restriction on %s</dt>\n' % getTermLink(onProp) + doc += '<dt>Restriction on %s</dt>\n' % getTermLink(onProp) prop_str = '' for p in findStatements(m, r, None, None): @@ -466,8 +469,9 @@ def owlRestrictionInfo(term, m): if comment is not None: prop_str += '\n<div>%s</div>\n' % getLiteralString(comment) - doc += '<dd>%s</dd></dl>' % prop_str if prop_str else ''; + doc += '<dd>%s</dd>' % prop_str if prop_str else ''; + doc += '</dl>' return doc def rdfsClassInfo(term, m): |