Add more export formats (e.g. as offered but obsolete at schema.rdfs.org) #208
Here's a quick look at reproducing the CSV export for types. You can run it in localhost:8000/console in appengine.
# CSV for types:
# id,label,comment,ancestors,supertypes,subtypes,properties
# ComedyClub,Comedy Club,,Thing Organization LocalBusiness EntertainmentBusiness,EntertainmentBusiness,,
import pprint
from api import *
t = 'CreativeWork'
di = Unit.GetUnit("domainIncludes")
ri = Unit.GetUnit("rangeIncludes")
def GetLabel(term):
for triple in term.arcsOut:
if (triple.arc.id == 'rdfs:label'):
return triple.text
def PropsForType(term):
for prop in sorted(GetSources(di, term), key=lambda u: u.id):
pprint.pprint("Property: %s" % prop.id )
term = Unit.GetUnit(t)
term_desc = GetComment(term)
p_subtypes = GetImmediateSubtypes(term)
p_supertypes = GetImmediateSupertypes(term)
subs = ( "Direct subtypes of %s: %s" % ( term.id, ', '.join([str(x.id) for x in p_subtypes]) ) )
sups = ( "Direct supertypes of %s: %s" % ( term.id, ', '.join([str(x.id) for x in p_supertypes]) ) )
pprint.pprint("Term: %s Label: %s Desc: %s Subs: %s Supers: %s Properties: %s" % (term.id, GetLabel(term), term_desc, subs, sups, PropsForType(term) ) )
(see https://github.com/rvguha/schemaorg/wiki/AppEngine re appengine console)
What about mapping to/from OWL? Now I have a microdata->RDF parser working, I can get back to hacking on this.
I'm not sure if it's better to use anonymous union classes where there are multiple domain and range statements given, or whether defining a named equivalent class is nicer (that has the advantage of possibly catching some missing abstractions when the hierarchy is classified ).
I'm feeling lazy enough to not bother trying to be clever about properties that are data and object valued, and just box incoming literal values.
@danbri is this still on the agenda? Specifically looking for an up-to-date json-LD representation including attribute-types
schema.rdfs.org offers JSON and CSV views of schema.org. However it is un-maintained. We are now reasonably well set up to do more of this kind of thing within schema.org itself than when both sites were first launched.