qa 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +284 -2
  3. data/app/controllers/qa/linked_data_terms_controller.rb +127 -0
  4. data/config/authorities/linked_data/agrovoc.json +61 -0
  5. data/config/authorities/linked_data/loc.json +46 -0
  6. data/config/authorities/linked_data/oclc_fast.json +78 -0
  7. data/config/initializers/linked_data_authorities.rb +17 -0
  8. data/config/routes.rb +3 -0
  9. data/lib/qa.rb +15 -0
  10. data/lib/qa/authorities.rb +2 -0
  11. data/lib/qa/authorities/base.rb +1 -1
  12. data/lib/qa/authorities/crossref.rb +16 -0
  13. data/lib/qa/authorities/crossref/generic_authority.rb +63 -0
  14. data/lib/qa/authorities/geonames.rb +2 -1
  15. data/lib/qa/authorities/linked_data.rb +10 -0
  16. data/lib/qa/authorities/linked_data/config.rb +80 -0
  17. data/lib/qa/authorities/linked_data/config/search_config.rb +170 -0
  18. data/lib/qa/authorities/linked_data/config/term_config.rb +186 -0
  19. data/lib/qa/authorities/linked_data/find_term.rb +148 -0
  20. data/lib/qa/authorities/linked_data/generic_authority.rb +49 -0
  21. data/lib/qa/authorities/linked_data/rdf_helper.rb +102 -0
  22. data/lib/qa/authorities/linked_data/search_query.rb +143 -0
  23. data/lib/qa/version.rb +1 -1
  24. data/spec/controllers/linked_data_terms_controller_spec.rb +202 -0
  25. data/spec/fixtures/authorities/linked_data/lod_full_config.json +111 -0
  26. data/spec/fixtures/authorities/linked_data/lod_lang_defaults.json +54 -0
  27. data/spec/fixtures/authorities/linked_data/lod_lang_multi_defaults.json +54 -0
  28. data/spec/fixtures/authorities/linked_data/lod_lang_no_defaults.json +52 -0
  29. data/spec/fixtures/authorities/linked_data/lod_lang_param.json +66 -0
  30. data/spec/fixtures/authorities/linked_data/lod_min_config.json +49 -0
  31. data/spec/fixtures/authorities/linked_data/lod_search_only_config.json +55 -0
  32. data/spec/fixtures/authorities/linked_data/lod_sort.json +27 -0
  33. data/spec/fixtures/authorities/linked_data/lod_term_only_config.json +59 -0
  34. data/spec/fixtures/funders-find-response.json +1 -0
  35. data/spec/fixtures/funders-noquery.json +1 -0
  36. data/spec/fixtures/funders-noresults.json +1 -0
  37. data/spec/fixtures/funders-result.json +1 -0
  38. data/spec/fixtures/journals-find-response-two-issn.json +1 -0
  39. data/spec/fixtures/journals-find-response.json +1 -0
  40. data/spec/fixtures/journals-noquery.json +1 -0
  41. data/spec/fixtures/journals-noresults.json +1 -0
  42. data/spec/fixtures/journals-result.json +705 -0
  43. data/spec/fixtures/lod_agrovoc_query_many_results.json +1 -0
  44. data/spec/fixtures/lod_agrovoc_query_no_results.json +1 -0
  45. data/spec/fixtures/lod_agrovoc_term_found.rdf.xml +217 -0
  46. data/spec/fixtures/lod_lang_search_en.rdf.xml +42 -0
  47. data/spec/fixtures/lod_lang_search_enfr.rdf.xml +48 -0
  48. data/spec/fixtures/lod_lang_search_enfrde.rdf.xml +54 -0
  49. data/spec/fixtures/lod_lang_search_fr.rdf.xml +42 -0
  50. data/spec/fixtures/lod_lang_term_en.rdf.xml +65 -0
  51. data/spec/fixtures/lod_lang_term_enfr.rdf.xml +71 -0
  52. data/spec/fixtures/lod_lang_term_enfr_noalt.rdf.xml +69 -0
  53. data/spec/fixtures/lod_lang_term_enfrde.rdf.xml +79 -0
  54. data/spec/fixtures/lod_lang_term_fr.rdf.xml +65 -0
  55. data/spec/fixtures/lod_loc_term_found.rdf.xml +262 -0
  56. data/spec/fixtures/lod_oclc_all_query_3_results.rdf.xml +142 -0
  57. data/spec/fixtures/lod_oclc_personalName_query_3_results.rdf.xml +128 -0
  58. data/spec/fixtures/lod_oclc_query_no_results.rdf.xml +13 -0
  59. data/spec/fixtures/lod_oclc_term_found.rdf.xml +51 -0
  60. data/spec/lib/authorities/crossref_spec.rb +180 -0
  61. data/spec/lib/authorities/geonames_spec.rb +2 -2
  62. data/spec/lib/authorities/linked_data/config_spec.rb +143 -0
  63. data/spec/lib/authorities/linked_data/find_term_spec.rb +5 -0
  64. data/spec/lib/authorities/linked_data/generic_authority_spec.rb +580 -0
  65. data/spec/lib/authorities/linked_data/search_config_spec.rb +385 -0
  66. data/spec/lib/authorities/linked_data/search_query_spec.rb +79 -0
  67. data/spec/lib/authorities/linked_data/term_config_spec.rb +419 -0
  68. data/spec/routing/linked_data_route_spec.rb +35 -0
  69. data/spec/spec_helper.rb +2 -0
  70. metadata +184 -39
