Created
July 6, 2015 23:48
-
-
Save sebotic/450b8d4db51ad680b1d6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__author__ = 'Sebastian Burgstaller' | |
__licence__ = 'GPLv3' | |
""" | |
Test retrieval and construction of a WD json representation | |
""" | |
import PBB_Core | |
import pprint | |
import time | |
from PBB_login import WDLogin | |
label = 'BRCA1' | |
domain = 'genes' | |
item_id = 'Q1232' | |
data = { | |
'P477': ['BRCAI', 'BRCC1', 'DACDE'], | |
'P480': ['ENSG00000012048', 'ENSG000000324112', 'ENSG000000AAAAA'] | |
} | |
references = { | |
'P477': [ | |
{ | |
'ref_properties': ['P149', 'TIMESTAMP'], | |
'ref_values': ['Q816', 'TIMESTAMP'] | |
}, | |
{ | |
'ref_properties': ['P149'], | |
'ref_values': ['Q213'] | |
}, | |
{ | |
'ref_properties': ['P149'], | |
'ref_values': ['Q213'] | |
} | |
] | |
} | |
start = time.time() | |
user = '' | |
pwd = '' | |
# create a login object first which can later be used to retrieve write tokens and write cookies | |
login_obj = WDLogin(user=user, pwd=pwd, server='test.wikidata.org') | |
wd_item = PBB_Core.WDItemEngine(wd_item_id=item_id, domain=domain, data=data, server='test.wikidata.org', references=references) | |
pprint.pprint(wd_item.get_wd_json_representation()) | |
# wd_item.set_aliases(aliases=['tttttt','ttad'], lang='en', append=True) | |
wd_item.set_description(description='ddasedikke112', lang='en') | |
wd_item.write(login_obj) | |
end = time.time() | |
print('Time elapsed:', end - start) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment