2. Data flow types in Provemod - rayhan-ferdous/ProvMod GitHub Wiki

There are several types of flow in this model. The generic type is Data. Using Data, 3 other types are created through inheritance. Details below.

Object type

The Object carries an intermediate value (e.g. an int, float, list, string etc.)

Working with Object

# val is a integer value
val = 111222333

# d1 is a data-flow carrying val
d1 = pm.Object(val)

# to see what is inside d1
print d1.ref

File type

The File carries a file as a dataflow.

Working with File

# read a saved file
f = open('article.txt')

# d2 is a data-flow carrying f
d2 = pm.File(f)

# using d2 to get the file
flow = d2.ref

# use data-flow to show file content
print flow.read()

Document type

This type carries CouchDB document lookup reference.

Working with Document type

# db is an existing database
couch = couchdb.Server()
db = couch['mydb']
# getting a document against a key
doc = db['e0658cab843b59e63c8779a9a5000b01']

# creating a data-flow carrying a document
d3 = pm.Document(doc)

# showing what is inside d3
print d3.ref