opener-ned 2.3.0 → 2.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/core/target/ehu-ned-1.0.jar +0 -0
- data/lib/opener/ned.rb +2 -4
- data/lib/opener/ned/version.rb +1 -1
- data/lib/opener/ned/views/index.erb +1 -1
- data/opener-ned.gemspec +1 -1
- metadata +17 -17
- data/lib/opener/ned/error_layer.rb +0 -89
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f455dcd18c5c9af58539968e2488a4227146164f
|
4
|
+
data.tar.gz: edbd9185e2293a6ef4636e0d259269c6e7201604
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3fb57fb253068c1f0f899cf0b4b73944497f4ffac8a9a00bde1230259fec980e39853c15425b50da2fb65d2266efc6279ee622738cecb7107e1d11d32261c6af
|
7
|
+
data.tar.gz: 4afc7fa154aa074c4f408853a3647be5494dea933375ab78b9cf52196c31d0bcf1c211f9a77d3bc491c0888d5296e15140a24bda77312633c2caaf0e0053859c
|
data/core/target/ehu-ned-1.0.jar
CHANGED
Binary file
|
data/lib/opener/ned.rb
CHANGED
@@ -7,11 +7,9 @@ require File.expand_path('../../../core/target/ehu-ned-1.0.jar', __FILE__)
|
|
7
7
|
|
8
8
|
require_relative 'ned/version'
|
9
9
|
require_relative 'ned/cli'
|
10
|
-
require_relative 'ned/error_layer'
|
11
10
|
|
12
11
|
import 'java.io.InputStreamReader'
|
13
12
|
|
14
|
-
import 'ehu.ned.Annotate'
|
15
13
|
import 'ixa.kaflib.KAFDocument'
|
16
14
|
|
17
15
|
module Opener
|
@@ -81,9 +79,9 @@ module Opener
|
|
81
79
|
)
|
82
80
|
|
83
81
|
return document.to_string
|
84
|
-
|
82
|
+
|
85
83
|
rescue Exception => error
|
86
|
-
return ErrorLayer.new(input, error.message, self.class).add
|
84
|
+
return Opener::Core::ErrorLayer.new(input, error.message, self.class).add
|
87
85
|
end
|
88
86
|
end
|
89
87
|
|
data/lib/opener/ned/version.rb
CHANGED
data/opener-ned.gemspec
CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |gem|
|
|
27
27
|
gem.add_dependency 'nokogiri'
|
28
28
|
gem.add_dependency 'puma'
|
29
29
|
gem.add_dependency 'opener-daemons'
|
30
|
-
gem.add_dependency 'opener-core',
|
30
|
+
gem.add_dependency 'opener-core', '~> 1.0'
|
31
31
|
|
32
32
|
gem.add_development_dependency 'rake'
|
33
33
|
gem.add_development_dependency 'cliver'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opener-ned
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- development@olery.com
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|
@@ -98,14 +98,14 @@ dependencies:
|
|
98
98
|
name: opener-core
|
99
99
|
version_requirements: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ~>
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
103
|
+
version: '1.0'
|
104
104
|
requirement: !ruby/object:Gem::Requirement
|
105
105
|
requirements:
|
106
|
-
- -
|
106
|
+
- - ~>
|
107
107
|
- !ruby/object:Gem::Version
|
108
|
-
version:
|
108
|
+
version: '1.0'
|
109
109
|
prerelease: false
|
110
110
|
type: :runtime
|
111
111
|
- !ruby/object:Gem::Dependency
|
@@ -139,27 +139,26 @@ dependencies:
|
|
139
139
|
description: NED client using DBpedia
|
140
140
|
email:
|
141
141
|
executables:
|
142
|
-
- ned
|
143
142
|
- ned-daemon
|
144
143
|
- ned-server
|
144
|
+
- ned
|
145
145
|
extensions: []
|
146
146
|
extra_rdoc_files: []
|
147
147
|
files:
|
148
|
-
- README.md
|
149
|
-
- bin/ned
|
150
|
-
- bin/ned-daemon
|
151
|
-
- bin/ned-server
|
152
|
-
- config.ru
|
153
148
|
- core/target/ehu-ned-1.0.jar
|
154
|
-
- exec/ned.rb
|
155
149
|
- lib/opener/ned.rb
|
150
|
+
- lib/opener/ned/version.rb
|
151
|
+
- lib/opener/ned/server.rb
|
156
152
|
- lib/opener/ned/cli.rb
|
157
|
-
- lib/opener/ned/error_layer.rb
|
158
153
|
- lib/opener/ned/public/markdown.css
|
159
|
-
- lib/opener/ned/server.rb
|
160
|
-
- lib/opener/ned/version.rb
|
161
154
|
- lib/opener/ned/views/index.erb
|
162
155
|
- opener-ned.gemspec
|
156
|
+
- config.ru
|
157
|
+
- README.md
|
158
|
+
- exec/ned.rb
|
159
|
+
- bin/ned-daemon
|
160
|
+
- bin/ned-server
|
161
|
+
- bin/ned
|
163
162
|
homepage:
|
164
163
|
licenses: []
|
165
164
|
metadata: {}
|
@@ -179,8 +178,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
179
178
|
version: '0'
|
180
179
|
requirements: []
|
181
180
|
rubyforge_project:
|
182
|
-
rubygems_version: 2.
|
181
|
+
rubygems_version: 2.1.9
|
183
182
|
signing_key:
|
184
183
|
specification_version: 4
|
185
184
|
summary: NED client using DBpedia
|
186
185
|
test_files: []
|
186
|
+
has_rdoc: yard
|
@@ -1,89 +0,0 @@
|
|
1
|
-
module Opener
|
2
|
-
class Ned
|
3
|
-
##
|
4
|
-
# Add Error Layer to KAF file instead of throwing an error.
|
5
|
-
#
|
6
|
-
class ErrorLayer
|
7
|
-
attr_accessor :input, :document, :error, :klass
|
8
|
-
|
9
|
-
def initialize(input, error, klass)
|
10
|
-
@input = input.to_s
|
11
|
-
# Make sure there is always a document, even if it is empty.
|
12
|
-
@document = Nokogiri::XML(input) rescue Nokogiri::XML(nil)
|
13
|
-
@error = error
|
14
|
-
@klass = klass
|
15
|
-
end
|
16
|
-
|
17
|
-
def add
|
18
|
-
if is_xml?
|
19
|
-
unless has_errors_layer?
|
20
|
-
add_errors_layer
|
21
|
-
end
|
22
|
-
else
|
23
|
-
add_root
|
24
|
-
add_text
|
25
|
-
add_errors_layer
|
26
|
-
end
|
27
|
-
add_error
|
28
|
-
|
29
|
-
xml = !!document.encoding ? document.to_xml : document.to_xml(:encoding => "UTF-8")
|
30
|
-
|
31
|
-
return xml
|
32
|
-
end
|
33
|
-
|
34
|
-
##
|
35
|
-
# Check if the document is a valid XML file.
|
36
|
-
#
|
37
|
-
def is_xml?
|
38
|
-
!!document.root
|
39
|
-
end
|
40
|
-
|
41
|
-
##
|
42
|
-
# Add root element to the XML file.
|
43
|
-
#
|
44
|
-
def add_root
|
45
|
-
root = Nokogiri::XML::Node.new "KAF", document
|
46
|
-
document.add_child(root)
|
47
|
-
end
|
48
|
-
|
49
|
-
##
|
50
|
-
# Check if the document already has an errors layer.
|
51
|
-
#
|
52
|
-
def has_errors_layer?
|
53
|
-
!!document.at('errors')
|
54
|
-
end
|
55
|
-
|
56
|
-
##
|
57
|
-
# Add errors element to the XML file.
|
58
|
-
#
|
59
|
-
def add_errors_layer
|
60
|
-
node = Nokogiri::XML::Node.new "errors", document
|
61
|
-
document.root.add_child(node)
|
62
|
-
end
|
63
|
-
|
64
|
-
##
|
65
|
-
# Add the text file incase it is not a valid XML document. More
|
66
|
-
# info for debugging.
|
67
|
-
#
|
68
|
-
def add_text
|
69
|
-
node = Nokogiri::XML::Node.new "raw", document
|
70
|
-
node.inner_html = input
|
71
|
-
document.root.add_child(node)
|
72
|
-
|
73
|
-
end
|
74
|
-
|
75
|
-
##
|
76
|
-
# Add the actual error to the errors layer.
|
77
|
-
#
|
78
|
-
def add_error
|
79
|
-
node = document.at('errors')
|
80
|
-
error_node = Nokogiri::XML::Node.new "error", node
|
81
|
-
error_node['class'] = klass.to_s
|
82
|
-
error_node['version'] = klass::VERSION
|
83
|
-
error_node.inner_html = error
|
84
|
-
node.add_child(error_node)
|
85
|
-
end
|
86
|
-
|
87
|
-
end # ErrorLayer
|
88
|
-
end # Ned
|
89
|
-
end # Opener
|