How to use the checklist.minim_graph.Minim_graph function in checklist

To help you get started, we’ve selected a few checklist examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wf4ever / ro-manager / src / checklist / mkminim.py View on Github external
def mkminim(grid, baseuri=None):
    """
    Generate minim graph from supplied grid

    Returns (status,mgr) where mgr is RDF graph containing minim description,
    or None.
    """
    # Decode the grid
    try:
        (d,(r,c)) = checklist_template.checklist.match(grid, 0, 0)
    except Exception, e:
        print "Failed to parse minim table %s"%(e)
        return (2,None)
    # Create RDF graph and initialize Minim graph creation
    mgr = Minim_graph(base=baseuri)
    # Add prefixes to graph
    for pre in d["prefixes"]:
        mgr.prefix(pre, d["prefixes"][pre])
    # Add checklists to graph
    for cl in d["checklists"]:
        mgr.checklist(purpose=cl["purpose"], model=cl["model"], target=cl["target_urit"])
    # Add models to graph
    for cm in d["models"]:
        mgr.model(cm["modelid"],
            [ mgr.item(seq=mi["seq"], level=mi["level"], ruleid=mi["reqid"])
                for mi in cm["items"]
            ])
    # Add requirement rules to graph
    for rq in d["requirements"]:
        if "foreach" in rq:
            # ForEach ...