Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve fastrun query #316

Open
4 tasks
LeMyst opened this issue Apr 14, 2022 · 0 comments · May be fixed by #333
Open
4 tasks

Improve fastrun query #316

LeMyst opened this issue Apr 14, 2022 · 0 comments · May be fixed by #333
Labels
enhancement New feature or request help wanted Extra attention is needed v0.13+

Comments

@LeMyst
Copy link
Owner

LeMyst commented Apr 14, 2022

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).

  • Add case insentive mode
  • Add quantity unit support
  • Add geocoordinate precision and globe support
  • Add time precision, timezone and calendar support

I think we can split in two main parts :

  1. From a specific entity, get all the statements (property number, statement id, and value)
  2. 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
@LeMyst LeMyst added enhancement New feature or request help wanted Extra attention is needed v0.12.x labels Apr 14, 2022
@LeMyst LeMyst added this to the 0.12 milestone Apr 14, 2022
@LeMyst LeMyst removed this from the 0.12 milestone May 7, 2022
@LeMyst LeMyst added v0.13+ and removed v0.12.x labels May 7, 2022
@LeMyst LeMyst linked a pull request May 28, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed v0.13+
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant