ld4l-works_rdf 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +7 -0
  2. data/.coveralls.yml +1 -0
  3. data/.gitignore +25 -0
  4. data/.travis.yml +14 -0
  5. data/CHANGES.md +3 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE.txt +22 -0
  8. data/README.md +170 -0
  9. data/Rakefile +2 -0
  10. data/ld4l-works_rdf.gemspec +42 -0
  11. data/lib/ld4l/works_rdf.rb +131 -0
  12. data/lib/ld4l/works_rdf/configuration.rb +41 -0
  13. data/lib/ld4l/works_rdf/models/bibframe/bibframe_identifier.rb +17 -0
  14. data/lib/ld4l/works_rdf/models/bibframe/bibframe_instance.rb +23 -0
  15. data/lib/ld4l/works_rdf/models/bibframe/bibframe_organization.rb +16 -0
  16. data/lib/ld4l/works_rdf/models/bibframe/bibframe_person.rb +16 -0
  17. data/lib/ld4l/works_rdf/models/bibframe/bibframe_place.rb +16 -0
  18. data/lib/ld4l/works_rdf/models/bibframe/bibframe_provider.rb +18 -0
  19. data/lib/ld4l/works_rdf/models/bibframe/bibframe_title.rb +18 -0
  20. data/lib/ld4l/works_rdf/models/bibframe/bibframe_work.rb +16 -0
  21. data/lib/ld4l/works_rdf/models/bibo/bibo_book.rb +19 -0
  22. data/lib/ld4l/works_rdf/models/bibo/bibo_document.rb +14 -0
  23. data/lib/ld4l/works_rdf/models/bibo/vivo_authorship.rb +15 -0
  24. data/lib/ld4l/works_rdf/models/bibo/vivo_book.rb +18 -0
  25. data/lib/ld4l/works_rdf/models/generic_work.rb +13 -0
  26. data/lib/ld4l/works_rdf/models/schema/oclc_schema_book.rb +16 -0
  27. data/lib/ld4l/works_rdf/models/schema/schema_book.rb +23 -0
  28. data/lib/ld4l/works_rdf/models/schema/schema_person.rb +17 -0
  29. data/lib/ld4l/works_rdf/models/schema/schema_publisher.rb +15 -0
  30. data/lib/ld4l/works_rdf/models/work_metadata.rb +212 -0
  31. data/lib/ld4l/works_rdf/services/attempt_generic_metadata_extraction.rb +41 -0
  32. data/lib/ld4l/works_rdf/services/conversion_services/get_rdfxml_from_marcxml.rb +44 -0
  33. data/lib/ld4l/works_rdf/services/conversion_services/marc2bibframe/modules/module.ErrorCodes.xqy +56 -0
  34. data/lib/ld4l/works_rdf/services/conversion_services/marc2bibframe/modules/module.MARCXML-2-MADSRDF.xqy +1702 -0
  35. data/lib/ld4l/works_rdf/services/conversion_services/marc2bibframe/modules/module.MARCXML-2-RecordInfoRDF.xqy +216 -0
  36. data/lib/ld4l/works_rdf/services/conversion_services/marc2bibframe/modules/module.MARCXMLBIB-2-BIBFRAME.xqy +140 -0
  37. data/lib/ld4l/works_rdf/services/conversion_services/marc2bibframe/modules/module.MARCXMLBIB-BFUtils.xqy +3287 -0
  38. data/lib/ld4l/works_rdf/services/conversion_services/marc2bibframe/modules/module.MBIB-2-BIBFRAME-Shared.xqy +4112 -0
  39. data/lib/ld4l/works_rdf/services/conversion_services/marc2bibframe/modules/module.MBIB-Default-2-BF.xqy +61 -0
  40. data/lib/ld4l/works_rdf/services/conversion_services/marc2bibframe/modules/module.MBIB-NotatedMusic-2-BF.xqy +105 -0
  41. data/lib/ld4l/works_rdf/services/conversion_services/marc2bibframe/modules/module.RDFXML-2-ExhibitJSON.xqy +119 -0
  42. data/lib/ld4l/works_rdf/services/conversion_services/marc2bibframe/modules/module.RDFXML-2-JSON.xqy +193 -0
  43. data/lib/ld4l/works_rdf/services/conversion_services/marc2bibframe/modules/module.RDFXML-2-Ntriples.xqy +276 -0
  44. data/lib/ld4l/works_rdf/services/conversion_services/marc2bibframe/modules/module.RDFXMLnested-2-flat.xqy +380 -0
  45. data/lib/ld4l/works_rdf/services/conversion_services/marc2bibframe/xbin/ml.xqy +239 -0
  46. data/lib/ld4l/works_rdf/services/conversion_services/marc2bibframe/xbin/saxon.xqy +134 -0
  47. data/lib/ld4l/works_rdf/services/conversion_services/marc2bibframe/xbin/zorba.xqy +359 -0
  48. data/lib/ld4l/works_rdf/services/conversion_services/marc2bibframe/xbin/zorba2-0.xqy +249 -0
  49. data/lib/ld4l/works_rdf/services/conversion_services/marc2bibframe/xbin/zorba3-0.xqy +362 -0
  50. data/lib/ld4l/works_rdf/services/conversion_services/saxon/saxon9he.jar +0 -0
  51. data/lib/ld4l/works_rdf/services/get_metadata_from_marcxml_uri.rb +43 -0
  52. data/lib/ld4l/works_rdf/services/get_metadata_from_oclc_uri.rb +25 -0
  53. data/lib/ld4l/works_rdf/services/get_metadata_from_solr_query.rb +29 -0
  54. data/lib/ld4l/works_rdf/services/get_metadata_from_vivo_uri.rb +25 -0
  55. data/lib/ld4l/works_rdf/services/get_model_from_uri.rb +62 -0
  56. data/lib/ld4l/works_rdf/services/metadata_services/get_metadata_from_bibframe_models.rb +60 -0
  57. data/lib/ld4l/works_rdf/services/metadata_services/get_metadata_from_bibo_model.rb +42 -0
  58. data/lib/ld4l/works_rdf/services/metadata_services/get_metadata_from_generic_model.rb +41 -0
  59. data/lib/ld4l/works_rdf/services/metadata_services/get_metadata_from_oclc_model.rb +42 -0
  60. data/lib/ld4l/works_rdf/services/metadata_services/get_metadata_from_solr_doc.rb +67 -0
  61. data/lib/ld4l/works_rdf/services/metadata_services/get_metadata_from_vivo_model.rb +45 -0
  62. data/lib/ld4l/works_rdf/services/metadata_services/set_error_in_metadata.rb +27 -0
  63. data/lib/ld4l/works_rdf/services/model_services/populate_bibframe_models_from_repository.rb +46 -0
  64. data/lib/ld4l/works_rdf/services/model_services/populate_generic_model_from_repository.rb +30 -0
  65. data/lib/ld4l/works_rdf/services/model_services/populate_oclc_model_from_repository.rb +27 -0
  66. data/lib/ld4l/works_rdf/services/model_services/populate_vivo_model_from_repository.rb +27 -0
  67. data/lib/ld4l/works_rdf/services/negotiation_services/get_marcxml_from_uri.rb +35 -0
  68. data/lib/ld4l/works_rdf/services/negotiation_services/get_rdfxml_from_uri.rb +37 -0
  69. data/lib/ld4l/works_rdf/services/negotiation_services/get_solr_results_from_solr_query.rb +35 -0
  70. data/lib/ld4l/works_rdf/services/negotiation_services/get_turtle_from_uri.rb +37 -0
  71. data/lib/ld4l/works_rdf/services/negotiation_services/response_header.rb +51 -0
  72. data/lib/ld4l/works_rdf/services/repository_services/populate_graph_from_rdfxml.rb +22 -0
  73. data/lib/ld4l/works_rdf/services/repository_services/populate_graph_from_turtle.rb +21 -0
  74. data/lib/ld4l/works_rdf/services/repository_services/populate_repository_from_graph.rb +25 -0
  75. data/lib/ld4l/works_rdf/version.rb +5 -0
  76. data/lib/ld4l/works_rdf/vocab/bf.rb +29 -0
  77. data/lib/ld4l/works_rdf/vocab/bgn.rb +5 -0
  78. data/lib/ld4l/works_rdf/vocab/bibo.rb +10 -0
  79. data/lib/ld4l/works_rdf/vocab/library.rb +6 -0
  80. data/lib/ld4l/works_rdf/vocab/vitro.rb +5 -0
  81. data/lib/ld4l/works_rdf/vocab/vivo.rb +11 -0
  82. data/spec/ld4l/works_rdf/configuration_spec.rb +166 -0
  83. data/spec/ld4l/works_rdf/models/books/vivo_book_rdf_spec.rb +267 -0
  84. data/spec/ld4l/works_rdf/services/get_metadata_from_uri_spec.rb +39 -0
  85. data/spec/ld4l/works_rdf/services/get_model_from_uri_spec.rb +34 -0
  86. data/spec/ld4l/works_rdf_spec.rb +53 -0
  87. data/spec/spec_helper.rb +26 -0
  88. metadata +321 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2ffbe00265c211ca744739f38e68fc2105fbc9ab
