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

Functions to reify and dereify a graph.
These functions should be perfect inverses of each other.
 
The strategy used is different from that of the reifier
in notation3.py, that tries to reify what it outputs.
This simply puts the reification into the sink given,
or a new one, depending on the function called.
$Id: reify.html,v 1.4 2007/12/16 01:06:11 syosi Exp $

 
Modules
       
diag
uripath

 
Functions
       
dereification(x, f, sink, bnodes={}, xList=[])
dereify(formula, sink=None, xList=[])
#### Alternative method
# Shortcuts are too messy and don't work with lists
flatten(formula)
Flatten a formula
 
This will minimally change a formula to make it valid RDF
flattening a flattened formula should thus be the unity
reify(formula)
Reify a formula
 
Returns an RDF formula with the same semantics
as the given formula
unflatten(formula, sink=None)
Undo the effects of the flatten function.
 
Note that this still requires helper methods scattered throughout the
Term heriarchy. 
 
Our life is made much more difficult by the necessity of removing all
triples that have been dereified --- this required a modification to dereification()

 
Data
        ALL4 = (0, 1, 2, 3)
CONTEXT = 0
Mixin = <mixin.mixinClass object>
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
owlOneOf = 'http://www.w3.org/2002/07/owl#oneOf'
rAnonymousNode = <mixin.mixinClass object>
rFormula = <mixin.mixinClass object>
rLabelledNode = <mixin.mixinClass object>
rList = <mixin.mixinClass object>
rLiteral = <mixin.mixinClass object>
rN3Set = <mixin.mixinClass object>
rTerm = <mixin.mixinClass object>
reifyNS = 'http://www.w3.org/2004/06/rei#'