def transform(self, graph): """ Transforms a universal restriction to a negated existential restriction """ Individual.factoryGraph = graph for restr, p, o in graph.triples((None, OWL_NS.allValuesFrom, None)): graph.remove((restr, p, o)) innerCompl = Class(complementOf=o) graph.add((restr, OWL_NS.someValuesFrom, innerCompl.identifier)) outerCompl = Class() for _s, _p, _o in graph.triples((None, None, restr)): graph.add((_s, _p, outerCompl.identifier)) graph.remove((_s, _p, _o)) outerCompl.complementOf = restr