root / rdfalchemy / trunk / test / sesame2_test.py

Revision 127, 0.5 kB (checked in by phil, 7 months ago)

This update to rdfalchemy moves some functions in to a sub-module and has the beginings of a sparql script
It adds some unit tests (for initBinding)

Breaking your Programs:

This update could break your code if you:


from rdfalchemy.sesame2 import SesameGraph?


you now need to import from rdfalchemy.sparql.sesame2
allows for jython or other sesame graph implimentations not dependent on the http sparql endpoint


you should probably be using create_engine instead

Line 
1from rdfalchemy.sparql.sesame2 import SesameGraph
2
3url = 'http://www.openvest.com:8080/openrdf-sesame/repositories/Portfolio/'
4g = SesameGraph(url)
5
6q1 = "select ?s ?p ?o where {?s ?p ?o} limit 100"
7
8responses = {}
9b = set(list(g.query(q1,resultMethod='brtr')))
10x = set(list(g.query(q1,resultMethod='xml')))
11j = set(list(g.query(q1,resultMethod='json')))
12
13print len(x)
14
15def sizes_test():
16    assert len(b) == len(x) == len(j)
17
18def eq_bx_test():
19    assert b == x
20
21def eq_bj_test():
22    assert b == j
23
24def eq_jx_test():
25    assert j == x
Note: See TracBrowser for help on using the browser.