Permalink
Browse files

Do not allow slash in RDF identifiers

  • Loading branch information...
1 parent da8a003 commit 246ad8a3c08bb3c868dc7114f6b910a0b29d94bf @pjotrp committed Nov 1, 2012
Showing with 8 additions and 4 deletions.
  1. +8 −4 lib/bio-table/rdf.rb
View
@@ -93,11 +93,15 @@ def write row, type
# --transform-ids (i.e. in the input side, rather than the output side)
#
def RDF::make_identifier(s)
- clean_s = s.gsub(/[^[:print:]]/, '').gsub(/[#)(,]/,"").gsub(/[%]/,"perc").gsub(/(\s|\.|\$)+/,"_")
- valid_id = if clean_s =~ /^\d/
- 'r' + clean_s
+ id = s.gsub(/[^[:print:]]/, '').gsub(/[#)(,]/,"").gsub(/[%]/,"perc").gsub(/(\s|\.|\$|\/|\\)+/,"_")
+ if id != s
+ logger = Bio::Log::LoggerPlus['bio-table']
+ logger.warn "Changed identifier <#{s}> to <#{id}>"
+ end
+ valid_id = if id =~ /^\d/
+ 'r' + id
else
- clean_s
+ id
end
valid_id
end

0 comments on commit 246ad8a

Please sign in to comment.