bbc_data_service 1.2 → 1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/bbc_data_service/rdf_parser.rb +12 -3
- data/lib/bbc_data_service/version.rb +1 -1
- metadata +4 -4
@@ -27,13 +27,13 @@ module BBCDataService
|
|
27
27
|
end
|
28
28
|
fixtures.each do |fixture|
|
29
29
|
current_fixture = BBCDataService::FeedFixture.new(self.instance_eval(self.execute_query(graph, query, mappings)))
|
30
|
-
self.process_relationships(graph, registered_fixture, current_fixture, fixture)
|
30
|
+
self.process_relationships(graph, registered_fixture, current_fixture, fixture, options)
|
31
31
|
results << current_fixture
|
32
32
|
end
|
33
33
|
results
|
34
34
|
end
|
35
35
|
|
36
|
-
def self.process_relationships(graph, fixture_data, current_fixture, rdf_fixture)
|
36
|
+
def self.process_relationships(graph, fixture_data, current_fixture, rdf_fixture, options)
|
37
37
|
relationships = fixture_data[:relationships]
|
38
38
|
if relationships
|
39
39
|
relationships.each do |relationship|
|
@@ -43,8 +43,17 @@ module BBCDataService
|
|
43
43
|
query = RDF::Query.new({
|
44
44
|
:fixture => self.generate_query(values[:mappings], values[:rdf_type])
|
45
45
|
})
|
46
|
+
if options[:filter]
|
47
|
+
solutions = query.execute(graph)
|
48
|
+
fixtures = self.filter_graph(solutions, options[:filter])
|
49
|
+
elsif registered_fixture[:filter]
|
50
|
+
solutions = query.execute(graph)
|
51
|
+
fixtures = self.filter_graph(solutions, registered_fixture[:filter])
|
52
|
+
else
|
53
|
+
fixtures = query.execute(graph)
|
54
|
+
end
|
46
55
|
results = []
|
47
|
-
|
56
|
+
fixtures.each do |fixture|
|
48
57
|
results << BBCDataService::FeedFixture.new(self.instance_eval(self.execute_query(graph, query, values[:mappings])))
|
49
58
|
end
|
50
59
|
current_fixture.add_relationship(key, results)
|
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bbc_data_service
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 9
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: "1.
|
8
|
+
- 3
|
9
|
+
version: "1.3"
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Matthew Crouch
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-10-
|
17
|
+
date: 2011-10-25 00:00:00 Z
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
20
|
name: sinatra
|