Skip to content

Instantly share code, notes, and snippets.

@ezodude
Forked from njh/bbc_episodes_for_brand.rb
Created May 3, 2011 16:03
Show Gist options
  • Save ezodude/953619 to your computer and use it in GitHub Desktop.
Save ezodude/953619 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'rubygems'
require 'rdf'
require 'rdf/rdfxml'
PROGRAMMES_URL = 'http://www.bbc.co.uk/programmes'
PO = RDF::Vocabulary.new("http://purl.org/ontology/po/")
brand_pid = 'b0081dq5'
brand_rdf = "#{PROGRAMMES_URL}/#{brand_pid}.rdf"
brand_uri = RDF::URI("#{PROGRAMMES_URL}/#{brand_pid}#programme")
graph = RDF::Graph.load(brand_rdf)
episode_pids = graph.query([brand_uri, PO::episode, nil]).map do |statement|
statement.object.basename
end
p episode_pids
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment