kgdata.wikidata.db#
Functions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Mapping from wikipedia article to wikidata id |
|
|
|
Classes
|
- class kgdata.wikidata.db.WDProxyDB(EntClass, dbpath: Union[Path, str], dboptions: Optional[Options] = None, compression: bool = False, create_if_missing=True, readonly=False)[source]#
Bases:
RocksDBDict,HugeMutableMapping[str,V]- cache()#
Return a new mapping that will cache the results to avoid calling to an external mapping
- clear() None. Remove all items from D.#
- compact()#
- deser_value#
- get_int_property()#
Retrieves a RocksDB property’s value and cast it to an integer.
Full list of properties that return int values could be find [here](https://github.com/facebook/rocksdb/blob/08809f5e6cd9cc4bc3958dd4d59457ae78c76660/include/rocksdb/db.h#L428-L634).
- items() a set-like object providing a view on D's items#
- keys() a set-like object providing a view on D's keys#
- pop(k[, d]) v, remove specified key and return the corresponding value.#
If key is not found, d is returned if given, otherwise KeyError is raised.
- popitem() (k, v), remove and return some (key, value) pair#
as a 2-tuple; but raise KeyError if D is empty.
- seek_items()#
Seek to the first key that matches the entire prefix. From there, the itereator will continue to read pairs as long as the prefix extracted from key matches the prefix extracted from prefix.
Note: for this function to always iterate over keys that match the entire prefix, set options.prefix_extractor to the length of the prefix.
- seek_keys()#
Seek to the first key that matches the entire prefix. From there, the itereator will continue to read pairs as long as the prefix extracted from key matches the prefix extracted from prefix.
Note: for this function to always iterate over keys that match the entire prefix, set options.prefix_extractor to the length of the prefix.
- ser_value#
- setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D#
- try_catch_up_with_primary()#
- update([E, ]**F) None. Update D from mapping/iterable E and F.#
If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v
- values() an object providing a view on D's values#
- kgdata.wikidata.db.query_wikidata_entities(qnode_ids: Union[Set[str], List[str]], endpoint: str = 'https://www.wikidata.org/w/api.php') Dict[str, WDEntity][source]#
- kgdata.wikidata.db.get_wdclass_db(dbfile: Union[Path, str], create_if_missing=True, read_only=False, proxy: bool = False) HugeMutableMapping[str, WDClass][source]#
- kgdata.wikidata.db.get_wdprop_db(dbfile: Union[Path, str], create_if_missing=True, read_only=False, proxy: bool = False) HugeMutableMapping[str, WDProperty][source]#
- kgdata.wikidata.db.get_entity_db(dbfile: Union[Path, str], create_if_missing=True, read_only=False, proxy: bool = False) HugeMutableMapping[str, WDEntity][source]#
- kgdata.wikidata.db.get_entity_redirection_db(dbfile: Union[Path, str], create_if_missing=False, read_only=True) HugeMutableMapping[str, str][source]#
- kgdata.wikidata.db.get_entity_label_db(dbfile: Union[Path, str], create_if_missing=False, read_only=True) HugeMutableMapping[str, WDEntityLabel][source]#
- Parameters
- Return type
HugeMutableMapping[str, WDEntityLabel]
- kgdata.wikidata.db.get_wp2wd_db(dbpath: Union[Path, str], create_if_missing=False, read_only=True) HugeMutableMapping[str, str][source]#
Mapping from wikipedia article to wikidata id