예제 #1
0
def map_measures(votable_path):
    vodml_instance = VodmlInstance(votable_path)
    vodml_instance.populate_templates()
    vodml_instance.connect_join_iterators()

    instance = vodml_instance.get_root_element("mango:MangoObject")
    if instance is None:
        raise Exception("No root element found")

    while True:
        inst = instance._get_next_row_instance()
        if inst != None:
            break
        else:
            break

    #BUG 2 parameters arrays are nested
    #TODO 2 be fixed
    parameters = inst["mango:MangoObject.parameters"]
    parameters = parameters[0]["mango:MangoObject.parameters"]
    parameter_map = {}
    for parameter in parameters:
        ucd = parameter["mango:Parameter.ucd"]["@value"]
        classe = parameter["mango:Parameter.measure"]["@dmtype"]
        semantic = parameter["mango:Parameter.semantic"]["@value"]
        description = parameter["mango:Parameter.description"]["@value"]
        parameter_map[classe] = {
            "class": classe,
            "ucd": ucd,
            "semantic": semantic,
            "description": description
        }
    return parameter_map
예제 #2
0
from client.demo import data_dir

from utils.dict_utils import DictUtils

from client.inst_builder.vodml_instance import VodmlInstance

if __name__ == '__main__':
    base_path = os.path.dirname(os.path.realpath(__file__))
    votable_path = os.path.join(data_dir, "annotated_data",
                                "vizier_votable_avecActivity_Vo-dml-lite.xml")
    vodml_instance = VodmlInstance(votable_path)
    vodml_instance.populate_templates()
    vodml_instance.connect_join_iterators()

    instance = vodml_instance.get_root_element("voprov:Entity")

    print(DictUtils.get_pretty_json(instance.json))
    print("=== Mapping of the columns")
    print(instance.get_flatten_data_head())
    #print(instance.get_data_subset_keys())
    print("=== First row: flatten mode")
    while True:
        inst = instance._get_next_flatten_row()
        if inst != None:
            print(DictUtils.get_pretty_json(inst))
            break
        else:
            break

    print("=== Second row: instance mode")
    sys.path.append(file_path)

from utils.dict_utils import DictUtils
from client.inst_builder.vodml_instance import VodmlInstance

from client.demo import data_dir

if __name__ == '__main__':
    base_path = os.path.dirname(os.path.realpath(__file__))
    votable_path = os.path.join(data_dir, "annotated_data",
                                "vizier_gaiadr2.annot.xml")
    vodml_instance = VodmlInstance(votable_path)
    vodml_instance.populate_templates()
    vodml_instance.connect_join_iterators()

    instance = vodml_instance.get_root_element("mango:MangoObject")
    if instance is None:
        raise Exception("No root element found")

    print("=== Mapping of the columns")
    print(instance.get_flatten_data_head())
    #print(instance.get_data_subset_keys())
    print("=== First row: flatten mode")
    while True:
        inst = instance._get_next_flatten_row()
        if inst != None:
            print(DictUtils.get_pretty_json(inst))
            break
        else:
            break
예제 #4
0
import os
from utils.dict_utils import DictUtils
from client.inst_builder.vodml_instance import VodmlInstance

from demo import data_dir

if __name__ == '__main__':
    base_path = os.path.dirname(os.path.realpath(__file__))
    votable_path = os.path.join(data_dir, "annotated_data",
                                "4xmm_detections.annot.xml")
    vodml_instance = VodmlInstance(votable_path)
    vodml_instance.populate_templates()
    vodml_instance.connect_join_iterators()

    instance = vodml_instance.get_root_element("mango:Source")
    if instance is None:
        raise Exception("No root element found")

    print("=== Mapping of the columns")
    print(instance.get_flatten_data_head())
    #print(instance.get_data_subset_keys())
    print("=== First row: flatten mode")
    while True:
        inst = instance._get_next_flatten_row()
        if inst != None:
            print(DictUtils.get_pretty_json(inst))
            break
        else:
            break
from utils.dict_utils import DictUtils
from client.inst_builder.vodml_instance import VodmlInstance

from client.demo import data_dir
from client.inst_builder.astropy_wrapper import AstropyWrapper

if __name__ == '__main__':
    base_path = os.path.dirname(os.path.realpath(__file__)) 
    votable_path = os.path.join(data_dir, 
                                "annotated_data",
                                "4xmm_detections.annot.xml"
                                )
    vodml_instance = VodmlInstance(votable_path)
    vodml_instance.populate_templates(resolve_refs=True)
    vodml_instance.connect_join_iterators()
    table_row_instances = vodml_instance.get_root_element("mango:MangoObject")

    if len(vodml_instance.table_mappers) == 0:
        print("no table mapper")
        sys.exit(1)
    mapper_name = None
    for k, v in vodml_instance.table_mappers.items():
        print("process table mapper {}".format(k))
        mapper_name = k
        break;
    
    while True:
        inst = table_row_instances._get_next_row_instance()
        if inst != None:
            print(DictUtils.get_pretty_json(inst))
        break