samuelmeuli / wikibase-api Goto Github PK
View Code? Open in Web Editor NEW๐ฆ Wrapper library for the Wikibase API
Home Page: https://wikibase-api.readthedocs.io
License: Other
๐ฆ Wrapper library for the Wikibase API
Home Page: https://wikibase-api.readthedocs.io
License: Other
It seems not yet implemented although it is used as example in the documentation. This code below should fix it
def get(self, entity_id, property_id=None, rank=None):
"""Get claims for the specified entity
:param entity_id: Entity identifier (e.g. ``"Q1"``)
:type entity_id: str
:param property_id: Property identifier (e.g. ``"P1"``)
:type property_id: str
:param rank: Optional filter to return only the claims that have the specified rank
(one of ``["deprecated", "normal", "preferred"]``)
:type rank: str
:return: Response
:rtype: dict
"""
params = {
"action": "wbgetclaims",
"entity": entity_id,
}
if property_id is not None: params['property'] = property_id
if rank is not None: params['rank'] = rank
return self.api.get(params)
It seems that it is not possible to create a new property...
I tried:
wb.entity.add(entity_type="property")
But got this error:
ApiError: {"code": "param-illegal", "info": "A datatype was expected, but either missing or not recognized.", "messages": [{"name": "wikibase-api-not-recognized-datatype", "parameters": [], "html": {"": "A datatype was expected, but either missing or not recognized."}}], "": "See http://localhost:8466/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for notice of API deprecations and breaking changes."}
In order to get the reference.py file to work with my claim reference, I changed the snak dictionary on line 82 from:
` snak = {property_id: [{"snaktype": snak_type, "property": property_id, "datavalue": value}]}
to
snak = {property_id: [{"snaktype": snak_type, "property": property_id,"datavalue":{"type":"string","value": value}}]}
Functions could be added that allow users to create/update/remove sitelinks. See the API docs for details.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.