Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sparqlstore drop deprecated methods and args #516

Merged
merged 4 commits into from
Jan 29, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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