def __init__( self, store, openFormula=None, thisDoc="", baseURI=None, genPrefix="", metaURI=None, flags="", why=None ): """ note: namespace names should *not* end in #; the # will get added during qname processing """ self._bindings = {} self._flags = flags if thisDoc != "": assertFudge(":" in thisDoc, "Document URI not absolute: " + thisDoc) self._bindings[""] = thisDoc + "#" # default self._store = store if genPrefix: store.setGenPrefix(genPrefix) # pass it on self._thisDoc = thisDoc self.source = store.sym(thisDoc) self.lines = 0 # for error handling self.statementCount = 0 # for stats only self.startOfLine = 0 # For calculating character number self.previousLine = 0 # For calculating character number self._genPrefix = genPrefix self.keywords = ["a", "this", "bind", "has", "is", "of", "true", "false"] self.keywordsSet = 0 # Then only can others be considerd qnames self._anonymousNodes = {} # Dict of anon nodes already declared ln: Term self._variables = {} self._parentVariables = {} self._reason = why # Why the parser was asked to parse this self._reason2 = None # Why these triples if diag.tracking: self._reason2 = BecauseOfData(store.newSymbol(thisDoc), self._reason) if baseURI: self._baseURI = baseURI else: if thisDoc: self._baseURI = thisDoc else: self._baseURI = None assertFudge(not self._baseURI or ":" in self._baseURI) if not self._genPrefix: if self._thisDoc: self._genPrefix = self._thisDoc + "#_g" else: self._genPrefix = uniqueURI() if openFormula == None: if self._thisDoc: self._formula = store.newFormula(thisDoc + "#_formula") else: self._formula = store.newFormula() else: self._formula = openFormula self._context = self._formula self._parentContext = None
def __init__(self, store, openFormula=None, thisDoc="", baseURI=None, genPrefix = "", metaURI=None, flags="", why=None): """ note: namespace names should *not* end in #; the # will get added during qname processing """ self._bindings = {} self._flags = flags if thisDoc != "": assertFudge( ':' in thisDoc, "Document URI not absolute: " + thisDoc) self._bindings[""] = thisDoc + "#" # default self._store = store if genPrefix: store.setGenPrefix(genPrefix) # pass it on self._thisDoc = thisDoc self.source = store.sym(thisDoc) self.lines = 0 # for error handling self.statementCount = 0 # for stats only self.startOfLine = 0 # For calculating character number self.previousLine = 0 # For calculating character number self._genPrefix = genPrefix self.keywords = ['a', 'this', 'bind', 'has', 'is', 'of', 'true', 'false' ] self.keywordsSet = 0 # Then only can others be considerd qnames self._anonymousNodes = {} # Dict of anon nodes already declared ln: Term self._variables = {} self._parentVariables = {} self._reason = why # Why the parser was asked to parse this self._reason2 = None # Why these triples if diag.tracking: self._reason2 = BecauseOfData( store.newSymbol(thisDoc), self._reason) if baseURI: self._baseURI = baseURI else: if thisDoc: self._baseURI = thisDoc else: self._baseURI = None assertFudge( not self._baseURI or ':' in self._baseURI) if not self._genPrefix: if self._thisDoc: self._genPrefix = self._thisDoc + "#_g" else: self._genPrefix = uniqueURI() if openFormula ==None: if self._thisDoc: self._formula = store.newFormula(thisDoc + "#_formula") else: self._formula = store.newFormula() else: self._formula = openFormula self._context = self._formula self._parentContext = None
def __init__(self, store, openFormula=None, thisDoc="", baseURI=None, genPrefix = "", metaURI=None, flags="", why=None): self._bindings = {} if thisDoc != "": assert ':' in thisDoc, "Document URI if any must be absolute: <%s>" % thisDoc self._bindings[""] = thisDoc + "#" # default self._store = store if genPrefix: store.setGenPrefix(genPrefix) # pass it on self._thisDoc = thisDoc self.lines = 0 # for error handling self.startOfLine = 0 # For calculating character number self._genPrefix = genPrefix self.keywordsSet = 0 # When and only when they have been set can others be considerd qnames self._reason = why # Why the parser w self._reason2 = None # Why these triples if diag.tracking: self._reason2 = BecauseOfData(store.newSymbol(thisDoc), because=self._reason) if baseURI: self._baseURI = baseURI else: if thisDoc: self._baseURI = thisDoc else: self._baseURI = "" assert not self._baseURI or ':' in self._baseURI if not self._genPrefix: if self._thisDoc: self._genPrefix = self._thisDoc + "#_g" else: self._genPrefix = uniqueURI() if openFormula ==None: if self._thisDoc: self._formula = store.newFormula(thisDoc + "#_formula") else: self._formula = store.newFormula() else: self._formula = openFormula import sys #self._tripleMaker = toXML.tmToRDF(sys.stdout, "foo:", base="file:/home/syosi/CVS-local/WWW/2000/10/swap/test/")#triple_maker.TripleMaker(self._formula) self._tripleMaker = notation3.tmToN3(sys.stdout.write, genPrefix="foo:", base="file:/home/syosi/CVS-local/WWW/2000/10/swap/test/") self._bindings[''] = self._baseURI + '#'
def __init__(self, store, openFormula=None, thisDoc="", baseURI=None, genPrefix = "", metaURI=None, flags="", why=None): """ note: namespace names should *not* end in #; the # will get added during qname processing """ self._bindings = {} self._flags = flags if thisDoc != "": assert ':' in thisDoc, "Document URI not absolute: <%s>" % thisDoc self._bindings[""] = thisDoc + "#" # default self._store = store if genPrefix: store.setGenPrefix(genPrefix) # pass it on self._thisDoc = thisDoc self.lines = 0 # for error handling self.startOfLine = 0 # For calculating character number self._genPrefix = genPrefix self.keywords = ['a', 'this', 'bind', 'has', 'is', 'of', 'true', 'false' ] self.keywordsSet = 0 # Then only can others be considerd qnames self._anonymousNodes = {} # Dict of anon nodes already declared ln: Term self._variables = {} self._parentVariables = {} self._reason = why # Why the parser was asked to parse this self._reason2 = None # Why these triples if diag.tracking: self._reason2 = BecauseOfData( store.newSymbol(thisDoc), because=self._reason) if baseURI: self._baseURI = baseURI else: if thisDoc: self._baseURI = thisDoc else: self._baseURI = None assert not self._baseURI or ':' in self._baseURI if not self._genPrefix: if self._thisDoc: self._genPrefix = self._thisDoc + "#_g" else: self._genPrefix = uniqueURI() if openFormula ==None: if self._thisDoc: self._formula = store.newFormula(thisDoc + "#_formula") else: self._formula = store.newFormula() else: self._formula = openFormula self._context = self._formula self._parentContext = None if metaURI: self.makeStatement((SYMBOL, metaURI), # relate doc to parse tree (SYMBOL, PARSES_TO_URI ), #pred (SYMBOL, thisDoc), #subj self._context) # obj self.makeStatement(((SYMBOL, metaURI), # quantifiers - use inverse? (SYMBOL, N3_forSome_URI), #pred self._context, #subj subj)) # obj
def __init__(self, store, openFormula=None, thisDoc="", baseURI=None, genPrefix="", metaURI=None, flags="", why=None): """ note: namespace names should *not* end in #; the # will get added during qname processing """ self._bindings = {} self._flags = flags if thisDoc != "": assert ':' in thisDoc, "Document URI not absolute: <%s>" % thisDoc self._bindings[""] = thisDoc + "#" # default self._store = store if genPrefix: store.setGenPrefix(genPrefix) # pass it on self._thisDoc = thisDoc self.lines = 0 # for error handling self.startOfLine = 0 # For calculating character number self._genPrefix = genPrefix self.keywords = [ 'a', 'this', 'bind', 'has', 'is', 'of', 'true', 'false' ] self.keywordsSet = 0 # Then only can others be considerd qnames self._anonymousNodes = { } # Dict of anon nodes already declared ln: Term self._variables = {} self._parentVariables = {} self._reason = why # Why the parser was asked to parse this self._reason2 = None # Why these triples if diag.tracking: self._reason2 = BecauseOfData(store.newSymbol(thisDoc), because=self._reason) if baseURI: self._baseURI = baseURI else: if thisDoc: self._baseURI = thisDoc else: self._baseURI = None assert not self._baseURI or ':' in self._baseURI if not self._genPrefix: if self._thisDoc: self._genPrefix = self._thisDoc + "#_g" else: self._genPrefix = uniqueURI() if openFormula == None: if self._thisDoc: self._formula = store.newFormula(thisDoc + "#_formula") else: self._formula = store.newFormula() else: self._formula = openFormula self._context = self._formula self._parentContext = None if metaURI: self.makeStatement( (SYMBOL, metaURI), # relate doc to parse tree (SYMBOL, PARSES_TO_URI), #pred (SYMBOL, thisDoc), #subj self._context) # obj self.makeStatement(( (SYMBOL, metaURI), # quantifiers - use inverse? (SYMBOL, N3_forSome_URI), #pred self._context, #subj subj)) # obj