Example #1
0
    def eval(self, subj, obj, queue, bindings, proof, query):
        if isinstance(subj, Literal):
##            print '%s makes %s' % (subj, toBool(str(subj), subj.datatype.fragid))
##            print '%s makes %s' % (obj, toBool(str(obj), obj.datatype.fragid))
##            print 'I got here on %s, %s, returning %s' % (subj, obj, toBool(str(subj), subj.datatype.fragid) is toBool(str(obj), obj.datatype.fragid))
            return toBool(str(subj), subj.datatype) is toBool(str(obj), obj.datatype)
        raise TypeError("%s type cannot be converted to boolean" % `subj.__class`)
Example #2
0
 def eval(self, subj, obj, queue, bindings, proof, query):
     if isinstance(subj, Literal):
         ##            print '%s makes %s' % (subj, toBool(str(subj), subj.datatype.fragid))
         ##            print '%s makes %s' % (obj, toBool(str(obj), obj.datatype.fragid))
         ##            print 'I got here on %s, %s, returning %s' % (subj, obj, toBool(str(subj), subj.datatype.fragid) is toBool(str(obj), obj.datatype.fragid))
         return toBool(str(subj), subj.datatype) is toBool(
             str(obj), obj.datatype)
     raise TypeError("%s type cannot be converted to boolean" %
                     ` subj.__class `)
Example #3
0
 def eval(self, subj, obj, queue, bindings, proof, query):
     xsd = self.store.integer.resource
     if isinstance(subj, Symbol) and isinstance(obj, Symbol):
         return subj is obj
     if isinstance(subj, Fragment) and isinstance(obj, Fragment):
         return subj is obj
     if isinstance(subj, Literal) and isinstance(obj, Literal):
         if subj.datatype == xsd['boolean'] or obj.datatype == xsd['boolean']:
             return (toBool(str(subj), subj.datatype.resource is xsd and subj.datatype.fragid or None) ==
                     toBool(str(obj), obj.datatype.resource is xsd and obj.datatype.fragid or None))
         if not subj.datatype and not obj.datatype:
             return str(subj) == str(obj)
         if subj.datatype.fragid in typeMap and obj.datatype.fragid in typeMap:
             return subj.value() == obj.value()
         if subj.datatype != obj.datatype:
             raise TypeError(subj, obj)
         return str(subj) == str(obj)
     raise TypeError(subj, obj)
Example #4
0
 def eval(self, subj, obj, queue, bindings, proof, query):
     xsd = self.store.integer.resource
     if isinstance(subj, Symbol) and isinstance(obj, Symbol):
         return subj is obj
     if isinstance(subj, Fragment) and isinstance(obj, Fragment):
         return subj is obj
     if isinstance(subj, Literal) and isinstance(obj, Literal):
         if subj.datatype == xsd['boolean'] or obj.datatype == xsd[
                 'boolean']:
             return (toBool(
                 str(subj),
                 subj.datatype.resource is xsd and subj.datatype.fragid
                 or None) == toBool(
                     str(obj),
                     obj.datatype.resource is xsd and obj.datatype.fragid
                     or None))
         if not subj.datatype and not obj.datatype:
             return str(subj) == str(obj)
         if subj.datatype.fragid in typeMap and obj.datatype.fragid in typeMap:
             return subj.value() == obj.value()
         if subj.datatype != obj.datatype:
             raise TypeError(subj, obj)
         return str(subj) == str(obj)
     raise TypeError(subj, obj)