Closed crisely09 closed 4 months ago
Attention: Patch coverage is 37.50000%
with 5 lines
in your changes are missing coverage. Please review.
Project coverage is 75.65%. Comparing base (
be27bb6
) to head (a391825
).
Files | Patch % | Lines |
---|---|---|
kgforge/core/archetypes/store.py | 25.00% | 3 Missing :warning: |
kgforge/specializations/resources/datasets.py | 50.00% | 2 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
How would it work in the case of multiple images? Just by stacking multiple lazy actions together like:
resource.image = [forge.attach_image(path, content_type, about) for path in paths]
?
I think this capability should go to Resource or one of its descendants just like Dataset currently holds specific data models for distributions and provenance. It is okay to add more data models for specific properties we want to offer as default on Resource or on one of its descendants.
forge.attach already supports uploading a dir (you'll get a list of distributions DataDownload)
I think this capability should go to Resource or one of its descendants just like Dataset currently holds specific data models for distributions and provenance.
@MFSY my issue with adding it to Resource
is that we would need to pass forge
to it, as it is done in Dataset
, and that is kind of ugly. Also because that would mean a big change in how we have been initializing Resource
.
Maybe passing forge only to the method add_image
?
How would it work in the case of multiple images? Just by stacking multiple lazy actions together like:
resource.image = [forge.attach_image(path, content_type, about) for path in paths]
?
In fact, the path can be a directory, and that would take all the files inside, and make the list automatically
I think this capability should go to Resource or one of its descendants just like Dataset currently holds specific data models for distributions and provenance.
@MFSY my issue with adding it to
Resource
is that we would need to passforge
to it, as it is done inDataset
, and that is kind of ugly. Also because that would mean a big change in how we have been initializingResource
. Maybe passing forge only to the methodadd_image
?
I am okay with having the method accept a forge object. Now Resource can also be extended with an Entity class that will have this method which can accept forge. In that case, client will need to create an Entity from a resource before using the method.
How would it work in the case of multiple images? Just by stacking multiple lazy actions together like:
resource.image = [forge.attach_image(path, content_type, about) for path in paths]
?
In fact, the path can be a directory, and that would take all the files inside, and make the list automatically
What if we have files from different directories? Would the piece of code provided by elefterios work?
How would it work in the case of multiple images? Just by stacking multiple lazy actions together like:
resource.image = [forge.attach_image(path, content_type, about) for path in paths]
?
In fact, the path can be a directory, and that would take all the files inside, and make the list automatically
What if we have files from different directories? Would the piece of code provided by elefterios work?
I think it should, yes
Hi @crisely09! Can this PR be merged now?
Any update on this merge?
Hi guys, We'll look into this this week.
With the current changes, to add an image, one has to start from a dataset:
dataset = Dataset.from_resource(forge, resource)
dataset.add_image(path, content_type, about)
This should work in the same way as explained before for paths and for a list of files.
To tackle #388
This is the simplest implementation to "attach" and image, and then use it to add it to any resource, similar to
attach
for distributions.Example of how it is used can be found inside the 03 - Storing notebook. The way to add the image would be :