bbc-programmes 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +5 -0
- data/README.md +11 -0
- data/Rakefile +50 -0
- data/VERSION +1 -0
- data/examples/basic.rb +19 -0
- data/examples/broadcasts.rb +19 -0
- data/examples/search.rb +15 -0
- data/examples/tracklist.rb +20 -0
- data/lib/bbc/programmes/base.rb +46 -0
- data/lib/bbc/programmes/brand.rb +12 -0
- data/lib/bbc/programmes/broadcast.rb +31 -0
- data/lib/bbc/programmes/episode.rb +13 -0
- data/lib/bbc/programmes/programme.rb +33 -0
- data/lib/bbc/programmes/segment.rb +18 -0
- data/lib/bbc/programmes/series.rb +14 -0
- data/lib/bbc/programmes/service.rb +17 -0
- data/lib/bbc/programmes/time_interval.rb +16 -0
- data/lib/bbc/programmes/time_line.rb +10 -0
- data/lib/bbc/programmes/version.rb +51 -0
- data/lib/bbc/programmes.rb +110 -0
- data/lib/rdf/po.rb +17 -0
- data/lib/rdf/time_line.rb +12 -0
- data/spec/bbc-programmes.spec +71 -0
- data/spec/brand.spec +74 -0
- data/spec/broadcast.spec +65 -0
- data/spec/data/b005sv69.rdf +507 -0
- data/spec/data/b00jnwlc.rdf +51 -0
- data/spec/data/b00jnwm0.rdf +128 -0
- data/spec/data/b00jnwnv.rdf +62 -0
- data/spec/data/the_wire.rdf +41 -0
- data/spec/episode.spec +78 -0
- data/spec/series.spec +74 -0
- data/spec/service.spec +34 -0
- data/spec/spec_helper.rb +31 -0
- data/spec/version.spec +90 -0
- metadata +151 -0
@@ -0,0 +1,51 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<rdf:RDF xmlns:rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
3
|
+
xmlns:rdfs = "http://www.w3.org/2000/01/rdf-schema#"
|
4
|
+
xmlns:owl = "http://www.w3.org/2002/07/owl#"
|
5
|
+
xmlns:foaf = "http://xmlns.com/foaf/0.1/"
|
6
|
+
xmlns:po = "http://purl.org/ontology/po/"
|
7
|
+
xmlns:mo = "http://purl.org/ontology/mo/"
|
8
|
+
xmlns:skos = "http://www.w3.org/2008/05/skos#"
|
9
|
+
xmlns:time = "http://www.w3.org/2006/time#"
|
10
|
+
xmlns:dc = "http://purl.org/dc/elements/1.1/"
|
11
|
+
xmlns:dcterms = "http://purl.org/dc/terms/"
|
12
|
+
xmlns:wgs84_pos= "http://www.w3.org/2003/01/geo/wgs84_pos#"
|
13
|
+
xmlns:timeline = "http://purl.org/NET/c4dm/timeline.owl#"
|
14
|
+
xmlns:event = "http://purl.org/NET/c4dm/event.owl#">
|
15
|
+
|
16
|
+
<rdf:Description rdf:about="/programmes/b00jnwlc.rdf">
|
17
|
+
<rdfs:label>Description of the brand The Wire</rdfs:label>
|
18
|
+
<dcterms:created rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2009-03-23T02:04:29Z</dcterms:created>
|
19
|
+
<dcterms:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2009-05-05T13:38:34+01:00</dcterms:modified>
|
20
|
+
<foaf:primaryTopic rdf:resource="/programmes/b00jnwlc#programme"/>
|
21
|
+
</rdf:Description>
|
22
|
+
|
23
|
+
<po:Brand rdf:about="/programmes/b00jnwlc#programme">
|
24
|
+
|
25
|
+
<po:pid>b00jnwlc</po:pid>
|
26
|
+
<dc:title>The Wire</dc:title>
|
27
|
+
<po:short_synopsis>Critically acclaimed American crime drama series set in Baltimore</po:short_synopsis>
|
28
|
+
<po:medium_synopsis>Critically acclaimed American crime drama series set in Baltimore, telling the story of inner-city drug culture as seen through the eyes of drug dealers and law enforcement. Created by David Simon</po:medium_synopsis>
|
29
|
+
|
30
|
+
|
31
|
+
<foaf:depiction rdf:resource="/iplayer/images/progbrand/b00jnwlc_512_288.jpg"/>
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
<po:genre rdf:resource="/programmes/genres/drama/crime#genre" />
|
36
|
+
|
37
|
+
|
38
|
+
<po:masterbrand rdf:resource="/bbctwo#service"/>
|
39
|
+
|
40
|
+
<po:series rdf:resource="/programmes/b00jnwm0#programme" />
|
41
|
+
<po:series rdf:resource="/programmes/b00kd3jk#programme" />
|
42
|
+
<po:series rdf:resource="/programmes/b00lfhbt#programme" />
|
43
|
+
<po:series rdf:resource="/programmes/b00lww66#programme" />
|
44
|
+
<po:series rdf:resource="/programmes/b00mb2rh#programme" />
|
45
|
+
|
46
|
+
|
47
|
+
|
48
|
+
</po:Brand>
|
49
|
+
|
50
|
+
|
51
|
+
</rdf:RDF>
|
@@ -0,0 +1,128 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<rdf:RDF xmlns:rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
3
|
+
xmlns:rdfs = "http://www.w3.org/2000/01/rdf-schema#"
|
4
|
+
xmlns:owl = "http://www.w3.org/2002/07/owl#"
|
5
|
+
xmlns:foaf = "http://xmlns.com/foaf/0.1/"
|
6
|
+
xmlns:po = "http://purl.org/ontology/po/"
|
7
|
+
xmlns:mo = "http://purl.org/ontology/mo/"
|
8
|
+
xmlns:skos = "http://www.w3.org/2008/05/skos#"
|
9
|
+
xmlns:time = "http://www.w3.org/2006/time#"
|
10
|
+
xmlns:dc = "http://purl.org/dc/elements/1.1/"
|
11
|
+
xmlns:dcterms = "http://purl.org/dc/terms/"
|
12
|
+
xmlns:wgs84_pos= "http://www.w3.org/2003/01/geo/wgs84_pos#"
|
13
|
+
xmlns:timeline = "http://purl.org/NET/c4dm/timeline.owl#"
|
14
|
+
xmlns:event = "http://purl.org/NET/c4dm/event.owl#">
|
15
|
+
|
16
|
+
<rdf:Description rdf:about="/programmes/b00jnwm0.rdf">
|
17
|
+
<rdfs:label>Description of the series Series 1</rdfs:label>
|
18
|
+
<dcterms:created rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2009-03-23T02:04:29Z</dcterms:created>
|
19
|
+
<dcterms:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2009-05-18T17:10:30+01:00</dcterms:modified>
|
20
|
+
<foaf:primaryTopic rdf:resource="/programmes/b00jnwm0#programme"/>
|
21
|
+
</rdf:Description>
|
22
|
+
|
23
|
+
<po:Series rdf:about="/programmes/b00jnwm0#programme">
|
24
|
+
|
25
|
+
<po:pid>b00jnwm0</po:pid>
|
26
|
+
<dc:title>Series 1</dc:title>
|
27
|
+
<po:short_synopsis>Critically acclaimed crime drama series telling the story of a single drugs investigation</po:short_synopsis>
|
28
|
+
<po:medium_synopsis>Critically acclaimed crime drama series telling the story of a single drugs-and-murder police investigation from the point of view of the police and their targets</po:medium_synopsis>
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
<po:genre rdf:resource="/programmes/genres/drama/crime#genre" />
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
<po:episode>
|
41
|
+
<po:Episode rdf:about="/programmes/b00jnwnv#programme">
|
42
|
+
<dc:title>The Target</dc:title>
|
43
|
+
<po:position rdf:datatype="http://www.w3.org/2001/XMLSchema#int">1</po:position>
|
44
|
+
</po:Episode>
|
45
|
+
</po:episode>
|
46
|
+
<po:episode>
|
47
|
+
<po:Episode rdf:about="/programmes/b00jnx7c#programme">
|
48
|
+
<dc:title>The Detail</dc:title>
|
49
|
+
<po:position rdf:datatype="http://www.w3.org/2001/XMLSchema#int">2</po:position>
|
50
|
+
</po:Episode>
|
51
|
+
</po:episode>
|
52
|
+
<po:episode>
|
53
|
+
<po:Episode rdf:about="/programmes/b00jnxlc#programme">
|
54
|
+
<dc:title>The Buys</dc:title>
|
55
|
+
<po:position rdf:datatype="http://www.w3.org/2001/XMLSchema#int">3</po:position>
|
56
|
+
</po:Episode>
|
57
|
+
</po:episode>
|
58
|
+
<po:episode>
|
59
|
+
<po:Episode rdf:about="/programmes/b00jnxqd#programme">
|
60
|
+
<dc:title>Old Cases</dc:title>
|
61
|
+
<po:position rdf:datatype="http://www.w3.org/2001/XMLSchema#int">4</po:position>
|
62
|
+
</po:Episode>
|
63
|
+
</po:episode>
|
64
|
+
<po:episode>
|
65
|
+
<po:Episode rdf:about="/programmes/b00jnxy1#programme">
|
66
|
+
<dc:title>The Pager</dc:title>
|
67
|
+
<po:position rdf:datatype="http://www.w3.org/2001/XMLSchema#int">5</po:position>
|
68
|
+
</po:Episode>
|
69
|
+
</po:episode>
|
70
|
+
<po:episode>
|
71
|
+
<po:Episode rdf:about="/programmes/b00jvjbx#programme">
|
72
|
+
<dc:title>The Wire</dc:title>
|
73
|
+
<po:position rdf:datatype="http://www.w3.org/2001/XMLSchema#int">6</po:position>
|
74
|
+
</po:Episode>
|
75
|
+
</po:episode>
|
76
|
+
<po:episode>
|
77
|
+
<po:Episode rdf:about="/programmes/b00jvjk3#programme">
|
78
|
+
<dc:title>One Arrest</dc:title>
|
79
|
+
<po:position rdf:datatype="http://www.w3.org/2001/XMLSchema#int">7</po:position>
|
80
|
+
</po:Episode>
|
81
|
+
</po:episode>
|
82
|
+
<po:episode>
|
83
|
+
<po:Episode rdf:about="/programmes/b00jvjnc#programme">
|
84
|
+
<dc:title>Lessons</dc:title>
|
85
|
+
<po:position rdf:datatype="http://www.w3.org/2001/XMLSchema#int">8</po:position>
|
86
|
+
</po:Episode>
|
87
|
+
</po:episode>
|
88
|
+
<po:episode>
|
89
|
+
<po:Episode rdf:about="/programmes/b00jvkd8#programme">
|
90
|
+
<dc:title>Game Day</dc:title>
|
91
|
+
<po:position rdf:datatype="http://www.w3.org/2001/XMLSchema#int">9</po:position>
|
92
|
+
</po:Episode>
|
93
|
+
</po:episode>
|
94
|
+
<po:episode>
|
95
|
+
<po:Episode rdf:about="/programmes/b00jz7bx#programme">
|
96
|
+
<dc:title>The Cost</dc:title>
|
97
|
+
<po:position rdf:datatype="http://www.w3.org/2001/XMLSchema#int">10</po:position>
|
98
|
+
</po:Episode>
|
99
|
+
</po:episode>
|
100
|
+
<po:episode>
|
101
|
+
<po:Episode rdf:about="/programmes/b00jz7gr#programme">
|
102
|
+
<dc:title>The Hunt</dc:title>
|
103
|
+
<po:position rdf:datatype="http://www.w3.org/2001/XMLSchema#int">11</po:position>
|
104
|
+
</po:Episode>
|
105
|
+
</po:episode>
|
106
|
+
<po:episode>
|
107
|
+
<po:Episode rdf:about="/programmes/b00jz82x#programme">
|
108
|
+
<dc:title>Cleaning Up</dc:title>
|
109
|
+
<po:position rdf:datatype="http://www.w3.org/2001/XMLSchema#int">12</po:position>
|
110
|
+
</po:Episode>
|
111
|
+
</po:episode>
|
112
|
+
<po:episode>
|
113
|
+
<po:Episode rdf:about="/programmes/b00jz7mc#programme">
|
114
|
+
<dc:title>Sentencing</dc:title>
|
115
|
+
<po:position rdf:datatype="http://www.w3.org/2001/XMLSchema#int">13</po:position>
|
116
|
+
</po:Episode>
|
117
|
+
</po:episode>
|
118
|
+
|
119
|
+
|
120
|
+
</po:Series>
|
121
|
+
|
122
|
+
<po:Brand rdf:about="/programmes/b00jnwlc#programme">
|
123
|
+
<po:series rdf:resource="/programmes/b00jnwm0#programme"/>
|
124
|
+
</po:Brand>
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
</rdf:RDF>
|
@@ -0,0 +1,62 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<rdf:RDF xmlns:rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
3
|
+
xmlns:rdfs = "http://www.w3.org/2000/01/rdf-schema#"
|
4
|
+
xmlns:owl = "http://www.w3.org/2002/07/owl#"
|
5
|
+
xmlns:foaf = "http://xmlns.com/foaf/0.1/"
|
6
|
+
xmlns:po = "http://purl.org/ontology/po/"
|
7
|
+
xmlns:mo = "http://purl.org/ontology/mo/"
|
8
|
+
xmlns:skos = "http://www.w3.org/2008/05/skos#"
|
9
|
+
xmlns:time = "http://www.w3.org/2006/time#"
|
10
|
+
xmlns:dc = "http://purl.org/dc/elements/1.1/"
|
11
|
+
xmlns:dcterms = "http://purl.org/dc/terms/"
|
12
|
+
xmlns:wgs84_pos= "http://www.w3.org/2003/01/geo/wgs84_pos#"
|
13
|
+
xmlns:timeline = "http://purl.org/NET/c4dm/timeline.owl#"
|
14
|
+
xmlns:event = "http://purl.org/NET/c4dm/event.owl#">
|
15
|
+
|
16
|
+
<rdf:Description rdf:about="/programmes/b00jnwnv.rdf">
|
17
|
+
<rdfs:label>Description of the episode The Target</rdfs:label>
|
18
|
+
<dcterms:created rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2009-03-23T02:04:29Z</dcterms:created>
|
19
|
+
<dcterms:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2009-03-23T02:04:29Z</dcterms:modified>
|
20
|
+
<foaf:primaryTopic rdf:resource="/programmes/b00jnwnv#programme"/>
|
21
|
+
</rdf:Description>
|
22
|
+
|
23
|
+
<po:Episode rdf:about="/programmes/b00jnwnv#programme">
|
24
|
+
|
25
|
+
<po:pid>b00jnwnv</po:pid>
|
26
|
+
<dc:title>The Target</dc:title>
|
27
|
+
<po:short_synopsis>During the murder trial of a mid-level dealer, the star witness recants her testimony.</po:short_synopsis>
|
28
|
+
<po:medium_synopsis>Critically acclaimed crime drama series. During the trial of a mid-level dealer accused of murder, the prosecution's star witness recants her testimony.</po:medium_synopsis>
|
29
|
+
<po:long_synopsis>Critically acclaimed drama series about drug dealers in West Baltimore and the police investigating them.
|
30
|
+
|
31
|
+
During the trial of D'Angelo Barksdale, a mid-level dealer accused of murder, the prosecution's star witness recants her testimony. After the trial, Detective James McNulty explains to Judge Phelan how he suspects the Barksdale crew for a slew of related murders.</po:long_synopsis>
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
<po:masterbrand rdf:resource="/bbctwo#service"/>
|
37
|
+
|
38
|
+
<po:position rdf:datatype="http://www.w3.org/2001/XMLSchema#int">1</po:position>
|
39
|
+
|
40
|
+
<po:genre rdf:resource="/programmes/genres/drama/crime#genre" />
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
<po:version rdf:resource="/programmes/b005sv69#programme" />
|
47
|
+
|
48
|
+
|
49
|
+
</po:Episode>
|
50
|
+
|
51
|
+
<po:Series rdf:about="/programmes/b00jnwm0#programme">
|
52
|
+
<po:episode rdf:resource="/programmes/b00jnwnv#programme"/>
|
53
|
+
</po:Series>
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
<po:Brand rdf:about="/programmes/b00jnwlc#programme">
|
58
|
+
<po:episode rdf:resource="/programmes/b00jnwnv#programme"/>
|
59
|
+
</po:Brand>
|
60
|
+
|
61
|
+
|
62
|
+
</rdf:RDF>
|
@@ -0,0 +1,41 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<rdf:RDF xmlns:rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
3
|
+
xmlns:rdfs = "http://www.w3.org/2000/01/rdf-schema#"
|
4
|
+
xmlns:owl = "http://www.w3.org/2002/07/owl#"
|
5
|
+
xmlns:foaf = "http://xmlns.com/foaf/0.1/"
|
6
|
+
xmlns:po = "http://purl.org/ontology/po/"
|
7
|
+
xmlns:mo = "http://purl.org/ontology/mo/"
|
8
|
+
xmlns:skos = "http://www.w3.org/2008/05/skos#"
|
9
|
+
xmlns:time = "http://www.w3.org/2006/time#"
|
10
|
+
xmlns:dc = "http://purl.org/dc/elements/1.1/"
|
11
|
+
xmlns:dcterms = "http://purl.org/dc/terms/"
|
12
|
+
xmlns:wgs84_pos= "http://www.w3.org/2003/01/geo/wgs84_pos#"
|
13
|
+
xmlns:timeline = "http://purl.org/NET/c4dm/timeline.owl#"
|
14
|
+
xmlns:event = "http://purl.org/NET/c4dm/event.owl#">
|
15
|
+
|
16
|
+
<foaf:Document rdf:about="">
|
17
|
+
<rdfs:label>THE WIRE</rdfs:label>
|
18
|
+
</foaf:Document>
|
19
|
+
|
20
|
+
<po:Programme rdf:about="/programmes/p001d75v#programme">
|
21
|
+
<po:pid>p001d75v</po:pid>
|
22
|
+
<dc:title>On The Wire</dc:title>
|
23
|
+
|
24
|
+
|
25
|
+
</po:Programme>
|
26
|
+
<po:Programme rdf:about="/programmes/b006ts0g#programme">
|
27
|
+
<po:pid>b006ts0g</po:pid>
|
28
|
+
<dc:title>The Wire</dc:title>
|
29
|
+
|
30
|
+
|
31
|
+
</po:Programme>
|
32
|
+
<po:Programme rdf:about="/programmes/b00jnwlc#programme">
|
33
|
+
<po:pid>b00jnwlc</po:pid>
|
34
|
+
<dc:title>The Wire</dc:title>
|
35
|
+
|
36
|
+
|
37
|
+
</po:Programme>
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
</rdf:RDF>
|
data/spec/episode.spec
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
require File.dirname(__FILE__) + "/spec_helper.rb"
|
2
|
+
|
3
|
+
describe BBC::Programmes::Episode do
|
4
|
+
before :each do
|
5
|
+
@repo = RDF::Repository.new
|
6
|
+
Spira.add_repository(:default, @repo)
|
7
|
+
end
|
8
|
+
|
9
|
+
context "fetching a Episode from the website" do
|
10
|
+
before :each do
|
11
|
+
mock_http('www.bbc.co.uk', 'b00jnwnv.rdf')
|
12
|
+
@episode = BBC::Programmes::Episode.fetch('b00jnwnv')
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should have a type URI defined" do
|
16
|
+
@episode.type.should == RDF::URI('http://purl.org/ontology/po/Episode')
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should have a correct URI" do
|
20
|
+
@episode.subject.should == RDF::URI('http://www.bbc.co.uk/programmes/b00jnwnv#programme')
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should have a programme indentifier" do
|
24
|
+
@episode.pid.should == 'b00jnwnv'
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should have the title 'The Target'" do
|
28
|
+
@episode.title.should == 'The Target'
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should have a short synopsis" do
|
32
|
+
@episode.short_synopsis.should =~ /^During the murder trial of a mid-level dealer/
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should have a medium synopsis" do
|
36
|
+
@episode.medium_synopsis.should =~ /^Critically acclaimed crime drama series. During the trial/
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should have no long synopsis" do
|
40
|
+
@episode.long_synopsis.should =~ /^During the trial of D'Angelo Barksdale/
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should have an image" do
|
44
|
+
@episode.image.should be_nil
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should have a master brand" do
|
48
|
+
@episode.masterbrand.should == RDF::URI('http://www.bbc.co.uk/bbctwo#service')
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should have a position of 1" do
|
52
|
+
@episode.position.should == 1
|
53
|
+
end
|
54
|
+
|
55
|
+
it "should have one version" do
|
56
|
+
@episode.versions.count.should == 1
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should have a first version of type Version" do
|
60
|
+
@episode.versions.first.should be_a BBC::Programmes::Version
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
context "getting a Episode from the local repository" do
|
65
|
+
before :each do
|
66
|
+
@repo.load(
|
67
|
+
fixture('b00jnwnv.rdf'),
|
68
|
+
:base_uri => 'http://www.bbc.co.uk/programmes/b00jnwnv.rdf'
|
69
|
+
)
|
70
|
+
@episode = BBC::Programmes::Episode.for('b00jnwnv')
|
71
|
+
end
|
72
|
+
|
73
|
+
it "should have the title 'The Target'" do
|
74
|
+
@episode.title.should == 'The Target'
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
data/spec/series.spec
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
require File.dirname(__FILE__) + "/spec_helper.rb"
|
2
|
+
|
3
|
+
describe BBC::Programmes::Series do
|
4
|
+
before :each do
|
5
|
+
@repo = RDF::Repository.new
|
6
|
+
Spira.add_repository(:default, @repo)
|
7
|
+
end
|
8
|
+
|
9
|
+
context "fetching a Series from the website" do
|
10
|
+
before :each do
|
11
|
+
mock_http('www.bbc.co.uk', 'b00jnwm0.rdf')
|
12
|
+
@series = BBC::Programmes::Series.fetch('b00jnwm0')
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should have a type URI defined" do
|
16
|
+
@series.type.should == RDF::URI('http://purl.org/ontology/po/Series')
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should have a correct URI" do
|
20
|
+
@series.subject.should == RDF::URI('http://www.bbc.co.uk/programmes/b00jnwm0#programme')
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should have a programme indentifier" do
|
24
|
+
@series.pid.should == 'b00jnwm0'
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should have the title 'Series 1'" do
|
28
|
+
@series.title.should == 'Series 1'
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should have a short synopsis" do
|
32
|
+
@series.short_synopsis.should =~ /^Critically acclaimed crime drama series telling the story/
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should have a medium synopsis" do
|
36
|
+
@series.medium_synopsis.should =~ /^Critically acclaimed crime drama series telling the story/
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should have no long synopsis" do
|
40
|
+
@series.long_synopsis.should be_nil
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should have an image" do
|
44
|
+
@series.image.should be_nil
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should have a position of 1"
|
48
|
+
# @series.position.should == 1
|
49
|
+
#end
|
50
|
+
|
51
|
+
it "should have 13 episodes" do
|
52
|
+
@series.episodes.count.should == 13
|
53
|
+
end
|
54
|
+
|
55
|
+
it "should have episode of type Episode" do
|
56
|
+
@series.episodes.first.should be_a BBC::Programmes::Episode
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
context "getting a Series from the local repository" do
|
61
|
+
before :each do
|
62
|
+
@repo.load(
|
63
|
+
fixture('b00jnwm0.rdf'),
|
64
|
+
:base_uri => 'http://www.bbc.co.uk/programmes/b00jnwm0.rdf'
|
65
|
+
)
|
66
|
+
@series = BBC::Programmes::Series.for('b00jnwm0')
|
67
|
+
end
|
68
|
+
|
69
|
+
it "should have the title 'Series 1'" do
|
70
|
+
@series.title.should == 'Series 1'
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
data/spec/service.spec
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
require File.dirname(__FILE__) + "/spec_helper.rb"
|
2
|
+
|
3
|
+
describe BBC::Programmes::Service do
|
4
|
+
before :each do
|
5
|
+
@repo = RDF::Repository.new
|
6
|
+
Spira.add_repository(:default, @repo)
|
7
|
+
end
|
8
|
+
|
9
|
+
context "getting a Service from the local repository" do
|
10
|
+
before :each do
|
11
|
+
@repo.load(
|
12
|
+
fixture('b005sv69.rdf'),
|
13
|
+
:base_uri => 'http://www.bbc.co.uk/programmes/b005sv69.rdf'
|
14
|
+
)
|
15
|
+
@service = BBC::Programmes::Service.for(
|
16
|
+
RDF::URI('http://www.bbc.co.uk/services/bbctwo/england#service')
|
17
|
+
)
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should have a label property" do
|
21
|
+
@service.label.should == 'England'
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should have a parent service property" do
|
25
|
+
@service.parent.should == BBC::Programmes::Service.for(
|
26
|
+
RDF::URI('http://www.bbc.co.uk/services/bbctwo#service')
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should have a to_s method that returns the service name" do
|
31
|
+
@service.to_s.should == 'England'
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
$:.unshift(File.join(File.dirname(__FILE__),'..','lib'))
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'spec'
|
5
|
+
require 'mocha'
|
6
|
+
|
7
|
+
require 'bbc/programmes'
|
8
|
+
|
9
|
+
|
10
|
+
def fixture(filename)
|
11
|
+
File.join(File.dirname(__FILE__),'data',filename)
|
12
|
+
end
|
13
|
+
|
14
|
+
def fixture_data(filename)
|
15
|
+
File.read(fixture(filename))
|
16
|
+
end
|
17
|
+
|
18
|
+
Spec::Runner.configure do |config|
|
19
|
+
config.mock_with :mocha
|
20
|
+
end
|
21
|
+
|
22
|
+
def mock_http(host, fixture_filename)
|
23
|
+
response = stub(
|
24
|
+
:value => nil,
|
25
|
+
:body => fixture_data(fixture_filename),
|
26
|
+
:content_type => 'application/rdf+xml'
|
27
|
+
)
|
28
|
+
Net::HTTP.expects(:start).with(host,nil).once.returns(response)
|
29
|
+
end
|
30
|
+
|
31
|
+
# FIXME: setup mock to never expect HTTP requests
|
data/spec/version.spec
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
require File.dirname(__FILE__) + "/spec_helper.rb"
|
2
|
+
|
3
|
+
describe BBC::Programmes::Version do
|
4
|
+
before :each do
|
5
|
+
@repo = RDF::Repository.new
|
6
|
+
Spira.add_repository(:default, @repo)
|
7
|
+
end
|
8
|
+
|
9
|
+
context "fetching a Version from the website" do
|
10
|
+
before :each do
|
11
|
+
mock_http('www.bbc.co.uk', 'b005sv69.rdf')
|
12
|
+
@version = BBC::Programmes::Version.fetch('b005sv69')
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should have a type URI defined" do
|
16
|
+
@version.type.should == RDF::URI('http://purl.org/ontology/po/Version')
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should have a correct URI" do
|
20
|
+
@version.subject.should == RDF::URI('http://www.bbc.co.uk/programmes/b005sv69#programme')
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should have a programme indentifier" do
|
24
|
+
@version.pid.should == 'b005sv69'
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should have an aspect ratio of 16:9" do
|
28
|
+
@version.aspect_ratio.should == '16:9'
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should have Stereo sound" do
|
32
|
+
@version.sound_format.should == 'Stereo'
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should have a duration of 1 hour" do
|
36
|
+
@version.duration.should == 3600
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should have 6 broadcasts" do
|
40
|
+
@version.broadcasts.count.should == 6
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should have a broadcast of type Broadcast" do
|
44
|
+
@version.broadcasts.first.should be_a BBC::Programmes::Broadcast
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should have a time interval property" do
|
48
|
+
@version.time.should be_a BBC::Programmes::TimeInterval
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should be on a timeline" do
|
52
|
+
@version.timeline.should be_a BBC::Programmes::TimeLine
|
53
|
+
end
|
54
|
+
|
55
|
+
it "should have multiple intervals" do
|
56
|
+
@version.intervals.should be_an Array
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should have a time interval of type TimeInterval" do
|
60
|
+
@version.intervals.first.should be_a BBC::Programmes::TimeInterval
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should have multiple segments" do
|
64
|
+
@version.segments.should be_an Array
|
65
|
+
end
|
66
|
+
|
67
|
+
it "should have a segment of type Segment" do
|
68
|
+
@version.segments.first.should be_a BBC::Programmes::Segment
|
69
|
+
end
|
70
|
+
|
71
|
+
it "should have a segment with a label" do
|
72
|
+
@version.segments.first.label.should_not be_nil
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
context "getting a Version from the local repository" do
|
77
|
+
before :each do
|
78
|
+
@repo.load(
|
79
|
+
fixture('b005sv69.rdf'),
|
80
|
+
:base_uri => 'http://www.bbc.co.uk/programmes/b005sv69.rdf'
|
81
|
+
)
|
82
|
+
@version = BBC::Programmes::Version.for('b005sv69')
|
83
|
+
end
|
84
|
+
|
85
|
+
it "should have a duration of an hour" do
|
86
|
+
@version.duration.should == 3600
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|