File Coverage

blib/lib/SBOM/CycloneDX/Component/ModelCard.pm
Criterion Covered Total %
statement 29 38 76.3
branch 0 10 0.0
condition n/a
subroutine 10 11 90.9
pod 1 1 100.0
total 40 60 66.6


line stmt bran cond sub pod time code
1             package SBOM::CycloneDX::Component::ModelCard;
2              
3 1     1   974 use 5.010001;
  1         3  
4 1     1   4 use strict;
  1         2  
  1         15  
5 1     1   2 use warnings;
  1         2  
  1         44  
6 1     1   4 use utf8;
  1         2  
  1         4  
7              
8 1     1   24 use SBOM::CycloneDX::BomRef;
  1         2  
  1         17  
9 1     1   3 use SBOM::CycloneDX::List;
  1         1  
  1         51  
10              
11 1     1   4 use Types::Standard qw(Str InstanceOf);
  1         1  
  1         6  
12 1     1   2165 use Types::TypeTiny qw(ArrayLike);
  1         1  
  1         6  
13              
14 1     1   353 use Moo;
  1         2  
  1         6  
15 1     1   262 use namespace::autoclean;
  1         2  
  1         7  
16              
17             extends 'SBOM::CycloneDX::Base';
18              
19             has bom_ref => (
20             is => 'rw',
21             isa => InstanceOf ['SBOM::CycloneDX::BomRef'],
22             coerce => sub { ref($_[0]) ? $_[0] : SBOM::CycloneDX::BomRef->new($_[0]) }
23             );
24              
25             has model_parameters => (is => 'rw', isa => InstanceOf ['SBOM::CycloneDX::Component::ModelParameters']);
26              
27             has quantitative_analysis => (is => 'rw', isa => InstanceOf ['SBOM::CycloneDX::Component::QuantitativeAnalysis']);
28              
29             has considerations => (is => 'rw', isa => InstanceOf ['SBOM::CycloneDX::Component::Considerations']);
30              
31             has properties => (is => 'rw', isa => ArrayLike [InstanceOf ['SBOM::CycloneDX::Property']]);
32              
33             sub TO_JSON {
34              
35 0     0 1   my $self = shift;
36              
37 0           my $json = {};
38              
39 0 0         $json->{bom} = $self->bom if $self->bom;
40 0 0         $json->{modelParameters} = $self->model_parameters if $self->model_parameters;
41 0 0         $json->{quantitativeAnalysis} = $self->quantitativeAnalysis if $self->quantitative_analysis;
42 0 0         $json->{considerations} = $self->considerations if $self->considerations;
43 0 0         $json->{properties} = $self->properties if @{$self->properties};
  0            
44              
45 0           return $json;
46              
47             }
48              
49             1;
50              
51             =encoding utf-8
52              
53             =head1 NAME
54              
55             SBOM::CycloneDX::Component::ModelCard - Model Card
56              
57             =head1 SYNOPSIS
58              
59             SBOM::CycloneDX::Component::ModelCard->new();
60              
61              
62             =head1 DESCRIPTION
63              
64             L provides a model card describes the
65             intended uses of a machine learning model and potential limitations,
66             including biases and ethical considerations. Model cards typically contain
67             the training parameters, which datasets were used to train the model,
68             performance metrics, and other relevant data useful for ML transparency.
69             This object SHOULD be specified for any component of type
70             `machine-learning-model` and must not be specified for other component
71             types.
72              
73             =head2 METHODS
74              
75             L inherits all methods from L
76             and implements the following new ones.
77              
78             =over
79              
80             =item SBOM::CycloneDX::Component::ModelCard->new( %PARAMS )
81              
82             Properties:
83              
84             =over
85              
86             =item * C, An identifier which can be used to reference the
87             model card elsewhere in the BOM. Every bom-ref must be unique within the
88             BOM.
89             Value SHOULD not start with the BOM-Link intro 'urn:cdx:' to avoid
90             conflicts with BOM-Links.
91              
92             =item * C, What considerations should be taken into account
93             regarding the model's construction, training, and application?
94              
95             =item * C, Hyper-parameters for construction of the model.
96              
97             =item * C, Provides the ability to document properties in a
98             name-value store. This provides flexibility to include data not officially
99             supported in the standard without having to use additional namespaces or
100             create extensions. Unlike key-value stores, properties support duplicate
101             names, each potentially having different values. Property names of interest
102             to the general public are encouraged to be registered in the CycloneDX
103             Property Taxonomy (L).
104             Formal registration is optional.
105              
106             =item * C, A quantitative analysis of the model
107              
108             =back
109              
110             =item $model_card->bom_ref
111              
112             =item $model_card->considerations
113              
114             =item $model_card->model_parameters
115              
116             =item $model_card->properties
117              
118             =item $model_card->quantitative_analysis
119              
120             =back
121              
122              
123             =head1 SUPPORT
124              
125             =head2 Bugs / Feature Requests
126              
127             Please report any bugs or feature requests through the issue tracker
128             at L.
129             You will be notified automatically of any progress on your issue.
130              
131             =head2 Source Code
132              
133             This is open source software. The code repository is available for
134             public review and contribution under the terms of the license.
135              
136             L
137              
138             git clone https://github.com/giterlizzi/perl-SBOM-CycloneDX.git
139              
140              
141             =head1 AUTHOR
142              
143             =over 4
144              
145             =item * Giuseppe Di Terlizzi
146              
147             =back
148              
149              
150             =head1 LICENSE AND COPYRIGHT
151              
152             This software is copyright (c) 2025-2026 by Giuseppe Di Terlizzi.
153              
154             This is free software; you can redistribute it and/or modify it under
155             the same terms as the Perl 5 programming language system itself.
156              
157             =cut