lib/bel/translator/plugins/bel_script/evidence_yielder.rb in bel-0.4.2 vs lib/bel/translator/plugins/bel_script/evidence_yielder.rb in bel-0.5.0
- old
+ new
@@ -22,20 +22,21 @@
def each
if block_given?
::BEL::Script.parse(@data).each { |parsed_obj|
case parsed_obj
when ::BEL::Language::DocumentProperty
- @metadata.document_header[parsed_obj.name] = parsed_obj.value
+ @metadata.document_header[parsed_obj.name.to_sym] = parsed_obj.value
when ::BEL::Model::Statement
yield to_evidence(parsed_obj, @references, @metadata)
when ::BEL::Language::AnnotationDefinition
- @references.annotations[parsed_obj.prefix] = {
- :type => parsed_obj.type,
- :domain => parsed_obj.value
- }
+ @references.add_annotation(
+ parsed_obj.prefix,
+ parsed_obj.type,
+ parsed_obj.value
+ )
when ::BEL::Namespace::NamespaceDefinition
- @references.namespaces[parsed_obj.prefix] = parsed_obj.url
+ @references.add_namespace(parsed_obj.prefix, parsed_obj.url)
end
}
else
to_enum(:each)
end
@@ -70,18 +71,9 @@
value = v.value
obj = {
:name => k,
:value => value
}
-
- annotation_def = references.annotations[k]
- if annotation_def
- type, domain = annotation_def.values_at(:type, :domain)
- if type == :url
- obj[:uri] = "#{domain}/#{value}"
- obj[:url] = domain
- end
- end
obj
}
)