Skip to content

Commit

Permalink
Merge pull request #136 from MaRDI4NFDI/new_fixes
Browse files Browse the repository at this point in the history
fix format and pull description
  • Loading branch information
LizzAlice authored Apr 12, 2024
2 parents 74a8ef8 + 97ee19e commit 6eeef1b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
5 changes: 5 additions & 0 deletions mardi_importer/mardi_importer/openml/OpenMLDataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def __init__(
integrator,
name,
dataset_id,
description,
version,
creators,
contributors,
Expand All @@ -67,6 +68,7 @@ def __init__(
self.api = integrator
self.name = name #done
self.dataset_id = str(dataset_id) #done
self.description=description
self.version = version #done
self.creators = creators
self.contributors = contributors
Expand Down Expand Up @@ -110,6 +112,9 @@ def insert_claims(self):
if self.version is not None and self.version != "None":
prop_nr = self.api.get_local_id_by_label("dataset version identifier", "property")
self.item.add_claim(prop_nr, str(self.version))
if self.description is not None:
prop_nr = self.api.get_local_id_by_label("description", "property")
self.item.add_claim(prop_nr, str(self.description))
if self.creators and self.creators != "None":
#object has role
qualifier = [self.api.get_claim("wdt:P3831", "wd:Q59275219")]
Expand Down
4 changes: 3 additions & 1 deletion mardi_importer/mardi_importer/openml/OpenMLSource.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def create_local_entities(self):
item.write()

def pull(self):
dataset_dict = {"name": [], "dataset_id": [], "version": [], "creators": [],
dataset_dict = {"name": [], "dataset_id": [], "description":[], "version": [], "creators": [],
"contributors" : [], "collection_date": [], "upload_date": [],
"license": [], "url":[], "default_target_attribute":[], "row_id_attribute":[],
"tags":[], "original_data_url":[], "paper_url":[],
Expand All @@ -65,6 +65,7 @@ def pull(self):
ds = openml.datasets.get_dataset(int(did), download_data=False, download_qualities=False, download_features_meta_data=False)
dataset_dict["name"].append(ds.name)
dataset_dict["dataset_id"].append(did)
dataset_dict["description"].append(ds.description)
dataset_dict["version"].append(ds.version)
dataset_dict["creators"].append(ds.creator)
dataset_dict["contributors"].append(ds.contributor)
Expand All @@ -78,6 +79,7 @@ def pull(self):
dataset_dict["original_data_url"].append(ds.original_data_url)
dataset_dict["paper_url"].append(ds.paper_url)
dataset_dict["md5_checksum"].append(ds.md5_checksum)
dataset_dict["format"].append(ds.format)
try:
qualities = ds.qualities
except:
Expand Down
5 changes: 5 additions & 0 deletions mardi_importer/mardi_importer/openml/new_entities.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
"description": "Version of a dataset",
"datatype": "string"
},
{
"label": "description",
"description": "long description of an item",
"datatype": "string"
},
{
"label": "collection date",
"description": "date as a string",
Expand Down
2 changes: 1 addition & 1 deletion mardi_importer/mardi_importer/openml/wikidata_entities.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ P459
P11238
P3831
Q59275219
Q20204892
Q20204892

0 comments on commit 6eeef1b

Please sign in to comment.