@@ -179,7 +179,9 @@ def _convert_dataset_files_creators(value):
179
179
@jsonld .s (
180
180
type = 'schema:DigitalDocument' ,
181
181
slots = True ,
182
- context = {'schema' : 'http://schema.org/' }
182
+ context = {
183
+ 'schema' : 'http://schema.org/' ,
184
+ }
183
185
)
184
186
class DatasetFile (Entity , CreatorsMixin ):
185
187
"""Represent a file in a dataset."""
@@ -197,7 +199,9 @@ class DatasetFile(Entity, CreatorsMixin):
197
199
198
200
dataset = jsonld .ib (context = 'schema:isPartOf' , default = None , kw_only = True )
199
201
200
- filename = attr .ib (kw_only = True )
202
+ filename = attr .ib (kw_only = True , converter = lambda x : Path (x ).name )
203
+
204
+ name = jsonld .ib (context = 'schema:name' , kw_only = True , default = None )
201
205
202
206
filesize = attr .ib (default = None , kw_only = True )
203
207
@@ -228,6 +232,10 @@ def size_in_mb(self):
228
232
"""Return file size in megabytes."""
229
233
return self .filesize * 1e-6
230
234
235
+ def __attrs_post_init__ (self ):
236
+ """Set the property "name" after initialization."""
237
+ self .name = self .filename
238
+
231
239
232
240
def _parse_date (value ):
233
241
"""Convert date to datetime."""
@@ -274,13 +282,7 @@ def _convert_keyword(keywords):
274
282
@jsonld .s (
275
283
type = 'schema:Dataset' ,
276
284
context = {
277
- 'added' : 'schema:dateCreated' ,
278
- 'affiliation' : 'schema:affiliation' ,
279
- 'alternate_name' : 'schema:alternateName' ,
280
- 'email' : 'schema:email' ,
281
- 'name' : 'schema:name' ,
282
285
'schema' : 'http://schema.org/' ,
283
- 'url' : 'schema:url'
284
286
},
285
287
)
286
288
class Dataset (Entity , CreatorsMixin ):
0 commit comments