Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NEAT-344] 🙉 Custom Asset Types #532

Merged
merged 4 commits into from
Jul 9, 2024
Merged

Conversation

doctrino
Copy link
Collaborator

@doctrino doctrino commented Jul 9, 2024

Changed many files because I renamed remove_namespace to remove_namespace_from_uri. The motivation for this renaming was to have remove_namespace as a parameter in functions/methods that use the remove_namespace_from_uri.

Copy link

github-actions bot commented Jul 9, 2024

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
22464 15691 70% 60% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
cognite/neat/_version.py 100% 🟢
cognite/neat/app/api/routers/data_exploration.py 56% 🟢
cognite/neat/graph/extractors/_classic_cdf/_assets.py 95% 🟢
cognite/neat/graph/extractors/_mock_graph_generator.py 19% 🟢
cognite/neat/graph/queries/_base.py 66% 🟢
cognite/neat/graph/queries/_shared.py 42% 🟢
cognite/neat/legacy/graph/extractors/_mock_graph_generator.py 83% 🟢
cognite/neat/legacy/graph/loaders/_asset_loader.py 86% 🟢
cognite/neat/legacy/graph/loaders/core/rdf_to_assets.py 79% 🟢
cognite/neat/legacy/graph/loaders/core/rdf_to_relationships.py 64% 🟢
cognite/neat/legacy/graph/transformations/query_generator/sparql.py 84% 🟢
cognite/neat/legacy/graph/transformations/transformer.py 87% 🟢
cognite/neat/legacy/rules/exporters/_rules2ontology.py 84% 🟢
cognite/neat/legacy/rules/importers/_graph2rules.py 90% 🟢
cognite/neat/legacy/rules/importers/_owl2rules/_owl2classes.py 95% 🟢
cognite/neat/legacy/rules/importers/_owl2rules/_owl2properties.py 97% 🟢
cognite/neat/rules/exporters/_rules2ontology.py 88% 🟢
cognite/neat/rules/importers/_inference2rules.py 91% 🟢
cognite/neat/rules/importers/_owl2rules/_owl2classes.py 96% 🟢
cognite/neat/rules/importers/_owl2rules/_owl2properties.py 96% 🟢
cognite/neat/utils/init.py 100% 🟢
cognite/neat/utils/utils.py 83% 🟢
TOTAL 81% 🟢

updated for commit: c40b388 by action🐍

@doctrino doctrino marked this pull request as ready for review July 9, 2024 07:01
@doctrino doctrino requested a review from a team as a code owner July 9, 2024 07:01
"""Converts an asset to triples."""
id_ = namespace[f"Asset_{asset.id}"]

# Set rdf type
triples: list[Triple] = [(id_, RDF.type, namespace["Asset"])]
type_ = "Asset"
if self.to_type:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very elegant :)

@@ -14,9 +14,14 @@ def test_asset_extractor():

store = NeatGraphStore.from_memory_store()

extractor = AssetsExtractor.from_dataset(client_mock, data_set_external_id="nordic44")
extractor = AssetsExtractor.from_dataset(
client_mock, data_set_external_id="nordic44", to_type=lambda a: a.metadata.get("type", "Unknown")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should .get have default fall back to "Asset"?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was just to demonstrate that you can fallback to whatever you would like.

@doctrino doctrino merged commit 26f8d0f into main Jul 9, 2024
7 checks passed
@doctrino doctrino deleted the asset-extractor-custom-type branch July 9, 2024 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants