Skip to content
This repository has been archived by the owner on Sep 24, 2019. It is now read-only.

Commit

Permalink
do not facet null-valued properties; closes #69
Browse files Browse the repository at this point in the history
facets are not created for null-valued properties in the following
sections:

- citation
- biological_context
- metadata

this change has the most affect on metadata, because the evidence
schema does not put constaints on null values.
  • Loading branch information
abargnesi committed Mar 27, 2015
1 parent 0da4781 commit 114a986
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions lib/evidence/facet_filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,15 @@ def map_biological_context_facets(biological_context)
value = annotation[:value]
if value.respond_to?(:each)
value.map { |v|
self.make_filter(:biological_context, name, v)
[:biological_context, name, v]
}
else
self.make_filter(:biological_context, name, value)
[:biological_context, name, value]
end
}.select { |category, name, value|
value != nil
}.map { |filter|
self.make_filter(*filter)
}
else
EMPTY
Expand All @@ -45,7 +49,11 @@ def map_biological_context_facets(biological_context)
def map_metadata_facets(metadata)
if metadata
metadata.map { |name, value|
self.make_filter(:metadata, name, value)
[:metadata, name, value]
}.select { |category, name, value|
value != nil
}.map { |filter|
self.make_filter(*filter)
}
else
EMPTY
Expand Down

0 comments on commit 114a986

Please sign in to comment.