As stated in https://www.wikidata.org/wiki/Wikidata:Request_a_query/Archive/2022/02#Get_all_data_of_a_statement_with_his_ID
the current fastrun take too much time or is not efficient and force to fallback on MW API to get data.
The goal of this issue is to trace the changes needed and the methodology to quickly get specific statements in an Entity to later query all qualifiers to reconstruct a better clone of the statements (if needed).
I think we can split in two main parts :
- From a specific entity, get all the statements (property number, statement id, and value)
- From a specific statement, get all the qualifiers (and references ?)
Get all the entities
#Tool: WikibaseIntegrator wbi_fastrun._query_data
SELECT ?sid ?entity ?value ?property_type WHERE {
?entity wdt:P31 wd:Q484170;
p:P4212 ?sid.
wd:P4212 wikibase:propertyType ?property_type.
?sid ps:P4212 ?value.
}
ORDER BY (?sid)
LIMIT 100
Get all statements
SELECT ?statement_ID ?statement_ref_ID WHERE { wd:Q79160 p:P1435 ?statement_ID. }
Get all the qualifiers
From https://www.wikidata.org/wiki/Wikidata:Request_a_query/Archive/2022/02#Get_all_data_of_a_statement_with_his_ID
SELECT ?propertyLabel ?value ?statement_ID ?statement_ref_ID ?ref_propertyLabel ?ref_value with { SELECT ?statement_ID ?statement_ref_ID
WHERE
{
wd:Q79160 p:P1435 ?statement_ID.
} } as %i
WHERE
{
INCLUDE %i
?statement_ID ?predicate ?value.
?property wikibase:qualifier|wikibase:statementProperty ?predicate .
?statement_ID prov:wasDerivedFrom ?statement_ref_ID.
?statement_ref_ID ?ref_predicate ?ref_value .
?ref_property wikibase:reference ?ref_predicate .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} order by ?statement_ID ?statement_ref_ID
Get all the qualifiers of a specific statement id
SELECT ?propertyLabel ?value ?statement_ID ?ref_propertyLabel ?ref_value
WHERE
{
VALUES ?statement_ID { wds:Q42-F078E5B3-F9A8-480E-B7AC-D97778CBBEF9 }
?statement_ID ?predicate ?value.
?property wikibase:qualifier|wikibase:statementProperty ?predicate .
?statement_ID prov:wasDerivedFrom ?statement_ref_ID.
?statement_ref_ID ?ref_predicate ?ref_value .
?ref_property wikibase:reference ?ref_predicate .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} order by ?statement_ID
As stated in https://www.wikidata.org/wiki/Wikidata:Request_a_query/Archive/2022/02#Get_all_data_of_a_statement_with_his_ID
the current fastrun take too much time or is not efficient and force to fallback on MW API to get data.
The goal of this issue is to trace the changes needed and the methodology to quickly get specific statements in an Entity to later query all qualifiers to reconstruct a better clone of the statements (if needed).
I think we can split in two main parts :
Get all the entities
Get all statements
Get all the qualifiers
From https://www.wikidata.org/wiki/Wikidata:Request_a_query/Archive/2022/02#Get_all_data_of_a_statement_with_his_ID
Get all the qualifiers of a specific statement id