4
+ data.tar.gz: 8ec7ead1254a884c7db9a191fb070712467f06a7
5
+ SHA512:
6
+ metadata.gz: 59fbcfb0222492df9d22eade950e6e6f223622cddd95a45a908322d8891b4db05583086dfe0a16d4d0690ea1eb2af29e90f1be0337dd5ab4fceff3694a2e320f
7
+ data.tar.gz: c0672fbd53a90bf1d5e9912704fd33e40ca441d07ecfe624ed212a50badb7cab00f0ddc002bcba972c025888e06038e4aa05dcc0761b6c15ab8246b8be7122dd
data/.coveralls.yml ADDED
@@ -0,0 +1 @@
1
+ service_name: travis-ci
data/.gitignore ADDED
@@ -0,0 +1,25 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
23
+ .idea
24
+ .ruby-gemset
25
+ .ruby-version
data/.travis.yml ADDED
@@ -0,0 +1,14 @@
1
+ language: ruby
2
+ bundler_args: --without debug
3
+ script: "bundle exec rspec spec"
4
+ sudo: false
5
+ cache: bundler
6
+ rvm:
7
+ - 2.2.4
8
+ - 2.3.0
9
+ - jruby-9.0.4.0
10
+ - rbx-2
11
+ matrix:
12
+ allow_failures:
13
+ - rvm: jruby-9.0.4.0
14
+ - rvm: rbx-2
data/CHANGES.md ADDED
@@ -0,0 +1,3 @@
1
+ 0.1.0
2
+ -----
3
+ * Initial release of gem. See README for more information.
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in ld4l-works_rdf.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 E. Lynette Rayle
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,170 @@
1
+ # LD4L::WorksRDF
2
+
3
+ [![Build Status](https://travis-ci.org/ld4l/works_rdf.png?branch=master)](https://travis-ci.org/ld4l/works_rdf)
4
+ [![Coverage Status](https://coveralls.io/repos/ld4l/works_rdf/badge.png?branch=master)](https://coveralls.io/r/ld4l/works_rdf?branch=master)
5
+ [![Gem Version](https://badge.fury.io/rb/ld4l-works_rdf.svg)](http://badge.fury.io/rb/ld4l-works_rdf)
6
+ [![Dependency Status](https://www.versioneye.com/ruby/ld4l-works_rdf/0.0.4/badge.svg)](https://www.versioneye.com/ruby/ld4l-works_rdf/0.0.4)
7
+
8
+
9
+ The primary purpose of this gem is the extraction of basic display metadata from rdf triples for use
10
+ in a user interface. It is assumed that if detailed metadata is required, the user will be redirected
11
+ back to the original source.
12
+
13
+ This is a catch all gem to process metadata coming from library works. It can process marcxml and rdf+mxl
14
+ of selected ontologies. It is expected that it will grow and be refined to be more robust and flexible
15
+ over time as more ontologies are identified and various interpretations of ontologies is accounted for in
16
+ the processing code.
17
+
18
+ ## Installation
19
+
20
+
21
+ Temporarily install gem from github until it is released.
22
+
23
+ ```
24
+ gem 'ld4l-works_rdf', :git => 'git@github.com:ld4l/works_rdf.git', :branch => 'master'
25
+ ```
26
+
27
+ <!-- Add this line to your application's Gemfile: -->
28
+ <!--
29
+ ```
30
+ gem 'ld4l-works_rdf'
31
+ ```
32
+ -->
33
+
34
+ And then execute:
35
+
36
+ $ bundle
37
+ <!--
38
+ Or install it yourself as:
39
+
40
+ $ gem install ld4l-works_rdf
41
+ -->
42
+
43
+ ## Usage
44
+
45
+ **Caveat:** This rails engine is part of the LD4L Project and is being used in that context. There is no guarantee
46
+ that the code will work in a usable way outside of its use in LD4L Use Cases.
47
+
48
+
49
+ ### Examples
50
+
51
+ *Common setup for all examples
52
+ ```
53
+ require 'ld4l/works_rdf'
54
+ ```
55
+
56
+ If the ontology is unknown, you can try all known methods by calling the generic metadata extraction service.
57
+ ```
58
+ item_metadata = LD4L::WorksRDF::AttemptGenericMetadataExtraction.call(uri)
59
+ ```
60
+
61
+ If the URI is known to return marcxml, use the following service.
62
+ ```
63
+ item_metadata = LD4L::WorksRDF::GetMetadataFromMarcxmlURI.call(uri)
64
+ ```
65
+
66
+ If the URI is known to return schema.org ontology as interpreted by oclc, use the following service.
67
+ ```
68
+ item_metadata = LD4L::WorksRDF::GetMetadataFromOclcURI.call(uri)
69
+ ```
70
+
71
+ If the URI is known to return bibo ontology as interpreted by vivo, use the following service.
72
+ ```
73
+ item_metadata = LD4L::WorksRDF::GetMetadataFromVivoURI.call(uri)
74
+ ```
75
+
76
+ ### Configuration
77
+
78
+ ####Example configuration and usage for base_uri and default localname_minter
79
+ ```
80
+ LD4L::WorksRDF.reset
81
+ LD4L::WorksRDF.configure do |config|
82
+ config.base_uri = "http://example.org/"
83
+ end
84
+
85
+ w = LD4L::WorksRDF::GenericWork.new(ActiveTriples::LocalName::Minter.generate_local_name(
86
+ LD4L::WorksRDF::GenericWork, 10, {:prefix=>'w'} ))
87
+
88
+ puts w.dump :ttl
89
+
90
+ w = LD4L::WorksRDF::GenericWork.new(ActiveTriples::LocalName::Minter.generate_local_name(
91
+ LD4L::WorksRDF::GenericWork, 10, {:prefix=>'w'},
92
+ &LD4L::WorksRDF.configuration.localname_minter ))
93
+
94
+ puts w.dump :ttl
95
+ ```
96
+ NOTE: If base_uri is not used, you need to restart your interactive environment (e.g. irb, pry). Once the
97
+ GenericWork class is instantiated the first time, the base_uri for the class is set. If you ran
98
+ through the main Examples, the base_uri was set to the default base_uri.
99
+
100
+
101
+ Example triples created for a generic work with configured base_uri and default minter
102
+ ```
103
+ <http://example.org/w45c9c85b-25af-4c52-96a4-cf0d8b70a768> a <http://schema.org/schema:Book> .
104
+ ```
105
+
106
+ ####Example configuration and usage for base_uri and configured localname_minter
107
+ ```
108
+ LD4L::WorksRDF.configure do |config|
109
+ config.base_uri = "http://example.org/"
110
+ config.localname_minter = lambda { |prefix=""| prefix+'_configured_'+SecureRandom.uuid }
111
+ end
112
+
113
+ w = LD4L::WorksRDF::GenericWork.new(ActiveTriples::LocalName::Minter.generate_local_name(
114
+ LD4L::WorksRDF::GenericWork, 10, 'w',
115
+ &LD4L::WorksRDF.configuration.localname_minter ))
116
+
117
+ puts w.dump :ttl
118
+ ```
119
+ NOTE: If base_uri is not used, you need to restart your interactive environment (e.g. irb, pry). Once the
120
+ GenericWork class is instantiated the first time, the base_uri for the class is set. If you ran
121
+ through the main Examples, the base_uri was set to the default base_uri.
122
+
123
+
124
+ Example triples created for a person with configured base_uri and configured minter.
125
+ ```
126
+ <http://example.org/w_configured_6498ba05-8b21-4e8c-b9d4-a6d5d2180966> a <http://schema.org/schema:Book> .
127
+ ```
128
+
129
+ ### Models
130
+
131
+ The LD4L::WorksRDF gem provides model definitions using the
132
+ [ActiveTriples](https://github.com/ActiveTriples/ActiveTriples) framework extension of
133
+ [ruby-rdf/rdf](https://github.com/ruby-rdf/rdf). The following models are provided:
134
+
135
+ 1. LD4L::WorksRDF::GenericWork - Reads triples into a graph without setting any properties.
136
+ 1. LD4L::WorksRDF::BibframeWork - Implements a work from the Bibframe ontology
137
+ 1. LD4L::WorksRDF::BibframeInstance - Implements an instance from the Bibframe ontology
138
+ 1. LD4L::WorksRDF::Bibframe* - Other supporting classes from Bibframe ontology
139
+ 1. LD4L::WorksRDF::BiboBook - Implements a BIBO Book
140
+ 1. LD4L::WorksRDF::BiboDocument - Implements a BIBO Document
141
+ 1. LD4L::WorksRDF::VivoBook - Implements VIVO extensions to BIBO Book
142
+ 1. LD4L::WorksRDF::Vivo* - Other supporting classes from the VIVO ontology
143
+ 1. LD4L::WorksRDF::SchemaBook - Implements a book from the schema ontology
144
+ 1. LD4L::WorksRDF::Schema* - Other supporting classes from the schema ontology
145
+ 1. LD4L::WorksRDF::OclcSchemaBook - Implements OCLC extensions to the schema Book
146
+
147
+ ### Ontologies
148
+
149
+ The listed ontologies are used to represent the primary metadata about the annotations.
150
+ Other ontologies may also be used that aren't listed.
151
+
152
+ * [Bibframe](http://www.loc.gov/bibframe/)
153
+ * [schema](schema.org)
154
+ * [bibo](http://bibliontology.com/bibo/bibo.php#)
155
+ * [RDF](http://www.w3.org/TR/rdf-syntax-grammar/)
156
+ * [Dublin Core (DC)](http://dublincore.org/documents/dces/)
157
+ * [Dublin Core Terms (DCTERMS)](http://dublincore.org/documents/dcmi-terms/)
158
+
159
+
160
+ ### Known Uses
161
+
162
+ [LD4L Virtual Collection engine](https://github.com/ld4l/ld4l_virtual_collection)
163
+
164
+ ## Contributing
165
+
166
+ 1. Fork it ( https://github.com/[my-github-username]/ld4l-works_rdf/fork )
167
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
168
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
169
+ 4. Push to the branch (`git push origin my-new-feature`)
170
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,42 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'ld4l/works_rdf/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "ld4l-works_rdf"
8
+ spec.version = LD4L::WorksRDF::VERSION
9
+ spec.authors = ["E. Lynette Rayle"]
10
+ spec.email = ["elr37@cornell.edu"]
11
+ spec.platform = Gem::Platform::RUBY
12
+ spec.summary = %q{Several RDF models for bibliographic works.}
13
+ spec.description = %q{LD4L Works RDF provides tools for modeling a bibliographic works as triples based on multiple ontologies and persisting to a triplestore.}
14
+ spec.homepage = "https://github.com/ld4l/works_rdf"
15
+ spec.license = "APACHE2"
16
+ spec.required_ruby_version = '>= 1.9.3'
17
+
18
+ spec.files = `git ls-files -z`.split("\x0")
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
+
21
+ spec.add_dependency('rdf')
22
+ spec.add_dependency('active-triples')
23
+ spec.add_dependency('active_triples-local_name')
24
+ spec.add_dependency('active_triples-solrizer')
25
+ spec.add_dependency('ld4l-foaf_rdf')
26
+
27
+ spec.add_dependency('curb')
28
+
29
+ spec.add_development_dependency('pry')
30
+ spec.add_development_dependency('pry-byebug')
31
+ spec.add_development_dependency('rdoc')
32
+ spec.add_development_dependency('rspec')
33
+ spec.add_development_dependency('coveralls')
34
+ spec.add_development_dependency('guard-rspec')
35
+ spec.add_development_dependency('webmock')
36
+
37
+ spec.extra_rdoc_files = [
38
+ "LICENSE.txt",
39
+ "README.md"
40
+ ]
41
+ end
42
+
@@ -0,0 +1,131 @@
1
+ require 'rdf'
2
+ require 'active_triples'
3
+ require 'active_triples/local_name'
4
+ require 'active_triples/solrizer'
5
+ require 'curb'
6
+ require 'linkeddata'
7
+ require 'ld4l/works_rdf/vocab/bibo'
8
+ require 'ld4l/works_rdf/vocab/vivo'
9
+ require 'ld4l/works_rdf/vocab/vitro'
10
+ require 'ld4l/works_rdf/vocab/library'
11
+ require 'ld4l/works_rdf/vocab/bf'
12
+ require 'ld4l/works_rdf/version'
13
+ require 'ld4l/foaf_rdf'
14
+
15
+
16
+ module LD4L
17
+ module WorksRDF
18
+
19
+ # Methods for configuring the GEM
20
+ class << self
21
+ attr_accessor :configuration
22
+ end
23
+
24
+ def self.configuration
25
+ @configuration ||= Configuration.new
26
+ end
27
+
28
+ def self.reset
29
+ @configuration = Configuration.new
30
+ end
31
+
32
+ def self.configure
33
+ yield(configuration)
34
+ end
35
+
36
+
37
+ # RDF vocabularies
38
+ autoload :BIBO, 'ld4l/works_rdf/vocab/bibo'
39
+ autoload :VIVO, 'ld4l/works_rdf/vocab/vivo'
40
+ autoload :LIBRARY, 'ld4l/works_rdf/vocab/library'
41
+ autoload :BF, 'ld4l/works_rdf/vocab/bf'
42
+
43
+ # autoload classes
44
+ autoload :Configuration, 'ld4l/works_rdf/configuration'
45
+
46
+ # autoload model classes
47
+ autoload :GenericWork, 'ld4l/works_rdf/models/generic_work'
48
+ autoload :WorkMetadata, 'ld4l/works_rdf/models/work_metadata'
49
+
50
+ # autoload bibo model classes
51
+ autoload :BiboBook, 'ld4l/works_rdf/models/bibo/bibo_book'
52
+ autoload :BiboDocument, 'ld4l/works_rdf/models/bibo/bibo_document'
53
+ autoload :VivoBook, 'ld4l/works_rdf/models/bibo/vivo_book'
54
+ autoload :VivoAuthorship, 'ld4l/works_rdf/models/bibo/vivo_authorship'
55
+
56
+ # autoload schema model classes
57
+ autoload :SchemaBook, 'ld4l/works_rdf/models/schema/schema_book'
58
+ autoload :SchemaPerson, 'ld4l/works_rdf/models/schema/schema_person'
59
+ autoload :SchemaPublisher, 'ld4l/works_rdf/models/schema/schema_publisher'
60
+ autoload :OclcSchemaBook, 'ld4l/works_rdf/models/schema/oclc_schema_book'
61
+
62
+ # autoload bibframe model classes
63
+ autoload :BibframeWork, 'ld4l/works_rdf/models/bibframe/bibframe_work'
64
+ autoload :BibframeInstance, 'ld4l/works_rdf/models/bibframe/bibframe_instance'
65
+ autoload :BibframeIdentifier, 'ld4l/works_rdf/models/bibframe/bibframe_identifier'
66
+ autoload :BibframeOrganization, 'ld4l/works_rdf/models/bibframe/bibframe_organization'
67
+ autoload :BibframePerson, 'ld4l/works_rdf/models/bibframe/bibframe_person'
68
+ autoload :BibframePlace, 'ld4l/works_rdf/models/bibframe/bibframe_place'
69
+ autoload :BibframeProvider, 'ld4l/works_rdf/models/bibframe/bibframe_provider'
70
+ autoload :BibframeTitle, 'ld4l/works_rdf/models/bibframe/bibframe_title'
71
+
72
+
73
+ # autoload service classes
74
+ autoload :GetMetadataFromMarcxmlURI, 'ld4l/works_rdf/services/get_metadata_from_marcxml_uri'
75
+ autoload :GetMetadataFromVivoURI, 'ld4l/works_rdf/services/get_metadata_from_vivo_uri'
76
+ autoload :GetMetadataFromOclcURI, 'ld4l/works_rdf/services/get_metadata_from_oclc_uri'
77
+ autoload :AttemptGenericMetadataExtraction, 'ld4l/works_rdf/services/attempt_generic_metadata_extraction'
78
+ autoload :GetMetadataFromSolrQuery, 'ld4l/works_rdf/services/get_metadata_from_solr_query'
79
+
80
+ autoload :GetModelFromURI, 'ld4l/works_rdf/services/get_model_from_uri'
81
+
82
+ # autoload conversion service classes
83
+ autoload :GetRdfxmlFromMarcxml, 'ld4l/works_rdf/services/conversion_services/get_rdfxml_from_marcxml'
84
+
85
+ # autoload metadata service classes
86
+ autoload :GetMetadataFromGenericModel, 'ld4l/works_rdf/services/metadata_services/get_metadata_from_generic_model'
87
+ autoload :GetMetadataFromBibframeModels,'ld4l/works_rdf/services/metadata_services/get_metadata_from_bibframe_models'
88
+ autoload :GetMetadataFromOclcModel, 'ld4l/works_rdf/services/metadata_services/get_metadata_from_oclc_model'
89
+ autoload :GetMetadataFromVivoModel, 'ld4l/works_rdf/services/metadata_services/get_metadata_from_vivo_model'
90
+ autoload :GetMetadataFromBiboModel, 'ld4l/works_rdf/services/metadata_services/get_metadata_from_bibo_model'
91
+ autoload :GetMetadataFromSolrDoc, 'ld4l/works_rdf/services/metadata_services/get_metadata_from_solr_doc'
92
+ autoload :SetErrorInMetadata, 'ld4l/works_rdf/services/metadata_services/set_error_in_metadata'
93
+
94
+ # autoload model service classes
95
+ autoload :PopulateGenericModelFromRepository, 'ld4l/works_rdf/services/model_services/populate_generic_model_from_repository'
96
+ autoload :PopulateBibframeModelsFromRepository,'ld4l/works_rdf/services/model_services/populate_bibframe_models_from_repository'
97
+ autoload :PopulateOclcModelFromRepository, 'ld4l/works_rdf/services/model_services/populate_oclc_model_from_repository'
98
+ autoload :PopulateVivoModelFromRepository, 'ld4l/works_rdf/services/model_services/populate_vivo_model_from_repository'
99
+
100
+ # autoload negotiation service classes
101
+ autoload :GetMarcxmlFromURI, 'ld4l/works_rdf/services/negotiation_services/get_marcxml_from_uri'
102
+ autoload :GetTurtleFromURI, 'ld4l/works_rdf/services/negotiation_services/get_turtle_from_uri'
103
+ autoload :GetRdfxmlFromURI, 'ld4l/works_rdf/services/negotiation_services/get_rdfxml_from_uri'
104
+ autoload :GetSolrResultsFromSolrQuery, 'ld4l/works_rdf/services/negotiation_services/get_solr_results_from_solr_query'
105
+ autoload :ResponseHeader, 'ld4l/works_rdf/services/negotiation_services/response_header'
106
+
107
+ # autoload repository service classes
108
+ autoload :PopulateRepositoryFromGraph, 'ld4l/works_rdf/services/repository_services/populate_repository_from_graph'
109
+ autoload :PopulateGraphFromRdfxml, 'ld4l/works_rdf/services/repository_services/populate_graph_from_rdfxml'
110
+ autoload :PopulateGraphFromTurtle, 'ld4l/works_rdf/services/repository_services/populate_graph_from_turtle'
111
+
112
+
113
+
114
+ def self.class_from_string(class_name, container_class=Kernel)
115
+ container_class = container_class.name if container_class.is_a? Module
116
+ container_parts = container_class.split('::')
117
+ (container_parts + class_name.split('::')).flatten.inject(Kernel) do |mod, class_name|
118
+ if mod == Kernel
119
+ Object.const_get(class_name)
120
+ elsif mod.const_defined? class_name.to_sym
121
+ mod.const_get(class_name)
122
+ else
123
+ container_parts.pop
124
+ class_from_string(class_name, container_parts.join('::'))
125
+ end
126
+ end
127
+ end
128
+
129
+ end
130
+ end
131
+
@@ -0,0 +1,41 @@
1
+ module LD4L
2
+ module WorksRDF
3
+ class Configuration
4
+
5
+ attr_reader :base_uri
6
+ attr_reader :localname_minter
7
+
8
+ def self.default_base_uri
9
+ @default_base_uri = "http://localhost/".freeze
10
+ end
11
+ private_class_method :default_base_uri
12
+
13
+ def self.default_localname_minter
14
+ # by setting to nil, it will use the default minter in the minter gem
15
+ @default_localname_minter = nil
16
+ end
17
+ private_class_method :default_localname_minter
18
+
19
+ def initialize
20
+ @base_uri = self.class.send(:default_base_uri)
21
+ @localname_minter = self.class.send(:default_localname_minter)
22
+ end
23
+
24
+ def base_uri=(new_base_uri)
25
+ @base_uri = new_base_uri
26
+ end
27
+
28
+ def reset_base_uri
29
+ @base_uri = self.class.send(:default_base_uri)
30
+ end
31
+
32
+ def localname_minter=(new_minter)
33
+ @localname_minter = new_minter
34
+ end
35
+
36
+ def reset_localname_minter
37
+ @localname_minter = self.class.send(:default_localname_minter)
38
+ end
39
+ end
40
+ end
41
+ end