Skip to content

Commit c8a95b7

Browse files
author
Michaela Iorga
committed
Proposed solution for the JSON Control Mapping schema errors identified in issue #2183.
1 parent 61476dc commit c8a95b7

1 file changed

Lines changed: 90 additions & 34 deletions

File tree

src/metaschema/oscal_mapping-common_metaschema.xml

Lines changed: 90 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@
6464
<assembly ref="gap-summary">
6565
<use-name>target-gap-summary</use-name>
6666
</assembly>
67-
<field ref="confidence-score" min-occurs="0" max-occurs="1" />
68-
<field ref="coverage" min-occurs="0" max-occurs="1" />
67+
<assembly ref="confidence-score" min-occurs="0" max-occurs="1" />
68+
<assembly ref="coverage" min-occurs="0" max-occurs="1" />
6969
</model>
7070
</define-assembly>
7171

@@ -177,8 +177,8 @@
177177
<use-name>qualifier</use-name>
178178
<group-as name="qualifiers" in-json="ARRAY" />
179179
</assembly>
180-
<field ref="confidence-score" min-occurs="0" max-occurs="1" />
181-
<field ref="coverage" min-occurs="0" max-occurs="1" />
180+
<assembly ref="confidence-score" min-occurs="0" max-occurs="1" />
181+
<assembly ref="coverage" min-occurs="0" max-occurs="1" />
182182
<assembly ref="property" max-occurs="unbounded">
183183
<group-as name="props" in-json="ARRAY" />
184184
</assembly>
@@ -364,8 +364,8 @@
364364
<flag ref="matching-rationale" required="yes" />
365365
<flag ref="status" required="yes" />
366366
<model>
367-
<field ref="confidence-score" min-occurs="0" max-occurs="1" />
368-
<field ref="coverage" min-occurs="0" max-occurs="1" />
367+
<assembly ref="confidence-score" min-occurs="0" max-occurs="1" />
368+
<assembly ref="coverage" min-occurs="0" max-occurs="1" />
369369
<!-- define-field name="mapping-description" as-type="markup-multiline" min-occurs="1"
370370
in-xml="WITH_WRAPPER">
371371
<formal-name>Mapping Description</formal-name>
@@ -422,11 +422,11 @@
422422
subject across revisions of the document.</description>
423423
</define-flag>
424424
<model>
425-
<assembly ref="select-control-by-id" min-occurs="1" max-occurs="unbounded">
425+
<assembly ref="match-control-by-id" min-occurs="1" max-occurs="unbounded">
426426
<use-name>unmapped-controls</use-name>
427427
<group-as name="unmapped-controls" in-json="ARRAY" />
428428
<remarks>
429-
<p>If <code>with-child-controls</code> is <q>yes</q> on the call to a control,
429+
<p>If <code>match-with-child-controls</code> is <q>yes</q> on the call to a control,
430430
any controls appearing within it (child controls) will be selected, with no
431431
additional <code>call</code> directives required. This flag provides a way
432432
to include controls with all their dependent controls (enhancements) without
@@ -435,47 +435,99 @@
435435
</assembly>
436436
</model>
437437
</define-assembly>
438-
439-
<!-- TBD: Move assembly to a common file since it is also defined in oscal_profile_metaschema.xml.-->
440-
<!-- NOTE: there is another locallly defined assembly but it is NOT identical with this one in mapping and profile -->
438+
439+
<!-- NOTE: there is another select-control-by-id defined locally in assessment but it is NOT identical with the one in profile and mapping.
440+
Changed the name to "match-control-by-id" to avoid duplicated definition in the complete schema -->
441441
<!-- NOTE: NOT clear the selection of controls using pattern matching is needed. If NOT needed, we can simplify but this
442-
assembly will be similar to the assessemnt-common one and cannot be moved. -->
443-
<define-assembly name="select-control-by-id" scope="local">
444-
<formal-name>Select Control</formal-name>
442+
assembly will be similar to the assessment-common one and cannot be moved. -->
443+
<define-assembly name="match-control-by-id" >
444+
<formal-name>Select Matched Control</formal-name>
445445
<description>Select a control or controls from an imported control set.</description>
446-
<flag ref="with-child-controls" />
446+
<flag ref="match-with-child-controls" />
447447
<model>
448448
<define-field name="with-id" as-type="token" max-occurs="unbounded">
449449
<formal-name>Match Controls by Identifier</formal-name>
450450
<description>Selecting a control by its ID given as a literal.</description>
451451
<group-as name="with-ids" in-json="ARRAY" />
452452
</define-field>
453-
<assembly ref="matching" max-occurs="unbounded">
454-
<group-as name="matching" in-json="ARRAY" />
453+
<assembly ref="match-control" max-occurs="unbounded">
454+
<group-as name="match-control-by" in-json="ARRAY" />
455455
</assembly>
456456
</model>
457457
<remarks>
458-
<p>If <code>with-child-controls</code> is <q>yes</q> on the call to a control, no
458+
<p>If <code>match-with-child-controls</code> is <q>yes</q> on the call to a control, no
459459
sibling <code>call</code>elements need to be used to call any controls appearing
460460
within it. Since generally, this is how control enhancements are represented (as
461461
controls within controls), this provides a way to include controls with all their
462462
dependent controls (enhancements) without having to call them individually.</p>
463463
</remarks>
464464
</define-assembly>
465-
466-
<!-- TBD: Move assembly to a common file since it is also defined in oscal_profile_metaschema.xml -->
465+
467466
<!-- NOTE: This assembly used in mapping and profile is NOT used in the assessment-common for select-control-by-id -->
468-
<define-assembly name="matching">
467+
<define-assembly name="match-control" >
469468
<formal-name>Match Controls by Pattern</formal-name>
470-
<description>Selecting a set of controls by matching their IDs with a wildcard
471-
pattern.</description>
472-
<flag ref="pattern" />
469+
<description>Selecting a set of controls by matching their IDs with a wildcard pattern.</description>
470+
<flag ref="match-pattern" />
471+
</define-assembly>
472+
473+
<define-assembly name="confidence-score" >
474+
<formal-name>Confidence Score</formal-name>
475+
<description>This records either a string category or a decimal value from 0-1 representing a percentage. Both of these values describe an estimation of the author's confidence
476+
that this mapping is correct and accurate. </description>
477+
<model>
478+
<choice>
479+
<define-field name="category" as-type="string" >
480+
<constraint>
481+
<allowed-values target=".[has-oscal-namespace('http://csrc.nist.gov/ns/oscal')]" allow-other="yes">
482+
<enum value="unspecified">No category is specified for the confidence score.</enum>
483+
<enum value="high">High confidence in the mapping.</enum>
484+
<enum value="medium">Medium confidence in the mapping.</enum>
485+
<enum value="low">Low confidence in the mapping.</enum>
486+
</allowed-values>
487+
</constraint>
488+
</define-field>
489+
<field ref="percentage" />
490+
</choice>
491+
</model>
492+
</define-assembly>
493+
494+
<!-- The coverage defined as field with flag with the intention of representing it as <coverage generation-method="arbitrary">0.85</coverage> does not convert
495+
clean oin the JSON schema - it adds STRVALUE to store the value of the named field. A representation like <coverage value="0.85" generation-method="arbitrary"/>
496+
<coverage generation-method="arbitrary"/></coverage>is generated with an assembly in metaschema definition and converts clean to JSON -->
497+
<define-assembly name="coverage" >
498+
<formal-name>Coverage</formal-name>
499+
<description>A decimal value from 0-1, representing the percentage coverage of the targets by the sources.</description>
500+
<define-flag name="generation-method" as-type="string" required="no" default="arbitrary">
501+
<constraint>
502+
<allowed-values allow-other="yes">
503+
<enum value="arbitrary">The coverage value is a qualitative estimate of coverage with no strict formula.</enum>
504+
</allowed-values>
505+
</constraint>
506+
</define-flag>
507+
<!-- define-flag name="percentage" as-type="decimal" required="yes"/ -->
508+
<model>
509+
<field ref="percentage" min-occurs="1" max-occurs="1" />
510+
</model>
511+
<remarks>
512+
<p>This field is scoped - that is, it can be used at the document-level, the mapping level, or the individual map item level. It only applies to targets and sources within it's scope.</p>
513+
<p>Coverage is calculated by taking the full set of all targets in-scope and the full set of all sources in-scope, then applying the "generation-method" to the two sets.
514+
By default the method is an arbitrary estimation of coverage.</p>
515+
<p>In a general sense "coverage" is defined as the percent of the set of targets that have mapped to by the set of sources,
516+
where each map is an "equivalent-to" or "equal-to" valued "relationship". Where relationship is "subset-of" or otherwise, it counts as an appropriate fraction of a full map. </p>
517+
<p> Since coverage is derived from mapping relationships, it is defined in the context of the mapping's "matching-rationale" - that is, the method used to determine relationships.</p>
518+
</remarks>
473519
</define-assembly>
474520

521+
475522
<!-- ################# -->
476523
<!-- FIELD DEFINITIONS -->
477524
<!-- ################# -->
478-
<define-field name="confidence-score">
525+
526+
<!-- This definition as field for hte confidence-score does not represent correctly
527+
the TWG intentions of having either a string or a decimal, no other values.
528+
Changed it above to an assembly with a choice between the two fields, each with the appropriate constraints.
529+
-->
530+
<!-- define-field name="confidence-score" as-type="string-or-decimal">
479531
<formal-name>Confidence Score</formal-name>
480532
<description>This records either a string category or a decimal value from 0-1 representing a percentage. Both of these values describe an estimation of the author's confidence
481533
that this mapping is correct and accurate. </description>
@@ -490,9 +542,9 @@
490542
</constraint>
491543
</define-flag>
492544
<define-flag name="percentage" as-type="decimal" required="no"/>
493-
</define-field>
494-
495-
<define-field name="coverage" as-type="decimal">
545+
</define-field -->
546+
547+
<!-- define-field name="coverage" as-type="decimal" >
496548
<formal-name>Coverage</formal-name>
497549
<description>A decimal value from 0-1, representing the percentage coverage of the targets by the sources.</description>
498550
<define-flag name="generation-method" as-type="string" required="no" default="arbitrary">
@@ -510,6 +562,11 @@
510562
where each map is an "equivalent-to" or "equal-to" valued "relationship". Where relationship is "subset-of" or otherwise, it counts as an appropriate fraction of a full map. </p>
511563
<p> Since coverage is derived from mapping relationships, it is defined in the context of the mapping's "matching-rationale" - that is, the method used to determine relationships.</p>
512564
</remarks>
565+
</define-field -->
566+
567+
<define-field name="percentage" as-type="decimal">
568+
<formal-name>Percentage</formal-name>
569+
<description>A decimal value from 0-1, representing a percentage.</description>
513570
</define-field>
514571

515572
<define-field name="mapping-description" as-type="markup-multiline">
@@ -577,16 +634,15 @@
577634
<p>If this flag appears in both locations, the lower-scoped value overrides while within it's scope.</p> </remarks>
578635
</define-flag>
579636

580-
<!-- TBD: Move assembly to a common file since it is also defined in oscal_profile_metaschema.xml -->
581-
<define-flag as-type="string" name="pattern">
582-
<formal-name>Pattern</formal-name>
637+
<!-- Updated the name of the flag to avoid conflict in the complete schema with the "patern" defined in oscal_profile_metaschema.xml -->
638+
<define-flag as-type="string" name="match-pattern">
639+
<formal-name>Matching Pattern</formal-name>
583640
<description>A <a href="https://en.wikipedia.org/wiki/Glob_(programming)">glob expression</a>
584641
matching the IDs of one or more controls to be selected.</description>
585642
</define-flag>
586643

587-
<!-- TBD: Move assembly to a common file since it is also defined in oscal_control-common_metaschema.xml -->
588-
<!-- NOTE: This is the only flag needed, and including all ones defined in oscal_control-common_metaschema.xml, constraints included. -->
589-
<define-flag as-type="token" name="with-child-controls">
644+
<!-- Updated the name of the flag to avoid conflict in the complete schema with the "with-child-control" defined in oscal_profile_metaschema.xml -->
645+
<define-flag as-type="token" name="match-with-child-controls">
590646
<formal-name>Include Contained Controls with Control</formal-name>
591647
<description>When a control is included, whether its child (dependent) controls are also
592648
included.</description>

0 commit comments

Comments
 (0)