-
Notifications
You must be signed in to change notification settings - Fork 4
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
Conversation
☂️ Python Coverage
Overall Coverage
New FilesNo new covered files... Modified Files
|
"""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: |
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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"?
There was a problem hiding this comment.
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.
Changed many files because I renamed
remove_namespace
toremove_namespace_from_uri
. The motivation for this renaming was to haveremove_namespace
as a parameter in functions/methods that use theremove_namespace_from_uri
.