Method: TTL2HTML::App#extract_license

Defined in:
lib/ttl2html.rb

#extract_license(data) ⇒ Object



402
403
404
405
406
407
408
409
410
411
412
413
414
415
# File 'lib/ttl2html.rb', line 402

def extract_license(data)
  license = {}
  if data["http://purl.org/dc/terms/license"]
    license_data = @data[data["http://purl.org/dc/terms/license"].first]
    if license_data
      license[:url] = license_data["http://www.w3.org/1999/02/22-rdf-syntax-ns#value"]&.first
      license[:icon] = license_data["http://xmlns.com/foaf/0.1/thumbnail"]&.first
      license[:label] = license_data["http://www.w3.org/2000/01/rdf-schema#label"]
    elsif data["http://purl.org/dc/terms/license"].first =~ URI::regexp
      license[:url] = license[:label] = data["http://purl.org/dc/terms/license"].first
    end
  end
  license
end