Skip to content

Commit a1018a6

Browse files
committed
updated sphinx generated doc
1 parent 0a1defd commit a1018a6

File tree

7 files changed

+169
-139
lines changed

7 files changed

+169
-139
lines changed

SPARQLWrapper/KeyCaseInsensitiveDict.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33
"""
44
A simple implementation of a key case-insensitive dictionary.
55
6-
@authors: U{Ivan Herman<http://www.ivan-herman.net>}, U{Sergio Fernández<http://www.wikier.org>}, U{Carlos Tejo Alonso<http://www.dayures.net>}
7-
@organization: U{World Wide Web Consortium<http://www.w3.org>} and U{Foundation CTIC<http://www.fundacionctic.org/>}.
8-
@license: U{W3C® SOFTWARE NOTICE AND LICENSE<href="http://www.w3.org/Consortium/Legal/copyright-software">}
6+
:author: Ivan Herman <http://www.ivan-herman.net>
7+
:author: Sergio Fernández <http://www.wikier.org>
8+
:author: Carlos Tejo Alonso <http://www.dayures.net>
9+
:author: Alexey Zakhlestin <https://indeyets.ru/>
10+
:organization: `World Wide Web Consortium <http://www.w3.org>`_ and `Foundation CTIC <http://www.fundacionctic.org/>`_.
11+
:license: `W3C® Software notice and license <http://www.w3.org/Consortium/Legal/copyright-software>`_
912
"""
1013

1114
class KeyCaseInsensitiveDict(dict):

