""" Exceptions throwable by the RDF generator """ # Copyright 2005, 2006 EIAO Consoritum # This program is distributed under the terms of the GNU General # Public License. # # This file is part of the European Internet Accessibility Observatory # (EIAO) # # EIAO is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # EIAO is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with EIAO; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, # MA 02110-1301 USA __author__ = "Morten Goodwin Olsen" __version__ = "0.1" __maintainer__ = "Nils Ulltveit-Moe" class RDFGeneratorError(Exception): """Basic class for reporting RDFGeneratorError """ class InstanceNotPresentError(RDFGeneratorError): """Excaption when a instance is not present """ def __init__(self, instancename, instance): """ Throws a InstanceNotPresentError exception Keyword arguments: instancename -- Name of the instance instance -- The instance not present """ msg = 'The instance %s is not present. The value %s is not valid' %(instancename, str(instance)) RDFGeneratorError.__init__(self,msg) class WrongLengthOfLogError(RDFGeneratorError): """Excaption when a tuple contains a wrong length """ def __init__(self, log): """ Throws a WrongLengthofLogError exception Keyword arguments: log -- The log that is of wrong length """ msg = 'The log %s is of invalid length. The log should be on the form (fromurl,fromline,fromcolum,tourl,toline,tocolumn)' %(str(log)) RDFGeneratorError.__init__(self,msg) class NotImplementedYetError(RDFGeneratorError): """Excaption when something is not implemented """ def __init__(self, description): """Throws an NotImplementedYetError exception. """ msg = '%s is not yet implementes' %(description) RDFGeneratorError.__init__(self,msg) class TripleDoesNotExistError(RDFGeneratorError): """Excaption when a triple does not exist """ def __init__(self, subject, predicate, object): """Throws an TripleDoesNotExistError exception. Keyword argumnts: subject -- Triple Subject predicate -- Triple predicate object -- Triple object """ msg = 'Triple does not exist (%s,%s,%s)' % (subject,predicate,object) RDFGeneratorError.__init__(self,msg) class IllegalCombinationError(RDFGeneratorError): """Excaption when an illegal combination of input values are provided """ def __init__(self, msg): """Throws an IllegalCombinationError exception. """ RDFGeneratorError.__init__(self,msg) class EmptyHeaderInformationError(RDFGeneratorError): """Excaption when the header information is empty """ def __init__(self): """Throws an EmptyHeaderInformationError exception. """ msg = 'Header information not present' RDFGeneratorError.__init__(self,msg) class IllegalTestRunValueError(RDFGeneratorError): """Excaption when the illegal characters as test run """ def __init__(self, character): """IlligalTestRunCharacterError exception. """ msg = ' '.join(['Illegal test run value',str(character)]) RDFGeneratorError.__init__(self,msg) class IllegalSiteSurveyValueError(RDFGeneratorError): """Exception when the illegal characters as site survey """ def __init__(self, character): """IlligalSiteSurvetCharacterError exception. """ msg = ' '.join(['Illegal site survey value',str(character)]) RDFGeneratorError.__init__(self,msg) class IllegalRDFError(RDFGeneratorError): """Exception when the RDF is invalid """ def __init__(self, rdf, value): """IlligalRDFError exception. """ msg = ' '.join(['Illegal RDF:',str(value),str(rdf)]) RDFGeneratorError.__init__(self,msg) class IllegalEARLError(IllegalRDFError): """Exception when the EARL is invalid """ def __init__(self, EARL, value): """IlligalEARLError exception. """ msg = ' '.join(['Illegal EARL:',value, str(EARL)]) RDFGeneratorError.__init__(self,msg) class NoAssertionsPresentEARLError(IllegalEARLError): """Exception when no Assertions are provided EARL """ def __init__(self, EARL, value): """NoAssertionsPresentEARLError exception. """ msg = ' '.join(['No assertions present in the EARL:',str(value),str(EARL)]) RDFGeneratorError.__init__(self,msg) class EmptyRDFError(IllegalRDFError): """Exception when the RDF is empty """ def __init__(self, rdf, value): """EmptyRDFError exception. """ msg = ' '.join(['Empty RDF:',str(rdf)]) IllegalRDFError.__init__(self,msg,value) class EmptyEARLError(EmptyRDFError): """Exception when the EARL is empty """ def __init__(self, EARL,value): """EmptyEARLError exception. """ msg = ' '.join(['Empty EARL:',str(EARL)]) EmptyRDFError.__init__(self,msg, value)