From 3e7b7937453d4abb7fffca792facedf17a8a4199 Mon Sep 17 00:00:00 2001 From: Joern Hees Date: Sun, 1 Mar 2015 18:40:53 +0100 Subject: updated test comments & added fuseki config parameter unionDefaultGraph=true --- .travis.yml | 2 +- test/test_sparqlupdatestore.py | 21 +++++++++++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5d196046..d8ded45d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,7 @@ before_install: - tar -zxf jena-fuseki-1.1.1-distribution.tar.gz - mv jena-fuseki-1.1.1 fuseki - cd fuseki - - bash fuseki-server --debug --update --mem /db &>fuseki.log & + - bash fuseki-server --debug --update --memTDB --set tdb:unionDefaultGraph=true /db &>fuseki.log & - sleep 2 - cd .. diff --git a/test/test_sparqlupdatestore.py b/test/test_sparqlupdatestore.py index a3596275..1bd276cd 100644 --- a/test/test_sparqlupdatestore.py +++ b/test/test_sparqlupdatestore.py @@ -6,10 +6,11 @@ from rdflib import ConjunctiveGraph, URIRef, Literal from rdflib.util import from_n3 # this assumed SPARQL1.1 query/update endpoints -# running locally at http://localhost:3030/ukpp/ -# for instance fuseki started with ./fuseki-server --mem --update /ukpp +# running locally at http://localhost:3030/db/ +# for instance fuseki started with +# ./fuseki-server --memTDB --update --set tdb:unionDefaultGraph=true /db -# THIS WILL DELETE ALL DATA IN THE /data dataset +# THIS WILL DELETE ALL DATA IN THE /db dataset michel = URIRef(u'urn:michel') tarek = URIRef(u'urn:tarek') @@ -82,8 +83,20 @@ class TestSparql11(unittest.TestCase): g.add((tarek, hates, cheese)) self.assertEquals(2, len(g), 'graph contains 2 triples') + + # the following are actually bad tests as they depend on your endpoint, + # as pointed out in the sparqlstore.py code: + # + ## For ConjunctiveGraphs, reading is done from the "default graph" Exactly + ## what this means depends on your endpoint, because SPARQL does not offer a + ## simple way to query the union of all graphs as it would be expected for a + ## ConjuntiveGraph. + ## + ## Fuseki/TDB has a flag for specifying that the default graph + ## is the union of all graphs (tdb:unionDefaultGraph in the Fuseki config). self.assertEquals(3, len(self.graph), - 'default union graph contains three triples') + 'default union graph should contain three triples but contains:\n' + '%s' % list(self.graph)) r = self.graph.query("SELECT * WHERE { ?s . }") self.assertEquals(2, len(list(r)), "two people like pizza") -- cgit v1.2.1