Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Checked: Contracting

Authors
Affiliations
Dynamical Systems Group
Humane Intelligence

This page runs the checks that the Checked block of the Contracting chapter claims: fourteen S-shapes over the measles evaluation, three M-shapes over the model graph, and the counterexamples that must fail. A reader need not take the chapter’s word for it. Every line of output below is produced by the code above it, the gate re-executes this notebook and fails if the committed outputs differ, and each claim is an assert that stops the notebook when it does not hold.

import sys; sys.path[:0] = ["notebooks", "."]  # the shared module lives beside this notebook
import checked

# The shapes the chapter's Checked block names, by file.
RECORD_SHAPES = ["S0-Record", "S0-Member", "S0-Parties", "S0-Roles", "S0-Independence", "S0-Access", "S0-Population", "S0-StatementOfWork", "S0-Mission", "S0-Need", "S0-Proposal", "S0-Layers", "S8-Delivery", "S9-Acceptance"]
MODEL_SHAPES = ["M1-Parties", "M1-Obligation", "M5-Cardinality"]

1The record conforms

The record is track/measles-evaluation.ttl with the EPO vocabulary and the model graph, loaded as the test suite loads it: one default graph, since the shapes derive an item’s step through the model (sheet 10-33). The shapes graph holds exactly the fourteen named shapes copied from shapes/epo.shapes.ttl; a name that is not a shape in that file raises an error, so a misnamed claim cannot pass silently.

record = checked.record()
S = checked.shapes("shapes/epo.shapes.ttl", RECORD_SHAPES)
conforms, fired = checked.report("track/measles-evaluation.ttl", record, S)
assert conforms and not fired
checked.passed("the measles evaluation conforms to the fourteen S-shapes the chapter names")
track/measles-evaluation.ttl: conforms = True
  S0-Access            pass
  S0-Independence      pass
  S0-Layers            pass
  S0-Member            pass
  S0-Mission           pass
  S0-Need              pass
  S0-Parties           pass
  S0-Population        pass
  S0-Proposal          pass
  S0-Record            pass
  S0-Roles             pass
  S0-StatementOfWork   pass
  S8-Delivery          pass
  S9-Acceptance        pass
ok: the measles evaluation conforms to the fourteen S-shapes the chapter names

2A requirement set before the agreement

The chapter says a requirement set declared before the agreement was signed fails the layer rule, S0-Layers. The counterexample is counterexamples/requirements-before-agreement.ttl, run against the same fourteen shapes. S0-Parties fires as well: it carries its own ordering constraint, that the agreement precedes the requirement set (R-21), and the layer rule (R-32) generalises it to every pinned item.

cx = checked.counterexample("requirements-before-agreement.ttl")
conforms, fired = checked.report("counterexamples/requirements-before-agreement.ttl", cx, S)
assert not conforms and "S0-Layers" in fired
checked.passed("requirements-before-agreement.ttl does not conform and fails S0-Layers")
counterexamples/requirements-before-agreement.ttl: conforms = False
  S0-Access            pass
  S0-Independence      pass
  S0-Layers            FAIL
  S0-Member            pass
  S0-Mission           pass
  S0-Need              pass
  S0-Parties           FAIL
  S0-Population        pass
  S0-Proposal          pass
  S0-Record            pass
  S0-Roles             pass
  S0-StatementOfWork   pass
  S8-Delivery          pass
  S9-Acceptance        pass
  S0-Layers at ev:service-agreement:
    S0 two layers (R-32): every item of the record pinned at the contract is generated no later than the requirement set, and every item pinned within the evaluation no earlier than the agreement.
  S0-Parties at ev:service-agreement:
    S0: the agreement precedes the requirement set: requirements are agreed under the contract, not before it (R-21).
ok: requirements-before-agreement.ttl does not conform and fails S0-Layers

3A population neither interviewed nor represented

counterexamples/population-unrepresented.ttl is the measles evaluation with the county residents’ representation removed: an affected population nobody speaks for. It must fail S0-Population and nothing else among the fourteen.

cx = checked.counterexample("population-unrepresented.ttl")
conforms, fired = checked.report("counterexamples/population-unrepresented.ttl", cx, S)
assert not conforms and set(fired) == {"S0-Population"}
checked.passed("population-unrepresented.ttl does not conform and fails S0-Population only")
counterexamples/population-unrepresented.ttl: conforms = False
  S0-Access            pass
  S0-Independence      pass
  S0-Layers            pass
  S0-Member            pass
  S0-Mission           pass
  S0-Need              pass
  S0-Parties           pass
  S0-Population        FAIL
  S0-Proposal          pass
  S0-Record            pass
  S0-Roles             pass
  S0-StatementOfWork   pass
  S8-Delivery          pass
  S9-Acceptance        pass
  S0-Population at ev:county-residents:
    S0: every affected population is spoken for: a stakeholder representation attributed to the person who speaks for it (epo:representedBy); where the statement of work decided an interview, a stakeholder input attributed to the population exists, the representation derives from it, and the population names who engaged it (epo:responsibleParty, its own property, no longer implied by epo:representedBy; round four, KG 14) (R-21, R-40, R-49 series wiring; sheet 10-13).
ok: population-unrepresented.ttl does not conform and fails S0-Population only

4A member without the record’s tag

counterexamples/member-untagged.ttl is the measles evaluation with the synthetic tag struck from one probe while the record stays tagged: a member’s tag equals its record’s (sheet 10-43). It must fail S0-Member and nothing else among the fourteen.

cx = checked.counterexample("member-untagged.ttl")
conforms, fired = checked.report("counterexamples/member-untagged.ttl", cx, S)
assert not conforms and set(fired) == {"S0-Member"}
checked.passed("member-untagged.ttl does not conform and fails S0-Member only")
counterexamples/member-untagged.ttl: conforms = False
  S0-Access            pass
  S0-Independence      pass
  S0-Layers            pass
  S0-Member            FAIL
  S0-Mission           pass
  S0-Need              pass
  S0-Parties           pass
  S0-Population        pass
  S0-Proposal          pass
  S0-Record            pass
  S0-Roles             pass
  S0-StatementOfWork   pass
  S8-Delivery          pass
  S9-Acceptance        pass
  S0-Member at ev:probe-1:
    S0: a member's synthetic tag equals its record's (sheet 10-43; round four, KG 9): a synthetic record has no untagged member, and a member tagged synthetic sits in a record tagged so.
ok: member-untagged.ttl does not conform and fails S0-Member only

A population the statement of work said would be interviewed, but the record only represents (ruling R-40): the decision was made, the evaluation did not realize it.

cx = checked.counterexample("engagement-mismatch.ttl")
conforms, fired = checked.report("counterexamples/engagement-mismatch.ttl", cx, S)
assert not conforms and set(fired) == {"S0-Population"}
checked.passed("engagement-mismatch.ttl does not conform and fails S0-Population only")
counterexamples/engagement-mismatch.ttl: conforms = False
  S0-Access            pass
  S0-Independence      pass
  S0-Layers            pass
  S0-Member            pass
  S0-Mission           pass
  S0-Need              pass
  S0-Parties           pass
  S0-Population        FAIL
  S0-Proposal          pass
  S0-Record            pass
  S0-Roles             pass
  S0-StatementOfWork   pass
  S8-Delivery          pass
  S9-Acceptance        pass
  S0-Population at ev:county-residents:
    S0: every affected population is spoken for: a stakeholder representation attributed to the person who speaks for it (epo:representedBy); where the statement of work decided an interview, a stakeholder input attributed to the population exists, the representation derives from it, and the population names who engaged it (epo:responsibleParty, its own property, no longer implied by epo:representedBy; round four, KG 14) (R-21, R-40, R-49 series wiring; sheet 10-13).
ok: engagement-mismatch.ttl does not conform and fails S0-Population only

5One person, two roles

Sheet 10-13: a person holds at most one of the person roles. In counterexamples/one-person-team.ttl Annie holds the domain expert role and the evaluation operator role at once. It must fail S0-Roles and nothing else among the fourteen.

cx = checked.counterexample("one-person-team.ttl")
conforms, fired = checked.report("counterexamples/one-person-team.ttl", cx, S)
assert not conforms and set(fired) == {"S0-Roles"}
checked.passed("one-person-team.ttl fails S0-Roles and no other of the fourteen")
counterexamples/one-person-team.ttl: conforms = False
  S0-Access            pass
  S0-Independence      pass
  S0-Layers            pass
  S0-Member            pass
  S0-Mission           pass
  S0-Need              pass
  S0-Parties           pass
  S0-Population        pass
  S0-Proposal          pass
  S0-Record            pass
  S0-Roles             FAIL
  S0-StatementOfWork   pass
  S8-Delivery          pass
  S9-Acceptance        pass
  S0-Roles at ev:annie:
    S0: a person holds at most one of the person roles: domain expert, evaluation operator, authorized representative, sponsor signatory (sheet 10-13; the disjointness axioms are on the role classes and do not reach persons).
ok: one-person-team.ttl fails S0-Roles and no other of the fourteen

6An independence nobody declared

Sheet 10-07: the testing organization’s independence of the test item provider is declared, dated and attributed, not assumed. counterexamples/independence-undeclared.ttl drops the declaration. It must fail S0-Parties and nothing else among the fourteen.

cx = checked.counterexample("independence-undeclared.ttl")
conforms, fired = checked.report("counterexamples/independence-undeclared.ttl", cx, S)
assert not conforms and set(fired) == {"S0-Parties"}
checked.passed("independence-undeclared.ttl fails S0-Parties and no other of the fourteen")
counterexamples/independence-undeclared.ttl: conforms = False
  S0-Access            pass
  S0-Independence      pass
  S0-Layers            pass
  S0-Member            pass
  S0-Mission           pass
  S0-Need              pass
  S0-Parties           FAIL
  S0-Population        pass
  S0-Proposal          pass
  S0-Record            pass
  S0-Roles             pass
  S0-StatementOfWork   pass
  S8-Delivery          pass
  S9-Acceptance        pass
  S0-Parties at ev:service-agreement:
    S0: the testing organization's independence is declared, not assumed (sheet 10-07): an independence declaration in the record, attributed to the authorized representative and dated, names the test item provider it is independent of; a testing organization that holds the test item provider's role declares no such independence.
ok: independence-undeclared.ttl fails S0-Parties and no other of the fourteen

7An acceptance by the organization

Sheet 10-06: where the sponsor signs, a named person signs for it. In counterexamples/acceptance-by-organization.ttl the acceptance is attributed to the county public-health office rather than to its signatory. It must fail S9-Acceptance and nothing else among the fourteen.

cx = checked.counterexample("acceptance-by-organization.ttl")
conforms, fired = checked.report("counterexamples/acceptance-by-organization.ttl", cx, S)
assert not conforms and set(fired) == {"S9-Acceptance"}
checked.passed("acceptance-by-organization.ttl fails S9-Acceptance and no other of the fourteen")
counterexamples/acceptance-by-organization.ttl: conforms = False
  S0-Access            pass
  S0-Independence      pass
  S0-Layers            pass
  S0-Member            pass
  S0-Mission           pass
  S0-Need              pass
  S0-Parties           pass
  S0-Population        pass
  S0-Proposal          pass
  S0-Record            pass
  S0-Roles             pass
  S0-StatementOfWork   pass
  S8-Delivery          pass
  S9-Acceptance        FAIL
  S9-Acceptance at ev:acceptance-1:
    S9: the acceptance is the sponsor's signatory's act on behalf of the sponsor, follows the delivery it accepts, and is an item of the accept step (the step is derived through the model graph, sheet 10-33).
ok: acceptance-by-organization.ttl fails S9-Acceptance and no other of the fourteen

8Seven more faults of the contract layer

The remaining record faults of sheet 10 and one from drift pass 4, each the measles evaluation with one change, written by scripts/render_counterexamples.py with the fault in its header (sheet 10-19). The files under counterexamples/ and the shape each must fail among the fourteen here, as tests/test_shacl.py pins them:

The faultFileMust fail
both determinations on a criterion by the operator who ran the sessions (sheet 10-15)operator-determines-alone.ttlS0-Independence
an access grant with no period (sheet 10-04)access-without-period.ttlS0-Access
a record with no independence level (sheet 10-15)record-without-level.ttlS0-Record
a provider fact that contradicts the role (sheet 10-09)provider-fact-contradicted.ttlS0-Parties
a statement of work dated after its agreement (sheet 10-05)statement-of-work-after-agreement.ttlS0-StatementOfWork
an item outside every record (sheet 10-31)item-outside-record.ttlS0-Member
a sponsor that is the test item’s customer and denies a user interest (sheet 10-07; drift pass 4)user-interest-denied.ttlS0-Parties

Each is run against the same fourteen shapes. The assert in each cell says that the file does not conform, that the named shape fires, and that no other of the fourteen does.

cx = checked.counterexample("operator-determines-alone.ttl")
conforms, fired = checked.report("counterexamples/operator-determines-alone.ttl", cx, S)
assert not conforms and set(fired) == {"S0-Independence"}
checked.passed("operator-determines-alone.ttl fails S0-Independence and no other of the fourteen")
counterexamples/operator-determines-alone.ttl: conforms = False
  S0-Access            pass
  S0-Independence      FAIL
  S0-Layers            pass
  S0-Member            pass
  S0-Mission           pass
  S0-Need              pass
  S0-Parties           pass
  S0-Population        pass
  S0-Proposal          pass
  S0-Record            pass
  S0-Roles             pass
  S0-StatementOfWork   pass
  S8-Delivery          pass
  S9-Acceptance        pass
  S0-Independence at ev:record:
    S0 independence at the person level (sheet 10-15): the person who determines on evidence is not the operator of the session that evidence came from, unless a second determination on the same evidence by another person exists.
ok: operator-determines-alone.ttl fails S0-Independence and no other of the fourteen
cx = checked.counterexample("access-without-period.ttl")
conforms, fired = checked.report("counterexamples/access-without-period.ttl", cx, S)
assert not conforms and set(fired) == {"S0-Access"}
checked.passed("access-without-period.ttl fails S0-Access and no other of the fourteen")
counterexamples/access-without-period.ttl: conforms = False
  S0-Access            FAIL
  S0-Independence      pass
  S0-Layers            pass
  S0-Member            pass
  S0-Mission           pass
  S0-Need              pass
  S0-Parties           pass
  S0-Population        pass
  S0-Proposal          pass
  S0-Record            pass
  S0-Roles             pass
  S0-StatementOfWork   pass
  S8-Delivery          pass
  S9-Acceptance        pass
  S0-Access at ev:test-item-access:
    Access states its period: from when (sheet 10-04).
  S0-Access at ev:test-item-access:
    Access states its period: until when (sheet 10-04).
ok: access-without-period.ttl fails S0-Access and no other of the fourteen
cx = checked.counterexample("record-without-level.ttl")
conforms, fired = checked.report("counterexamples/record-without-level.ttl", cx, S)
assert not conforms and set(fired) == {"S0-Record"}
checked.passed("record-without-level.ttl fails S0-Record and no other of the fourteen")
counterexamples/record-without-level.ttl: conforms = False
  S0-Access            pass
  S0-Independence      pass
  S0-Layers            pass
  S0-Member            pass
  S0-Mission           pass
  S0-Need              pass
  S0-Parties           pass
  S0-Population        pass
  S0-Proposal          pass
  S0-Record            FAIL
  S0-Roles             pass
  S0-StatementOfWork   pass
  S8-Delivery          pass
  S9-Acceptance        pass
  S0-Record at ev:record:
    The record states the level at which independence between the roles is required: person, department or organization (sheet 10-15).
ok: record-without-level.ttl fails S0-Record and no other of the fourteen
cx = checked.counterexample("provider-fact-contradicted.ttl")
conforms, fired = checked.report("counterexamples/provider-fact-contradicted.ttl", cx, S)
assert not conforms and set(fired) == {"S0-Parties"}
checked.passed("provider-fact-contradicted.ttl fails S0-Parties and no other of the fourteen")
counterexamples/provider-fact-contradicted.ttl: conforms = False
  S0-Access            pass
  S0-Independence      pass
  S0-Layers            pass
  S0-Member            pass
  S0-Mission           pass
  S0-Need              pass
  S0-Parties           FAIL
  S0-Population        pass
  S0-Proposal          pass
  S0-Record            pass
  S0-Roles             pass
  S0-StatementOfWork   pass
  S8-Delivery          pass
  S9-Acceptance        pass
  S0-Parties at ev:service-agreement:
    S0: the provider fact agrees with the roles (sheet 10-09): the organization that says it provides the test item holds the test item provider's role and the one that holds the role says so; a sponsor that says it does not provide it does not hold the role.
ok: provider-fact-contradicted.ttl fails S0-Parties and no other of the fourteen
cx = checked.counterexample("statement-of-work-after-agreement.ttl")
conforms, fired = checked.report("counterexamples/statement-of-work-after-agreement.ttl", cx, S)
assert not conforms and set(fired) == {"S0-StatementOfWork"}
checked.passed("statement-of-work-after-agreement.ttl fails S0-StatementOfWork and no other of the fourteen")
counterexamples/statement-of-work-after-agreement.ttl: conforms = False
  S0-Access            pass
  S0-Independence      pass
  S0-Layers            pass
  S0-Member            pass
  S0-Mission           pass
  S0-Need              pass
  S0-Parties           pass
  S0-Population        pass
  S0-Proposal          pass
  S0-Record            pass
  S0-Roles             pass
  S0-StatementOfWork   FAIL
  S8-Delivery          pass
  S9-Acceptance        pass
  S0-StatementOfWork at ev:statement-of-work:
    S0: the statement of work is the sponsor's decision (R-40), dated no later than the agreement it is under (sheet 10-05).
ok: statement-of-work-after-agreement.ttl fails S0-StatementOfWork and no other of the fourteen
cx = checked.counterexample("item-outside-record.ttl")
conforms, fired = checked.report("counterexamples/item-outside-record.ttl", cx, S)
assert not conforms and set(fired) == {"S0-Member"}
checked.passed("item-outside-record.ttl fails S0-Member and no other of the fourteen")
counterexamples/item-outside-record.ttl: conforms = False
  S0-Access            pass
  S0-Independence      pass
  S0-Layers            pass
  S0-Member            FAIL
  S0-Mission           pass
  S0-Need              pass
  S0-Parties           pass
  S0-Population        pass
  S0-Proposal          pass
  S0-Record            pass
  S0-Roles             pass
  S0-StatementOfWork   pass
  S8-Delivery          pass
  S9-Acceptance        pass
  S0-Member at ev:probe-1:
    S0: every entity, activity and agent of a record is a member of exactly one record, a prov:Bundle, through ogc:inRecord (sheet 10-31): an item outside every record would escape the constraints anchored on it.
ok: item-outside-record.ttl fails S0-Member and no other of the fourteen
cx = checked.counterexample("user-interest-denied.ttl")
conforms, fired = checked.report("counterexamples/user-interest-denied.ttl", cx, S)
assert not conforms and set(fired) == {"S0-Parties"}
checked.passed("user-interest-denied.ttl fails S0-Parties and no other of the fourteen")
counterexamples/user-interest-denied.ttl: conforms = False
  S0-Access            pass
  S0-Independence      pass
  S0-Layers            pass
  S0-Member            pass
  S0-Mission           pass
  S0-Need              pass
  S0-Parties           FAIL
  S0-Population        pass
  S0-Proposal          pass
  S0-Record            pass
  S0-Roles             pass
  S0-StatementOfWork   pass
  S8-Delivery          pass
  S9-Acceptance        pass
  S0-Parties at ev:service-agreement:
    S0: the user-interest declaration agrees with the roles (sheet 10-07; drift pass 4, contracting officer 12): a sponsor that holds the test item customer role, receiving the test item it commissions the evaluation of, declares a user interest, not its absence (ISO/IEC 17000 4.4).
