Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Remove duplicated ontology scheme rows #584

Merged
merged 5 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading