Read
cognite.neat._session._read.CDFReadAPI
#
Bases: BaseReadAPI
Reads from CDF Data Models.
Use the .data_model()
method to load a CDF Data Model to the knowledge graph.
data_model(data_model_id)
#
graph(data_model_id, instance_space=None)
#
Reads a knowledge graph from Cognite Data Fusion (CDF).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_model_id |
DataModelIdentifier
|
Tuple of strings with the id of a CDF Data Model. |
required |
instance_space |
str | SequenceNotStr[str] | None
|
The instance spaces to extract. If None, all instance spaces are extracted. |
None
|
Returns:
Name | Type | Description |
---|---|---|
IssueList |
IssueList
|
A list of issues that occurred during the extraction. |
cognite.neat._session._read.CDFClassicAPI
#
Bases: BaseReadAPI
Reads from the Classic Data Model from CDF.
Use the .graph()
method to load CDF core resources to the knowledge graph.
graph(root_asset_external_id, limit_per_type=None)
#
Reads the classic knowledge graph from CDF.
The Classic Graph consists of the following core resource type.
Classic Node CDF Resources
- Assets
- TimeSeries
- Sequences
- Events
- Files
All the classic node CDF resources can have one or more connections to one or more assets. This will match a direct relationship in the data modeling of CDF.
In addition, you have relationships between the classic node CDF resources. This matches an edge in the data modeling of CDF.
Finally, you have labels and data sets that to organize the graph. In which data sets have a similar, but different, role as a space in data modeling. While labels can be compared to node types in data modeling, used to quickly filter and find nodes/edges.
This extractor will extract the classic CDF graph into Neat starting from either a data set or a root asset.
It works as follows
- Extract all core nodes (assets, time series, sequences, events, files) filtered by the given data set or root asset.
- Extract all relationships starting from any of the extracted core nodes.
- Extract all core nodes that are targets of the relationships that are not already extracted.
- Extract all labels that are connected to the extracted core nodes/relationships.
- Extract all data sets that are connected to the extracted core nodes/relationships.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
root_asset_external_id |
str
|
The external id of the root asset |
required |
limit_per_type |
int | None
|
The maximum number of nodes to extract per core node type. If None, all nodes are extracted. |
None
|
Returns:
Name | Type | Description |
---|---|---|
IssueList |
IssueList
|
A list of issues that occurred during the extraction. |
cognite.neat._session._read.ExcelReadAPI
#
Bases: BaseReadAPI
Reads a Neat Excel Rules sheet to the graph store. The rules sheet may stem from an Information architect, or a DMS Architect.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
io |
file path to the Excel sheet |
required |
__call__(io)
#
Reads a Neat Excel Rules sheet to the graph store. The rules sheet may stem from an Information architect, or a DMS Architect.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
io |
Any
|
file path to the Excel sheet |
required |
cognite.neat._session._read.YamlReadAPI
#
Bases: BaseReadAPI
__call__(io, format='neat')
#
Reads a yaml with either neat rules, or several toolkit yaml files to import Data Model(s) into NeatSession.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
io |
Any
|
File path to the Yaml file in the case of "neat" yaml, or path to a zip folder or directory with several Yaml files in the case of "toolkit". |
required |
format |
Literal['neat', 'toolkit']
|
The format of the yaml file(s). Can be either "neat" or "toolkit". |
'neat'
|
cognite.neat._session._read.CSVReadAPI
#
Bases: BaseReadAPI
Reads a csv that contains a column to use as primary key which will be the unique identifier for the type of data you want to read in. Ex. a csv can hold information about assets, and their identifiers are specified in a "ASSET_TAG" column.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
io |
file path or url to the csv |
required | |
type |
string that specifies what type of data the csv contains. For instance "Asset" or "Equipment" |
required | |
primary_key |
string name of the column that should be used as the unique identifier for each row of data |
required |