Class: Marc2LinkedData::Loc
Constant Summary
collapse
- PREFIX =
'http://id.loc.gov/authorities/'
- PREFIX_NAMES =
"#{PREFIX}names/"
- PREFIX_SUBJECTS =
"#{PREFIX}subjects/"
Instance Attribute Summary
Attributes inherited from Resource
#iri
Instance Method Summary
collapse
Methods inherited from Resource
#get_rdf, #id, #initialize, #iri_types, #rdf_find_object, #rdf_find_subject, #rdf_uri, #rdf_valid?, #resolve_external_auth, #same_as, #same_as_array
Instance Method Details
#authority? ⇒ Boolean
33
34
35
|
# File 'lib/marc2linkeddata/loc.rb', line 33
def authority?
iri_types.filter {|s| s[:o] == 'http://www.loc.gov/mads/rdf/v1#Authority' }.length > 0
end
|
#conference? ⇒ Boolean
41
42
43
|
# File 'lib/marc2linkeddata/loc.rb', line 41
def conference?
iri_types.filter {|s| s[:o] == 'http://www.loc.gov/mads/rdf/v1#ConferenceName' }.length > 0
end
|
#corporation? ⇒ Boolean
45
46
47
|
# File 'lib/marc2linkeddata/loc.rb', line 45
def corporation?
iri_types.filter {|s| s[:o] == 'http://www.loc.gov/mads/rdf/v1#CorporateName' }.length > 0
end
|
#deprecated? ⇒ Boolean
37
38
39
|
# File 'lib/marc2linkeddata/loc.rb', line 37
def deprecated?
iri_types.filter {|s| s[:o] == 'http://www.loc.gov/mads/rdf/v1#DeprecatedAuthority' }.length > 0
end
|
#geographic? ⇒ Boolean
60
61
62
|
# File 'lib/marc2linkeddata/loc.rb', line 60
def geographic?
iri_types.filter {|s| s[:o] == 'http://www.loc.gov/mads/rdf/v1#Geographic' }.length > 0
end
|
#get_oclc_identity ⇒ Object
68
69
70
71
72
73
74
75
76
77
|
# File 'lib/marc2linkeddata/loc.rb', line 68
def get_oclc_identity
return @oclc_iri unless @oclc_iri.nil?
oclc_url = URI.encode('http://www.worldcat.org/identities/lccn-' + id + '/')
@oclc_iri = resolve_external_auth(oclc_url)
end
|
#get_viaf ⇒ Object
79
80
81
82
83
84
85
86
87
88
89
90
|
# File 'lib/marc2linkeddata/loc.rb', line 79
def get_viaf
return @viaf_iri unless @viaf_iri.nil?
viaf_url = URI.encode('http://viaf.org/viaf/sourceID/LC|' + id + '#skos:Concept')
@viaf_iri = resolve_external_auth(viaf_url)
end
|
#label ⇒ Object
27
28
29
30
31
|
# File 'lib/marc2linkeddata/loc.rb', line 27
def label
label_predicate = '<http://www.loc.gov/mads/rdf/v1#authoritativeLabel>'
query = SPARQL.parse("SELECT * WHERE { <#{@iri}> #{label_predicate} ?o }")
rdf.query(query).first[:o].to_s rescue nil
end
|
#name_title? ⇒ Boolean
49
50
51
|
# File 'lib/marc2linkeddata/loc.rb', line 49
def name_title?
iri_types.filter {|s| s[:o] == 'http://www.loc.gov/mads/rdf/v1#NameTitle' }.length > 0
end
|
#person? ⇒ Boolean
53
54
55
56
57
58
|
# File 'lib/marc2linkeddata/loc.rb', line 53
def person?
iri_types.filter {|s| s[:o] == 'http://www.loc.gov/mads/rdf/v1#PersonalName' }.length > 0
end
|
#rdf ⇒ Object
def id
return nil if @iri.nil?
@id ||= @iri.basename
end
20
21
22
23
24
25
|
# File 'lib/marc2linkeddata/loc.rb', line 20
def rdf
return nil if @iri.nil?
return @rdf unless @rdf.nil?
uri4rdf = @iri.to_s + '.rdf'
@rdf = get_rdf(uri4rdf)
end
|
64
65
66
|
# File 'lib/marc2linkeddata/loc.rb', line 64
def uniform_title?
iri_types.filter {|s| s[:o] == 'http://www.loc.gov/mads/rdf/v1#Title' }.length > 0
end
|