39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# File 'lib/bel/translator/plugins/rdf/monkey_patch.rb', line 39
def to_rdf(graph_name = nil, remap = nil)
if !@enc && @ns.is_a?(BEL::Namespace::NamespaceDefinition)
@enc = @ns[@value].enc
end
if remap && remap['namespaces']
ro_ind = remap['namespaces'].index { |mapping|
mapping['remap'] && mapping['remap'].is_a?(Hash) &&
mapping['remap']['from'] && mapping['remap']['from'].is_a?(Hash) &&
mapping['remap']['from']['prefix'] == @ns.prefix.to_s &&
mapping['remap']['from']['url'] == @ns.url
}
if ro_ind
@ns.prefix = remap['namespaces'][ro_ind]['remap']['to']['prefix']
@ns.url = remap['namespaces'][ro_ind]['remap']['to']['url']
@ns.rdf_uri = remap['namespaces'][ro_ind]['remap']['to']['rdf_uri']
end
end
uri = to_uri
encodings = ['A'].concat(@enc.to_s.each_char.to_a).uniq
encodings.map! { |enc| concept_statement(enc, uri, graph_name)}
[uri, encodings]
end
|