Skip to content

Commit 44c6d38

Browse files
committed
Merge pull request #25 from ActiveTriples/repository_from_rdf_rb
Interface Added for Blazegraph and Repository.
2 parents bd974a0 + 658b69f commit 44c6d38

36 files changed

+45774
-17145
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#Ignore Rubymine and jetty files
2323
/.idea
2424
/jetty
25+
/ldf-jetty
2526

2627
#Ignore yml files
2728
/*.yml

Gemfile

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,27 +35,33 @@ gem 'sdoc', '~> 0.4.0', group: :doc
3535
gem 'responders'
3636
gem 'rdf'
3737
gem 'rdf-turtle'
38-
gem 'json-ld', '1.1.8'
38+
gem 'json-ld', '~> 1.99'
39+
#gem 'json-ld'
3940
gem 'active-triples'
40-
gem 'rdf-vocab', github: "ruby-rdf/rdf-vocab", branch: "develop"
41+
#gem 'rdf-vocab', github: "ruby-rdf/rdf-vocab", branch: "develop"
42+
gem 'rdf-vocab', '0.8.7.1'
4143
gem 'jettywrapper', '>= 2.0.0'
4244
gem 'marmotta'
45+
gem 'ldfwrapper', github: 'boston-library/ldf-wrapper', branch: "master"
46+
gem 'rdf-blazegraph'
4347

4448
group :development, :test do
4549
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
4650
gem 'byebug'
4751

48-
# Access an IRB console on exception pages or by using <%= console %> in views
49-
gem 'web-console', '~> 2.0'
50-
5152
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
5253
gem 'spring'
5354

5455
gem 'rspec-rails'
5556
gem 'pry-byebug'
56-
gem 'vcr'
57+
end
58+
59+
group :development do
60+
# Access an IRB console on exception pages or by using <%= console %> in views
61+
gem 'web-console', '~> 2.0'
5762
end
5863

5964
group :test do
65+
gem 'vcr'
6066
gem 'webmock'
6167
end

README.md

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,49 @@ Configuration
1010
YAML
1111
----
1212

13-
There is a ldf.yml.sample that you need to configure as ldf.yml. There are default values already entered into the
14-
file.
13+
You need a ldf.yml file configured. There are currently two sample files for configurations of two different backend
14+
caching layers: ldf.yml.sample_marmotta and ldf.yml.sample_repository.
1515

1616
Marmotta
1717
--------
1818

1919
If you do not already have a marmotta instance, you can use an instance that runs off of jetty by running the following
20-
generator:
20+
rake task:
2121

22-
rails g linked_data_fragments:marmotta
22+
rake ldfwrapper:install
2323

2424
Once that finishes, please copy config/jetty.yml.sample to config/jetty.yml. You can change the defaults.
2525

2626
Once that is all setup, here are some commands that can be run to use the marmotta instance:
2727

28-
rake jetty:stop
29-
rake jetty:config
30-
rake jetty:start
28+
rake ldfjetty:stop
29+
rake ldfjetty:config
30+
rake ldfjetty:start
3131

32+
Blazegraph
33+
-----------
34+
35+
If you do not already have a blazegraph instance, you can use an instance that runs off of jetty by running the following
36+
rake task:
37+
38+
rake ldfwrapper:install
39+
40+
Once that finishes, please copy config/ldfjetty.yml.sample to config/ldfjetty.yml. You can change the defaults.
41+
42+
It is recommended that you populate Blazegraph with LoC for terms to work. To do this:
43+
44+
* Download the latest subjects vocab from: [http://id.loc.gov/download/](http://id.loc.gov/download/) (the nt version of “LC Subject Headings (SKOS/RDF only)”)
45+
46+
* Extract the above download into a directory.
47+
48+
* Run the following command from that extraction directory:
49+
curl -H 'Content-Type: text/turtle' --upload-file subjects-skos-20140306.nt -X POST "http://localhost:8988/blazegraph/sparql?context-uri=http://id.loc.gov/static/data/authoritiessubjects.nt.skos.zip"
50+
51+
Once that is all setup, here are some commands that can be run to use the blazegraph instance:
52+
53+
rake ldfjetty:stop
54+
rake ldfjetty:config
55+
rake ldfjetty:start
3256

3357
Usage
3458
=====

app/controllers/subject_controller.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ def self.assign_cache_service
99
case Setting.cache_backend
1010
when 'marmotta'
1111
@cache = LinkedDataFragments::Marmotta.new
12+
when 'repository'
13+
@cache = LinkedDataFragments::Repository.new
14+
when 'blazegraph'
15+
@cache = LinkedDataFragments::Blazegraph.new
1216
else
1317
#FIXME: What type of error should this be? Need to unit test this as well once figured out.
1418
raise ArgumentError, 'Invalid cache_backend set in the yml config'

app/models/setting.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def cache_backend
5252
end
5353

5454
def cache_backend_url
55-
Setting.config[:cache_backend][:url] || 'http://localhost:8983/marmotta'
55+
Setting.config[:cache_backend][:url] || 'http://localhost:8988/marmotta'
5656
end
5757

5858
def cache_backend_context

circle.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,4 @@ machine:
33
version: 2.2.0
44
dependencies:
55
post:
6-
- cp config/ldf.yml.sample config/ldf.yml
7-
- cp config/jetty.yml.sample config/jetty.yml
6+
- cp config/ldf.yml.sample_repository config/ldf.yml

config/ldf.yml.sample_blazegraph

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
development:
2+
uri_endpoint: 'http://localhost:3000/{?subject}'
3+
uri_root: 'http://localhost:3000/#dataset'
4+
cache_backend:
5+
provider: 'blazegraph'
6+
url: 'http://localhost:8988/blazegraph/sparql'
7+
context: 'http://localhost:8988/linked_data_fragments_dev'
8+
test: &TEST_
9+
uri_endpoint: 'http://localhost:3000/{?subject}'
10+
uri_root: 'http://localhost:3000/#dataset'
11+
cache_backend:
12+
provider: 'blazegraph'
13+
url: 'http://localhost:8988/blazegraph/sparql'
14+
context: 'http://localhost:8988/linked_data_fragments_test'
15+
production:
16+
uri_endpoint: 'http://localhost:3000/{?subject}'
17+
uri_root: 'http://localhost:3000/#dataset'
18+
cache_backend:
19+
provider: 'blazegraph'
20+
url: 'http://localhost:8988/blazegraph/sparql'
21+
context: 'http://localhost:8988/linked_data_fragments_production'
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@ development:
33
uri_root: 'http://localhost:3000/#dataset'
44
cache_backend:
55
provider: 'marmotta'
6-
url: 'http://localhost:8983/marmotta'
7-
context: 'linked_data_fragments_dev'
6+
url: 'http://localhost:8988/marmotta'
7+
context: 'http://localhost:8988/linked_data_fragments_dev'
88
test: &TEST_
99
uri_endpoint: 'http://localhost:3000/{?subject}'
1010
uri_root: 'http://localhost:3000/#dataset'
1111
cache_backend:
1212
provider: 'marmotta'
13-
url: 'http://localhost:8983/marmotta'
14-
context: 'linked_data_fragments_test'
13+
url: 'http://localhost:8988/marmotta'
14+
context: 'http://localhost:8988/linked_data_fragments_test'
1515
production:
1616
uri_endpoint: 'http://localhost:3000/{?subject}'
1717
uri_root: 'http://localhost:3000/#dataset'
1818
cache_backend:
1919
provider: 'marmotta'
20-
url: 'http://localhost:8983/marmotta'
21-
context: 'linked_data_fragments_production'
20+
url: 'http://localhost:8988/marmotta'
21+
context: 'http://localhost:8988/linked_data_fragments_production'

config/ldf.yml.sample_repository

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
development:
2+
uri_endpoint: 'http://localhost:3000/{?subject}'
3+
uri_root: 'http://localhost:3000/#dataset'
4+
cache_backend:
5+
provider: 'repository'
6+
test: &TEST_
7+
uri_endpoint: 'http://localhost:3000/{?subject}'
8+
uri_root: 'http://localhost:3000/#dataset'
9+
cache_backend:
10+
provider: 'repository'
11+
production:
12+
uri_endpoint: 'http://localhost:3000/{?subject}'
13+
uri_root: 'http://localhost:3000/#dataset'
14+
cache_backend:
15+
provider: 'repository'

lib/generators/linked_data_fragments/marmotta_generator.rb

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)