iqvoc 3.3.3 → 3.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +5 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +4 -0
- data/README.md +1 -0
- data/app/controllers/import_controller.rb +39 -0
- data/app/models/labeling/skos/base.rb +0 -1
- data/app/views/dashboard/index.html.erb +3 -0
- data/app/views/import/import.html.erb +4 -0
- data/app/views/import/index.html.erb +23 -0
- data/config/deploy.rb +1 -1
- data/config/locales/de.yml +1 -0
- data/config/locales/en.yml +1 -0
- data/config/routes.rb +3 -0
- data/iqvoc.gemspec +0 -1
- data/lib/engine_tasks/db.rake +1 -1
- data/lib/engine_tasks/setup.rake +9 -0
- data/lib/iqvoc.rb +23 -1
- data/lib/iqvoc/ability.rb +1 -0
- data/lib/iqvoc/skos_importer.rb +9 -6
- data/lib/iqvoc/version.rb +1 -1
- data/lib/iqvoc/versioning.rb +3 -1
- data/lib/tasks/setup.rake +2 -15
- metadata +22 -18
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -85,6 +85,7 @@ GEM
|
|
85
85
|
railties (>= 3.0.0)
|
86
86
|
launchy (2.0.5)
|
87
87
|
addressable (~> 2.2.6)
|
88
|
+
libv8 (3.3.10.4)
|
88
89
|
mail (2.3.0)
|
89
90
|
i18n (>= 0.4.0)
|
90
91
|
mime-types (~> 1.16)
|
@@ -147,6 +148,8 @@ GEM
|
|
147
148
|
tilt (~> 1.1, != 1.3.0)
|
148
149
|
sqlite3 (1.3.5)
|
149
150
|
term-ansicolor (1.0.7)
|
151
|
+
therubyracer (0.9.9)
|
152
|
+
libv8 (~> 3.3.10)
|
150
153
|
thor (0.14.6)
|
151
154
|
tilt (1.3.3)
|
152
155
|
treetop (1.4.10)
|
@@ -189,5 +192,6 @@ DEPENDENCIES
|
|
189
192
|
rails_autolink
|
190
193
|
rvm
|
191
194
|
sqlite3
|
195
|
+
therubyracer
|
192
196
|
turn
|
193
197
|
uglifier
|
data/README.md
CHANGED
@@ -0,0 +1,39 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
# Copyright 2011 innoQ Deutschland GmbH
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
require 'iqvoc/skos_importer'
|
18
|
+
|
19
|
+
class ImportController < ApplicationController
|
20
|
+
|
21
|
+
before_filter do
|
22
|
+
authorize! :import, Concept::Base
|
23
|
+
end
|
24
|
+
|
25
|
+
def index
|
26
|
+
end
|
27
|
+
|
28
|
+
def import
|
29
|
+
content = params[:ntriples_file] && params[:ntriples_file].read
|
30
|
+
strio = StringIO.new
|
31
|
+
begin
|
32
|
+
Iqvoc::SkosImporter.new(content.to_s.split("\n"), params[:default_namespace], Logger.new(strio))
|
33
|
+
@messages = strio.string
|
34
|
+
rescue Exception => e
|
35
|
+
@messages = e.to_s + "\n\n" + e.backtrace.join("\n")
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
@@ -88,7 +88,6 @@ class Labeling::SKOS::Base < Labeling::Base
|
|
88
88
|
lang = $3
|
89
89
|
value = JSON.parse(%Q{["#{$1}"]})[0].gsub("\\n", "\n") # Trick to decode \uHHHHH chars
|
90
90
|
|
91
|
-
|
92
91
|
subject.send(self.name.to_relation_name) << self.new(:target => self.label_class.new(:value => value, :language => lang))
|
93
92
|
end
|
94
93
|
|
@@ -11,6 +11,9 @@
|
|
11
11
|
<%= link_to("RDF/XML", concepts_url(:format => :rdf)) %>
|
12
12
|
</li>
|
13
13
|
<%- end -%>
|
14
|
+
<%- if can?(:import, Concept::Base) -%>
|
15
|
+
<li><%= link_to(t('txt.views.dashboard.import') , import_url) %></li>
|
16
|
+
<%- end -%>
|
14
17
|
<%#= link_to "Triple Store Sync", new_triple_store_sync_path %>
|
15
18
|
</ul>
|
16
19
|
<table>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<h2>Import</h2>
|
2
|
+
|
3
|
+
<%= form_tag import_url, :method => :post, :multipart => true , :class => "form" do %>
|
4
|
+
<fieldset>
|
5
|
+
<ol>
|
6
|
+
|
7
|
+
<li>
|
8
|
+
<%= label_tag "ntriples_file", "NTriples File: " %>
|
9
|
+
<%= file_field_tag 'ntriples_file' %>
|
10
|
+
</li>
|
11
|
+
|
12
|
+
<li>
|
13
|
+
<%= label_tag "default_namespace", "Default namespace: " %>
|
14
|
+
<%= text_field_tag 'default_namespace', root_url(:format => nil, :lang => nil, :trailing_slash => true).gsub(/\/\/$/, "/") %>
|
15
|
+
</li>
|
16
|
+
|
17
|
+
<li>
|
18
|
+
<%= submit_tag "Start" %>
|
19
|
+
</li>
|
20
|
+
|
21
|
+
</ol>
|
22
|
+
</fieldset>
|
23
|
+
<% end %>
|
data/config/deploy.rb
CHANGED
data/config/locales/de.yml
CHANGED
data/config/locales/en.yml
CHANGED
data/config/routes.rb
CHANGED
@@ -44,6 +44,9 @@ Rails.application.routes.draw do
|
|
44
44
|
match 'about(.:format)' => 'pages#about', :as => 'about'
|
45
45
|
match 'dashboard(.:format)' => 'dashboard#index', :as => 'dashboard'
|
46
46
|
|
47
|
+
get "import" => "import#index", :as => 'import'
|
48
|
+
post "import" => "import#import"
|
49
|
+
|
47
50
|
match 'search(.:format)' => 'search_results#index', :as => 'search'
|
48
51
|
|
49
52
|
root :to => 'concepts/hierarchical#index', :format => nil
|
data/iqvoc.gemspec
CHANGED
@@ -20,7 +20,6 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.add_dependency 'iq_rdf', '~> 0.1.0'
|
21
21
|
s.add_dependency 'json'
|
22
22
|
s.add_dependency 'rails_autolink'
|
23
|
-
|
24
23
|
|
25
24
|
s.files = %w(LICENSE README.md CHANGELOG.md Gemfile Gemfile.lock Rakefile iqvoc.gemspec) +
|
26
25
|
Dir.glob("{app,config,db,public,lib,test,vendor}/**/*")
|
data/lib/engine_tasks/db.rake
CHANGED
@@ -35,7 +35,7 @@ namespace :iqvoc do
|
|
35
35
|
}
|
36
36
|
|
37
37
|
engines.select{|e| e.engine_name !~ /^iqvoc_/}.each do |engine|
|
38
|
-
puts "There is a non-iQvoc engine (#{engine.engine_name}) having seeds. These seeds are not necessarily
|
38
|
+
puts "There is a non-iQvoc engine (#{engine.engine_name}) having seeds. These seeds are not necessarily idempotent."
|
39
39
|
puts "Do you with to (c)ontinue, (i)gnore it or (a)bort?"
|
40
40
|
input = nil
|
41
41
|
while input !~ /^[cia]$/
|
data/lib/iqvoc.rb
CHANGED
@@ -34,12 +34,15 @@ module Iqvoc
|
|
34
34
|
:core_assets
|
35
35
|
|
36
36
|
self.title = "iQvoc"
|
37
|
-
|
37
|
+
|
38
38
|
self.core_assets = %w(
|
39
39
|
manifest.css
|
40
40
|
manifest.js
|
41
41
|
blueprint/ie.css
|
42
42
|
iqvoc/ie_fixes.css
|
43
|
+
excanvas.js
|
44
|
+
jit_rgraph.js
|
45
|
+
iqvoc/visualization.js
|
43
46
|
)
|
44
47
|
|
45
48
|
self.searchable_class_names = [
|
@@ -84,6 +87,25 @@ module Iqvoc
|
|
84
87
|
ability_class_name.constantize
|
85
88
|
end
|
86
89
|
|
90
|
+
def self.generate_secret_token
|
91
|
+
require 'securerandom'
|
92
|
+
|
93
|
+
template = Rails.root.join("config", "initializers", "secret_token.rb.template")
|
94
|
+
raise "File not found: #{template}" unless File.exist?(template)
|
95
|
+
|
96
|
+
file_name = "config/initializers/secret_token.rb"
|
97
|
+
|
98
|
+
token = SecureRandom.hex(64)
|
99
|
+
txt = File.read(template)
|
100
|
+
txt.gsub!("S-E-C-R-E-T", token)
|
101
|
+
|
102
|
+
File.open(file_name, "w") do |f|
|
103
|
+
f.write txt
|
104
|
+
end
|
105
|
+
|
106
|
+
puts "Secret token configuration has been created in #{file_name}."
|
107
|
+
end
|
108
|
+
|
87
109
|
# ************** Concept specific settings **************
|
88
110
|
|
89
111
|
module Concept
|
data/lib/iqvoc/ability.rb
CHANGED
data/lib/iqvoc/skos_importer.rb
CHANGED
@@ -7,7 +7,10 @@ module Iqvoc
|
|
7
7
|
Iqvoc::Concept.relation_classes +
|
8
8
|
Iqvoc::Concept.match_classes
|
9
9
|
|
10
|
-
def initialize(file, default_namespace_url)
|
10
|
+
def initialize(file, default_namespace_url, logger = Rails.logger)
|
11
|
+
|
12
|
+
@logger = logger
|
13
|
+
|
11
14
|
unless file.is_a?(File) || file.is_a?(Array)
|
12
15
|
raise "Iqvoc::SkosImporter#import: Parameter 'file' should be a File or an Array."
|
13
16
|
end
|
@@ -62,7 +65,7 @@ module Iqvoc
|
|
62
65
|
subject.publish
|
63
66
|
subject.save!
|
64
67
|
else
|
65
|
-
|
68
|
+
@logger.warn "WARNING: Subject not valid: '#{subject.origin}'. Won't be published automatically.."
|
66
69
|
end
|
67
70
|
end
|
68
71
|
|
@@ -75,9 +78,9 @@ module Iqvoc
|
|
75
78
|
|
76
79
|
if (@existing_origins[origin])
|
77
80
|
if (types[object] == @existing_origins[origin])
|
78
|
-
|
81
|
+
@logger.info "Iqvoc::SkosImporter: Subject with origin '#{origin}' already exists. Skipping duplicate creation (should be no problem)."
|
79
82
|
else
|
80
|
-
|
83
|
+
@logger.warn "Iqvoc::SkosImporter: Subject with origin '#{origin} already exists but has another class (#{@existing_origins[origin]}) then the one I wanted to create (#{types[object]}). You seem to have a problem with your configuration!"
|
81
84
|
end
|
82
85
|
else
|
83
86
|
@seen_first_level_objects[origin] = types[object].create!(:origin => origin)
|
@@ -92,7 +95,7 @@ module Iqvoc
|
|
92
95
|
subject_origin = $1
|
93
96
|
subject = load_first_level_object(subject_origin)
|
94
97
|
unless subject
|
95
|
-
|
98
|
+
@logger.warn "Iqvoc::SkosImporter: Couldn't find Subject with origin '#{subject_origin}. Skipping entry '#{subject} #{predicate} #{object}.'"
|
96
99
|
return
|
97
100
|
end
|
98
101
|
|
@@ -101,7 +104,7 @@ module Iqvoc
|
|
101
104
|
object_origin = $1
|
102
105
|
object = load_first_level_object(object_origin)
|
103
106
|
unless object
|
104
|
-
|
107
|
+
@logger.warn "Iqvoc::SkosImporter: Couldn't find Object with origin '#{object_origin}. Skipping entry ':#{subject_origin} #{predicate} #{object}.'"
|
105
108
|
return
|
106
109
|
end
|
107
110
|
end
|
data/lib/iqvoc/version.rb
CHANGED
data/lib/iqvoc/versioning.rb
CHANGED
data/lib/tasks/setup.rake
CHANGED
@@ -1,20 +1,7 @@
|
|
1
1
|
namespace :setup do
|
2
2
|
task :generate_secret_token do
|
3
|
-
require '
|
4
|
-
|
5
|
-
template = Rails.root.join("config", "initializers", "secret_token.rb.template")
|
6
|
-
raise "File not found: #{template}" unless File.exist?(template)
|
3
|
+
require 'iqvoc'
|
7
4
|
|
8
|
-
|
9
|
-
|
10
|
-
token = SecureRandom.hex(64)
|
11
|
-
txt = File.read(template)
|
12
|
-
txt.gsub!("S-E-C-R-E-T", token)
|
13
|
-
|
14
|
-
File.open(file_name, "w") do |f|
|
15
|
-
f.write txt
|
16
|
-
end
|
17
|
-
|
18
|
-
puts "Secret token configuration has been created in #{file_name}."
|
5
|
+
Iqvoc.generate_secret_token
|
19
6
|
end
|
20
7
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iqvoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.3.
|
4
|
+
version: 3.3.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,11 +11,11 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2012-01-
|
14
|
+
date: 2012-01-16 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rails
|
18
|
-
requirement: &
|
18
|
+
requirement: &70224561742940 !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
21
21
|
- - ~>
|
@@ -23,10 +23,10 @@ dependencies:
|
|
23
23
|
version: 3.1.3
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
|
-
version_requirements: *
|
26
|
+
version_requirements: *70224561742940
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
|
-
requirement: &
|
29
|
+
requirement: &70224561742540 !ruby/object:Gem::Requirement
|
30
30
|
none: false
|
31
31
|
requirements:
|
32
32
|
- - ! '>='
|
@@ -34,10 +34,10 @@ dependencies:
|
|
34
34
|
version: '0'
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
|
-
version_requirements: *
|
37
|
+
version_requirements: *70224561742540
|
38
38
|
- !ruby/object:Gem::Dependency
|
39
39
|
name: kaminari
|
40
|
-
requirement: &
|
40
|
+
requirement: &70224561742080 !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
43
|
- - ! '>='
|
@@ -45,10 +45,10 @@ dependencies:
|
|
45
45
|
version: '0'
|
46
46
|
type: :runtime
|
47
47
|
prerelease: false
|
48
|
-
version_requirements: *
|
48
|
+
version_requirements: *70224561742080
|
49
49
|
- !ruby/object:Gem::Dependency
|
50
50
|
name: authlogic
|
51
|
-
requirement: &
|
51
|
+
requirement: &70224561741660 !ruby/object:Gem::Requirement
|
52
52
|
none: false
|
53
53
|
requirements:
|
54
54
|
- - ! '>='
|
@@ -56,10 +56,10 @@ dependencies:
|
|
56
56
|
version: '0'
|
57
57
|
type: :runtime
|
58
58
|
prerelease: false
|
59
|
-
version_requirements: *
|
59
|
+
version_requirements: *70224561741660
|
60
60
|
- !ruby/object:Gem::Dependency
|
61
61
|
name: cancan
|
62
|
-
requirement: &
|
62
|
+
requirement: &70224561741240 !ruby/object:Gem::Requirement
|
63
63
|
none: false
|
64
64
|
requirements:
|
65
65
|
- - ! '>='
|
@@ -67,10 +67,10 @@ dependencies:
|
|
67
67
|
version: '0'
|
68
68
|
type: :runtime
|
69
69
|
prerelease: false
|
70
|
-
version_requirements: *
|
70
|
+
version_requirements: *70224561741240
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
72
|
name: iq_rdf
|
73
|
-
requirement: &
|
73
|
+
requirement: &70224561740740 !ruby/object:Gem::Requirement
|
74
74
|
none: false
|
75
75
|
requirements:
|
76
76
|
- - ~>
|
@@ -78,10 +78,10 @@ dependencies:
|
|
78
78
|
version: 0.1.0
|
79
79
|
type: :runtime
|
80
80
|
prerelease: false
|
81
|
-
version_requirements: *
|
81
|
+
version_requirements: *70224561740740
|
82
82
|
- !ruby/object:Gem::Dependency
|
83
83
|
name: json
|
84
|
-
requirement: &
|
84
|
+
requirement: &70224561740320 !ruby/object:Gem::Requirement
|
85
85
|
none: false
|
86
86
|
requirements:
|
87
87
|
- - ! '>='
|
@@ -89,10 +89,10 @@ dependencies:
|
|
89
89
|
version: '0'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
|
-
version_requirements: *
|
92
|
+
version_requirements: *70224561740320
|
93
93
|
- !ruby/object:Gem::Dependency
|
94
94
|
name: rails_autolink
|
95
|
-
requirement: &
|
95
|
+
requirement: &70224561739860 !ruby/object:Gem::Requirement
|
96
96
|
none: false
|
97
97
|
requirements:
|
98
98
|
- - ! '>='
|
@@ -100,7 +100,7 @@ dependencies:
|
|
100
100
|
version: '0'
|
101
101
|
type: :runtime
|
102
102
|
prerelease: false
|
103
|
-
version_requirements: *
|
103
|
+
version_requirements: *70224561739860
|
104
104
|
description: iQvoc - a SKOS(-XL) vocabulary management system built on the Semantic
|
105
105
|
Web
|
106
106
|
email:
|
@@ -172,6 +172,7 @@ files:
|
|
172
172
|
- app/controllers/concepts/versions_controller.rb
|
173
173
|
- app/controllers/concepts_controller.rb
|
174
174
|
- app/controllers/dashboard_controller.rb
|
175
|
+
- app/controllers/import_controller.rb
|
175
176
|
- app/controllers/pages_controller.rb
|
176
177
|
- app/controllers/rdf_controller.rb
|
177
178
|
- app/controllers/search_results_controller.rb
|
@@ -252,6 +253,8 @@ files:
|
|
252
253
|
- app/views/errors/access_denied.html.erb
|
253
254
|
- app/views/errors/multiple_choices.html.erb
|
254
255
|
- app/views/errors/not_found.html.erb
|
256
|
+
- app/views/import/import.html.erb
|
257
|
+
- app/views/import/index.html.erb
|
255
258
|
- app/views/kaminari/_page.html.erb
|
256
259
|
- app/views/kaminari/_paginator.html.erb
|
257
260
|
- app/views/layouts/_controls.html.erb
|
@@ -533,6 +536,7 @@ files:
|
|
533
536
|
- public/robots.txt
|
534
537
|
- public/stylesheets/iqvoc/ie_fixes.css
|
535
538
|
- lib/engine_tasks/db.rake
|
539
|
+
- lib/engine_tasks/setup.rake
|
536
540
|
- lib/iqvoc/ability.rb
|
537
541
|
- lib/iqvoc/data_helper.rb
|
538
542
|
- lib/iqvoc/deep_cloning.rb
|