padv.builtin.query.FindArtifacts Class
Namespace: padv.builtin.query
Superclasses: padv.Query
Query for finding artifacts
Description
This class requires CI/CD Automation for Simulink Check.
The padv.builtin.query.FindArtifacts
class provides a query that can return
artifacts in your project folder. By default, the query finds
all artifacts in your project folder. You can automatically
include or exclude certain artifacts by using the optional
name-value arguments.
You can use this query in your process model to find artifacts for your tasks to iterate
over or use as inputs. If you only need to find a single file at a specific path, you can use
the built-in query padv.builtin.query.FindFileWithAddress
instead.
The padv.builtin.query.FindArtifacts
class is a handle
class.
Creation
Description
creates a query for finding the artifacts in your project folder.query
= padv.builtin.query.FindArtifacts()
sets certain properties using one or more name-value arguments. For example,
query
= padv.builtin.query.FindArtifacts(Name=Value
)padv.builtin.query.FindArtifacts(InProject = true)
creates a query
that only finds artifact that were explicitly added to the project.
The padv.builtin.query.FindArtifacts
class also has other properties, but you cannot set
those properties during query creation.
Input Arguments
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: query = padv.builtin.query.FindArtifacts(ExcludePath =
"Control")
ArtifactType
— Type of artifact
"sl_model_file"
| "m_file"
| "zc_file"
| ...
Type of artifact, 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_item" | Requirement (since R2024b) |
| Requirement (for R2024a and earlier) | |
"sl_req_file" | Requirement file | |
"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 |
Example: "m_file"
Example: ["sl_model_file" "zc_file"]
ExcludeLabel
— Exclude artifacts with specific project label
cell array
Exclude artifacts with specific project label, specified as a cell array where the first entry is the project label category and the second entry is the project label name.
Example: {"Classification","Design"}
Data Types: cell
ExcludePath
— Exclude artifacts where path contains specific text
string | character vector
Exclude artifacts where the path contains specific text, specified as a string
or a character vector. Consider using ExcludePathRegex
instead.
Example: "Control"
Data Types: string
ExcludePathRegex
— Exclude artifacts where path matches regular expression pattern
string | character vector
Exclude artifacts where the path matches a regular expression pattern, specified
as a string or a character vector.
ExcludePathRegex
expects UNIX®-style path separators.
If you want to use a literal path, use ExcludePath
instead.
You can specify either ExcludePath
or
ExcludePathRegex
but not both.
Example: "DD_.*\.sldd"
Data Types: char
| string
FilterSubFileArtifacts
— Filter out sub-file artifacts from query results
1
(true
) (default) | 0
(false
)
Filter out sub-file artifacts from query results, specified as a numeric or
logical 1
(true
) or 0
(false
).
A sub-file is a part of a larger file. For example, a subsystem is a sub-file of a model file.
Example: false
Data Types: logical
IncludeLabel
— Find artifacts with specific project label
cell array
Find artifacts with specific project label, specified as a cell array where the first entry is the project label category and the second entry is the project label name.
Example: {"Classification","Design"}
Data Types: cell
IncludePath
— Find artifacts where path contains specific text
string
Find artifacts where the path contains specific text, specified as a string.
Consider using IncludePathRegex
instead.
Example: "Control"
Data Types: string
IncludePathRegex
— Find artifacts where path matches regular expression pattern
string | character vector
Find artifacts where the path matches a regular expression pattern, specified as
a character vector or string. IncludePathRegex
expects UNIX-style path separators.
If you want to use a literal path, use IncludePath
instead.
You can specify either IncludePath
or
IncludePathRegex
but not both.
Example: "DD_.*\.sldd"
Data Types: char
| string
InProject
— Include only artifacts added to project
0
(false
) (default) | 1
(true
)
Include only artifacts that have been added to the project, specified as a
numeric or logical 1
(true
) or
0
(false
).
Note
If you specify InProject
as true
, you
cannot use the query as an input query.
Example: true
Data Types: logical
Name
— Unique identifier for query
string
Unique identifier for query, specified as a string.
Example: "FindMyArtifacts"
Data Types: string
Properties
ArtifactType
— Type of artifact
"sl_model_file"
| "m_file"
| "zc_file"
| ...
Type of artifact, 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_item" | Requirement (since R2024b) |
| Requirement (for R2024a and earlier) | |
"sl_req_file" | Requirement file | |
"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 |
Example: "m_file"
Example: ["sl_model_file" "zc_file"]
IncludeLabel
— Find artifacts with specific project label
cell array
Find artifacts with specific project label, specified as a cell array where the first entry is the project label category and the second entry is the project label name.
Example: {"Classification","Design"}
Data Types: cell
ExcludeLabel
— Exclude artifacts with specific project label
cell array
Exclude artifacts with specific project label, specified as a cell array where the first entry is the project label category and the second entry is the project label name.
Example: {"Classification","Design"}
Data Types: cell
IncludePathRegex
— Find artifacts where path matches regular expression pattern
string | character vector
Find artifacts where the path matches a regular expression pattern, specified as a
character vector or string. IncludePathRegex
expects
UNIX-style path separators.
If you want to use a literal path, use IncludePath
instead. You
can specify either IncludePath
or
IncludePathRegex
but not both.
Example: "DD_.*\.sldd"
Data Types: char
| string
ExcludePathRegex
— Exclude artifacts where path matches regular expression pattern
string | character vector
Exclude artifacts where the path matches a regular expression pattern, specified as
a string or a character vector. ExcludePathRegex
expects UNIX-style path separators.
If you want to use a literal path, use ExcludePath
instead. You
can specify either ExcludePath
or
ExcludePathRegex
but not both.
Example: "DD_.*\.sldd"
Data Types: char
| string
FilterSubFileArtifacts
— Filter out sub-file artifacts from query results
1
(true
) (default) | 0
(false
)
Filter out sub-file artifacts from query results, specified as a numeric or logical
1
(true
) or 0
(false
).
A sub-file is a part of a larger file. For example, a subsystem is a sub-file of a model file.
Example: false
Data Types: logical
InProject
— Include only artifacts added to project
0
(false
) (default) | 1
(true
)
Include only artifacts that have been added to the project, specified as a numeric
or logical 1
(true
) or 0
(false
).
For more information about how to add or remove files from a project, see Manage Project Files.
Note
If you specify InProject
as true
, you
cannot use the query as an input query.
Example: true
Attributes:
Dependent | true |
Data Types: logical
Title
— Query title
"Find all artifacts in project that meet the specified
criteria"
(default) | string | character vector
Query title, specified as a string or a character vector.
Example: "Find my artifacts"
Data Types: string
DefaultArtifactType
— Default artifact type returned by query
"padv_output_file"
(default) | "m_file"
| "sl_model_file"
| "zc_file"
| ...
Default artifact type returned by the query, specified as one or more of the values 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_item" | Requirement (since R2024b) |
| Requirement (for R2024a and earlier) | |
"sl_req_file" | Requirement file | |
"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 |
Example: "zc_file"
Example: ["sl_model_file" "zc_file"]
Parent
— Initial query that runs before iteration query
padv.Query
| Name
of padv.Query
object
Initial query that runs before iteration query, specified as either a
padv.Query
object or the Name
of a
padv.Query
object. When you specify an iteration query for a task,
the parent query is the initial query that the build system runs before running the
specified iteration query.
For information on how to improve Process Advisor load times by sharing query instances across your process model, see Best Practices for Process Model Authoring.
Example: sharedQuery
Example: "FindMyInitialArtifacts"
Name
— Unique identifier for query
string
Unique identifier for query, specified as a string.
Example: "FindMyArtifacts"
Data Types: string
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 an example, 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
method.
The sortArtifacts
method should return a list of sorted
padv.Artifact
objects.
Example: SortArtifacts = false
Data Types: logical
FunctionHandle
— Handle to function that function-based query runs
function_handle
Handle to the function that a function-based query
runs, specified as
a function_handle
.
If you define your query functionality inside a function and you or the build system
call run
on the query, the query runs the function specified by the
function_handle
.
The built-in queries are defined inside classes and do not use the
FunctionHandle
.
Example: FunctionHandle = @FunctionForQuery
Data Types: function_handle
Methods
Specialized Public Methods
This class overrides the following inherited methods.
run | Run query to find the artifacts that meet the criteria specified by the query. The query returns a Note You do not need to manually invoke this method inside your process
model. The build system automatically invokes the
The function artifacts = run(obj,~) ... end |
Examples
Find Data Dictionaries for Task in Process
You can use the FindArtifacts
query in your process
model to find artifacts for your tasks to iterate over (IterationQuery
)
or use as inputs (addInputQueries
). For example, you can use the
FindArtifacts
query to find the data dictionaries in your project folder
and have a task run one time for each data dictionary.
Open a project. For this example, open the Process Advisor example project.
processAdvisorExampleStart
Suppose that you have a custom task, MyCustomTask
, that you add
to your process model. You can use the built-in query
padv.builtin.query.FindArtifacts
to find specific types of
artifacts. To find the data dictionaries in the project, you specify the
ArtifactType
argument as
"sl_data_dictionary_file"
. Edit the process model to include this
code:
taskObj = addTask(pm, "MyCustomTask",... IterationQuery = padv.builtin.query.FindArtifacts(... ArtifactType = "sl_data_dictionary_file"),... InputQueries = padv.builtin.query.GetIterationArtifact);
InputQueries
as
padv.builtin.query.GetIterationArtifact
, that allows the task to
use the artifacts returned by IterationQuery
as inputs to the
task.In Process Advisor, view the updated Tasks by
clicking Refresh Tasks and switching to the
Project view. For the task MyCustomTask
, there
is one task iteration for each data dictionary.
Test FindArtifacts
Query Outside Process Model
Although you typically use a query inside your process model, you can
run an instance of the FindArtifacts
query outside of your process model to
confirm which artifacts the query returns.
Open a project. For this example, you can open the Process Advisor example project.
processAdvisorExampleStart
Create an instance of the query. You can use the arguments of the query to filter
the query results. For example, you can use the IncludeLabel
argument to have the query only return artifacts that use the Design
project label from the Classification
project label
category.
q = padv.builtin.query.FindArtifacts(... IncludeLabel = {'Classification','Design'});
Run the query and inspect the array of artifacts that the query returns.
q.run
ans = 1×26 Artifact array with properties: Type Parent ArtifactAddress
Find Artifacts that Digital Thread Tracks
To identify which artifacts the digital thread can monitor for
changes, you can run an instance of the FindArtifacts
query on your
project.
Open a project. For this example, you can open the Process Advisor example project.
processAdvisorExampleStart
Create an instance of the FindArtifacts
query without specifying any
additional
arguments.
q = padv.builtin.query.FindArtifacts();
Run the query and inspect the array of artifacts that the query returns.
trackedArtifacts = q.run
trackedArtifacts = 1×44 Artifact array with properties: Type Parent ArtifactAddress Alias
You can use the properties of the padv.Artifact
objects to identify
the type, address, and name of the artifact. For example, the Alias
property stores the name of the
artifact.
trackedArtifacts.Alias
Note
If there is an artifact in your project that the FindArtifacts
query does not find, the digital thread does not detect changes to that
artifact.
Capabilities and Limitations
This table identifies functionality that is supported by the query.
Functionality | Supported? |
---|---|
Input query for task | Only when the query property |
Iteration query for task | Yes. See IterationQuery. |
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 (한국어)