def org_top_categories(orgs):
g = Graph()
for org_name in orgs:
#print>>sys.stderr, "Processing", org_name, "top categories"
org_uri = waan_uri(org_name)
ln = local_name(org_uri)
top_cat = load_incites_json_file(org_name, 'categories')
for item in top_cat:
cat = item['category']
category_uri = get_category_uri(cat)
curi = D['topcategory-'] + ln + slugify(cat)
g.add((curi, RDF.type, WOS.InCitesTopCategory))
g.add((curi, RDFS.label, Literal("{} - {}".format(org_name, cat))))
g.add((curi, WOS.number, Literal(item['count'])))
g.add((curi, VIVO.relates, category_uri))
g.add((curi, VIVO.relates, org_uri))
#print g.serialize(format="turtle")
ng = "http://localhost/data/incites-top-categories"
backend.sync_updates(ng, g)
return True
评论列表
文章目录