padv.Query
Select set of artifacts from project
Description
This object requires CI/CD Automation for Simulink Check. A padv.Query
object represents a query that you can
use to select a set of artifacts from a project. Use the input arguments to define the set of
artifacts that the query selects. Queries can either be function-based or class-based. Use
FunctionHandle
to specify a function for a function-based query or use
inheritance for a class-based query. For more information, see Find Artifacts with Queries and Create Custom Queries.
Creation
Description
creates a query object with the name Q
= padv.Query(Name
)Name
.
specifies query properties using one or more name-value arguments. For example,
Q
= padv.Query(___,Name = Value
)DefaultArtifactType = "sl_model_file"
changes the default artifact
type for the query from a generic output file, "padv_output_file"
, to a
model file, "sl_model_file"
.
Input Arguments
Name
— Unique identifier for query
character vector | string
Unique identifier for query, specified as character vector or string. You can only specify a query name when you create a query object. You cannot change the query name after you create the query object.
Each query in the process model must have a unique name.
Example: "CustomQueryForArtifacts"
Data Types: char
| string
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Example: DefaultArtifactType = "sl_model_file"
Title
— Human-readable name for query
character vector | string
Human-readable name for query, specified as character vector or string.
Example: Title = "Custom Query for Artifacts"
Data Types: char
| string
DefaultArtifactType
— Expected artifact type
"padv_output_file"
(default) | valid value for the Type
property of a
padv.Artifact
object
Expected artifact type, specified as one or more of the values listed in this table. To specify multiple values, use an array.
Category | Artifact Type | Description |
---|---|---|
MATLAB® | "m_class" | MATLAB class |
"m_file" | MATLAB file | |
"m_func" | MATLAB function | |
"m_method" | MATLAB class method | |
"m_property" | MATLAB class property | |
Model Advisor | "ma_config_file" | Model Advisor configuration file |
"ma_justification_file" | Model Advisor justification file | |
Process Advisor | "padv_dep_artifacts" | Related artifacts that current artifact depends on |
"padv_output_file" | Process Advisor output file | |
Project | "project" | Current project file |
Requirements | "mwreq_file" | Requirement file (since R2024b) |
"mwreq_item" | Requirement (since R2024b) | |
| Requirement (for R2024a and earlier) | |
"sl_req_file" | Requirement file (for R2024a and earlier) | |
"sl_req_table" | Requirements Table | |
Stateflow® | "sf_chart" | Stateflow chart |
"sf_graphical_fcn" | Stateflow graphical function | |
"sf_group" | Stateflow group | |
"sf_state" | Stateflow state | |
"sf_state_transition_chart" | Stateflow state transition chart | |
"sf_truth_table" | Stateflow truth table | |
Simulink® | "sl_block_diagram" | Block diagram |
"sl_data_dictionary_file" | Data dictionary file | |
"sl_embedded_matlab_fcn" | MATLAB function | |
"sl_block_diagram" | Block diagram | |
"sl_library_file" | Library file | |
"sl_model_file" | Simulink model file | |
"sl_protected_model_file" | Protected Simulink model file | |
"sl_subsystem" | Subsystem | |
"sl_subsystem_file" | Subsystem file | |
System Composer™ | "zc_block_diagram" | System Composer architecture |
"zc_component" | System Composer architecture component | |
"zc_file" | System Composer architecture file | |
Tests | "harness_info_file" | Harness info file |
"sl_harness_block_diagram" | Harness block diagram | |
"sl_harness_file" | Test harness file | |
"sl_test_case" | Simulink Test™ case | |
"sl_test_case_result" | Simulink Test case result | |
"sl_test_file" | Simulink Test file | |
"sl_test_iteration" | Simulink Test iteration | |
"sl_test_iteration_result" | Simulink Test iteration result | |
"sl_test_report_file" | Simulink Test result report | |
"sl_test_result_file" | Simulink Test result file | |
"sl_test_resultset" | Simulink Test result set | |
"sl_test_seq" | Test Sequence | |
"sl_test_suite" | Simulink Test suite | |
"sl_test_suite_result" | Simulink Test suite result |
padv.Task
objects use the
DefaultArtifactType
to confirm that the artifacts output by
the query are the types of artifacts required by the padv.Task
object.
When you use the run
function on
a query object, the DefaultArtifactType
is the default value
for artifacts returned by the function.
Example: DefaultArtifactType = "sl_model_file"
Parent
— Initial query run before iteration query
padv.Query
object | Name
of padv.Query
object
Initial query run before iteration
query, specified as either a
padv.Query
object or the Name
of a
padv.Query
object. When you specify a padv.Query
object as the iteration query for a task, the Parent
query is
the initial query that the build system runs before running the specified iteration
query.
For
example, the built-in query
padv.builtin.query.FindModelsWithTestCases
has the
Parent
query
padv.builtin.query.FindModels
. If you specify
padv.builtin.query.FindModelsWithTestCases
as the iteration
query for a task, you are specifying that you want the task to run once for each
model with a test case. The build system runs the Parent
query
padv.builtin.query.FindModels
first, to find the models in the
project, and then the build system runs the iteration query
padv.builtin.query.FindModelsWithTestCases
to find the models
with test
cases.
The build system ignores the Parent
query when you specify
a query as an input query or dependency query for a task.
Example: "padv.builtin.query.FindModels"
ShowFileExtension
— Show file extensions for returned artifacts
0
(false
) | 1
(true
)
Show file extensions in the Alias
property of returned
artifacts, specified as a numeric or logical 1
(true
) or 0
(false
). The
Alias
property controls the display name for the artifact in
the Tasks column in Process Advisor.
By default, queries strip file extensions from the Alias
property of each task iteration artifact. To show file extensions for
all artifacts in the
Tasks column, select the project setting Show file
extensions. To keep file extensions in the results for a specific
query, specify the query property ShowFileExtension
as
true
.
Example: true
Data Types: logical
SortArtifacts
— Setting for automatically sorting artifacts by address
true
or 1
(default) | false
or 0
Setting for automatically sorting artifacts by address, specified as a numeric
or logical 1
(true
) or 0
(false
). When a query returns artifacts, the artifacts should
be in a consistent order. By default, the build system sorts artifacts by the
artifact address.
Alternatively, you can sort artifacts in a different order by overriding the
internal sortArtifacts
method in a subclass that defines a custom
sort behavior.
For more information, see Sort Artifacts in Specific Order.
The build system automatically calls the sortArtifacts
method
when using the process model. The sortArtifacts
method expects two
input arguments: a padv.Query
object and a list of
padv.Artifact
objects returned by the run
function. The sortArtifacts
method should return a list of sorted
padv.Artifact
objects.
Example: SortArtifacts = false
Data Types: logical
FunctionHandle
— Handle to function that runs when you run query object
function_handle
Handle to function that runs when you run query
object, specified as a
function_handle
.
When you call the run
function on a query object,
run
runs the function specified by the
function_handle
.
Example: FunctionHandle = @FunctionForQuery
Data Types: function_handle
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)