# Path: rdfalchemy/exceptions.py
# class RDFAlchemyError(Exception):
#     """Generic error class."""
# 
# Path: rdfalchemy/Literal.py
# XSD = Namespace(u'http://www.w3.org/2001/XMLSchema#')
#     class rebindingLogFilter(logging.Filter):
#         def filter(self, record):
# def _strToDateTime(s):


from rdflib import ConjunctiveGraph, __version__ as rdflibversion
from rdflib import BNode, RDF, URIRef
from rdflib.term import Identifier
from rdfalchemy.exceptions import RDFAlchemyError
from rdfalchemy.Literal import Literal
        from random import choice
import re
import logging
            "descriptor %s not found for class %s" % (key, cls))

    # short term hack.  Need to go to a sqlalchemy 0.4 style query method
    # obj.query.get_by should map to obj.get_by  ..same for fetch_by
    @classmethod
    def query(cls):
        return cls

    @classmethod
    def get_by(cls, **kwargs):
        """Class Method, returns a single instance of the class
        by a single kwarg.  the keyword must be a descriptor of the
        class.
        example:

        .. code-block:: python

            bigBlue = Company.get_by(symbol='IBM')

        :Note:
            the keyword should map to an rdf predicate
            that is of type owl:InverseFunctional"""
        if len(kwargs) != 1:
            raise ValueError(
                "get_by wanted exactly 1 but got  %i args\n" +
                "Maybe you wanted filter_by" % (len(kwargs)))
        key, value = kwargs.items()[0]
        if isinstance(value, (URIRef, BNode, Literal)):
            o = value
        else:

# Path: rdfalchemy/exceptions.py
# class RDFAlchemyError(Exception):
#     """Generic error class."""
# 
# Path: rdfalchemy/Literal.py
# XSD = Namespace(u'http://www.w3.org/2001/XMLSchema#')
#     class rebindingLogFilter(logging.Filter):
#         def filter(self, record):
# def _strToDateTime(s):


# Path: rdfalchemy/rdfSubject.py
from rdflib import ConjunctiveGraph, __version__ as rdflibversion
from rdflib import BNode, RDF, URIRef
from rdflib.term import Identifier
from rdfalchemy.exceptions import RDFAlchemyError
from rdfalchemy.Literal import Literal
        from random import choice
import re
import logging

            "descriptor %s not found for class %s" % (key, cls))

    # short term hack.  Need to go to a sqlalchemy 0.4 style query method
    # obj.query.get_by should map to obj.get_by  ..same for fetch_by
    @classmethod
    def query(cls):
        return cls

    @classmethod
    def get_by(cls, **kwargs):
        """Class Method, returns a single instance of the class
        by a single kwarg.  the keyword must be a descriptor of the
        class.
        example:

        .. code-block:: python

            bigBlue = Company.get_by(symbol='IBM')

        :Note:
            the keyword should map to an rdf predicate
            that is of type owl:InverseFunctional"""
        if len(kwargs) != 1:
            raise ValueError(
                "get_by wanted exactly 1 but got  %i args\n" +
                "Maybe you wanted filter_by" % (len(kwargs)))
        key, value = kwargs.items()[0]
        if isinstance(value, (URIRef, BNode, Literal)):
            o = value
        else:

            o = Literal(value)