dbpedia_concept_search 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +11 -0
- data/lib/dbpedia_concept_search.rb +9 -1
- metadata +9 -9
data/README.md
CHANGED
@@ -35,3 +35,14 @@ JSON
|
|
35
35
|
|
36
36
|
Use search.to_json to return a JSON representation of the data.
|
37
37
|
|
38
|
+
Background service
|
39
|
+
------------------
|
40
|
+
|
41
|
+
DbpediaConceptSearch relies on [the dbpedia lookup service](http://wiki.dbpedia.org/Lookup?show_files=1).
|
42
|
+
To test this service, check that the flowing URL returns XML describing Berlin concepts:
|
43
|
+
|
44
|
+
http://lookup.dbpedia.org/api/search.asmx/KeywordSearch?QueryClass=place&QueryString=berlin
|
45
|
+
|
46
|
+
If you get a failure, I've found the best solution is to post the error to
|
47
|
+
dbpedia-discussion@lists.sourceforge.net.
|
48
|
+
|
@@ -6,13 +6,21 @@ require 'json'
|
|
6
6
|
class DbpediaConceptSearch
|
7
7
|
attr_reader :query_class, :query_string
|
8
8
|
|
9
|
+
def self.hostname
|
10
|
+
@hostname ||= 'lookup.dbpedia.org'
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.hostname=(hostname)
|
14
|
+
@hostname = hostname
|
15
|
+
end
|
16
|
+
|
9
17
|
def initialize(query_class, query_string)
|
10
18
|
@query_class = query_class
|
11
19
|
@query_string = query_string
|
12
20
|
end
|
13
21
|
|
14
22
|
def dbpedia_url
|
15
|
-
%Q{http
|
23
|
+
%Q{http://#{DbpediaConceptSearch.hostname}/api/search.asmx/KeywordSearch?QueryClass=#{query_class}&QueryString=#{cleaned_query_string}}
|
16
24
|
end
|
17
25
|
|
18
26
|
def cleaned_query_string
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dbpedia_concept_search
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-08-16 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: hashie
|
16
|
-
requirement: &
|
16
|
+
requirement: &21724760 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 1.2.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *21724760
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: json
|
27
|
-
requirement: &
|
27
|
+
requirement: &21724220 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *21724220
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: nori
|
38
|
-
requirement: &
|
38
|
+
requirement: &21723660 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *21723660
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: typhoeus
|
49
|
-
requirement: &
|
49
|
+
requirement: &21723100 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *21723100
|
58
58
|
description: A tool that queries dbpedia.org's lookup tool to find concepts, and then
|
59
59
|
bundles the results into either ruby objects (using Hashie) or json.
|
60
60
|
email: rob@undervale.co.uk
|