def setUp(self): self.sparql = SimpleSPARQL("http://localhost:2020/sparql") self.sparql.setGraph("http://dwiel.net/axpress/testing") self.sparql.setNamespaces(n) self.p = PassCheckCreateUnlessExists(self.sparql) # depends on Joseki #def test1(self): #q = { #n.sparql.reads : [ #], #n.sparql.writes : [ #{ #n.sparql.create : n.sparql.unless_exists, #n.sparql.path : (0,), #n.test.x : 1, #}, #], #} #r = { #n.sparql.reads : [ ], #n.sparql.writes : [ #{ #n.sparql.create : n.sparql.existed, #n.sparql.path : (0,), #n.sparql.subject : n.test.object1, #n.test.x : 1, #}, #], #} print prettyquery(q) self.p(q)
def __init__(self): """One instance of Globals is created during application initialization and is available during requests via the 'g' variable """ self.n = globalNamespaces() self.n.bind('bk', '<http://theburningkumquat.com/schema/>') self.n.bind('bkitem', '<http://theburningkumquat.com/item/>') self.sparql = SimpleSPARQL("http://localhost:2020/queryKumquat", sparul = "http://localhost:2020/updateKumquat") self.sparql.setNamespaces(self.n)
# -*- coding: utf-8 -*- # Translator testing # this translator assumes the translations available in loadTranslator import unittest import time, urllib from rdflib import * from SimpleSPARQL import * from SimpleSPARQL.Utils import sub_var_bindings sparql = SimpleSPARQL("http://localhost:2020/sparql") sparql.setGraph("http://dwiel.net/axpress/testing") n = sparql.n n.bind('library', '<http://dwiel.net/axpress/library/0.1/>') n.bind('music', '<http://dwiel.net/axpress/music/0.1/>') n.bind('music_album', '<http://dwiel.net/axpress/music_album/0.1/>') n.bind('source', '<http://dwiel.net/axpress/source/0.1/>') n.bind('lastfm', '<http://dwiel.net/axpress/lastfm/0.1/>') n.bind('rdfs', '<http://www.w3.org/2000/01/rdf-schema#>') n.bind('test', '<http://dwiel.net/express/test/0.1/>') n.bind('bound_var', '<http://dwiel.net/axpress/bound_var/0.1/>') a = n.rdfs.type cache_sparql = SimpleSPARQL("http://localhost:2020/sparql", graph="http://dwiel.net/axpress/cache") cache = Cache(cache_sparql) translator = Translator(cache)
#!/usr/bin/env python # -*- coding: utf-8 -*- import unittest import time, urllib from rdflib import * from SimpleSPARQL import * sparql = SimpleSPARQL("http://localhost:2020/sparql") sparql.setGraph("http://dwiel.net/axpress/testing") n = sparql.n n.bind('string', '<http://dwiel.net/express/string/0.1/>') n.bind('math', '<http://dwiel.net/express/math/0.1/>') n.bind('file', '<http://dwiel.net/express/file/0.1/>') n.bind('glob', '<http://dwiel.net/express/glob/0.1/>') n.bind('color', '<http://dwiel.net/express/color/0.1/>') n.bind('sparql', '<http://dwiel.net/express/sparql/0.1/>') n.bind('call', '<http://dwiel.net/express/call/0.1/>') n.bind('test', '<http://dwiel.net/express/test/0.1/>') n.bind('library', '<http://dwiel.net/axpress/library/0.1/>') n.bind('music', '<http://dwiel.net/axpress/music/0.1/>') n.bind('music_album', '<http://dwiel.net/axpress/music_album/0.1/>') n.bind('source', '<http://dwiel.net/axpress/source/0.1/>') n.bind('lastfm', '<http://dwiel.net/axpress/lastfm/0.1/>') n.bind('rdfs', '<http://www.w3.org/2000/01/rdf-schema#>') n.bind('test', '<http://dwiel.net/express/test/0.1/>') n.bind('bound_var', '<http://dwiel.net/axpress/bound_var/0.1/>') a = n.rdfs.type #cache_sparql = SimpleSPARQL("http://localhost:2020/sparql", graph = "http://dwiel.net/axpress/cache")
def setUp(self): self.sparql = SimpleSPARQL("http://localhost:2020/sparql") self.sparql.setGraph("http://dwiel.net/axpress/testing") self.sparql.setNamespaces(n) self.parser = Parser(n)