SPARQLWrapper/SPARQLExceptions.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@
44
55
SPARQL Wrapper exceptions
66
7-
@authors: U{Ivan Herman<http://www.ivan-herman.net>}, U{Sergio Fernández<http://www.wikier.org>}, U{Carlos Tejo Alonso<http://www.dayures.net>}
8-
@organization: U{World Wide Web Consortium<http://www.w3.org>} and U{Foundation CTIC<http://www.fundacionctic.org/>}.
9-
@license: U{W3C® SOFTWARE NOTICE AND LICENSE<href="http://www.w3.org/Consortium/Legal/copyright-software">}
7+
:author: Ivan Herman <http://www.ivan-herman.net>
8+
:author: Sergio Fernández <http://www.wikier.org>
9+
:author: Carlos Tejo Alonso <http://www.dayures.net>
10+
:author: Alexey Zakhlestin <https://indeyets.ru/>
11+
:organization: `World Wide Web Consortium <http://www.w3.org>`_ and `Foundation CTIC <http://www.fundacionctic.org/>`_.
12+
:license: `W3C® Software notice and license <http://www.w3.org/Consortium/Legal/copyright-software>`_
1013
1114
"""
1215

SPARQLWrapper/SmartWrapper.py

+31-27
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
# -*- coding: utf-8 -*-
22

33
"""
4-
@see: U{SPARQL Specification<http://www.w3.org/TR/rdf-sparql-query/>}
5-
@authors: U{Ivan Herman<http://www.ivan-herman.net>}, U{Sergio Fernández<http://www.wikier.org>}, U{Carlos Tejo Alonso<http://www.dayures.net>}
6-
@organization: U{World Wide Web Consortium<http://www.w3.org>} and U{Foundation CTIC<http://www.fundacionctic.org/>}.
7-
@license: U{W3C® SOFTWARE NOTICE AND LICENSE<href="http://www.w3.org/Consortium/Legal/copyright-software">}
8-
@requires: U{RDFLib<http://rdflib.net>} package.
4+
.. seealso:: `SPARQL Specification <http://www.w3.org/TR/rdf-sparql-query/>`_
5+
6+
:author: Ivan Herman <http://www.ivan-herman.net>
7+
:author: Sergio Fernández <http://www.wikier.org>
8+
:author: Carlos Tejo Alonso <http://www.dayures.net>
9+
:author: Alexey Zakhlestin <https://indeyets.ru/>
10+
:organization: `World Wide Web Consortium <http://www.w3.org>`_ and `Foundation CTIC <http://www.fundacionctic.org/>`_.
11+
:license: `W3C® Software notice and license <http://www.w3.org/Consortium/Legal/copyright-software>`_
12+
:requires: `RDFLib <https://rdflib.readthedocs.io>`_ package.
913
"""
1014

1115
import urllib2
@@ -74,19 +78,19 @@ class Bindings(object):
7478
return value and instantiates a number of attributes that can be consulted directly. See
7579
the list of variables.
7680
77-
The U{Serializing SPARQL Query Results in JSON<http://www.w3.org/TR/rdf-sparql-json-res/>} explains the details of the
78-
JSON return structures. Very succintly: the return data has "bindings", which means a list of dictionaries. Each
81+
The `Serializing SPARQL Query Results in JSON <http://www.w3.org/TR/rdf-sparql-json-res/>`_ explains the details of the
82+
JSON return structures. Very succinctly: the return data has "bindings", which means a list of dictionaries. Each
7983
dictionary is a possible binding of the SELECT variables to :class:`Value` instances. This structure is made a bit
8084
more usable by this class.
8185
8286
:ivar fullResult: The original dictionary of the results, stored for an easier reference
8387
:ivar head: Header part of the return, see the JSON return format document for details
8488
:ivar variables: List of unbounds (variables) of the original query. It is an array of strings. None in the case of an ASK query
85-
:ivar bindings: The final bindings: array of dictionaries, mapping variables to :class:`Value` instances.
86-
(If unbound, then no value is set in the dictionary; that can be easily checked with
87-
C{var in res.bindings[..]}, for example.)
89+
:ivar bindings: The final bindings: array of dictionaries, mapping variables to :class:`Value` instances. \
90+
(If unbound, then no value is set in the dictionary; that can be easily checked with \
91+
``var in res.bindings[..]``, for example.)
8892
:ivar askResult: by default, set to False; in case of an ASK query, the result of the query
89-
:type askResult: Boolean
93+
:type askResult: bool
9094
"""
9195
def __init__(self, retval):
9296
"""
@@ -122,7 +126,7 @@ def __init__(self, retval):
122126

123127
def getValues(self, key):
124128
"""A shorthand for the retrieval of all bindings for a single key. It is
125-
equivalent to "C{[b[key] for b in self[key]]}"
129+
equivalent to "``[b[key] for b in self[key]]``"
126130
127131
:param key: possible variable
128132
:return: list of :class:`Value` instances
@@ -133,12 +137,12 @@ def getValues(self, key):
133137
return []
134138

135139
def __contains__(self, key):
136-
"""Emulation of the "C{key in obj}" operator. Key can be a string for a variable or an array/tuple
140+
"""Emulation of the "``key in obj``" operator. Key can be a string for a variable or an array/tuple
137141
of strings.
138142
139-
If C{key} is a variable, the return value is C{True} if there is at least one binding where C{key} is
140-
bound. If C{key} is an array or tuple, the return value is C{True} if there is at least one binding
141-
where I{all} variables in C{key} are bound.
143+
If ``key`` is a variable, the return value is ``True`` if there is at least one binding where ``key`` is
144+
bound. If ``key`` is an array or tuple, the return value is ``True`` if there is at least one binding
145+
where *all* variables in ``key`` are bound.
142146
143147
:param key: possible variable, or array/tuple of variables
144148
:return: whether there is a binding of the variable in the return
@@ -168,16 +172,16 @@ def __contains__(self, key):
168172
return False
169173

170174
def __getitem__(self, key):
171-
"""Emulation of the C{obj[key]} operator. Slice notation is also available.
175+
"""Emulation of the ``obj[key]`` operator. Slice notation is also available.
172176
The goal is to choose the right bindings among the available ones. The return values are always
173177
arrays of bindings, ie, arrays of dictionaries mapping variable keys to :class:`Value` instances.
174178
The different value settings mean the followings:
175179
176-
- C{obj[key]} returns the bindings where C{key} has a valid value
177-
- C{obj[key1,key2,...]} returns the bindings where I{all} C{key1,key2,...} have valid values
178-
- C{obj[(key1,key2,...):(nkey1,nkey2,...)]} returns the bindings where all C{key1,key2,...} have
179-
valid values and I{none} of the C{nkey1,nkey2,...} have valid values
180-
- C{obj[:(nkey1,nkey2,...)]} returns the bindings where I{none} of the C{nkey1,nkey2,...} have valid values
180+
- ``obj[key]`` returns the bindings where ``key`` has a valid value
181+
- ``obj[key1,key2,...]`` returns the bindings where *all* ``key1,key2,...`` have valid values
182+
- ``obj[(key1,key2,...):(nkey1,nkey2,...)]`` returns the bindings where all ``key1,key2,...`` have
183+
valid values and *none* of the ``nkey1,nkey2,...`` have valid values
184+
- ``obj[:(nkey1,nkey2,...)]`` returns the bindings where *none* of the ``nkey1,nkey2,...`` have valid values
181185
182186
In all cases complete bindings are returned, ie, the values for other variables, not present among
183187
the keys in the call, may or may not be present depending on the query results.
@@ -235,12 +239,12 @@ def _nonSliceCase(key):
235239
return retval
236240

237241
def convert(self):
238-
"""This is just a convenience method, returns C{self}.
242+
"""This is just a convenience method, returns ``self``.
239243
240-
Although C{Binding} is not a subclass of :class:`QueryResult<SPARQLWrapper.Wrapper.QueryResult>`, it is returned as a result by
244+
Although ``Binding`` is not a subclass of :class:`QueryResult<SPARQLWrapper.Wrapper.QueryResult>`, it is returned as a result by
241245
:class:`SPARQLWrapper2.query`, just like :class:`QueryResult<SPARQLWrapper.Wrapper.QueryResult>` is returned by
242246
:class:`SPARQLWrapper.SPARQLWrapper.query`. Consequently,
243-
having an empty C{convert} method to imitate :class:`QueryResult's convert method<SPARQLWrapper.Wrapper.QueryResult.convert>` may avoid unnecessary problems.
247+
having an empty ``convert`` method to imitate :class:`QueryResult's convert method<SPARQLWrapper.Wrapper.QueryResult.convert>` may avoid unnecessary problems.
244248
"""
245249
return self
246250

@@ -279,7 +283,7 @@ def query(self):
279283
Exceptions can be raised if either the URI is wrong or the HTTP sends back an error.
280284
The usual urllib2 exceptions are raised, which cover possible SPARQL errors, too.
281285
282-
If the query type is I{not} SELECT, the method falls back to the
286+
If the query type is *not* SELECT, the method falls back to the
283287
:class:`corresponding method in the superclass<SPARQLWrapper.query>`.
284288
285289
:return: query result
@@ -295,7 +299,7 @@ def query(self):
295299
def queryAndConvert(self):
296300
"""This is here to override the inherited method; it is equivalent to :class:`query`.
297301
298-
If the query type is I{not} SELECT, the method falls back to the
302+
If the query type is *not* SELECT, the method falls back to the
299303
:class:`corresponding method in the superclass<SPARQLWrapper.queryAndConvert>`.
300304
301305
:return: the converted query result.

0 commit comments

Comments
 (0)