thing
index
/devel/WWW/2000/10/swap/thing.py

$Id: thing.html,v 1.22 2004/06/24 03:17:12 timbl Exp $
 
OBSOLETE
 This module was too much of a mixture. See
 
 - myStore.py to import to set up a default store for your program, and Namespace.
 - term.py to define the class of Term and some subclasses.
 
Was: Interning of URIs and strings for storage in SWAP store
 
Includes:
 - template classes for builtins

 
Modules
            
binascii
md5
string
sys
uripath
urllib
 
Classes
            
Term
CompoundTerm
List
EmptyList
FragmentNil(EmptyList, Fragment)
NonEmptyList
Fragment
Anonymous
BuiltIn
Function
HeavyBuiltIn
LightBuiltIn
ReverseFunction
Literal
Integer
Symbol
__builtin__.object
Namespace
 
class Anonymous(Fragment)
       
  
Method resolution order:
Anonymous
Fragment
Term

Methods defined here:
__init__(self, resource, fragid)
asPair(self)
generated(self)

Data and non-method functions defined here:
__doc__ = None
__module__ = 'thing'

Methods inherited from Fragment:
reification(self, sink, why=None)
Describe myself in RDF to the given context
 
[ reify:uri "http://example.org/#whatever"]
representation(self, base=None)
 Optimize output if prefixes available
uriref(self)
uriref2(self, base)

Methods inherited from Term:
__repr__(self)
This method only used for debugging output - it can be ambiguous,
as it is is deliberately short to make debug printout readable.
occurringIn(self, vars)
qname(self)
Output XML qnames [http://www.w3.org/TR/REC-xml-names/#NT-QName].
This should be beefed up to guarantee unambiguity (see __repr__ documentation).
substitution(self, bindings, why=None)
Return this or a version of me with subsitution made
unify(self, other, vars, existentials, bindings)
Unify this which may contain variables with the other,
which may contain existentials but not variables.
Return 0 if impossible.
Return [(var1, val1), (var2,val2)...] if match
value(self)
As a python value - by default, none exists, use self
 
class BuiltIn(Fragment)
      This class is a supercalss to any builtin predicate in cwm.
 
A binary operator can calculate truth value given 2 arguments
 
  
Method resolution order:
BuiltIn
Fragment
Term

Methods defined here:
__init__(self, resource, fragid)
eval(self, subj, obj, queue, bindings, proof, query)
This function which has access to the store, unless overridden,
calls a simpler one which uses python conventions.
 
To reduce confusion, the inital ones called with the internals available
use abreviations "eval", "subj" etc while the python-style ones use evaluate, subject, etc.

Data and non-method functions defined here:
__doc__ = 'This class is a supercalss to any builtin predic...rator can calculate truth value given 2 arguments'
__module__ = 'thing'

Methods inherited from Fragment:
generated(self)
 A generated identifier?
This arises when a document is parsed and a arbitrary
name is made up to represent a node with no known URI.
It is useful to know that its ID has no use outside that
context.
reification(self, sink, why=None)
Describe myself in RDF to the given context
 
[ reify:uri "http://example.org/#whatever"]
representation(self, base=None)
 Optimize output if prefixes available
uriref(self)
uriref2(self, base)

Methods inherited from Term:
__repr__(self)
This method only used for debugging output - it can be ambiguous,
as it is is deliberately short to make debug printout readable.
asPair(self)
Representation in an earlier format, being phased out 2002/08
 
The first part of the pair is a constant number represnting the type
see RDFSink.py.  the second is the value -- uri for symbols, string for literals
occurringIn(self, vars)
qname(self)
Output XML qnames [http://www.w3.org/TR/REC-xml-names/#NT-QName].
This should be beefed up to guarantee unambiguity (see __repr__ documentation).
substitution(self, bindings, why=None)
Return this or a version of me with subsitution made
unify(self, other, vars, existentials, bindings)
Unify this which may contain variables with the other,
which may contain existentials but not variables.
Return 0 if impossible.
Return [(var1, val1), (var2,val2)...] if match
value(self)
As a python value - by default, none exists, use self
 
class CompoundTerm(Term)
      A compound term has occurrences of terms within it.
Examples: List, Formula
 
   Data and non-method functions defined here:
__doc__ = 'A compound term has occurrences of terms within it.\n Examples: List, Formula'
__module__ = 'thing'

Methods inherited from Term:
__init__(self, store=None)
__repr__(self)
This method only used for debugging output - it can be ambiguous,
as it is is deliberately short to make debug printout readable.
asPair(self)
Representation in an earlier format, being phased out 2002/08
 
The first part of the pair is a constant number represnting the type
see RDFSink.py.  the second is the value -- uri for symbols, string for literals
generated(self)
Boolean Is this thing a genid - is its name arbitrary?
occurringIn(self, vars)
qname(self)
Output XML qnames [http://www.w3.org/TR/REC-xml-names/#NT-QName].
This should be beefed up to guarantee unambiguity (see __repr__ documentation).
representation(self, base=None)
The string represnting this in N3
substitution(self, bindings, why=None)
Return this or a version of me with subsitution made
unify(self, other, vars, existentials, bindings)
Unify this which may contain variables with the other,
which may contain existentials but not variables.
Return 0 if impossible.
Return [(var1, val1), (var2,val2)...] if match
value(self)
As a python value - by default, none exists, use self
 
class EmptyList(List)
       
  
Method resolution order:
EmptyList
List
CompoundTerm
Term

Methods defined here:
__repr__(self)
newList(self, value)
occurringIn(self, vars)
substitution(self, bindings, why=None)
Return this or a version of me with subsitution made
unify(self, other, vars, existentials, bindings)
Unify this which may contain variables with the other,
which may contain existentials but not variables.
Return 0 if impossible.
Return [(var1, val1), (var2,val2)...] if match
uriref(self)
value(self)

Data and non-method functions defined here:
__doc__ = None
__module__ = 'thing'

Methods inherited from List:
__init__(self, store, first, rest)
__iter__(self)
The internal method which allows one to iterate over the statements
as though a formula were a sequence.
asSequence(self)
Convert to a python sequence - NOT recursive
precededBy(self, first)

Methods inherited from Term:
asPair(self)
Representation in an earlier format, being phased out 2002/08
 
The first part of the pair is a constant number represnting the type
see RDFSink.py.  the second is the value -- uri for symbols, string for literals
generated(self)
Boolean Is this thing a genid - is its name arbitrary?
qname(self)
Output XML qnames [http://www.w3.org/TR/REC-xml-names/#NT-QName].
This should be beefed up to guarantee unambiguity (see __repr__ documentation).
representation(self, base=None)
The string represnting this in N3
 
class Fragment(Term)
          A Term which DOES have a fragment id in its URI
 
   Methods defined here:
__init__(self, resource, fragid)
generated(self)
 A generated identifier?
This arises when a document is parsed and a arbitrary
name is made up to represent a node with no known URI.
It is useful to know that its ID has no use outside that
context.
reification(self, sink, why=None)
Describe myself in RDF to the given context
 
[ reify:uri "http://example.org/#whatever"]
representation(self, base=None)
 Optimize output if prefixes available
uriref(self)
uriref2(self, base)

Data and non-method functions defined here:
__doc__ = ' A Term which DOES have a fragment id in its URI\n '
__module__ = 'thing'

Methods inherited from Term:
__repr__(self)
This method only used for debugging output - it can be ambiguous,
as it is is deliberately short to make debug printout readable.
asPair(self)
Representation in an earlier format, being phased out 2002/08
 
The first part of the pair is a constant number represnting the type
see RDFSink.py.  the second is the value -- uri for symbols, string for literals
occurringIn(self, vars)
qname(self)
Output XML qnames [http://www.w3.org/TR/REC-xml-names/#NT-QName].
This should be beefed up to guarantee unambiguity (see __repr__ documentation).
substitution(self, bindings, why=None)
Return this or a version of me with subsitution made
unify(self, other, vars, existentials, bindings)
Unify this which may contain variables with the other,
which may contain existentials but not variables.
Return 0 if impossible.
Return [(var1, val1), (var2,val2)...] if match
value(self)
As a python value - by default, none exists, use self
 
class FragmentNil(EmptyList, Fragment)
       This is unique in being both a symbol and a list
 
  
Method resolution order:
FragmentNil
EmptyList
List
CompoundTerm
Term
Fragment

Methods defined here:
__init__(self, resource, fragid)

Data and non-method functions defined here:
__doc__ = ' This is unique in being both a symbol and a list'
__module__ = 'thing'

Methods inherited from EmptyList:
__repr__(self)
newList(self, value)
occurringIn(self, vars)
substitution(self, bindings, why=None)
Return this or a version of me with subsitution made
unify(self, other, vars, existentials, bindings)
Unify this which may contain variables with the other,
which may contain existentials but not variables.
Return 0 if impossible.
Return [(var1, val1), (var2,val2)...] if match
uriref(self)
value(self)

Methods inherited from List:
__iter__(self)
The internal method which allows one to iterate over the statements
as though a formula were a sequence.
asSequence(self)
Convert to a python sequence - NOT recursive
precededBy(self, first)

Methods inherited from Term:
asPair(self)
Representation in an earlier format, being phased out 2002/08
 
The first part of the pair is a constant number represnting the type
see RDFSink.py.  the second is the value -- uri for symbols, string for literals
generated(self)
Boolean Is this thing a genid - is its name arbitrary?
qname(self)
Output XML qnames [http://www.w3.org/TR/REC-xml-names/#NT-QName].
This should be beefed up to guarantee unambiguity (see __repr__ documentation).
representation(self, base=None)
The string represnting this in N3

Methods inherited from Fragment:
reification(self, sink, why=None)
Describe myself in RDF to the given context
 
[ reify:uri "http://example.org/#whatever"]
uriref2(self, base)
 
class Function(BuiltIn)
      A function is a builtin which can calculate its object given its subject.
 
To get cwm to invoke it this way, your built-in must be a subclass of Function.
I may make changes to clean up the parameters of these methods below some day. -tbl
 
  
Method resolution order:
Function
BuiltIn
Fragment
Term

Methods defined here:
__init__(self)
eval(self, subj, obj, queue, bindings, proof, query)
evalObj(self, subj, queue, bindings, proof, query)
This function which has access to the store, unless overridden,
calls a simpler one which uses python conventions.
 
To reduce confusion, the inital ones called with the internals available
use abreviations "eval", "subj" etc while the python-style ones use "evaluate", "subject", etc.

Data and non-method functions defined here:
__doc__ = 'A function is a builtin which can calculate its ... parameters of these methods below some day. -tbl'
__module__ = 'thing'

Methods inherited from Fragment:
generated(self)
 A generated identifier?
This arises when a document is parsed and a arbitrary
name is made up to represent a node with no known URI.
It is useful to know that its ID has no use outside that
context.
reification(self, sink, why=None)
Describe myself in RDF to the given context
 
[ reify:uri "http://example.org/#whatever"]
representation(self, base=None)
 Optimize output if prefixes available
uriref(self)
uriref2(self, base)

Methods inherited from Term:
__repr__(self)
This method only used for debugging output - it can be ambiguous,
as it is is deliberately short to make debug printout readable.
asPair(self)
Representation in an earlier format, being phased out 2002/08
 
The first part of the pair is a constant number represnting the type
see RDFSink.py.  the second is the value -- uri for symbols, string for literals
occurringIn(self, vars)
qname(self)
Output XML qnames [http://www.w3.org/TR/REC-xml-names/#NT-QName].
This should be beefed up to guarantee unambiguity (see __repr__ documentation).
substitution(self, bindings, why=None)
Return this or a version of me with subsitution made
unify(self, other, vars, existentials, bindings)
Unify this which may contain variables with the other,
which may contain existentials but not variables.
Return 0 if impossible.
Return [(var1, val1), (var2,val2)...] if match
value(self)
As a python value - by default, none exists, use self
 
class HeavyBuiltIn(BuiltIn)
      A heavy built-in is fast and is calculated late, after searching the store
to see if the answer is already in it.
 
Make your built-in a subclass of either this or LightBultIn to tell cwm when to
run it.  Going out onto the web or net counts as Heavy.
 
  
Method resolution order:
HeavyBuiltIn
BuiltIn
Fragment
Term

Data and non-method functions defined here:
__doc__ = 'A heavy built-in is fast and is calculated late,.... Going out onto the web or net counts as Heavy.'
__module__ = 'thing'

Methods inherited from BuiltIn:
__init__(self, resource, fragid)
eval(self, subj, obj, queue, bindings, proof, query)
This function which has access to the store, unless overridden,
calls a simpler one which uses python conventions.
 
To reduce confusion, the inital ones called with the internals available
use abreviations "eval", "subj" etc while the python-style ones use evaluate, subject, etc.

Methods inherited from Fragment:
generated(self)
 A generated identifier?
This arises when a document is parsed and a arbitrary
name is made up to represent a node with no known URI.
It is useful to know that its ID has no use outside that
context.
reification(self, sink, why=None)
Describe myself in RDF to the given context
 
[ reify:uri "http://example.org/#whatever"]
representation(self, base=None)
 Optimize output if prefixes available
uriref(self)
uriref2(self, base)

Methods inherited from Term:
__repr__(self)
This method only used for debugging output - it can be ambiguous,
as it is is deliberately short to make debug printout readable.
asPair(self)
Representation in an earlier format, being phased out 2002/08
 
The first part of the pair is a constant number represnting the type
see RDFSink.py.  the second is the value -- uri for symbols, string for literals
occurringIn(self, vars)
qname(self)
Output XML qnames [http://www.w3.org/TR/REC-xml-names/#NT-QName].
This should be beefed up to guarantee unambiguity (see __repr__ documentation).
substitution(self, bindings, why=None)
Return this or a version of me with subsitution made
unify(self, other, vars, existentials, bindings)
Unify this which may contain variables with the other,
which may contain existentials but not variables.
Return 0 if impossible.
Return [(var1, val1), (var2,val2)...] if match
value(self)
As a python value - by default, none exists, use self
 
class Integer(Literal)
       
  
Method resolution order:
Integer
Literal
Term

Methods defined here:
__init__(self, store, str)
__int__(self)
__repr__(self)
__str__(self)
representation(self, base=None)
value(self)

Data and non-method functions defined here:
__doc__ = None
__module__ = 'thing'

Methods inherited from Literal:
asHashURI(self)
return a md5: URI for this literal.
Hmm... encoding... assuming utf8? @@test this.
Hmm... for a class of literals including this one,
strictly speaking.
asPair(self)
occurringIn(self, vars)
reification(self, sink, why=None)
Describe myself in RDF to the given context
 
[ reify:value "un expression quelconque"@fr ]
substitution(self, bindings, why=None)
Return this or a version of me with subsitution made
unify(self, other, vars, existentials, bindings)
Unify this which may contain variables with the other,
which may contain existentials but not variables.
Return 0 if impossible.
Return [(var1, val1), (var2,val2)...] if match
uriref(self)

Methods inherited from Term:
generated(self)
Boolean Is this thing a genid - is its name arbitrary?
qname(self)
Output XML qnames [http://www.w3.org/TR/REC-xml-names/#NT-QName].
This should be beefed up to guarantee unambiguity (see __repr__ documentation).
 
class LightBuiltIn(BuiltIn)
      A light built-in is fast and is calculated immediately before searching the store.
 
Make your built-in a subclass of either this or HeavyBultIn to tell cwm when to
run it.  Going out onto the web or net counts as heavy.
 
  
Method resolution order:
LightBuiltIn
BuiltIn
Fragment
Term

Data and non-method functions defined here:
__doc__ = 'A light built-in is fast and is calculated immed.... Going out onto the web or net counts as heavy.'
__module__ = 'thing'

Methods inherited from BuiltIn:
__init__(self, resource, fragid)
eval(self, subj, obj, queue, bindings, proof, query)
This function which has access to the store, unless overridden,
calls a simpler one which uses python conventions.
 
To reduce confusion, the inital ones called with the internals available
use abreviations "eval", "subj" etc while the python-style ones use evaluate, subject, etc.

Methods inherited from Fragment:
generated(self)
 A generated identifier?
This arises when a document is parsed and a arbitrary
name is made up to represent a node with no known URI.
It is useful to know that its ID has no use outside that
context.
reification(self, sink, why=None)
Describe myself in RDF to the given context
 
[ reify:uri "http://example.org/#whatever"]
representation(self, base=None)
 Optimize output if prefixes available
uriref(self)
uriref2(self, base)

Methods inherited from Term:
__repr__(self)
This method only used for debugging output - it can be ambiguous,
as it is is deliberately short to make debug printout readable.
asPair(self)
Representation in an earlier format, being phased out 2002/08
 
The first part of the pair is a constant number represnting the type
see RDFSink.py.  the second is the value -- uri for symbols, string for literals
occurringIn(self, vars)
qname(self)
Output XML qnames [http://www.w3.org/TR/REC-xml-names/#NT-QName].
This should be beefed up to guarantee unambiguity (see __repr__ documentation).
substitution(self, bindings, why=None)
Return this or a version of me with subsitution made
unify(self, other, vars, existentials, bindings)
Unify this which may contain variables with the other,
which may contain existentials but not variables.
Return 0 if impossible.
Return [(var1, val1), (var2,val2)...] if match
value(self)
As a python value - by default, none exists, use self
 
class List(CompoundTerm)
       
  
Method resolution order:
List
CompoundTerm
Term

Methods defined here:
__init__(self, store, first, rest)
__iter__(self)
The internal method which allows one to iterate over the statements
as though a formula were a sequence.
asSequence(self)
Convert to a python sequence - NOT recursive
occurringIn(self, vars)
Which variables in the list occur in this list?
precededBy(self, first)
substitution(self, bindings, why=None)
Return this or a version of me with subsitution made
uriref(self)
value(self)

Data and non-method functions defined here:
__doc__ = None
__module__ = 'thing'

Methods inherited from Term:
__repr__(self)
This method only used for debugging output - it can be ambiguous,
as it is is deliberately short to make debug printout readable.
asPair(self)
Representation in an earlier format, being phased out 2002/08
 
The first part of the pair is a constant number represnting the type
see RDFSink.py.  the second is the value -- uri for symbols, string for literals
generated(self)
Boolean Is this thing a genid - is its name arbitrary?
qname(self)
Output XML qnames [http://www.w3.org/TR/REC-xml-names/#NT-QName].
This should be beefed up to guarantee unambiguity (see __repr__ documentation).
representation(self, base=None)
The string represnting this in N3
unify(self, other, vars, existentials, bindings)
Unify this which may contain variables with the other,
which may contain existentials but not variables.
Return 0 if impossible.
Return [(var1, val1), (var2,val2)...] if match
 
class Literal(Term)
       A Literal is a representation of an RDF literal
 
really, data:text/rdf+n3;%22hello%22 == "hello" but who
wants to store it that way?  Maybe we do... at least in theory and maybe
practice but, for now, we keep them in separate subclases of Term.
An RDF literal has a value - by default a string, and a datattype, and a language
 
   Methods defined here:
__init__(self, store, string, dt=None, lang=None)
__int__(self)
__repr__(self)
__str__(self)
asHashURI(self)
return a md5: URI for this literal.
Hmm... encoding... assuming utf8? @@test this.
Hmm... for a class of literals including this one,
strictly speaking.
asPair(self)
occurringIn(self, vars)
reification(self, sink, why=None)
Describe myself in RDF to the given context
 
[ reify:value "un expression quelconque"@fr ]
representation(self, base=None)
substitution(self, bindings, why=None)
Return this or a version of me with subsitution made
unify(self, other, vars, existentials, bindings)
Unify this which may contain variables with the other,
which may contain existentials but not variables.
Return 0 if impossible.
Return [(var1, val1), (var2,val2)...] if match
uriref(self)
value(self)

Data and non-method functions defined here:
__doc__ = ' A Literal is a representation of an RDF literal...lt a string, and a datattype, and a language\n '
__module__ = 'thing'

Methods inherited from Term:
generated(self)
Boolean Is this thing a genid - is its name arbitrary?
qname(self)
Output XML qnames [http://www.w3.org/TR/REC-xml-names/#NT-QName].
This should be beefed up to guarantee unambiguity (see __repr__ documentation).
 
class Namespace(__builtin__.object)
      A shortcut for getting a symbols as interned by the default store
 
>>> RDF = Namespace('http://www.w3.org/1999/02/22-rdf-syntax-ns#')
>>> RDF.type
'http://www.w3.org/1999/02/22-rdf-syntax-ns#type'
>>> RDF.type is RDF.type
1
 
   Methods defined here:
__getattr__(self, lname)
get the lname Symbol in this namespace.
 
lname -- an XML name (limited to URI characters)
I hope this is only called *after* the ones defines above have been checked
__init__(self, name)
sym(self, lname)
For getting a symbol for an expression, rather than a constant.
For, and from, pim/toIcal.py

Data and non-method functions defined here:
__dict__ = <dict-proxy object>
__doc__ = "A shortcut for getting a symbols as interned by ...ype'\n >>> RDF.type is RDF.type\n 1\n\n "
__module__ = 'thing'
__weakref__ = <member '__weakref__' of 'Namespace' objects>

Methods inherited from __builtin__.object:
__delattr__(...)
x.__delattr__('name') <==> del x.name
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__hash__(...)
x.__hash__() <==> hash(x)
__reduce__(...)
helper for pickle
__repr__(...)
x.__repr__() <==> repr(x)
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
__str__(...)
x.__str__() <==> str(x)

Data and non-method functions inherited from __builtin__.object:
__class__ = <type 'type'>
__new__ = <built-in method __new__ of type object at 0xc39bc>
T.__new__(S, ...) -> a new object with type S, a subtype of T
 
class NonEmptyList(List)
       
  
Method resolution order:
NonEmptyList
List
CompoundTerm
Term

Methods defined here:
__repr__(self)
unify(self, other, vars, existentials, bindings)
Unify this which may contain variables with the other,
which may contain existentials but not variables.
Return 0 if impossible.
Return [(var1, val1), (var2,val2)...] if match

Data and non-method functions defined here:
__doc__ = None
__module__ = 'thing'

Methods inherited from List:
__init__(self, store, first, rest)
__iter__(self)
The internal method which allows one to iterate over the statements
as though a formula were a sequence.
asSequence(self)
Convert to a python sequence - NOT recursive
occurringIn(self, vars)
Which variables in the list occur in this list?
precededBy(self, first)
substitution(self, bindings, why=None)
Return this or a version of me with subsitution made
uriref(self)
value(self)

Methods inherited from Term:
asPair(self)
Representation in an earlier format, being phased out 2002/08
 
The first part of the pair is a constant number represnting the type
see RDFSink.py.  the second is the value -- uri for symbols, string for literals
generated(self)
Boolean Is this thing a genid - is its name arbitrary?
qname(self)
Output XML qnames [http://www.w3.org/TR/REC-xml-names/#NT-QName].
This should be beefed up to guarantee unambiguity (see __repr__ documentation).
representation(self, base=None)
The string represnting this in N3
 
class ReverseFunction(BuiltIn)
      A reverse function is a builtin which can calculate its subject given its object.
 
To get cwm to invoke it this way, your built-in must be a subclass of ReverseFunction.
If a function (like log:uri for example) is a two-way  (1:1) builtin, it should be declared
a subclass of Function and ReverseFunction. Then, cwm will call it either way as needed
in trying to resolve a query.
 
  
Method resolution order:
ReverseFunction
BuiltIn
Fragment
Term

Methods defined here:
__init__(self)
eval(self, subj, obj, queue, bindings, proof, query)
evalSubj(self, obj, queue, bindings, proof, query)
This function which has access to the store, unless overridden,
calls a simpler one which uses python conventions

Data and non-method functions defined here:
__doc__ = 'A reverse function is a builtin which can calcul... as needed\n in trying to resolve a query.\n '
__module__ = 'thing'

Methods inherited from Fragment:
generated(self)
 A generated identifier?
This arises when a document is parsed and a arbitrary
name is made up to represent a node with no known URI.
It is useful to know that its ID has no use outside that
context.
reification(self, sink, why=None)
Describe myself in RDF to the given context
 
[ reify:uri "http://example.org/#whatever"]
representation(self, base=None)
 Optimize output if prefixes available
uriref(self)
uriref2(self, base)

Methods inherited from Term:
__repr__(self)
This method only used for debugging output - it can be ambiguous,
as it is is deliberately short to make debug printout readable.
asPair(self)
Representation in an earlier format, being phased out 2002/08
 
The first part of the pair is a constant number represnting the type
see RDFSink.py.  the second is the value -- uri for symbols, string for literals
occurringIn(self, vars)
qname(self)
Output XML qnames [http://www.w3.org/TR/REC-xml-names/#NT-QName].
This should be beefed up to guarantee unambiguity (see __repr__ documentation).
substitution(self, bindings, why=None)
Return this or a version of me with subsitution made
unify(self, other, vars, existentials, bindings)
Unify this which may contain variables with the other,
which may contain existentials but not variables.
Return 0 if impossible.
Return [(var1, val1), (var2,val2)...] if match
value(self)
As a python value - by default, none exists, use self
 
class Symbol(Term)
         A Term which has no fragment
 
   Methods defined here:
__init__(self, uri, store=None)
internAnonymous(r, fragid)
internFrag(self, fragid, thetype)
reification(self, sink, why=None)
Describe myself in RDF to the given context
 
[ reify:uri "http://example.org/whatever"]
uriref(self)
uriref2(self, base)

Data and non-method functions defined here:
__doc__ = ' A Term which has no fragment\n '
__module__ = 'thing'

Methods inherited from Term:
__repr__(self)
This method only used for debugging output - it can be ambiguous,
as it is is deliberately short to make debug printout readable.
asPair(self)
Representation in an earlier format, being phased out 2002/08
 
The first part of the pair is a constant number represnting the type
see RDFSink.py.  the second is the value -- uri for symbols, string for literals
generated(self)
Boolean Is this thing a genid - is its name arbitrary?
occurringIn(self, vars)
qname(self)
Output XML qnames [http://www.w3.org/TR/REC-xml-names/#NT-QName].
This should be beefed up to guarantee unambiguity (see __repr__ documentation).
representation(self, base=None)
The string represnting this in N3
substitution(self, bindings, why=None)
Return this or a version of me with subsitution made
unify(self, other, vars, existentials, bindings)
Unify this which may contain variables with the other,
which may contain existentials but not variables.
Return 0 if impossible.
Return [(var1, val1), (var2,val2)...] if match
value(self)
As a python value - by default, none exists, use self
 
class Term
      The Term object represents an RDF term.
 
It is interned for speed of processing by the store.
 
   Methods defined here:
__init__(self, store=None)
__repr__(self)
This method only used for debugging output - it can be ambiguous,
as it is is deliberately short to make debug printout readable.
asPair(self)
Representation in an earlier format, being phased out 2002/08
 
The first part of the pair is a constant number represnting the type
see RDFSink.py.  the second is the value -- uri for symbols, string for literals
generated(self)
Boolean Is this thing a genid - is its name arbitrary?
occurringIn(self, vars)
qname(self)
Output XML qnames [http://www.w3.org/TR/REC-xml-names/#NT-QName].
This should be beefed up to guarantee unambiguity (see __repr__ documentation).
representation(self, base=None)
The string represnting this in N3
substitution(self, bindings, why=None)
Return this or a version of me with subsitution made
unify(self, other, vars, existentials, bindings)
Unify this which may contain variables with the other,
which may contain existentials but not variables.
Return 0 if impossible.
Return [(var1, val1), (var2,val2)...] if match
value(self)
As a python value - by default, none exists, use self

Data and non-method functions defined here:
__doc__ = 'The Term object represents an RDF term.\n \n ...terned for speed of processing by the store.\n '
__module__ = 'thing'
 
Functions
            
_checkStore(s=None)
Check that an explict or implicit stroe exists
bNode(str, context)
Create or reuse, in the default store, a new unnamed node within the given
formula as context, and return it for future use
existential(str, context, uri)
Create or reuse, in the default store, a new named variable
existentially qualified within the given
formula as context, and return it for future use
formula()
Create or reuse, in the default store, a new empty formula (triple people think: triple store)
and return it for future use
literal(str, dt=None, lang=None)
Create or reuse, in the default store, an interned version of the given literal string
and return it for future use
load(uri=None, contentType=None, formulaURI=None, remember=1)
Get and parse document.  Guesses format if necessary.
 
uri:      if None, load from standard input.
remember: if 1, store as metadata the relationship between this URI and this formula.
 
Returns:  top-level formula of the parsed document.
Raises:   IOError, SyntaxError, DocumentError
loadMany(uris)
Load a number of resources into the same formula
 
Returns:  top-level formula of the parsed information.
Raises:   IOError, SyntaxError, DocumentError
merge(a, b)
Merge sorted sequences
 
The fact that the sequences are sorted makes this faster
setStore(s)
Set the process-global default store to be used when an explicit store is not
setStoreClass(c)
Set the process-global class to be used to generate a new store if needed
symbol(uri)
Create or reuse, in the default store, an interned version of the given symbol
and return it for future use
universal(str, context, uri)
Create or reuse, in the default store, a named variable
universally qualified within the given
formula as context, and return it for future use
uri_encode(str)
 untested - this must be in a standard library somewhere
 
Data
             ALL4 = (0, 1, 2, 3)
ANONYMOUS = 3
BOUNDLISTS = 4
CONSTS = 2
CONTEXT = 0
FORMULA = 1
INFINITY = 1000000000
LITERAL = 2
LITERAL_URI_prefix = 'data:text/rdf+n3;'
List_NS = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'
Logic_NS = 'http://www.w3.org/2000/10/swap/log#'
OBJ = 3
PARTS = (1, 2, 3)
PRED = 1
QUAD = 5
SHORT = 1
STATE = 0
SUBJ = 2
SYMBOL = 0
VARS = 3
__file__ = './thing.py'
__name__ = 'thing'
_nextList = 0
generators = _Feature((2, 2, 0, 'alpha', 1), (2, 3, 0, 'final', 0), 4096)
reify = <thing.Namespace object>
store = None
storeClass = None
subcontext_cache_context = None
subcontext_cache_subcontexts = None