Exemplo n.º 1
0
 def parse(self, response):
     g = None
     try:
         g = sotools.loadSOGraphFromHtml(response.body, response.url)
     except Exception as e:
         self.logger.warning(e)
     self.logger.info(
         f"response url = {response.url} has a Dataset = {sotools.isDataset(g)}"
     )
     identifiers = sotools.getDatasetIdentifiers(g)
     print(str(identifiers))
     metadata = sotools.getDatasetMetadataLinks(g)
     res = {
         "source": response.url,
         "identifiers": identifiers,
         "metadata": metadata
     }
     yield res
Exemplo n.º 2
0
# Get links to metadata documents referenced from a SO:dataset
import sotools
from pprint import pprint

json_source = "examples/data/ds_m_subjectof.json"
g = sotools.loadSOGraph(filename=json_source,
                        publicID="https://my.server.net/data/")
links = sotools.getDatasetMetadataLinks(g)
pprint(links, indent=2)