@@ -0,0 +1,142 @@
1
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:coord="http://whatever/java/ORG.oclc.util.CoordToDecimal" xmlns:naco="http://whatever/java/ORG.oclc.util.NacoNormalize" xmlns:norm="http://whatever/java/ORG.oclc.util.NormalFormC" xmlns:schema="http://schema.org/" xmlns:madsrdf="http://www.loc.gov/mads/rdf/v1#" xmlns:skosxl="http://www.w3.org/2008/05/skos-xl#" xmlns:dct="http://purl.org/dc/terms/" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:void="http://rdfs.org/ns/void#" xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns:mx="http://www.loc.gov/MARC21/slim" xmlns:skos="http://www.w3.org/2004/02/skos/core#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xml:base="http://id.worldcat.org/fast/">
2
+ <rdf:Description rdf:about="530369">
3
+ <dct:identifier>530369</dct:identifier>
4
+ <skos:inScheme rdf:resource="ontology/1.0/#fast"/>
5
+ <rdf:type rdf:resource="http://schema.org/Organization"/>
6
+ <skos:inScheme rdf:resource="ontology/1.0/#facet-Corporate"/>
7
+ <skos:prefLabel>Cornell University</skos:prefLabel>
8
+ <schema:name>Cornell University</schema:name>
9
+ <skos:altLabel>Ithaca (N.Y.). Cornell University</skos:altLabel>
10
+ <schema:name>Ithaca (N.Y.). Cornell University</schema:name>
11
+ <skos:altLabel>Kornel\xCA\xB9skii universitet</skos:altLabel>
12
+ <schema:name>Kornel\xCA\xB9skii universitet</schema:name>
13
+ <skos:altLabel>K\xCA\xBBang-nai-erh ta hs\xC3\xBCeh</skos:altLabel>
14
+ <schema:name>K\xCA\xBBang-nai-erh ta hs\xC3\xBCeh</schema:name>
15
+ <schema:sameAs>
16
+ <rdf:Description rdf:about="http://id.loc.gov/authorities/names/n79021621">
17
+ <rdfs:label>Cornell University</rdfs:label>
18
+ </rdf:Description>
19
+ </schema:sameAs>
20
+ <schema:sameAs>
21
+ <rdf:Description rdf:about="https://viaf.org/viaf/126293486">
22
+ <rdfs:label>Cornell University</rdfs:label>
23
+ </rdf:Description>
24
+ </schema:sameAs>
25
+ </rdf:Description>
26
+ <rdf:Description rdf:about="fst00530369">
27
+ <rdfs:comment>This identifier is deprecated. See the rdfs:seeAlso link for the new identifier.</rdfs:comment>
28
+ <rdfs:seeAlso rdf:resource="530369"/>
29
+ </rdf:Description>
30
+ <foaf:Document rdf:about="530369/rdf.xml">
31
+ <void:inDataset rdf:resource="http://id.worldcat.org/fast/void/0.1"/>
32
+ <foaf:primaryTopic rdf:resource="530369"/>
33
+ <dc:format>application/rdf+xml</dc:format>
34
+ <dct:created rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2005-05-13T00:00:00.0</dct:created>
35
+ <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2012-07-06T14:07:21.0</dct:modified>
36
+ <dct:language rdf:resource="http://lexvo.org/id/iso639-3/eng"/>
37
+ <skos:changeNote xml:lang="en">Cataloged by agency: OCoLC</skos:changeNote>
38
+ <skos:changeNote xml:lang="en">Transcribed by agency: OCoLC</skos:changeNote>
39
+ </foaf:Document>
40
+ <rdf:Description rdf:about="5140">
41
+ <dct:identifier>5140</dct:identifier>
42
+ <skos:inScheme rdf:resource="ontology/1.0/#fast"/>
43
+ <rdf:type rdf:resource="http://schema.org/Person"/>
44
+ <skos:inScheme rdf:resource="ontology/1.0/#facet-Personal"/>
45
+ <skos:prefLabel>Cornell, Joseph</skos:prefLabel>
46
+ <schema:name>Cornell, Joseph</schema:name>
47
+ <skos:altLabel>K\xC5\x8Dneru, Jozefu</skos:altLabel>
48
+ <schema:name>K\xC5\x8Dneru, Jozefu</schema:name>
49
+ <schema:sameAs>
50
+ <rdf:Description rdf:about="http://id.loc.gov/authorities/names/n50016406">
51
+ <rdfs:label>Cornell, Joseph</rdfs:label>
52
+ </rdf:Description>
53
+ </schema:sameAs>
54
+ <foaf:focus>
55
+ <rdf:Description rdf:about="http://en.wikipedia.org/wiki/Joseph_Cornell">
56
+ <rdfs:label>Joseph Cornell</rdfs:label>
57
+ </rdf:Description>
58
+ </foaf:focus>
59
+ <schema:sameAs>
60
+ <rdf:Description rdf:about="https://viaf.org/viaf/100297313">
61
+ <rdfs:label>Cornell, Joseph</rdfs:label>
62
+ </rdf:Description>
63
+ </schema:sameAs>
64
+ </rdf:Description>
65
+ <rdf:Description rdf:about="fst00005140">
66
+ <rdfs:comment>This identifier is deprecated. See the rdfs:seeAlso link for the new identifier.</rdfs:comment>
67
+ <rdfs:seeAlso rdf:resource="5140"/>
68
+ </rdf:Description>
69
+ <foaf:Document rdf:about="5140/rdf.xml">
70
+ <void:inDataset rdf:resource="http://id.worldcat.org/fast/void/0.1"/>
71
+ <foaf:primaryTopic rdf:resource="5140"/>
72
+ <dc:format>application/rdf+xml</dc:format>
73
+ <dct:created rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2004-09-24T00:00:00.0</dct:created>
74
+ <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2012-07-06T14:07:21.0</dct:modified>
75
+ <dct:language rdf:resource="http://lexvo.org/id/iso639-3/eng"/>
76
+ <skos:changeNote xml:lang="en">Cataloged by agency: OCoLC</skos:changeNote>
77
+ <skos:changeNote xml:lang="en">Transcribed by agency: OCoLC</skos:changeNote>
78
+ </foaf:Document>
79
+ <rdf:Description rdf:about="557490">
80
+ <dct:identifier>557490</dct:identifier>
81
+ <skos:inScheme rdf:resource="ontology/1.0/#fast"/>
82
+ <rdf:type rdf:resource="http://schema.org/Organization"/>
83
+ <skos:inScheme rdf:resource="ontology/1.0/#facet-Corporate"/>
84
+ <skos:prefLabel>New York State School of Industrial and Labor Relations</skos:prefLabel>
85
+ <schema:name>New York State School of Industrial and Labor Relations</schema:name>
86
+ <skos:altLabel>Cornell University. ILR School</skos:altLabel>
87
+ <schema:name>Cornell University. ILR School</schema:name>
88
+ <skos:altLabel>Cornell University. New York State School of Industrial and Labor Relations</skos:altLabel>
89
+ <schema:name>Cornell University. New York State School of Industrial and Labor Relations</schema:name>
90
+ <skos:altLabel>Cornell University. School of Industrial and Labor Relations</skos:altLabel>
91
+ <schema:name>Cornell University. School of Industrial and Labor Relations</schema:name>
92
+ <skos:altLabel>Cornell University. State School of Industrial and Labor Relations</skos:altLabel>
93
+ <schema:name>Cornell University. State School of Industrial and Labor Relations</schema:name>
94
+ <skos:altLabel>ILR/Cornell</skos:altLabel>
95
+ <schema:name>ILR/Cornell</schema:name>
96
+ <skos:altLabel>New York (State). School of Industrial and Labor Relations</skos:altLabel>
97
+ <schema:name>New York (State). School of Industrial and Labor Relations</schema:name>
98
+ <skos:altLabel>New York (State). State School of Industrial and Labor Relations</skos:altLabel>
99
+ <schema:name>New York (State). State School of Industrial and Labor Relations</schema:name>
100
+ <skos:altLabel>NYSSILR</skos:altLabel>
101
+ <schema:name>NYSSILR</schema:name>
102
+ <skos:altLabel>University of the State of New York. School of Industrial and Labor Relations</skos:altLabel>
103
+ <schema:name>University of the State of New York. School of Industrial and Labor Relations</schema:name>
104
+ <skos:altLabel>University of the State of New York. State School of Industrial and Labor Relations</skos:altLabel>
105
+ <schema:name>University of the State of New York. State School of Industrial and Labor Relations</schema:name>
106
+ <schema:sameAs>
107
+ <rdf:Description rdf:about="http://id.loc.gov/authorities/names/n81063067">
108
+ <rdfs:label>New York State School of Industrial and Labor Relations</rdfs:label>
109
+ </rdf:Description>
110
+ </schema:sameAs>
111
+ <schema:sameAs>
112
+ <rdf:Description rdf:about="https://viaf.org/viaf/153458035">
113
+ <rdfs:label>New York State School of Industrial and Labor Relations</rdfs:label>
114
+ </rdf:Description>
115
+ </schema:sameAs>
116
+ </rdf:Description>
117
+ <rdf:Description rdf:about="fst00557490">
118
+ <rdfs:comment>This identifier is deprecated. See the rdfs:seeAlso link for the new identifier.</rdfs:comment>
119
+ <rdfs:seeAlso rdf:resource="557490"/>
120
+ </rdf:Description>
121
+ <foaf:Document rdf:about="557490/rdf.xml">
122
+ <void:inDataset rdf:resource="http://id.worldcat.org/fast/void/0.1"/>
123
+ <foaf:primaryTopic rdf:resource="557490"/>
124
+ <dc:format>application/rdf+xml</dc:format>
125
+ <dct:created rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2005-05-13T00:00:00.0</dct:created>
126
+ <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2016-07-13T11:21:28.0</dct:modified>
127
+ <dct:language rdf:resource="http://lexvo.org/id/iso639-3/eng"/>
128
+ <skos:changeNote xml:lang="en">Cataloged by agency: OCoLC</skos:changeNote>
129
+ <skos:changeNote xml:lang="en">Transcribed by agency: OCoLC</skos:changeNote>
130
+ </foaf:Document>
131
+ <void:Dataset rdf:about="http://id.worldcat.org/fast/void/0.1">
132
+ <dct:title>FAST (Faceted Application of Subject Terminology) Data</dct:title>
133
+ <dct:license>
134
+ <rdf:Description rdf:about="http://www.oclc.org/research/activities/fast/odcby.htm">
135
+ <dct:title>Open Data Commons Attribution License (ODC-By) v1.0</dct:title>
136
+ <rdfs:comment>This is OCLC's "local copy" of the ODC-By license</rdfs:comment>
137
+ <rdfs:seeAlso rdf:resource="http://opendatacommons.org/licenses/by/#toc-anchor-337-3"/>
138
+ <owl:sameAs rdf:resource="http://opendatacommons.org/licenses/by/1-0/"/>
139
+ </rdf:Description>
140
+ </dct:license>
141
+ </void:Dataset>
142
+ </rdf:RDF>
@@ -0,0 +1,128 @@
1
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:coord="http://whatever/java/ORG.oclc.util.CoordToDecimal" xmlns:naco="http://whatever/java/ORG.oclc.util.NacoNormalize" xmlns:norm="http://whatever/java/ORG.oclc.util.NormalFormC" xmlns:schema="http://schema.org/" xmlns:madsrdf="http://www.loc.gov/mads/rdf/v1#" xmlns:skosxl="http://www.w3.org/2008/05/skos-xl#" xmlns:dct="http://purl.org/dc/terms/" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:void="http://rdfs.org/ns/void#" xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns:mx="http://www.loc.gov/MARC21/slim" xmlns:skos="http://www.w3.org/2004/02/skos/core#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xml:base="http://id.worldcat.org/fast/">
2
+ <rdf:Description rdf:about="5140">
3
+ <dct:identifier>5140</dct:identifier>
4
+ <skos:inScheme rdf:resource="ontology/1.0/#fast"/>
5
+ <rdf:type rdf:resource="http://schema.org/Person"/>
6
+ <skos:inScheme rdf:resource="ontology/1.0/#facet-Personal"/>
7
+ <skos:prefLabel>Cornell, Joseph</skos:prefLabel>
8
+ <schema:name>Cornell, Joseph</schema:name>
9
+ <skos:altLabel>K\xC5\x8Dneru, Jozefu</skos:altLabel>
10
+ <schema:name>K\xC5\x8Dneru, Jozefu</schema:name>
11
+ <schema:sameAs>
12
+ <rdf:Description rdf:about="http://id.loc.gov/authorities/names/n50016406">
13
+ <rdfs:label>Cornell, Joseph</rdfs:label>
14
+ </rdf:Description>
15
+ </schema:sameAs>
16
+ <foaf:focus>
17
+ <rdf:Description rdf:about="http://en.wikipedia.org/wiki/Joseph_Cornell">
18
+ <rdfs:label>Joseph Cornell</rdfs:label>
19
+ </rdf:Description>
20
+ </foaf:focus>
21
+ <schema:sameAs>
22
+ <rdf:Description rdf:about="https://viaf.org/viaf/100297313">
23
+ <rdfs:label>Cornell, Joseph</rdfs:label>
24
+ </rdf:Description>
25
+ </schema:sameAs>
26
+ </rdf:Description>
27
+ <rdf:Description rdf:about="fst00005140">
28
+ <rdfs:comment>This identifier is deprecated. See the rdfs:seeAlso link for the new identifier.</rdfs:comment>
29
+ <rdfs:seeAlso rdf:resource="5140"/>
30
+ </rdf:Description>
31
+ <foaf:Document rdf:about="5140/rdf.xml">
32
+ <void:inDataset rdf:resource="http://id.worldcat.org/fast/void/0.1"/>
33
+ <foaf:primaryTopic rdf:resource="5140"/>
34
+ <dc:format>application/rdf+xml</dc:format>
35
+ <dct:created rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2004-09-24T00:00:00.0</dct:created>
36
+ <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2012-07-06T14:07:21.0</dct:modified>
37
+ <dct:language rdf:resource="http://lexvo.org/id/iso639-3/eng"/>
38
+ <skos:changeNote xml:lang="en">Cataloged by agency: OCoLC</skos:changeNote>
39
+ <skos:changeNote xml:lang="en">Transcribed by agency: OCoLC</skos:changeNote>
40
+ </foaf:Document>
41
+ <rdf:Description rdf:about="72456">
42
+ <dct:identifier>72456</dct:identifier>
43
+ <skos:inScheme rdf:resource="ontology/1.0/#fast"/>
44
+ <rdf:type rdf:resource="http://schema.org/Person"/>
45
+ <skos:inScheme rdf:resource="ontology/1.0/#facet-Personal"/>
46
+ <skos:prefLabel>Cornell, Sarah Maria, 1802-1832</skos:prefLabel>
47
+ <schema:name>Cornell, Sarah Maria, 1802-1832</schema:name>
48
+ <skos:altLabel>Cornell, Sarah M. (Sarah Maria), 1802-1832</skos:altLabel>
49
+ <schema:name>Cornell, Sarah M. (Sarah Maria), 1802-1832</schema:name>
50
+ <schema:sameAs>
51
+ <rdf:Description rdf:about="http://id.loc.gov/authorities/names/n81052350">
52
+ <rdfs:label>Cornell, Sarah Maria, 1802-1832</rdfs:label>
53
+ </rdf:Description>
54
+ </schema:sameAs>
55
+ <foaf:focus>
56
+ <rdf:Description rdf:about="http://en.wikipedia.org/wiki/Sarah_Maria_Cornell">
57
+ <rdfs:label>Sarah Maria Cornell</rdfs:label>
58
+ </rdf:Description>
59
+ </foaf:focus>
60
+ <schema:sameAs>
61
+ <rdf:Description rdf:about="https://viaf.org/viaf/23460880">
62
+ <rdfs:label>Cornell, Sarah Maria, 1802-1832</rdfs:label>
63
+ </rdf:Description>
64
+ </schema:sameAs>
65
+ </rdf:Description>
66
+ <rdf:Description rdf:about="fst00072456">
67
+ <rdfs:comment>This identifier is deprecated. See the rdfs:seeAlso link for the new identifier.</rdfs:comment>
68
+ <rdfs:seeAlso rdf:resource="72456"/>
69
+ </rdf:Description>
70
+ <foaf:Document rdf:about="72456/rdf.xml">
71
+ <void:inDataset rdf:resource="http://id.worldcat.org/fast/void/0.1"/>
72
+ <foaf:primaryTopic rdf:resource="72456"/>
73
+ <dc:format>application/rdf+xml</dc:format>
74
+ <dct:created rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2004-09-24T00:00:00.0</dct:created>
75
+ <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2016-07-13T11:21:28.0</dct:modified>
76
+ <dct:language rdf:resource="http://lexvo.org/id/iso639-3/eng"/>
77
+ <skos:changeNote xml:lang="en">Cataloged by agency: OCoLC</skos:changeNote>
78
+ <skos:changeNote xml:lang="en">Transcribed by agency: OCoLC</skos:changeNote>
79
+ </foaf:Document>
80
+ <rdf:Description rdf:about="409667">
81
+ <dct:identifier>409667</dct:identifier>
82
+ <skos:inScheme rdf:resource="ontology/1.0/#fast"/>
83
+ <rdf:type rdf:resource="http://schema.org/Person"/>
84
+ <skos:inScheme rdf:resource="ontology/1.0/#facet-Personal"/>
85
+ <skos:prefLabel>Cornell, Ezra, 1807-1874</skos:prefLabel>
86
+ <schema:name>Cornell, Ezra, 1807-1874</schema:name>
87
+ <schema:sameAs>
88
+ <rdf:Description rdf:about="http://id.loc.gov/authorities/names/n97066641">
89
+ <rdfs:label>Cornell, Ezra, 1807-1874</rdfs:label>
90
+ </rdf:Description>
91
+ </schema:sameAs>
92
+ <foaf:focus>
93
+ <rdf:Description rdf:about="http://en.wikipedia.org/wiki/Ezra_Cornell">
94
+ <rdfs:label>Ezra Cornell</rdfs:label>
95
+ </rdf:Description>
96
+ </foaf:focus>
97
+ <schema:sameAs>
98
+ <rdf:Description rdf:about="https://viaf.org/viaf/1755530">
99
+ <rdfs:label>Cornell, Ezra, 1807-1874</rdfs:label>
100
+ </rdf:Description>
101
+ </schema:sameAs>
102
+ </rdf:Description>
103
+ <rdf:Description rdf:about="fst00409667">
104
+ <rdfs:comment>This identifier is deprecated. See the rdfs:seeAlso link for the new identifier.</rdfs:comment>
105
+ <rdfs:seeAlso rdf:resource="409667"/>
106
+ </rdf:Description>
107
+ <foaf:Document rdf:about="409667/rdf.xml">
108
+ <void:inDataset rdf:resource="http://id.worldcat.org/fast/void/0.1"/>
109
+ <foaf:primaryTopic rdf:resource="409667"/>
110
+ <dc:format>application/rdf+xml</dc:format>
111
+ <dct:created rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2004-09-24T00:00:00.0</dct:created>
112
+ <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2012-07-06T14:07:21.0</dct:modified>
113
+ <dct:language rdf:resource="http://lexvo.org/id/iso639-3/eng"/>
114
+ <skos:changeNote xml:lang="en">Cataloged by agency: OCoLC</skos:changeNote>
115
+ <skos:changeNote xml:lang="en">Transcribed by agency: OCoLC</skos:changeNote>
116
+ </foaf:Document>
117
+ <void:Dataset rdf:about="http://id.worldcat.org/fast/void/0.1">
118
+ <dct:title>FAST (Faceted Application of Subject Terminology) Data</dct:title>
119
+ <dct:license>
120
+ <rdf:Description rdf:about="http://www.oclc.org/research/activities/fast/odcby.htm">
121
+ <dct:title>Open Data Commons Attribution License (ODC-By) v1.0</dct:title>
122
+ <rdfs:comment>This is OCLC's "local copy" of the ODC-By license</rdfs:comment>
123
+ <rdfs:seeAlso rdf:resource="http://opendatacommons.org/licenses/by/#toc-anchor-337-3"/>
124
+ <owl:sameAs rdf:resource="http://opendatacommons.org/licenses/by/1-0/"/>
125
+ </rdf:Description>
126
+ </dct:license>
127
+ </void:Dataset>
128
+ </rdf:RDF>
@@ -0,0 +1,13 @@
1
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:coord="http://whatever/java/ORG.oclc.util.CoordToDecimal" xmlns:naco="http://whatever/java/ORG.oclc.util.NacoNormalize" xmlns:norm="http://whatever/java/ORG.oclc.util.NormalFormC" xmlns:schema="http://schema.org/" xmlns:madsrdf="http://www.loc.gov/mads/rdf/v1#" xmlns:skosxl="http://www.w3.org/2008/05/skos-xl#" xmlns:dct="http://purl.org/dc/terms/" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:void="http://rdfs.org/ns/void#" xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns:mx="http://www.loc.gov/MARC21/slim" xmlns:skos="http://www.w3.org/2004/02/skos/core#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xml:base="http://id.worldcat.org/fast/">
2
+ <void:Dataset rdf:about="http://id.worldcat.org/fast/void/0.1">
3
+ <dct:title>FAST (Faceted Application of Subject Terminology) Data</dct:title>
4
+ <dct:license>
5
+ <rdf:Description rdf:about="http://www.oclc.org/research/activities/fast/odcby.htm">
6
+ <dct:title>Open Data Commons Attribution License (ODC-By) v1.0</dct:title>
7
+ <rdfs:comment>This is OCLC's "local copy" of the ODC-By license</rdfs:comment>
8
+ <rdfs:seeAlso rdf:resource="http://opendatacommons.org/licenses/by/#toc-anchor-337-3"/>
9
+ <owl:sameAs rdf:resource="http://opendatacommons.org/licenses/by/1-0/"/>
10
+ </rdf:Description>
11
+ </dct:license>
12
+ </void:Dataset>
13
+ </rdf:RDF>
@@ -0,0 +1,51 @@
1
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:coord="http://whatever/java/ORG.oclc.util.CoordToDecimal" xmlns:naco="http://whatever/java/ORG.oclc.util.NacoNormalize" xmlns:norm="http://whatever/java/ORG.oclc.util.NormalFormC" xmlns:schema="http://schema.org/" xmlns:madsrdf="http://www.loc.gov/mads/rdf/v1#" xmlns:skosxl="http://www.w3.org/2008/05/skos-xl#" xmlns:dct="http://purl.org/dc/terms/" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:void="http://rdfs.org/ns/void#" xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns:mx="http://www.loc.gov/MARC21/slim" xmlns:skos="http://www.w3.org/2004/02/skos/core#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xml:base="http://id.worldcat.org/fast/">
2
+ <rdf:Description rdf:about="530369">
3
+ <dct:identifier>530369</dct:identifier>
4
+ <skos:inScheme rdf:resource="ontology/1.0/#fast"/>
5
+ <rdf:type rdf:resource="http://schema.org/Organization"/>
6
+ <skos:inScheme rdf:resource="ontology/1.0/#facet-Corporate"/>
7
+ <skos:prefLabel>Cornell University</skos:prefLabel>
8
+ <schema:name>Cornell University</schema:name>
9
+ <skos:altLabel>Ithaca (N.Y.). Cornell University</skos:altLabel>
10
+ <schema:name>Ithaca (N.Y.). Cornell University</schema:name>
11
+ <skos:altLabel>Kornel\xCA\xB9skii universitet</skos:altLabel>
12
+ <schema:name>Kornel\xCA\xB9skii universitet</schema:name>
13
+ <skos:altLabel>K\xCA\xBBang-nai-erh ta hs\xC3\xBCeh</skos:altLabel>
14
+ <schema:name>K\xCA\xBBang-nai-erh ta hs\xC3\xBCeh</schema:name>
15
+ <schema:sameAs>
16
+ <rdf:Description rdf:about="http://id.loc.gov/authorities/names/n79021621">
17
+ <rdfs:label>Cornell University</rdfs:label>
18
+ </rdf:Description>
19
+ </schema:sameAs>
20
+ <schema:sameAs>
21
+ <rdf:Description rdf:about="https://viaf.org/viaf/126293486">
22
+ <rdfs:label>Cornell University</rdfs:label>
23
+ </rdf:Description>
24
+ </schema:sameAs>
25
+ </rdf:Description>
26
+ <rdf:Description rdf:about="fst00530369">
27
+ <rdfs:comment>This identifier is deprecated. See the rdfs:seeAlso link for the new identifier.</rdfs:comment>
28
+ <rdfs:seeAlso rdf:resource="530369"/>
29
+ </rdf:Description>
30
+ <foaf:Document rdf:about="530369/rdf.xml">
31
+ <void:inDataset rdf:resource="http://id.worldcat.org/fast/void/0.1"/>
32
+ <foaf:primaryTopic rdf:resource="530369"/>
33
+ <dc:format>application/rdf+xml</dc:format>
34
+ <dct:created rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2005-05-13T00:00:00.0</dct:created>
35
+ <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2012-07-06T14:07:21.0</dct:modified>
36
+ <dct:language rdf:resource="http://lexvo.org/id/iso639-3/eng"/>
37
+ <skos:changeNote xml:lang="en">Cataloged by agency: OCoLC</skos:changeNote>
38
+ <skos:changeNote xml:lang="en">Transcribed by agency: OCoLC</skos:changeNote>
39
+ </foaf:Document>
40
+ <void:Dataset rdf:about="http://id.worldcat.org/fast/void/0.1">
41
+ <dct:title>FAST (Faceted Application of Subject Terminology) Data</dct:title>
42
+ <dct:license>
43
+ <rdf:Description rdf:about="http://www.oclc.org/research/activities/fast/odcby.htm">
44
+ <dct:title>Open Data Commons Attribution License (ODC-By) v1.0</dct:title>
45
+ <rdfs:comment>This is OCLC's "local copy" of the ODC-By license</rdfs:comment>
46
+ <rdfs:seeAlso rdf:resource="http://opendatacommons.org/licenses/by/#toc-anchor-337-3"/>
47
+ <owl:sameAs rdf:resource="http://opendatacommons.org/licenses/by/1-0/"/>
48
+ </rdf:Description>
49
+ </dct:license>
50
+ </void:Dataset>
51
+ </rdf:RDF>
@@ -0,0 +1,180 @@
1
+ require 'spec_helper'
2
+ describe Qa::Authorities::Crossref do
3
+ describe "#new" do
4
+ context "without a sub-authority" do
5
+ it "raises an exception" do
6
+ expect { described_class.new }.to raise_error RuntimeError, "Initializing with as sub authority is removed. use Module.subauthority_for(nil) instead"
7
+ end
8
+ end
9
+ end
10
+
11
+ describe "#subauthority_for" do
12
+ context "with an invalid sub-authority" do
13
+ it "raises an exception" do
14
+ expect { described_class.subauthority_for("foo") }.to raise_error Qa::InvalidSubAuthority
15
+ end
16
+ end
17
+ context "with a valid sub-authority" do
18
+ it "creates the authority" do
19
+ expect(described_class.subauthority_for("funders")).to be_kind_of Qa::Authorities::Crossref::GenericAuthority
20
+ end
21
+ end
22
+ end
23
+
24
+ describe "#urls" do
25
+ let :authority do
26
+ described_class.subauthority_for("funders")
27
+ end
28
+
29
+ context "for searching" do
30
+ let(:url) { 'http://api.crossref.org/funders?query=heart' }
31
+ it "returns a url" do
32
+ expect(authority.build_query_url("heart")).to eq(url)
33
+ end
34
+ end
35
+
36
+ context "for returning single terms" do
37
+ let(:url) { 'http://api.crossref.org/funders/100011056' }
38
+ it "returns a url with an authority and id" do
39
+ expect(authority.find_url("100011056")).to eq(url)
40
+ end
41
+ end
42
+ end
43
+
44
+ describe "#search funders" do
45
+ let :authority do
46
+ described_class.subauthority_for("funders")
47
+ end
48
+
49
+ context "when query is blank" do
50
+ # server returns results but no results header
51
+ let :results do
52
+ stub_request(:get, "http://api.crossref.org/funders?query=")
53
+ .with(headers: { 'Accept' => 'application/json' })
54
+ .to_return(body: webmock_fixture("funders-noquery.json"), status: 200, headers: {})
55
+ authority.search("")
56
+ end
57
+ it "returns 20 results" do
58
+ expect(results.length).to eq(20)
59
+ end
60
+ end
61
+
62
+ context "with no results" do
63
+ let :results do
64
+ stub_request(:get, "http://api.crossref.org/funders?query=supercalafragalistic")
65
+ .with(headers: { 'Accept' => 'application/json' })
66
+ .to_return(body: webmock_fixture("funders-noresults.json"), status: 200, headers: {})
67
+ authority.search("supercalafragalistic")
68
+ end
69
+ it "returns an empty array" do
70
+ expect(results).to eq([])
71
+ end
72
+ end
73
+
74
+ context "with funder results" do
75
+ let :results do
76
+ stub_request(:get, "http://api.crossref.org/funders?query=heart")
77
+ .with(headers: { 'Accept' => 'application/json' })
78
+ .to_return(body: webmock_fixture("funders-result.json"), status: 200, headers: {})
79
+ described_class.subauthority_for("funders").search("heart")
80
+ end
81
+ it "is correctly parsed" do
82
+ expect(results.count).to eq(20)
83
+ expect(results.first[:id]).to eq('100011056')
84
+ expect(results.first[:uri]).to eq('http://dx.doi.org/10.13039/100011056')
85
+ expect(results.first[:label]).to eq('British Society for Heart Failure, (BSH), United Kingdom')
86
+ expect(results.first[:value]).to eq('British Society for Heart Failure')
87
+ end
88
+ end
89
+ end
90
+
91
+ describe "#search journals" do
92
+ let :authority do
93
+ described_class.subauthority_for("journals")
94
+ end
95
+
96
+ context "when query is blank" do
97
+ # server returns results but no results header
98
+ let :results do
99
+ stub_request(:get, "http://api.crossref.org/journals?query=")
100
+ .with(headers: { 'Accept' => 'application/json' })
101
+ .to_return(body: webmock_fixture("journals-noquery.json"), status: 200, headers: {})
102
+ authority.search("")
103
+ end
104
+ it "returns 20 results" do
105
+ expect(results.length).to eq(20)
106
+ end
107
+ end
108
+
109
+ context "with no results" do
110
+ let :results do
111
+ stub_request(:get, "http://api.crossref.org/journals?query=supercalafragalistic")
112
+ .with(headers: { 'Accept' => 'application/json' })
113
+ .to_return(body: webmock_fixture("journals-noresults.json"), status: 200, headers: {})
114
+ authority.search("supercalafragalistic")
115
+ end
116
+ it "returns an empty array" do
117
+ expect(results).to eq([])
118
+ end
119
+ end
120
+
121
+ context "with journal results" do
122
+ let :results do
123
+ stub_request(:get, "http://api.crossref.org/journals?query=heart")
124
+ .with(headers: { 'Accept' => 'application/json' })
125
+ .to_return(body: webmock_fixture("journals-result.json"), status: 200, headers: {})
126
+ described_class.subauthority_for("journals").search("heart")
127
+ end
128
+ it "is correctly parsed" do
129
+ expect(results.count).to eq(20)
130
+ expect(results.first[:id]).to eq('1024-8714')
131
+ expect(results.first[:label]).to eq('Bangladesh Heart Journal')
132
+ expect(results.first[:publisher]).to eq('Bangladesh Journals Online')
133
+ end
134
+ end
135
+ end
136
+
137
+ describe "#find" do
138
+ context "using a funder id" do
139
+ let :subject do
140
+ stub_request(:get, "http://api.crossref.org/funders/100011056")
141
+ .to_return(status: 200, body: webmock_fixture("funders-find-response.json"))
142
+ described_class.subauthority_for("funders").find("100011056")
143
+ end
144
+
145
+ it "returns the complete record for a given funder" do
146
+ expect(subject['message']['id']).to eq '100011056'
147
+ expect(subject['message']['name']).to eq "British Society for Heart Failure"
148
+ end
149
+ end
150
+ context "using an issn" do
151
+ let :subject do
152
+ stub_request(:get, "http://api.crossref.org/journals/1024-8714")
153
+ .to_return(status: 200, body: webmock_fixture("journals-find-response.json"))
154
+ described_class.subauthority_for("journals").find("1024-8714")
155
+ end
156
+
157
+ it "returns the complete record for the given journal" do
158
+ expect(subject['message']['ISSN']).to eq ['1024-8714']
159
+ expect(subject['message']['title']).to eq "Bangladesh Heart Journal"
160
+ end
161
+ end
162
+ context "using a journal with two issns" do
163
+ let :issn do
164
+ stub_request(:get, "http://api.crossref.org/journals/1941-3289")
165
+ .to_return(status: 200, body: webmock_fixture("journals-find-response-two-issn.json"))
166
+ described_class.subauthority_for("journals").find("1941-3289")
167
+ end
168
+ let :issn2 do
169
+ stub_request(:get, "http://api.crossref.org/journals/1941-3297")
170
+ .to_return(status: 200, body: webmock_fixture("journals-find-response-two-issn.json"))
171
+ described_class.subauthority_for("journals").find("1941-3297")
172
+ end
173
+
174
+ it "returns the complete record for the given journal with either issn" do
175
+ expect(issn['message']['ISSN']).to eq ["1941-3289", "1941-3297"]
176
+ expect(issn2['message']['ISSN']).to eq ["1941-3289", "1941-3297"]
177
+ end
178
+ end
179
+ end
180
+ end