blob: 02112ce3c73498a7a712bb27ffc796dce645c46f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
"""
A simple example showing how to process RDFa from the web
"""
from rdflib import Graph
if __name__ == '__main__':
g = Graph()
g.parse('http://www.worldcat.org/title/library-of-babel/oclc/44089369', format='rdfa')
print "Books found:"
for row in g.query("""SELECT ?title ?author WHERE {
[ a schema:Book ;
schema:author [ rdfs:label ?author ] ;
schema:name ?title ]
FILTER (LANG(?title) = 'en') } """):
print "%s by %s"%(row.title, row.author)
|