Skip to content

Commit

Permalink
Merge branch 'sparqlstore_drop_deprecated' into 5.0.0-dev, closes #516
Browse files Browse the repository at this point in the history
* sparqlstore_drop_deprecated:
  drop deprecated SPARQLStore(..., bNodeAsURI) arg
  drop deprecated sparqlstore.localName
  drop deprecated sparqlstore.TraverseSPARQLResultDOM
  drop deprecated sparqlstore.CastToTerm
  • Loading branch information
joernhees committed Aug 27, 2015
2 parents 562f4c5 + 7bf3dfb commit aceaa22
Showing 1 changed file with 2 additions and 44 deletions.
46 changes: 2 additions & 44 deletions rdflib/plugins/stores/sparqlstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import re
import collections
import urllib2
import warnings

try:
from SPARQLWrapper import SPARQLWrapper, XML, POST, GET, URLENCODED, POSTDIRECTLY
Expand Down Expand Up @@ -109,14 +108,6 @@ def _node_from_result(node):
raise Exception('Unknown answer type')


def CastToTerm(node):
warnings.warn(
"Call to deprecated function CastToTerm, use _node_from_result.",
category=DeprecationWarning,
)
return _node_from_result(node)


def _node_to_sparql(node):
if isinstance(node, BNode):
raise Exception(
Expand All @@ -126,7 +117,6 @@ def _node_to_sparql(node):
return node.n3()



def _traverse_sparql_result_dom(
doc, as_dictionary=False, node_from_result=_node_from_result):
"""
Expand Down Expand Up @@ -163,30 +153,6 @@ def __locproc(values_):
yield __locproc(values), vars_


def TraverseSPARQLResultDOM(doc, asDictionary=False):
warnings.warn(
"Call to deprecated function TraverseSPARQLResultDOM, use "
"_traverse_sparql_result_dom instead and update asDictionary arg to "
"as_dictionary.",
category=DeprecationWarning,
)
return _traverse_sparql_result_dom(
doc, as_dictionary=asDictionary, node_from_result=_node_from_result)


def _local_name(qname):
# wtf - elementtree cant do this for me
return qname[qname.index("}") + 1:]


def localName(qname):
warnings.warn(
"Call to deprecated unused function localName, will be dropped soon.",
category=DeprecationWarning,
)
return _local_name(qname)


class SPARQLStore(NSSPARQLWrapper, Store):
"""
An RDFLib store around a SPARQL endpoint
Expand Down Expand Up @@ -229,7 +195,7 @@ class SPARQLStore(NSSPARQLWrapper, Store):
regex_matching = NATIVE_REGEX

def __init__(self,
endpoint=None, bNodeAsURI=False,
endpoint=None,
sparql11=True, context_aware=True,
node_to_sparql=_node_to_sparql,
node_from_result=_node_from_result,
Expand All @@ -239,13 +205,6 @@ def __init__(self,
super(SPARQLStore, self).__init__(
endpoint, returnFormat=XML, **sparqlwrapper_kwargs)
self.setUseKeepAlive()
self.bNodeAsURI = bNodeAsURI
if bNodeAsURI:
warnings.warn(
"bNodeAsURI argument was never supported and will be dropped "
"in favor of node_to_sparql and node_from_result args.",
category=DeprecationWarning,
)
self.node_to_sparql = node_to_sparql
self.node_from_result = node_from_result
self.nsBindings = {}
Expand Down Expand Up @@ -582,7 +541,7 @@ class SPARQLUpdateStore(SPARQLStore):

def __init__(self,
queryEndpoint=None, update_endpoint=None,
bNodeAsURI=False, sparql11=True,
sparql11=True,
context_aware=True,
postAsEncoded=True, autocommit=True,
**kwds
Expand All @@ -591,7 +550,6 @@ def __init__(self,
SPARQLStore.__init__(
self,
queryEndpoint,
bNodeAsURI,
sparql11,
context_aware,
updateEndpoint=update_endpoint,
Expand Down

0 comments on commit aceaa22

Please sign in to comment.