def irimap(self): # self.out(":- ensure_loaded(library('semweb/rdf_db')).") # for short in self.nsmap.shortNames(): # self.out(':- rdf_register_ns('+short+', '+atom_quote(self.nsmap.getLong(short)), ").") if not self.supress_nsmap: self.out("\n% Namespaces used:") # self.out(':- discontiguous(ns/2).') for short in self.nsmap.shortNames(): self.out("ns(" + atom_quote(short) + ", " + atom_quote(self.nsmap.getLong(short)), ").") self.out("\n")
def iri(self, text): # errrrr, duplicating stuff already in qname, yes? try: (long, local) = qname.uri_split(text) except qname.Unsplitable: long = "" local = text short = self.nsmap.getShort(long) if short != "rif": short = self.atom_prefix + short # self.outk(short+":"+atom_quote(local)) if short == "": local = local.lower() # hack... self.outk(atom_quote(local)) else: self.outk(atom_quote(short + "_" + local))
def do_DataValue(self, obj): self.outk("data(", atom_quote(obj.lexrep), ", ") self.iri(obj.datatype) self.outk(")")