iqvoc_similar_terms 0.7.1 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0eaec0b3caf5fbb0da0d2d26d0e5872b3603337f
|
4
|
+
data.tar.gz: 4ef9b1d6d61ffea7e942ceab50a7d594bf79d87a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ada85feb7c1ab0ae5799c9c06df5b7fe2e0e1b285fd707bdbf3ef0f67097ea70efcaac5db9e84e4e5e80f9eb371f5f9f67d9bd2f679721653cca5206701a3ff
|
7
|
+
data.tar.gz: 5d92281ae57e7a1ff0a4ae6540e6acb69a1b7fe550994816c73e5c44d9ff7f5ebf72ded3cb4ae5ac035c968008aa9baab3af508918c02f084a05e344cd9b24a9
|
@@ -15,29 +15,12 @@ class SimilarTermsController < ApplicationController
|
|
15
15
|
@terms = Iqvoc::InlineDataHelper.parse_inline_values(params[:terms])
|
16
16
|
lang = params[:lang]
|
17
17
|
|
18
|
-
|
19
18
|
respond_to do |format|
|
20
19
|
format.html do
|
21
20
|
@results = Iqvoc::SimilarTerms.ranked(lang, *@terms)
|
22
21
|
end
|
23
|
-
format.ttl do
|
22
|
+
format.any(:rdf, :ttl) do
|
24
23
|
@results = Iqvoc::SimilarTerms.alphabetical(lang, *@terms)
|
25
|
-
|
26
|
-
# manually generating Turtle here to allow users to process the data
|
27
|
-
# without requiring an RDF parser (not using IqRdf because it doesn't
|
28
|
-
# appear to support this format and we want to avoid subtle changes in
|
29
|
-
# the serialization).
|
30
|
-
query = url_for(request.query_parameters.
|
31
|
-
merge(:only_path => false, :anchor => ""))
|
32
|
-
literals = @results.
|
33
|
-
map { |label| IqRdf::Literal.new label.value, label.language }.
|
34
|
-
join(", ")
|
35
|
-
render :text => <<-rdf.strip
|
36
|
-
@prefix skos: <http://www.w3.org/2004/02/skos/core#>.
|
37
|
-
@prefix query: <#{query}>.
|
38
|
-
|
39
|
-
query:top skos:altLabel #{literals}.
|
40
|
-
rdf
|
41
24
|
end
|
42
25
|
end
|
43
26
|
end
|
@@ -4,6 +4,7 @@
|
|
4
4
|
<%= sidebar do %>
|
5
5
|
<%= sidebar_header t('txt.common.representations') %>
|
6
6
|
<%= sidebar_item :icon => 'share', :text => 'HTML', :path => similar_path(:terms => params[:terms], :format => :html) %>
|
7
|
+
<%= sidebar_item :icon => 'share', :text => 'RDF/XML', :path => similar_path(:terms => params[:terms], :format => :rdf) %>
|
7
8
|
<%= sidebar_item :icon => 'share', :text => 'RDF/Turtle', :path => similar_path(:terms => params[:terms], :format => :ttl) %>
|
8
9
|
<% end %>
|
9
10
|
<% end %>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
Iqvoc.default_rdf_namespace_helper_methods.each do |meth|
|
2
|
+
document.namespaces(self.send(meth))
|
3
|
+
end
|
4
|
+
|
5
|
+
subject = url_for(request.query_parameters.
|
6
|
+
merge(:only_path => false, :anchor => ""))
|
7
|
+
|
8
|
+
document.namespaces(:query => subject)
|
9
|
+
|
10
|
+
#document << IqRdf::query do |query|
|
11
|
+
# @results.each do |label|
|
12
|
+
# query::Skos.altLabel(label.value, :lang => label.language)
|
13
|
+
# end
|
14
|
+
#end
|
15
|
+
document << IqRdf::Query.top do |t|
|
16
|
+
@results.each do |label|
|
17
|
+
t.Skos.altLabel(label.value, :lang => label.language)
|
18
|
+
end
|
19
|
+
end if @results.length > 0
|
data/test/functional/api_test.rb
CHANGED
@@ -32,7 +32,7 @@ class SimilarTermsTest < ActionController::TestCase
|
|
32
32
|
|
33
33
|
get :show, :lang => "en", :format => "ttl", :terms => "foo"
|
34
34
|
assert_response 200
|
35
|
-
assert !@response.body.include?("
|
35
|
+
assert !@response.body.include?("skos:altLabel")
|
36
36
|
end
|
37
37
|
|
38
38
|
test "RDF representations" do
|
@@ -45,7 +45,8 @@ class SimilarTermsTest < ActionController::TestCase
|
|
45
45
|
@prefix query: <http://test.host/en/similar.ttl?terms=forest#>.
|
46
46
|
EOS
|
47
47
|
assert @response.body.include?(<<-EOS.strip)
|
48
|
-
query:top skos:altLabel "forest"@en
|
48
|
+
query:top skos:altLabel "forest"@en;
|
49
|
+
skos:altLabel "woods"@en.
|
49
50
|
EOS
|
50
51
|
|
51
52
|
get :show, :lang => "en", :format => "ttl", :terms => "forest,automobile"
|
@@ -57,7 +58,10 @@ query:top skos:altLabel "forest"@en, "woods"@en.
|
|
57
58
|
@prefix query: <http://test.host/en/similar.ttl?terms=forest%2Cautomobile#>.
|
58
59
|
EOS
|
59
60
|
assert @response.body.include?(<<-EOS.strip)
|
60
|
-
query:top skos:altLabel "automobile"@en
|
61
|
+
query:top skos:altLabel "automobile"@en;
|
62
|
+
skos:altLabel "car"@en;
|
63
|
+
skos:altLabel "forest"@en;
|
64
|
+
skos:altLabel "woods"@en.
|
61
65
|
EOS
|
62
66
|
end
|
63
67
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iqvoc_similar_terms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Frederik Dohr
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-05-02 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: iqvoc
|
@@ -41,6 +41,7 @@ files:
|
|
41
41
|
- Rakefile
|
42
42
|
- app/controllers/similar_terms_controller.rb
|
43
43
|
- app/views/similar_terms/show.html.erb
|
44
|
+
- app/views/similar_terms/show.iqrdf
|
44
45
|
- config.ru
|
45
46
|
- config/application.rb
|
46
47
|
- config/boot.rb
|