Comments (2)
Hi igolkotek, thanks for opening the issue. I just tested your use case and I don't see the problem. The item Q1800 (currently) has four statements for P131. They are,
- Q1356097 Ernakulam district (rank=deprecated)
- Q1186 Kerala (rank=normal)
- Q1538311 Travancore-Cochin (rank=normal)
- Q150056 Kingdom of Cochin (rank=normal)
You can see the ranks in the little icons next to each target data value that hvae a circle in the middle and a triangle on the top and bottom.
The definition of "truthy" statements from the docs is,
βTruthy statements represent statements that have the best non-deprecated rank for a given property. Namely, if there is a preferred statement for a property P, then only preferred statements for P will be considered truthy. Otherwise, all normal-rank statements for P are considered truthy.β
In this case, that makes the last 3 statements
- Q1186 Kerala (rank=normal)
- Q1538311 Travancore-Cochin (rank=normal)
- Q150056 Kingdom of Cochin (rank=normal)
the truthy ones. That's what I get if I run the following code,
from qwikidata.entity import WikidataItem
from qwikidata.linked_data_interface import get_entity_dict_from_api
q1800_dict = get_entity_dict_from_api('Q1800')
q1800 = WikidataItem(q1800_dict)
print('all claim groups')
print('=' * 60)
p131_claim_group = q1800.get_claim_group('P131')
for claim in p131_claim_group:
print(claim)
print()
print('truthy claim groups')
print('=' * 60)
p131_truthy_claim_group = q1800.get_truthy_claim_group('P131')
for claim in p131_truthy_claim_group:
print(claim)
print()
all claim groups
============================================================
WikidataClaim(type=statement, rank=deprecated, mainsnak=WikidataSnak(snaktype=value, property_id=P131, snak_datatype=wikibase-item, value_datatype=wikibase-entityid, datavalue=WikibaseEntityId(id=Q1356097)), qualifiers=OrderedDict())
WikidataClaim(type=statement, rank=normal, mainsnak=WikidataSnak(snaktype=value, property_id=P131, snak_datatype=wikibase-item, value_datatype=wikibase-entityid, datavalue=WikibaseEntityId(id=Q1186)), qualifiers=OrderedDict([('P580', [WikidataQualifier(hash=1f8c91b2570e6f837a39a5baebf3dc1fcf5ef4d2, snak=WikidataSnak(snaktype=value, property_id=P580, snak_datatype=time, value_datatype=time, datavalue=Time(time=+1956-11-01T00:00:00Z, precision=11)))])]))
WikidataClaim(type=statement, rank=normal, mainsnak=WikidataSnak(snaktype=value, property_id=P131, snak_datatype=wikibase-item, value_datatype=wikibase-entityid, datavalue=WikibaseEntityId(id=Q1538311)), qualifiers=OrderedDict([('P580', [WikidataQualifier(hash=6940cae70ef8512392b0e62f1e5148bf1da05c47, snak=WikidataSnak(snaktype=value, property_id=P580, snak_datatype=time, value_datatype=time, datavalue=Time(time=+1949-07-01T00:00:00Z, precision=11)))]), ('P582', [WikidataQualifier(hash=134e737dfcddb40a4e25328b6e0a44d9b560384b, snak=WikidataSnak(snaktype=value, property_id=P582, snak_datatype=time, value_datatype=time, datavalue=Time(time=+1956-11-01T00:00:00Z, precision=11)))])]))
WikidataClaim(type=statement, rank=normal, mainsnak=WikidataSnak(snaktype=value, property_id=P131, snak_datatype=wikibase-item, value_datatype=wikibase-entityid, datavalue=WikibaseEntityId(id=Q150056)), qualifiers=OrderedDict([('P582', [WikidataQualifier(hash=37bcaa3fd7ae0fa53da1a79a90438cdc9175d281, snak=WikidataSnak(snaktype=value, property_id=P582, snak_datatype=time, value_datatype=time, datavalue=Time(time=+1949-07-01T00:00:00Z, precision=11)))])]))
truthy claim groups
============================================================
WikidataClaim(type=statement, rank=normal, mainsnak=WikidataSnak(snaktype=value, property_id=P131, snak_datatype=wikibase-item, value_datatype=wikibase-entityid, datavalue=WikibaseEntityId(id=Q1186)), qualifiers=OrderedDict([('P580', [WikidataQualifier(hash=1f8c91b2570e6f837a39a5baebf3dc1fcf5ef4d2, snak=WikidataSnak(snaktype=value, property_id=P580, snak_datatype=time, value_datatype=time, datavalue=Time(time=+1956-11-01T00:00:00Z, precision=11)))])]))
WikidataClaim(type=statement, rank=normal, mainsnak=WikidataSnak(snaktype=value, property_id=P131, snak_datatype=wikibase-item, value_datatype=wikibase-entityid, datavalue=WikibaseEntityId(id=Q1538311)), qualifiers=OrderedDict([('P580', [WikidataQualifier(hash=6940cae70ef8512392b0e62f1e5148bf1da05c47, snak=WikidataSnak(snaktype=value, property_id=P580, snak_datatype=time, value_datatype=time, datavalue=Time(time=+1949-07-01T00:00:00Z, precision=11)))]), ('P582', [WikidataQualifier(hash=134e737dfcddb40a4e25328b6e0a44d9b560384b, snak=WikidataSnak(snaktype=value, property_id=P582, snak_datatype=time, value_datatype=time, datavalue=Time(time=+1956-11-01T00:00:00Z, precision=11)))])]))
WikidataClaim(type=statement, rank=normal, mainsnak=WikidataSnak(snaktype=value, property_id=P131, snak_datatype=wikibase-item, value_datatype=wikibase-entityid, datavalue=WikibaseEntityId(id=Q150056)), qualifiers=OrderedDict([('P582', [WikidataQualifier(hash=37bcaa3fd7ae0fa53da1a79a90438cdc9175d281, snak=WikidataSnak(snaktype=value, property_id=P582, snak_datatype=time, value_datatype=time, datavalue=Time(time=+1949-07-01T00:00:00Z, precision=11)))])]))
let me know if that helps!
thanks again,
-Gabriel
from qwikidata.
Thank you )
from qwikidata.
Related Issues (9)
- Checking value types HOT 3
- Filtering the dump HOT 6
- Add python 3.5 support
- getting all claims for an items
- dump_entities_to_json fails if entities has only one member HOT 2
- How to render Time (datavalue type) HOT 1
- Exception from`return_sparql_query_results` HOT 2
- basic_json_dump.py yields: TypeError: 'list' object is not an iterator HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from qwikidata.