@@ -0,0 +1,2444 @@
+from rdflib import *%0A%0A%0ABF = Namespace(%22http://bibframe.org/vocab/%22)%0AABS = Namespace(%22http://bibframe.org/model-abstract/%22)%0A%0Adef print_bibframe(g):%0A    g.namespace_manager.bind(None, BF)%0A    global otherclasses, otherprops%0A    otherclasses = set(g.subjects(RDF.type, RDFS.Class))%0A    otherprops = set(g.subjects(RDF.type, ABS.BFProperty))%0A    print_class(g.resource(BF.Resource))%0A    #for c in sorted(otherclasses):%0A    #    if not g.value(c, RDFS.subClassOf):%0A    #        print_class(g.resource(c))%0A    for c in sorted(otherclasses):%0A        print_class(g.resource(c))%0A    if otherprops:%0A        print %22#Other%22%0A        for p in sorted(otherprops):%0A            print_propsum(g.resource(p), None, %22   %22)%0A%0Adef print_class(c, superclasses=set()):%0A    indent = %22    %22 * len(superclasses)%0A    subnote = %22/ %22 if superclasses else %22%22%0A    superclasses = superclasses %7C %7Bc%7D%0A    otherclasses.discard(c.identifier)%0A    print indent + subnote + c.qname()%0A    props = sorted(c.subjects(RDFS.domain))%0A    for prop in props:%0A        if any(prop.objects(RDFS.subPropertyOf)):%0A            continue%0A        otherprops.discard(prop.identifier)%0A        lbl = prop.qname()%0A        ranges = tuple(prop.objects(RDFS.range))%0A        if ranges:%0A            lbl += %22 =%3E %22 + %22, %22.join(rc.qname() for rc in ranges)%0A        marc = prop.value(ABS.marcField)%0A        if marc:%0A            lbl += %22 # %22 + marc%0A        print indent + %22    %22 + lbl%0A        print_subproperties(prop, c, %22       %22)%0A    for subc in sorted(c.subjects(RDFS.subClassOf)):%0A        if subc in superclasses:%0A            print indent, %22%3C=%22, subc.qname()%0A            continue%0A        print_class(subc, superclasses)%0A    if props:%0A        print%0A%0Adef print_subproperties(prop, domain, indent):%0A    for subprop in sorted(prop.subjects(RDFS.subPropertyOf)):%0A        otherprops.discard(subprop.identifier)%0A        print_propsum(subprop, domain, indent)%0A        print_subproperties(subprop, domain, indent + %22    %22)%0A%0Adef print_propsum(subprop, domain, indent):%0A    lbl = subprop.qname()%0A    subpropdomains = sorted(subprop.objects(RDFS.domain))%0A    if subpropdomains and subpropdomains != %5Bdomain%5D:%0A        lbl += %22 of %22 + %22, %22.join(spd.qname() for spd in subpropdomains)%0A    marc = subprop.value(ABS.marcField)%0A    if marc:%0A        lbl += %22 # %22 + marc%0A    print indent, lbl%0A%0A%0Aif __name__ == '__main__':%0A    from sys import argv%0A    src = argv%5B1%5D%0A    g = Graph().parse(src, format=%22turtle%22)%0A    print_bibframe(g)%0A

Add bibframe-summary.py