ok: user-interest-denied.ttl fails S0-Parties and no other of the fourteen

9The model graph conforms

The model graph is model/og-caie.model.ttl, the pruned RDF rendering of the SysML source (R-22). The three named M-shapes are copied from shapes/model.shapes.ttl.

model = checked.model_graph()
M = checked.shapes("shapes/model.shapes.ttl", MODEL_SHAPES)
conforms, fired = checked.report("model/og-caie.model.ttl", model, M)
assert conforms and not fired
checked.passed("the model graph conforms to the three M-shapes the chapter names")
model/og-caie.model.ttl: conforms = True
  M1-Obligation        pass
  M1-Parties           pass
  M5-Cardinality       pass
ok: the model graph conforms to the three M-shapes the chapter names

10A model with no obligation

counterexamples/model/no-obligation.sysml names a sponsor and affected populations but relates them by nothing, and its mission regards no population. It is built to RDF through the same pipeline as the canonical graph (the pinned OpenSysML converter, then scripts/prune_model.py), and must fail M1-Obligation. The package is minimal, so its testing organization declares no authorized representative and M5-Cardinality fires too; the claim is about M1-Obligation, and the assert says exactly that.

cx = checked.model_counterexample("no-obligation.sysml")
conforms, fired = checked.report("counterexamples/model/no-obligation.sysml", cx, M)
assert not conforms and "M1-Obligation" in fired
checked.passed("no-obligation.sysml does not conform and fails M1-Obligation")
counterexamples/model/no-obligation.sysml: conforms = False
  M1-Obligation        FAIL
  M1-Parties           pass
  M5-Cardinality       FAIL
  M1-Obligation at elmt:NoObligation__Mission:
    The mission regards one or more affected populations: the Mission item owns a reference part typed AffectedPopulation with lower bound one (R-37, R-38).
  M1-Obligation at elmt:NoObligation__OgCaieEvaluation:
    The assembly relates the sponsor to the affected populations by an obligation: a connection usage typed Obligation whose ends are the sponsor part and the affected part, a relation that carries no item (R-38).
  M5-Cardinality at elmt:NoObligation__SponsorOrganization:
    The sponsor organization holds exactly one signatory (SponsorSignatory), the named person who signs, approves the requirement set and accepts on its behalf (sheet 10-06, R-50).
  M5-Cardinality at elmt:NoObligation__TestingOrganization:
    The testing organization holds exactly one authorized representative (AuthorizedRepresentative) (R-23).
ok: no-obligation.sysml does not conform and fails M1-Obligation

11Verdict

One line for the reader and for the gate. It is printed only when every cell above ran and every assert held.

checked.verdict()
claims checked: 17
  the measles evaluation conforms to the fourteen S-shapes the chapter names
  requirements-before-agreement.ttl does not conform and fails S0-Layers
  population-unrepresented.ttl does not conform and fails S0-Population only
  member-untagged.ttl does not conform and fails S0-Member only
  engagement-mismatch.ttl does not conform and fails S0-Population only
  one-person-team.ttl fails S0-Roles and no other of the fourteen
  independence-undeclared.ttl fails S0-Parties and no other of the fourteen
  acceptance-by-organization.ttl fails S9-Acceptance and no other of the fourteen
  operator-determines-alone.ttl fails S0-Independence and no other of the fourteen
  access-without-period.ttl fails S0-Access and no other of the fourteen
  record-without-level.ttl fails S0-Record and no other of the fourteen
  provider-fact-contradicted.ttl fails S0-Parties and no other of the fourteen
  statement-of-work-after-agreement.ttl fails S0-StatementOfWork and no other of the fourteen
  item-outside-record.ttl fails S0-Member and no other of the fourteen
  user-interest-denied.ttl fails S0-Parties and no other of the fourteen
  the model graph conforms to the three M-shapes the chapter names
  no-obligation.sysml does not conform and fails M1-Obligation
NOTEBOOK: PASS