def process(self, id, rdf_dict): try: if ns.bibo["doi"] in rdf_dict[id]: url = "http://dx.doi.org/%s" % rdf_dict[id][ns.bibo["doi"]][0] self.logger.info("Grabbing data from: %s" % url) graph = create_graph() graph.parse(url) self.logger.info("Retrieved data from: %s" % url, extra= { notify_user: True, }) plugins = lookup_plugin_by_type(GREF_DOI_RDF_PROCESSOR) for updater in plugins: try: updater().process(id, url, rdf_dict, graph) except Exception, e: self.logger.exception(e.message) except Exception, e: self.logger.exception(e.message)
def dump_rdf(self, results, format="pretty-xml"): for i in results[0]: graph = create_graph() internal_rdf_dict_to_graph(i, results[0][i], graph) print graph.serialize(format=format)