Skip to content

Commit

Permalink
Fix: Remove duplicated ontology scheme rows (#584)
Browse files Browse the repository at this point in the history
* remove duplicated ontology scheme rows

* move the concept details row duplication logic to filter_properties function

* clean concept details component code

* reject bottom set keys from leftover in concepts details component

* fix skos-xl not been displayed in the raw data section
  • Loading branch information
Bilelkihal authored Apr 26, 2024
1 parent cc058df commit 2360d29
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
5 changes: 3 additions & 2 deletions app/components/concept_details_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,12 @@ def properties_set_by_keys(keys, concept_properties, exclude_keys = [])
end
end

def filter_properties(top_keys, bottom_keys, exclude_keys, concept_properties)
def filter_properties(top_keys, bottom_keys, exclude_keys, concept_properties)
all_keys = concept_properties&.keys || []
top_set = properties_set_by_keys(top_keys, concept_properties, exclude_keys)
bottom_set = properties_set_by_keys(bottom_keys, concept_properties, exclude_keys)
leftover = properties_set_by_keys(all_keys - top_keys - bottom_keys, concept_properties, exclude_keys)
leftover = properties_set_by_keys(all_keys, concept_properties, exclude_keys)
leftover = leftover.reject { |key, _| top_set.key?(key) || bottom_set.key?(key) }
[top_set, leftover, bottom_set]
end

Expand Down
13 changes: 10 additions & 3 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ module ApplicationHelper
:cc => "http://creativecommons.org/ns#", :schema => "http://schema.org/", :doap => "http://usefulinc.com/ns/doap#", :bibo => "http://purl.org/ontology/bibo/",
:wdrs => "http://www.w3.org/2007/05/powder-s#", :cito => "http://purl.org/spar/cito/", :pav => "http://purl.org/pav/", :nkos => "http://w3id.org/nkos/nkostype#",
:oboInOwl => "http://www.geneontology.org/formats/oboInOwl#", :idot => "http://identifiers.org/idot/", :sd => "http://www.w3.org/ns/sparql-service-description#",
:cclicense => "http://creativecommons.org/licenses/"}
:cclicense => "http://creativecommons.org/licenses/",
'skos-xl' => "http://www.w3.org/2008/05/skos-xl#"}
def url_to_endpoint(url)
uri = URI.parse(url)
endpoint = uri.path.sub(/^\//, '')
Expand Down Expand Up @@ -556,7 +557,13 @@ def prefix_properties(concept_properties)
next if key_string.include?('metadata')

modified_key = prefix_property_url(key_string, key)
modified_properties[modified_key] = value unless modified_key.nil?

if modified_key
modified_properties[modified_key] = value
else
modified_properties[link_last_part(key_string)] = value
end

end
end

Expand All @@ -582,7 +589,7 @@ def prefix_property_url(key_string, key = nil)
elsif key.nil? && namespace_key
namespace_key
else # we don't try to guess the prefix
nil
nil
end
end

Expand Down

0 comments on commit 2360d29

Please sign in to comment.