Ejemplo n.º 1
0
def from_rdf_dict(id, rdf_dict):

    ris_type = get_ris_type(id, rdf_dict)
    ris_dict = OrderedDefaultDict(rdf_fac(depth=1))
    ris_dict[TY].append(ris_type)
    mapper = type_map[ris_type](id, ris_type, None)[MAP_POS](id, ris_type) #ToDo Does this need a reverse type map?
    base_type = rdf_dict[id][ns.rdf['type']][0]
    grab_from_node(id, mapper, rdf_dict, ris_dict, base_type)

    return ris_dict
Ejemplo n.º 2
0
def from_rdf_dict(id, rdf_dict):

    bib_type = get_bibtex_type(id, rdf_dict)
    if bib_type is None: raise Exception("Cannot figure out Bibtex type. ")
    bib_dict = OrderedDefaultDict(rdf_fac(depth=1))
    bib_dict[type_key] = bib_type
    mapper = bibtex_to_rdf_type_map[bib_type](id, bib_type, None)[MAP_POS](id, bib_type) #ToDo Des this need a reverse type map?
    base_type = rdf_dict[id][ns.rdf['type']][0]
    grab_from_node(id, mapper, rdf_dict, bib_dict, base_type)
    return bib_dict
Ejemplo n.º 3
0
    def to_rdf_dict(self, bib_dict):
        self.pre_process(bib_dict)
        converted = {}
        order = []
        for i in bib_dict[1]:
            rdf_dict = OrderedDefaultDict(rdf_fac())
            bib_type, copy = self.make_copy(bib_dict[0][i])
            id = self.convert_entry_to_rdf_dict(i, bib_type, rdf_dict, copy)
            self.post_to_rdf_conversion_processing(id, copy, rdf_dict)
            converted[id] = rdf_dict
            order.append(id)

        return converted, order