term
index
/home/syosi/cvs-trunk/WWW/2000/10/swap/term.py

$Id: term.html,v 1.17 2004/10/19 20:23:08 syosi Exp $
 
term
 
This module defines objects correspodning to the basic terms in the RDF
and N3 langauges: Symbols, Literals and Lists.  (The N3 language goes on to
include formuale, which are defined elsewhere)
 
The code in this module deals with the represnetation of these terms and
in debug form (__repr__)
 
Interning of URIs and strings for storage in SWAP store.
 
It also defines th utility Namespace module which makes
using terms in practice both more convenient maybe even
more efficient than carrying full URIs around.
 
Includes:
 - template classes for builtins

 
Modules
       
binascii
diag
md5
string
sys
types
uripath

 
Classes
       
Term
CompoundTerm
List
EmptyList
FragmentNil(EmptyList, Fragment)
NonEmptyList
Literal
Node
AnonymousNode
AnonymousVariable
AnonymousExistential
AnonymousUniversal
LabelledNode
Fragment
BuiltIn
FiniteProperty(BuiltIn, Function, ReverseFunction)
Function
HeavyBuiltIn
LightBuiltIn
ReverseFunction
Symbol

 
class AnonymousExistential(AnonymousVariable)
    An anonymous node which is existentially quantified in a given context.
Also known as a Blank Node, or "bnode" in RDF parlance.
 
 
Method resolution order:
AnonymousExistential
AnonymousVariable
AnonymousNode
Node
Term

Methods inherited from AnonymousVariable:
__init__(self, scope, uri=None)

Methods inherited from AnonymousNode:
asPair(self)
classOrder(self)
Anonymous ndoes are higher than symbols as the = smushing
tries to minimize the order rank of the node which it adopts
as the epresentative node of an equivalence class.
compareTerm(self, other)
Assume is also a Formula - see function compareTerm below
flatten(self, sink, why=None)
generated(self)
reification(self, sink, bnodeMap={}, why=None)
Describe myself in RDF to the given context
 
[ reify:items ( [ reify:value "foo"]  .... ) ]
unflatten(self, sink, bNodes, why=None)
uriref(self)

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.
 
output as XML qnames [http://www.w3.org/TR/REC-xml-names/#NT-QName].
This could be beefed up to guarantee unambiguity.
compareAnyTerm(self, other)
Compare two langauge items
This is a cannoncial ordering in that is designed to allow
the same graph always to be printed in the same order.
This makes the regression tests possible.
The literals are deemed smaller than symbols, which are smaller
than formulae.  This puts the rules at the botom of a file where
they tend to take a lot of space anyway.
Formulae have to be compared as a function of their sorted contents.
 
@@ Anonymous nodes have to, within a given Formula, be compared as
a function of the sorted information about them in that context.
This is not done yet
debugString(self, already)
doesNodeAppear(self, symbol)
Does that node appear within this one
 
This non-overloaded function will simply return if I'm equal to him
occurringIn(self, vars)
representation(self, base=None)
The string represnting this in N3
substituteEquals(self, bindings, newRedirections)
Return this or a version of me with substitution made
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 [({}, reason] if no new bindings
Return [( {var1: val1, var2: val2,...}, reason), ...] if match
value(self)
As a python value - by default, none exists, use self

 
class AnonymousNode(Node)
    Has no real URI except when needed for output.
Goal is to eliminate use of ths URI in the code.
The URI is however useful as a diagnostic, so we carry it
when it is given.   It is NOT checked for uniqueness etc.
This is a superclass of many things, including AnonymousExistential, which has a scope.
 
 
Method resolution order:
AnonymousNode
Node
Term

Methods defined here:
__init__(self, store, uri=None)
asPair(self)
classOrder(self)
Anonymous ndoes are higher than symbols as the = smushing
tries to minimize the order rank of the node which it adopts
as the epresentative node of an equivalence class.
compareTerm(self, other)
Assume is also a Formula - see function compareTerm below
flatten(self, sink, why=None)
generated(self)
reification(self, sink, bnodeMap={}, why=None)
Describe myself in RDF to the given context
 
[ reify:items ( [ reify:value "foo"]  .... ) ]
unflatten(self, sink, bNodes, why=None)
uriref(self)

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.
 
output as XML qnames [http://www.w3.org/TR/REC-xml-names/#NT-QName].
This could be beefed up to guarantee unambiguity.
compareAnyTerm(self, other)
Compare two langauge items
This is a cannoncial ordering in that is designed to allow
the same graph always to be printed in the same order.
This makes the regression tests possible.
The literals are deemed smaller than symbols, which are smaller
than formulae.  This puts the rules at the botom of a file where
they tend to take a lot of space anyway.
Formulae have to be compared as a function of their sorted contents.
 
@@ Anonymous nodes have to, within a given Formula, be compared as
a function of the sorted information about them in that context.
This is not done yet
debugString(self, already)
doesNodeAppear(self, symbol)
Does that node appear within this one
 
This non-overloaded function will simply return if I'm equal to him
occurringIn(self, vars)
representation(self, base=None)
The string represnting this in N3
substituteEquals(self, bindings, newRedirections)
Return this or a version of me with substitution made
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 [({}, reason] if no new bindings
Return [( {var1: val1, var2: val2,...}, reason), ...] if match
value(self)
As a python value - by default, none exists, use self

 
class AnonymousUniversal(AnonymousVariable)
    Nodes which are introduced as universally quantified variables with no quotable URI
 
 
Method resolution order:
AnonymousUniversal
AnonymousVariable
AnonymousNode
Node
Term

Methods inherited from AnonymousVariable:
__init__(self, scope, uri=None)

Methods inherited from AnonymousNode:
asPair(self)
classOrder(self)
Anonymous ndoes are higher than symbols as the = smushing
tries to minimize the order rank of the node which it adopts
as the epresentative node of an equivalence class.
compareTerm(self, other)
Assume is also a Formula - see function compareTerm below
flatten(self, sink, why=None)
generated(self)
reification(self, sink, bnodeMap={}, why=None)
Describe myself in RDF to the given context
 
[ reify:items ( [ reify:value "foo"]  .... ) ]
unflatten(self, sink, bNodes, why=None)
uriref(self)

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.
 
output as XML qnames [http://www.w3.org/TR/REC-xml-names/#NT-QName].
This could be beefed up to guarantee unambiguity.
compareAnyTerm(self, other)
Compare two langauge items
This is a cannoncial ordering in that is designed to allow
the same graph always to be printed in the same order.
This makes the regression tests possible.
The literals are deemed smaller than symbols, which are smaller
than formulae.  This puts the rules at the botom of a file where
they tend to take a lot of space anyway.
Formulae have to be compared as a function of their sorted contents.
 
@@ Anonymous nodes have to, within a given Formula, be compared as
a function of the sorted information about them in that context.
This is not done yet
debugString(self, already)
doesNodeAppear(self, symbol)
Does that node appear within this one
 
This non-overloaded function will simply return if I'm equal to him
occurringIn(self, vars)
representation(self, base=None)
The string represnting this in N3
substituteEquals(self, bindings, newRedirections)
Return this or a version of me with substitution made
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 [({}, reason] if no new bindings
Return [( {var1: val1, var2: val2,...}, reason), ...] if match
value(self)
As a python value - by default, none exists, use self

 
class AnonymousVariable(AnonymousNode)
    An anonymous node which is existentially quantified in a given context.
Also known as a Blank Node, or "bnode" in RDF parlance.
 
 
Method resolution order:
AnonymousVariable
AnonymousNode
Node
Term

Methods defined here:
__init__(self, scope, uri=None)

Methods inherited from AnonymousNode:
asPair(self)
classOrder(self)
Anonymous ndoes are higher than symbols as the = smushing
tries to minimize the order rank of the node which it adopts
as the epresentative node of an equivalence class.
compareTerm(self, other)
Assume is also a Formula - see function compareTerm below
flatten(self, sink, why=None)
generated(self)
reification(self, sink, bnodeMap={}, why=None)
Describe myself in RDF to the given context
 
[ reify:items ( [ reify:value "foo"]  .... ) ]
unflatten(self, sink, bNodes, why=None)
uriref(self)

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.
 
output as XML qnames [http://www.w3.org/TR/REC-xml-names/#NT-QName].
This could be beefed up to guarantee unambiguity.
compareAnyTerm(self, other)
Compare two langauge items
This is a cannoncial ordering in that is designed to allow
the same graph always to be printed in the same order.
This makes the regression tests possible.
The literals are deemed smaller than symbols, which are smaller
than formulae.  This puts the rules at the botom of a file where
they tend to take a lot of space anyway.
Formulae have to be compared as a function of their sorted contents.
 
@@ Anonymous nodes have to, within a given Formula, be compared as
a function of the sorted information about them in that context.
This is not done yet
debugString(self, already)
doesNodeAppear(self, symbol)
Does that node appear within this one
 
This non-overloaded function will simply return if I'm equal to him
occurringIn(self, vars)
representation(self, base=None)
The string represnting this in N3
substituteEquals(self, bindings, newRedirections)
Return this or a version of me with substitution made
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 [({}, reason] if no new bindings
Return [( {var1: val1, var2: val2,...}, reason), ...] 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
LabelledNode
Node
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.

Methods inherited from Fragment:
dereference(self, mode='', workingContext=None)
dereference an identifyer, finding the semantics of its schema if any
 
Returns None if it cannot be retreived.
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.
representation(self, base=None)
Optimize output if prefixes available
uriref(self)
uriref2(self, base)

Methods inherited from LabelledNode:
classOrder(self)
compareTerm(self, other)
Assume is also a LabelledNode - see function compareTerm in formula.py
flatten(self, sink, why=None)
reification(self, sink, bnodeMap={}, why=None)
Describe myself in RDF to the given context
 
[ reify:uri "http://example.org/whatever"]

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.
 
output as XML qnames [http://www.w3.org/TR/REC-xml-names/#NT-QName].
This could be beefed up to guarantee unambiguity.
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
compareAnyTerm(self, other)
Compare two langauge items
This is a cannoncial ordering in that is designed to allow
the same graph always to be printed in the same order.
This makes the regression tests possible.
The literals are deemed smaller than symbols, which are smaller
than formulae.  This puts the rules at the botom of a file where
they tend to take a lot of space anyway.
Formulae have to be compared as a function of their sorted contents.
 
@@ Anonymous nodes have to, within a given Formula, be compared as
a function of the sorted information about them in that context.
This is not done yet
debugString(self, already)
doesNodeAppear(self, symbol)
Does that node appear within this one
 
This non-overloaded function will simply return if I'm equal to him
occurringIn(self, vars)
substituteEquals(self, bindings, newRedirections)
Return this or a version of me with substitution made
substitution(self, bindings, why=None)
Return this or a version of me with subsitution made
unflatten(self, sink, bNodes, why=None)
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 [({}, reason] if no new bindings
Return [( {var1: val1, var2: val2,...}, reason), ...] 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
 
  Methods inherited from Term:
__init__(self, store)
__repr__(self)
This method only used for debugging output - it can be ambiguous,
as it is is deliberately short to make debug printout readable.
 
output as XML qnames [http://www.w3.org/TR/REC-xml-names/#NT-QName].
This could be beefed up to guarantee unambiguity.
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
compareAnyTerm(self, other)
Compare two langauge items
This is a cannoncial ordering in that is designed to allow
the same graph always to be printed in the same order.
This makes the regression tests possible.
The literals are deemed smaller than symbols, which are smaller
than formulae.  This puts the rules at the botom of a file where
they tend to take a lot of space anyway.
Formulae have to be compared as a function of their sorted contents.
 
@@ Anonymous nodes have to, within a given Formula, be compared as
a function of the sorted information about them in that context.
This is not done yet
debugString(self, already)
doesNodeAppear(self, symbol)
Does that node appear within this one
 
This non-overloaded function will simply return if I'm equal to him
generated(self)
Boolean Is this thing a genid - is its name arbitrary?
occurringIn(self, vars)
representation(self, base=None)
The string represnting this in N3
substituteEquals(self, bindings, newRedirections)
Return this or a version of me with substitution made
substitution(self, bindings, why=None)
Return this or a version of me with subsitution made
unflatten(self, sink, bNodes, why=None)
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 [({}, reason] if no new bindings
Return [( {var1: val1, var2: val2,...}, reason), ...] 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:
__getitem__(self, i)
__repr__(self)
classOrder(self)
newList(self, value)
occurringIn(self, vars)
substituteEquals(self, bindings, newBindings)
Return this or a version of me with substitution of equals made
substitution(self, bindings, why=None)
Return this or a version of me with substitution made
unify(self, other, vars, existentials, bindings)
Unify the substitution of this using bindings found so far
with the other.
This may contain variables, the other may contain existentials but not variables.
Return 0 if impossible.
Return [({}, None)] if no new bindings
Return [( {var1: val1, var2: val2, ...}, reason) ...] if match.
bindings is a dictionary.
uriref(self)
value(self)

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
doesNodeAppear(self, symbol)
Does that particular node appear anywhere in this list
 
This function is necessarily recursive, and is useful for the pretty printer
It will also be useful for the flattener, when we write it.
flatten(self, sink, why=None)
prepend(self, first)
reification(self, sink, bnodeMap={}, why=None)
Describe myself in RDF to the given context
 
[ reify:items ( [ reify:value "foo"]  .... ) ]
unflatten(self, sink, bNodes, why=None)

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
compareAnyTerm(self, other)
Compare two langauge items
This is a cannoncial ordering in that is designed to allow
the same graph always to be printed in the same order.
This makes the regression tests possible.
The literals are deemed smaller than symbols, which are smaller
than formulae.  This puts the rules at the botom of a file where
they tend to take a lot of space anyway.
Formulae have to be compared as a function of their sorted contents.
 
@@ Anonymous nodes have to, within a given Formula, be compared as
a function of the sorted information about them in that context.
This is not done yet
debugString(self, already)
generated(self)
Boolean Is this thing a genid - is its name arbitrary?
representation(self, base=None)
The string represnting this in N3

 
class FiniteProperty(BuiltIn, Function, ReverseFunction)
    A finite property has a finite set of pairs of (subj, object) values
 
The built-in finite property can ennumerate them all if necessary.
Argv is the only useful example I can think of right now.
 
 
Method resolution order:
FiniteProperty
BuiltIn
Fragment
LabelledNode
Node
Term
Function
ReverseFunction

Methods defined here:
enn(self)
Return list of pairs [(subj, obj)]
ennumerate(self)
eval(self, subj, obj, queue, bindings, proof, query)
This is of course   very inefficient except for really small ones like argv.
evalObj(self, subj, queue, bindings, proof, query)
This is of course   very inefficient except for really small ones like argv.
evalSubj(self, obj, queue, bindings, proof, query)
This is of course   very inefficient except for really small ones like argv.

Methods inherited from BuiltIn:
__init__(self, resource, fragid)

Methods inherited from Fragment:
dereference(self, mode='', workingContext=None)
dereference an identifyer, finding the semantics of its schema if any
 
Returns None if it cannot be retreived.
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.
representation(self, base=None)
Optimize output if prefixes available
uriref(self)
uriref2(self, base)

Methods inherited from LabelledNode:
classOrder(self)
compareTerm(self, other)
Assume is also a LabelledNode - see function compareTerm in formula.py
flatten(self, sink, why=None)
reification(self, sink, bnodeMap={}, why=None)
Describe myself in RDF to the given context
 
[ reify:uri "http://example.org/whatever"]

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.
 
output as XML qnames [http://www.w3.org/TR/REC-xml-names/#NT-QName].
This could be beefed up to guarantee unambiguity.
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
compareAnyTerm(self, other)
Compare two langauge items
This is a cannoncial ordering in that is designed to allow
the same graph always to be printed in the same order.
This makes the regression tests possible.
The literals are deemed smaller than symbols, which are smaller
than formulae.  This puts the rules at the botom of a file where
they tend to take a lot of space anyway.
Formulae have to be compared as a function of their sorted contents.
 
@@ Anonymous nodes have to, within a given Formula, be compared as
a function of the sorted information about them in that context.
This is not done yet
debugString(self, already)
doesNodeAppear(self, symbol)
Does that node appear within this one
 
This non-overloaded function will simply return if I'm equal to him
occurringIn(self, vars)
substituteEquals(self, bindings, newRedirections)
Return this or a version of me with substitution made
substitution(self, bindings, why=None)
Return this or a version of me with subsitution made
unflatten(self, sink, bNodes, why=None)
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 [({}, reason] if no new bindings
Return [( {var1: val1, var2: val2,...}, reason), ...] if match
value(self)
As a python value - by default, none exists, use self

 
class Fragment(LabelledNode)
    Term which DOES have a fragment id in its URI
 
 
Method resolution order:
Fragment
LabelledNode
Node
Term

Methods defined here:
__init__(self, resource, fragid)
dereference(self, mode='', workingContext=None)
dereference an identifyer, finding the semantics of its schema if any
 
Returns None if it cannot be retreived.
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.
representation(self, base=None)
Optimize output if prefixes available
uriref(self)
uriref2(self, base)

Methods inherited from LabelledNode:
classOrder(self)
compareTerm(self, other)
Assume is also a LabelledNode - see function compareTerm in formula.py
flatten(self, sink, why=None)
reification(self, sink, bnodeMap={}, why=None)
Describe myself in RDF to the given context
 
[ reify:uri "http://example.org/whatever"]

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.
 
output as XML qnames [http://www.w3.org/TR/REC-xml-names/#NT-QName].
This could be beefed up to guarantee unambiguity.
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
compareAnyTerm(self, other)
Compare two langauge items
This is a cannoncial ordering in that is designed to allow
the same graph always to be printed in the same order.
This makes the regression tests possible.
The literals are deemed smaller than symbols, which are smaller
than formulae.  This puts the rules at the botom of a file where
they tend to take a lot of space anyway.
Formulae have to be compared as a function of their sorted contents.
 
@@ Anonymous nodes have to, within a given Formula, be compared as
a function of the sorted information about them in that context.
This is not done yet
debugString(self, already)
doesNodeAppear(self, symbol)
Does that node appear within this one
 
This non-overloaded function will simply return if I'm equal to him
occurringIn(self, vars)
substituteEquals(self, bindings, newRedirections)
Return this or a version of me with substitution made
substitution(self, bindings, why=None)
Return this or a version of me with subsitution made
unflatten(self, sink, bNodes, why=None)
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 [({}, reason] if no new bindings
Return [( {var1: val1, var2: val2,...}, reason), ...] 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
LabelledNode
Node

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

Methods inherited from EmptyList:
__getitem__(self, i)
__repr__(self)
classOrder(self)
newList(self, value)
occurringIn(self, vars)
substituteEquals(self, bindings, newBindings)
Return this or a version of me with substitution of equals made
substitution(self, bindings, why=None)
Return this or a version of me with substitution made
unify(self, other, vars, existentials, bindings)
Unify the substitution of this using bindings found so far
with the other.
This may contain variables, the other may contain existentials but not variables.
Return 0 if impossible.
Return [({}, None)] if no new bindings
Return [( {var1: val1, var2: val2, ...}, reason) ...] if match.
bindings is a dictionary.
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
doesNodeAppear(self, symbol)
Does that particular node appear anywhere in this list
 
This function is necessarily recursive, and is useful for the pretty printer
It will also be useful for the flattener, when we write it.
flatten(self, sink, why=None)
prepend(self, first)
reification(self, sink, bnodeMap={}, why=None)
Describe myself in RDF to the given context
 
[ reify:items ( [ reify:value "foo"]  .... ) ]
unflatten(self, sink, bNodes, why=None)

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
compareAnyTerm(self, other)
Compare two langauge items
This is a cannoncial ordering in that is designed to allow
the same graph always to be printed in the same order.
This makes the regression tests possible.
The literals are deemed smaller than symbols, which are smaller
than formulae.  This puts the rules at the botom of a file where
they tend to take a lot of space anyway.
Formulae have to be compared as a function of their sorted contents.
 
@@ Anonymous nodes have to, within a given Formula, be compared as
a function of the sorted information about them in that context.
This is not done yet
debugString(self, already)
generated(self)
Boolean Is this thing a genid - is its name arbitrary?
representation(self, base=None)
The string represnting this in N3

Methods inherited from Fragment:
dereference(self, mode='', workingContext=None)
dereference an identifyer, finding the semantics of its schema if any
 
Returns None if it cannot be retreived.
uriref2(self, base)

Methods inherited from LabelledNode:
compareTerm(self, other)
Assume is also a LabelledNode - see function compareTerm in formula.py

 
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
LabelledNode
Node
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.

Methods inherited from Fragment:
dereference(self, mode='', workingContext=None)
dereference an identifyer, finding the semantics of its schema if any
 
Returns None if it cannot be retreived.
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.
representation(self, base=None)
Optimize output if prefixes available
uriref(self)
uriref2(self, base)

Methods inherited from LabelledNode:
classOrder(self)
compareTerm(self, other)
Assume is also a LabelledNode - see function compareTerm in formula.py
flatten(self, sink, why=None)
reification(self, sink, bnodeMap={}, why=None)
Describe myself in RDF to the given context
 
[ reify:uri "http://example.org/whatever"]

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.
 
output as XML qnames [http://www.w3.org/TR/REC-xml-names/#NT-QName].
This could be beefed up to guarantee unambiguity.
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
compareAnyTerm(self, other)
Compare two langauge items
This is a cannoncial ordering in that is designed to allow
the same graph always to be printed in the same order.
This makes the regression tests possible.
The literals are deemed smaller than symbols, which are smaller
than formulae.  This puts the rules at the botom of a file where
they tend to take a lot of space anyway.
Formulae have to be compared as a function of their sorted contents.
 
@@ Anonymous nodes have to, within a given Formula, be compared as
a function of the sorted information about them in that context.
This is not done yet
debugString(self, already)
doesNodeAppear(self, symbol)
Does that node appear within this one
 
This non-overloaded function will simply return if I'm equal to him
occurringIn(self, vars)
substituteEquals(self, bindings, newRedirections)
Return this or a version of me with substitution made
substitution(self, bindings, why=None)
Return this or a version of me with subsitution made
unflatten(self, sink, bNodes, why=None)
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 [({}, reason] if no new bindings
Return [( {var1: val1, var2: val2,...}, reason), ...] 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
LabelledNode
Node
Term

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:
dereference(self, mode='', workingContext=None)
dereference an identifyer, finding the semantics of its schema if any
 
Returns None if it cannot be retreived.
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.
representation(self, base=None)
Optimize output if prefixes available
uriref(self)
uriref2(self, base)

Methods inherited from LabelledNode:
classOrder(self)
compareTerm(self, other)
Assume is also a LabelledNode - see function compareTerm in formula.py
flatten(self, sink, why=None)
reification(self, sink, bnodeMap={}, why=None)
Describe myself in RDF to the given context
 
[ reify:uri "http://example.org/whatever"]

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.
 
output as XML qnames [http://www.w3.org/TR/REC-xml-names/#NT-QName].
This could be beefed up to guarantee unambiguity.
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
compareAnyTerm(self, other)
Compare two langauge items
This is a cannoncial ordering in that is designed to allow
the same graph always to be printed in the same order.
This makes the regression tests possible.
The literals are deemed smaller than symbols, which are smaller
than formulae.  This puts the rules at the botom of a file where
they tend to take a lot of space anyway.
Formulae have to be compared as a function of their sorted contents.
 
@@ Anonymous nodes have to, within a given Formula, be compared as
a function of the sorted information about them in that context.
This is not done yet
debugString(self, already)
doesNodeAppear(self, symbol)
Does that node appear within this one
 
This non-overloaded function will simply return if I'm equal to him
occurringIn(self, vars)
substituteEquals(self, bindings, newRedirections)
Return this or a version of me with substitution made
substitution(self, bindings, why=None)
Return this or a version of me with subsitution made
unflatten(self, sink, bNodes, why=None)
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 [({}, reason] if no new bindings
Return [( {var1: val1, var2: val2,...}, reason), ...] if match
value(self)
As a python value - by default, none exists, use self

 
class LabelledNode(Node)
    The labelled node is one which has a URI.
 
 
Method resolution order:
LabelledNode
Node
Term

Methods defined here:
classOrder(self)
compareTerm(self, other)
Assume is also a LabelledNode - see function compareTerm in formula.py
flatten(self, sink, why=None)
reification(self, sink, bnodeMap={}, why=None)
Describe myself in RDF to the given context
 
[ reify:uri "http://example.org/whatever"]

Methods inherited from Term:
__init__(self, store)
__repr__(self)
This method only used for debugging output - it can be ambiguous,
as it is is deliberately short to make debug printout readable.
 
output as XML qnames [http://www.w3.org/TR/REC-xml-names/#NT-QName].
This could be beefed up to guarantee unambiguity.
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
compareAnyTerm(self, other)
Compare two langauge items
This is a cannoncial ordering in that is designed to allow
the same graph always to be printed in the same order.
This makes the regression tests possible.
The literals are deemed smaller than symbols, which are smaller
than formulae.  This puts the rules at the botom of a file where
they tend to take a lot of space anyway.
Formulae have to be compared as a function of their sorted contents.
 
@@ Anonymous nodes have to, within a given Formula, be compared as
a function of the sorted information about them in that context.
This is not done yet
debugString(self, already)
doesNodeAppear(self, symbol)
Does that node appear within this one
 
This non-overloaded function will simply return if I'm equal to him
generated(self)
Boolean Is this thing a genid - is its name arbitrary?
occurringIn(self, vars)
representation(self, base=None)
The string represnting this in N3
substituteEquals(self, bindings, newRedirections)
Return this or a version of me with substitution made
substitution(self, bindings, why=None)
Return this or a version of me with subsitution made
unflatten(self, sink, bNodes, why=None)
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 [({}, reason] if no new bindings
Return [( {var1: val1, var2: val2,...}, reason), ...] if match
value(self)
As a python value - by default, none exists, use self

 
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
LabelledNode
Node
Term

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:
dereference(self, mode='', workingContext=None)
dereference an identifyer, finding the semantics of its schema if any
 
Returns None if it cannot be retreived.
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.
representation(self, base=None)
Optimize output if prefixes available
uriref(self)
uriref2(self, base)

Methods inherited from LabelledNode:
classOrder(self)
compareTerm(self, other)
Assume is also a LabelledNode - see function compareTerm in formula.py
flatten(self, sink, why=None)
reification(self, sink, bnodeMap={}, why=None)
Describe myself in RDF to the given context
 
[ reify:uri "http://example.org/whatever"]

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.
 
output as XML qnames [http://www.w3.org/TR/REC-xml-names/#NT-QName].
This could be beefed up to guarantee unambiguity.
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
compareAnyTerm(self, other)
Compare two langauge items
This is a cannoncial ordering in that is designed to allow
the same graph always to be printed in the same order.
This makes the regression tests possible.
The literals are deemed smaller than symbols, which are smaller
than formulae.  This puts the rules at the botom of a file where
they tend to take a lot of space anyway.
Formulae have to be compared as a function of their sorted contents.
 
@@ Anonymous nodes have to, within a given Formula, be compared as
a function of the sorted information about them in that context.
This is not done yet
debugString(self, already)
doesNodeAppear(self, symbol)
Does that node appear within this one
 
This non-overloaded function will simply return if I'm equal to him
occurringIn(self, vars)
substituteEquals(self, bindings, newRedirections)
Return this or a version of me with substitution made
substitution(self, bindings, why=None)
Return this or a version of me with subsitution made
unflatten(self, sink, bNodes, why=None)
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 [({}, reason] if no new bindings
Return [( {var1: val1, var2: val2,...}, reason), ...] 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
doesNodeAppear(self, symbol)
Does that particular node appear anywhere in this list
 
This function is necessarily recursive, and is useful for the pretty printer
It will also be useful for the flattener, when we write it.
flatten(self, sink, why=None)
occurringIn(self, vars)
Which variables in the list occur in this list?
prepend(self, first)
reification(self, sink, bnodeMap={}, why=None)
Describe myself in RDF to the given context
 
[ reify:items ( [ reify:value "foo"]  .... ) ]
substituteEquals(self, bindings, newBindings)
Return this or a version of me with substitution of equals made
substitution(self, bindings, why=None)
Return this or a version of me with variable substitution made
unflatten(self, sink, bNodes, why=None)
uriref(self)
value(self)

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.
 
output as XML qnames [http://www.w3.org/TR/REC-xml-names/#NT-QName].
This could be beefed up to guarantee unambiguity.
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
compareAnyTerm(self, other)
Compare two langauge items
This is a cannoncial ordering in that is designed to allow
the same graph always to be printed in the same order.
This makes the regression tests possible.
The literals are deemed smaller than symbols, which are smaller
than formulae.  This puts the rules at the botom of a file where
they tend to take a lot of space anyway.
Formulae have to be compared as a function of their sorted contents.
 
@@ Anonymous nodes have to, within a given Formula, be compared as
a function of the sorted information about them in that context.
This is not done yet
debugString(self, already)
generated(self)
Boolean Is this thing a genid - is its name arbitrary?
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 [({}, reason] if no new bindings
Return [( {var1: val1, var2: val2,...}, reason), ...] if match

 
class Literal(Term)
    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:
__decimal__(self)
__float__(self)
__init__(self, store, str, 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)
classOrder(self)
compareTerm(self, other)
Assume is also a literal - see function compareTerm in formula.py
flatten(self, sink, why=None)
occurringIn(self, vars)
reification(self, sink, bnodeMap={}, why=None)
Describe myself in RDF to the given context
 
[ reify:value "un expression quelconque"@fr ]
representation(self, base=None)
substituteEquals(self, bindings, newBindings)
Return this or a version of me with subsitution made
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)
Datatype conversion XSD to Python
 
RDF primitive datatypes are XML schema datatypes, in the XSD namespace.
see http://www.w3.org/TR/xmlschema-2

Methods inherited from Term:
compareAnyTerm(self, other)
Compare two langauge items
This is a cannoncial ordering in that is designed to allow
the same graph always to be printed in the same order.
This makes the regression tests possible.
The literals are deemed smaller than symbols, which are smaller
than formulae.  This puts the rules at the botom of a file where
they tend to take a lot of space anyway.
Formulae have to be compared as a function of their sorted contents.
 
@@ Anonymous nodes have to, within a given Formula, be compared as
a function of the sorted information about them in that context.
This is not done yet
debugString(self, already)
doesNodeAppear(self, symbol)
Does that node appear within this one
 
This non-overloaded function will simply return if I'm equal to him
generated(self)
Boolean Is this thing a genid - is its name arbitrary?
unflatten(self, sink, bNodes, why=None)

 
class Node(Term)
    A node in the graph
 
  Methods inherited from Term:
__init__(self, store)
__repr__(self)
This method only used for debugging output - it can be ambiguous,
as it is is deliberately short to make debug printout readable.
 
output as XML qnames [http://www.w3.org/TR/REC-xml-names/#NT-QName].
This could be beefed up to guarantee unambiguity.
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
compareAnyTerm(self, other)
Compare two langauge items
This is a cannoncial ordering in that is designed to allow
the same graph always to be printed in the same order.
This makes the regression tests possible.
The literals are deemed smaller than symbols, which are smaller
than formulae.  This puts the rules at the botom of a file where
they tend to take a lot of space anyway.
Formulae have to be compared as a function of their sorted contents.
 
@@ Anonymous nodes have to, within a given Formula, be compared as
a function of the sorted information about them in that context.
This is not done yet
debugString(self, already)
doesNodeAppear(self, symbol)
Does that node appear within this one
 
This non-overloaded function will simply return if I'm equal to him
generated(self)
Boolean Is this thing a genid - is its name arbitrary?
occurringIn(self, vars)
representation(self, base=None)
The string represnting this in N3
substituteEquals(self, bindings, newRedirections)
Return this or a version of me with substitution made
substitution(self, bindings, why=None)
Return this or a version of me with subsitution made
unflatten(self, sink, bNodes, why=None)
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 [({}, reason] if no new bindings
Return [( {var1: val1, var2: val2,...}, reason), ...] if match
value(self)
As a python value - by default, none exists, use self

 
class NonEmptyList(List)
    
Method resolution order:
NonEmptyList
List
CompoundTerm
Term

Methods defined here:
__getitem__(self, i)
classOrder(self)
compareTerm(self, other)
Assume is also a NonEmptyList - see function compareTerm in formula.py
debugString(self, already)
unify(self, other, vars, existentials, bindings)
See Term.unify()

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
doesNodeAppear(self, symbol)
Does that particular node appear anywhere in this list
 
This function is necessarily recursive, and is useful for the pretty printer
It will also be useful for the flattener, when we write it.
flatten(self, sink, why=None)
occurringIn(self, vars)
Which variables in the list occur in this list?
prepend(self, first)
reification(self, sink, bnodeMap={}, why=None)
Describe myself in RDF to the given context
 
[ reify:items ( [ reify:value "foo"]  .... ) ]
substituteEquals(self, bindings, newBindings)
Return this or a version of me with substitution of equals made
substitution(self, bindings, why=None)
Return this or a version of me with variable substitution made
unflatten(self, sink, bNodes, why=None)
uriref(self)
value(self)

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.
 
output as XML qnames [http://www.w3.org/TR/REC-xml-names/#NT-QName].
This could be beefed up to guarantee unambiguity.
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
compareAnyTerm(self, other)
Compare two langauge items
This is a cannoncial ordering in that is designed to allow
the same graph always to be printed in the same order.
This makes the regression tests possible.
The literals are deemed smaller than symbols, which are smaller
than formulae.  This puts the rules at the botom of a file where
they tend to take a lot of space anyway.
Formulae have to be compared as a function of their sorted contents.
 
@@ Anonymous nodes have to, within a given Formula, be compared as
a function of the sorted information about them in that context.
This is not done yet
generated(self)
Boolean Is this thing a genid - is its name arbitrary?
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
LabelledNode
Node
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

Methods inherited from Fragment:
dereference(self, mode='', workingContext=None)
dereference an identifyer, finding the semantics of its schema if any
 
Returns None if it cannot be retreived.
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.
representation(self, base=None)
Optimize output if prefixes available
uriref(self)
uriref2(self, base)

Methods inherited from LabelledNode:
classOrder(self)
compareTerm(self, other)
Assume is also a LabelledNode - see function compareTerm in formula.py
flatten(self, sink, why=None)
reification(self, sink, bnodeMap={}, why=None)
Describe myself in RDF to the given context
 
[ reify:uri "http://example.org/whatever"]

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.
 
output as XML qnames [http://www.w3.org/TR/REC-xml-names/#NT-QName].
This could be beefed up to guarantee unambiguity.
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
compareAnyTerm(self, other)
Compare two langauge items
This is a cannoncial ordering in that is designed to allow
the same graph always to be printed in the same order.
This makes the regression tests possible.
The literals are deemed smaller than symbols, which are smaller
than formulae.  This puts the rules at the botom of a file where
they tend to take a lot of space anyway.
Formulae have to be compared as a function of their sorted contents.
 
@@ Anonymous nodes have to, within a given Formula, be compared as
a function of the sorted information about them in that context.
This is not done yet
debugString(self, already)
doesNodeAppear(self, symbol)
Does that node appear within this one
 
This non-overloaded function will simply return if I'm equal to him
occurringIn(self, vars)
substituteEquals(self, bindings, newRedirections)
Return this or a version of me with substitution made
substitution(self, bindings, why=None)
Return this or a version of me with subsitution made
unflatten(self, sink, bNodes, why=None)
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 [({}, reason] if no new bindings
Return [( {var1: val1, var2: val2,...}, reason), ...] if match
value(self)
As a python value - by default, none exists, use self

 
class Symbol(LabelledNode)
    Term which has no fragment
 
 
Method resolution order:
Symbol
LabelledNode
Node
Term

Methods defined here:
__getitem__(self, lname)
get the lname Symbol in this namespace.
 
lname -- an XML name (limited to URI characters)
__init__(self, uri, store)
dereference(self, mode='', workingContext=None)
dereference an identifier, finding the semantics of its schema if any
 
Returns None if it cannot be retreived.
internFrag(self, fragid, thetype)
uriref(self)
uriref2(self, base)

Methods inherited from LabelledNode:
classOrder(self)
compareTerm(self, other)
Assume is also a LabelledNode - see function compareTerm in formula.py
flatten(self, sink, why=None)
reification(self, sink, bnodeMap={}, why=None)
Describe myself in RDF to the given context
 
[ reify:uri "http://example.org/whatever"]

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.
 
output as XML qnames [http://www.w3.org/TR/REC-xml-names/#NT-QName].
This could be beefed up to guarantee unambiguity.
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
compareAnyTerm(self, other)
Compare two langauge items
This is a cannoncial ordering in that is designed to allow
the same graph always to be printed in the same order.
This makes the regression tests possible.
The literals are deemed smaller than symbols, which are smaller
than formulae.  This puts the rules at the botom of a file where
they tend to take a lot of space anyway.
Formulae have to be compared as a function of their sorted contents.
 
@@ Anonymous nodes have to, within a given Formula, be compared as
a function of the sorted information about them in that context.
This is not done yet
debugString(self, already)
doesNodeAppear(self, symbol)
Does that node appear within this one
 
This non-overloaded function will simply return if I'm equal to him
generated(self)
Boolean Is this thing a genid - is its name arbitrary?
occurringIn(self, vars)
representation(self, base=None)
The string represnting this in N3
substituteEquals(self, bindings, newRedirections)
Return this or a version of me with substitution made
substitution(self, bindings, why=None)
Return this or a version of me with subsitution made
unflatten(self, sink, bNodes, why=None)
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 [({}, reason] if no new bindings
Return [( {var1: val1, var2: val2,...}, reason), ...] 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.
Every term has a pointer back to its store.
 
  Methods defined here:
__init__(self, store)
__repr__(self)
This method only used for debugging output - it can be ambiguous,
as it is is deliberately short to make debug printout readable.
 
output as XML qnames [http://www.w3.org/TR/REC-xml-names/#NT-QName].
This could be beefed up to guarantee unambiguity.
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
compareAnyTerm(self, other)
Compare two langauge items
This is a cannoncial ordering in that is designed to allow
the same graph always to be printed in the same order.
This makes the regression tests possible.
The literals are deemed smaller than symbols, which are smaller
than formulae.  This puts the rules at the botom of a file where
they tend to take a lot of space anyway.
Formulae have to be compared as a function of their sorted contents.
 
@@ Anonymous nodes have to, within a given Formula, be compared as
a function of the sorted information about them in that context.
This is not done yet
debugString(self, already)
doesNodeAppear(self, symbol)
Does that node appear within this one
 
This non-overloaded function will simply return if I'm equal to him
generated(self)
Boolean Is this thing a genid - is its name arbitrary?
occurringIn(self, vars)
representation(self, base=None)
The string represnting this in N3
substituteEquals(self, bindings, newRedirections)
Return this or a version of me with substitution made
substitution(self, bindings, why=None)
Return this or a version of me with subsitution made
unflatten(self, sink, bNodes, why=None)
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 [({}, reason] if no new bindings
Return [( {var1: val1, var2: val2,...}, reason), ...] if match
value(self)
As a python value - by default, none exists, use self

 
Functions
       
uri_encode(str)
untested - this must be in a standard library somewhere

 
Data
        ALL4 = (0, 1, 2, 3)
ANONYMOUS = 3
CONTEXT = 0
FORMULA = 1
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
RDF_type_URI = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type'
REIFY_NS = 'http://www.w3.org/2004/06/rei#'
SUBJ = 2
SYMBOL = 0
generators = _Feature((2, 2, 0, 'alpha', 1), (2, 3, 0, 'final', 0), 4096)
nextId = 0
typeMap = {'ENTITIES': <type 'str'>, 'ENTITY': <type 'str'>, 'ID': <type 'str'>, 'IDREF': <type 'str'>, 'IDREFS': <type 'str'>, 'NCNAME': <type 'str'>, 'NMTOKEN': <type 'str'>, 'NMTOKENS': <type 'str'>, 'NOTATION': <type 'str'>, 'Name': <type 'str'>, ...}