Created
May 10, 2011 16:57
-
-
Save sbp/964888 to your computer and use it in GitHub Desktop.
schemadoc patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ diff -Naur schemadoc-2006-12-21.py schemadoc.py | |
--- schemadoc-2006-12-21.py 2006-12-21 17:31:40.000000000 +0000 | |
+++ schemadoc.py 2011-05-10 18:08:38.000000000 +0100 | |
@@ -6,7 +6,7 @@ | |
""" | |
import sys | |
-from rdflib.Graph import ConjunctiveGraph as Graph | |
+from rdflib import ConjunctiveGraph as Graph | |
from rdflib import URIRef, Literal, BNode, Namespace | |
from rdflib import RDF, RDFS | |
@@ -104,7 +104,7 @@ | |
<body> | |
<h1>Schema Documentation</h1> | |
""" | |
- classes = [] | |
+ classes = {} | |
for metaclass in [RDFS.Class, OWL.Class]: | |
for uri in G.subjects(RDF.type, metaclass): | |
if not isinstance(uri, URIRef): continue | |
@@ -118,11 +118,11 @@ | |
c.properties.append((p, ranges)) | |
# c.properties = [Property(u) for u in G.subjects(RDFS.domain, uri)] | |
c.comments = [str(s) for s in G.objects(uri, RDFS.comment)] | |
- classes.append(c) | |
+ classes[c.name()] = c | |
print '<h2>Classes</h2>' | |
print '<ul>' | |
- for c in sorted(classes): | |
+ for c in sorted(classes.values()): | |
print '<li>' | |
print '<dl>' | |
print '<dt class="class">' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment