def test_load(self): """ LOAD ... """ expected = canonical(u""" LOAD <http://example.com> """) query = load().load(URIRef("http://example.com")) result = canonical(SparulTranslator(query).translate()) self.assertEqual(expected, result)
def test_load_into(): """ LOAD ... INTO ... """ expected = canonical(u""" LOAD <http://example.com> INTO <http://example.com/graph> """) query = load().load(URIRef("http://example.com"))\ .into(URIRef("http://example.com/graph")) result = canonical(SparulTranslator(query).translate()) assert expected == result
def load_triples(self, source=None, context=None): """ Load resources on the web into the triple-store. """ if source: query = load() query.load(remote_uri=source) if context: query.into(context) query_str = unicode(query) self.log.debug(query_str) self.__sparql_wrapper.setQuery(query_str) self.__sparql_wrapper.query().convert() return True return False
def load_triples(self, source=None, context=None): """ Load resources on the web into the triple-store. :param str source: path to the sources of triples to load :param context: the given context :return: True if successful :rtype: bool """ if source: query = load() query.load(remote_uri=source) if context: query.into(context) query_str = str(query) debug(query_str) self._sparql_wrapper.setQuery(query_str) self._sparql_wrapper.query().convert() return True return False
def load_triples(self, source=None, context=None): """ Load resources on the web into the triple-store. :param str source: path to the sources of triples to load :param context: the given context :return: True if successful :rtype: bool """ if source: query = load() query.load(remote_uri=source) if context: query.into(context) query_str = unicode(query) debug(query_str) self._sparql_wrapper.setQuery(query_str) self._sparql_wrapper.query().convert() return True return False