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