Exemplo n.º 1
0
 def test_get_high_level_entity_from_url(self):
     schema_parser = SchemaParser(None)
     url = "https://schema.humancellatlas.org/type/project/5.1.0/project"
     self.assertEqual("type",
                      schema_parser.get_high_level_entity_from_url(url))
     url = 'http://schema.dev.data.humancellatlas.org/system/1.0.0/provenance'
     self.assertEqual('system',
                      schema_parser.get_high_level_entity_from_url(url))
Exemplo n.º 2
0
 def test_get_domain_entity_from_url(self):
     schema_parser = SchemaParser(None)
     url = "https://schema.humancellatlas.org/type/project/5.1.0/project"
     self.assertEqual("project",
                      schema_parser.get_domain_entity_from_url(url))
     url = "https://schema.humancellatlas.org/type/foo/bar/5.1.0/project"
     self.assertEqual("foo/bar",
                      schema_parser.get_domain_entity_from_url(url))
     url = "https://schema.humancellatlas.org/type/foo/bar/latest/project"
     self.assertEqual("foo/bar",
                      schema_parser.get_domain_entity_from_url(url))
     url = "https://schema.humancellatlas.org/type/foo/latest/project"
     self.assertEqual("foo", schema_parser.get_domain_entity_from_url(url))
     url = 'https://schema.humancellatlas.org/bundle/1.0.0/links'
     self.assertEqual(None, schema_parser.get_domain_entity_from_url(url))
     url = 'http://schema.dev.data.humancellatlas.org/system/1.0.0/provenance'
     self.assertEqual(None, schema_parser.get_domain_entity_from_url(url))
Exemplo n.º 3
0
 def test_get_module_from_url(self):
     schema_parser = SchemaParser(None)
     url = "https://schema.humancellatlas.org/type/project/5.1.0/project"
     self.assertEqual("project", schema_parser.get_module_from_url(url))
Exemplo n.º 4
0
"""
__author__ = "jupp"
__license__ = "Apache 2.0"
__date__ = "11/01/2019"

from ingest.template.schema_template import SchemaTemplate
from ingest.template.schema_template import SchemaParser
from yaml import dump as yaml_dump
from yaml import load as yaml_load

import urllib.request
import json
import jsonref

template = SchemaTemplate()
parser = SchemaParser(template)

INGESTAPI = "http://api.ingest.dev.data.humancellatlas.org"

list_of_schema_urls = template.get_latest_submittable_schema_urls(INGESTAPI)


def get_data(uri):

    print("getting " + uri)

    with urllib.request.urlopen(uri) as url:
        data = json.loads(url.read().decode())

        if parser.get_high_level_entity_from_url(uri) != 'type':
            del data["$id"]