Skip to content

Instantly share code, notes, and snippets.

@edsu
Last active December 18, 2015 08:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edsu/5757032 to your computer and use it in GitHub Desktop.
Save edsu/5757032 to your computer and use it in GitHub Desktop.
.-(ed@prajna 09:52:06) ~
`-->python
Python 2.7.2 (default, Oct 11 2012, 20:14:37)
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import rdflib
>>> g = rdflib.Graph()
>>> g.parse("http://www.bbc.co.uk/news/world-us-canada-22857062")
<Graph identifier=N9eafdebcea6c40ef9738165d93b7b79a (<class 'rdflib.graph.Graph'>)>
>>> print len(g)
26
>>> print g.serialize(format='turtle')
@prefix og: <http://opengraphprotocol.org/schema/> .
@prefix rnews: <http://iptc.org/std/rNews/2011-10-07#> .
@prefix xhv: <http://www.w3.org/1999/xhtml/vocab#> .
<http://www.bbc.co.uk/news/world-us-canada-22857062> a rnews:NewsItem;
rnews:creator "http://www.bbc.co.uk#org"@en-GB;
rnews:datePublished "2013/06/11 13:07:15"@en-GB;
rnews:description "EU officials demand assurances over claims the US captures vast amounts of data on foreigners, as an ex-CIA leaker goes to ground in Hong Kong."@en-GB;
rnews:headline "EU wants clarity on US data snooping"@en-GB;
rnews:thumbnailUrl "http://news.bbcimg.co.uk/media/images/68110000/jpg/_68110108_07sx9n8p.jpg"@en-GB;
og:image "http://news.bbcimg.co.uk/media/images/68110000/jpg/_68110235_68110230.jpg"@en-GB;
og:site_name "BBC News"@en-GB;
og:title "EU wants clarity on US data snooping"@en-GB;
og:type "article"@en-GB;
og:url "http://www.bbc.co.uk/news/world-us-canada-22857062"@en-GB;
xhv:copyright <http://www.bbc.co.uk/terms/>;
xhv:help <http://www.bbc.co.uk/help/>;
xhv:icon <http://www.bbc.co.uk/favicon.ico>;
xhv:index <http://www.bbc.co.uk/a-z/>,
<http://www.bbc.co.uk/news/>;
xhv:stylesheet <http://news.bbcimg.co.uk/css/screen/shared/0.3.185/3pt_ads.css>,
<http://news.bbcimg.co.uk/view/1_4_38/cream/hi/news/skin.css>,
<http://news.bbcimg.co.uk/view/3_0_16/cream/hi/shared/components/components.css>,
<http://news.bbcimg.co.uk/view/3_0_16/cream/hi/shared/global.css>,
<http://news.bbcimg.co.uk/view/3_0_16/cream/hi/shared/layout/story.css>,
<http://news.bbcimg.co.uk/view/3_0_16/cream/hi/shared/mobile.css>,
<http://news.bbcimg.co.uk/view/3_0_16/cream/hi/shared/print.css>,
<http://news.bbcimg.co.uk/view/3_0_16/cream/hi/shared/story.css>,
<http://news.bbcimg.co.uk/view/3_0_16/cream/hi/shared/type.css>,
<http://static.bbci.co.uk/frameworks/barlesque/2.45.9/desktop/3.5/style/main.css> .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment