Skip to content

Commit

Permalink
initial import
Browse files Browse the repository at this point in the history
  • Loading branch information
pavan046 committed May 5, 2011
0 parents commit 290d676
Show file tree
Hide file tree
Showing 397 changed files with 46,126 additions and 0 deletions.
77 changes: 77 additions & 0 deletions SPARQLWrapper/.svn/entries
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
10

dir
0
http://knoesis-svn.cs.wright.edu/svn/pavan/pubsubhubbub/trunk/pshb-example/pubsubhubbub/hub/virtuoso_connect/SPARQLWrapper/SPARQLWrapper
http://knoesis-svn.cs.wright.edu/svn/pavan
add







svn:special svn:externals svn:needs-lock











8661c0b3-8f0a-4391-bfa0-cfeaea3dbe21

KeyInsensitiveDict.py
file



add

SPARQLExceptions.py
file



add

SPARQLUtils.py
file



add

SmartWrapper.py
file



add

Wrapper.py
file



add

__init__.py
file



add

jsonlayer.py
file



add

35 changes: 35 additions & 0 deletions SPARQLWrapper/KeyInsensitiveDict.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# -*- coding: utf-8 -*-

"""
A simple implementation of a key-insensitive dictionary (implemented by using the pattern decorator).
@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>}
@organization: U{World Wide Web Consortium<http://www.w3.org>} and U{Foundation CTIC<http://www.fundacionctic.org/>}.
@license: U{W3C® SOFTWARE NOTICE AND LICENSE<href="http://www.w3.org/Consortium/Legal/copyright-software">}
"""

class KeyInsensitiveDict:
"""
A simple implementation of a key-insensitive dictionary (implemented by using the pattern decorator).
"""

def __init__(self, d={}):
self.__dict__["d"] = {}
for k, v in d.items(): self[k] = v

def __getattr__(self, attr):
return getattr(self.__dict__["d"], attr)

def __setattr__(self, attr, value):
setattr(self.__dict__["d"], attr, value)

def __setitem__(self, key, value):
if (hasattr(key, "lower")):
key = key.lower()
self.__dict__["d"][key] = value

def __getitem__(self, key):
if (hasattr(key, "lower")):
key = key.lower()
return self.__dict__["d"][key]

Binary file added SPARQLWrapper/KeyInsensitiveDict.pyc
Binary file not shown.
47 changes: 47 additions & 0 deletions SPARQLWrapper/SPARQLExceptions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# -*- coding: utf-8 -*-

"""
SPARQL Wrapper exceptions
@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>}
@organization: U{World Wide Web Consortium<http://www.w3.org>} and U{Foundation CTIC<http://www.fundacionctic.org/>}.
@license: U{W3C® SOFTWARE NOTICE AND LICENSE<href="http://www.w3.org/Consortium/Legal/copyright-software">}
"""

import exceptions

class SPARQLWrapperException(exceptions.Exception):
"""
Base class for SPARQL Wrapper exceptions
"""

def __init__(self):
Exception.__init__(self)

def __str__(self):
return "SPARQLWrapperException: an exception has occured"

class QueryBadFormed(SPARQLWrapperException):
"""
Query Bad Formed exceptions
"""

def __init__(self):
SPARQLWrapperException.__init__(self)

def __str__(self):
return "QueryBadFormed: a bad request has been sent to the endpoint, probably the sparql query is bad formed"

class EndPointNotFound(SPARQLWrapperException):
"""
End Point Not Found exceptions
"""

def __init__(self):
SPARQLWrapperException.__init__(self)

def __str__(self):
return "EndPointNotFound: it was impossible to connect with the endpoint in that address, check if it is correct"

Binary file added SPARQLWrapper/SPARQLExceptions.pyc
Binary file not shown.
29 changes: 29 additions & 0 deletions SPARQLWrapper/SPARQLUtils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# -*- coding: utf8 -*-

"""
SPARQL Wrapper Utils
@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>}
@organization: U{World Wide Web Consortium<http://www.w3.org>} and U{Foundation CTIC<http://www.fundacionctic.org/>}.
@license: U{W3C SOFTWARE NOTICE AND LICENSE<href="http://www.w3.org/Consortium/Legal/copyright-software">}
"""

import warnings

def deprecated(func):
"""
This is a decorator which can be used to mark functions
as deprecated. It will result in a warning being emmitted
when the function is used.
@see: http://code.activestate.com/recipes/391367/
"""
def newFunc(*args, **kwargs):
warnings.warn("Call to deprecated function %s." % func.__name__, category=DeprecationWarning, stacklevel=2)
return func(*args, **kwargs)
newFunc.__name__ = func.__name__
newFunc.__doc__ = func.__doc__
newFunc.__dict__.update(func.__dict__)
return newFunc

Binary file added SPARQLWrapper/SPARQLUtils.pyc
Binary file not shown.
Loading

0 comments on commit 290d676

Please sign in to comment.