class BibCard::Person
Public Instance Methods
dbpedia_resource()
click to toggle source
# File lib/bib_card/person.rb, line 46 def dbpedia_resource self.dbpedia_uri.as(BibCard::DBPedia::Resource) if self.dbpedia_uri end
dbpedia_uri()
click to toggle source
# File lib/bib_card/person.rb, line 30 def dbpedia_uri stmt = related_entity_by_uri_prefix("http://dbpedia.org/resource") stmt.nil? ? nil : stmt.object end
getty_subject()
click to toggle source
# File lib/bib_card/person.rb, line 50 def getty_subject self.getty_uri.as(BibCard::Getty::Subject) if self.getty_uri end
getty_uri()
click to toggle source
# File lib/bib_card/person.rb, line 35 def getty_uri stmt = related_entity_by_uri_prefix("http://vocab.getty.edu/ulan") # Note that we are modifying the URI to get the RWO URI stmt.nil? ? nil : RDF::URI.new( stmt.object.to_s.gsub('-agent', '') ) end
loc_uri()
click to toggle source
# File lib/bib_card/person.rb, line 25 def loc_uri stmt = related_entity_by_uri_prefix("http://id.loc.gov/authorities/names/") stmt.nil? ? nil : stmt.object end
name(preferred_languages = nil)
click to toggle source
# File lib/bib_card/person.rb, line 12 def name(preferred_languages = nil) if preferred_languages matches = Spira.repository.query({subject: @subject, predicate: SCHEMA_NAME}).reduce(Array.new) do |matches, stmt| language = stmt.object.language.to_s matches << stmt if preferred_languages.include?(language) matches end else matches = Spira.repository.query({subject: @subject, predicate: SCHEMA_NAME}) end matches.first.nil? ? nil : matches.first.object.to_s end
uri()
click to toggle source
# File lib/bib_card/person.rb, line 8 def uri self.subject end
wikidata_entity()
click to toggle source
# File lib/bib_card/person.rb, line 54 def wikidata_entity self.wikidata_uri.as(BibCard::Wikidata::Entity) if self.wikidata_uri end
wikidata_uri()
click to toggle source
# File lib/bib_card/person.rb, line 41 def wikidata_uri stmt = related_entity_by_uri_prefix("http://www.wikidata.org/entity") stmt.nil? ? nil : stmt.object end