ProjetPP / WikibaseEntityStore

NOT SUPPORTED ANYMORE - persistant storage for Wikibase entities
GNU General Public License v2.0
7 stars 4 forks source link

Question: usage of Ask queries #9

Open JeroenDeDauw opened 9 years ago

JeroenDeDauw commented 9 years ago

I'm wondering what the intend behind the Ask Query support is. As far as I can tell, right now nothing is actually using this. (I checked this repo and PPP-Wikidata.) How will the queries be exposed to the user? No GUI and no human writeable format exist for this implementation of the Ask language at present.

Tpt commented 9 years ago

The goal is to use Ask Queries in the PPP-Wikidata module in order to be able to use as backends WikidataQuery or the query capacities of the MongoDB-based store (in order to have both fast queries for the askplatyp.us instance and slow but easy to setup ones for development environments).

The choice of Ask Queries have been done in order to be able to switch easily to the Wikidata API instead of WikidataQuery when simple queries feature will be deployed.

It is not planned to be directly exposed to the user (but indirectly thought the use of power user input https://projetpp.github.io/demo.html#power-user-input ).

JeroenDeDauw commented 9 years ago

So you will have some parser that turns this power user input into Ask objects?

Tpt commented 9 years ago

Yes. The current implementation turns a part of this input into WikidataQuery query language: https://github.com/ProjetPP/PPP-Wikidata/blob/2b69df242f51f64a1061607e4f7a401df257a3eb/src/TreeSimplifier/MissingSubjectTripleNodeSimplifier.php#L122

The goal is to use Ask instead of WikidataQuery language in order to able to use easily different backends (WikidataQuery, MongoDB store, maybe the Wikidata API in the future...).

JeroenDeDauw commented 9 years ago

I'm curious about turning this more expressive query language into Ask. What will you do with things that cannot be expressed in Ask? Will you support answering them in some other way?

Tpt commented 9 years ago

I believe that the power user's language implemented by the PPP-Wikidata module has only one feature that Ask do not support: the ability to find the value for a given property in a given entity like find the "birth date" of "Barack Obama" (in the language: (Barack Obama, birth date, ?)).

Example of query that may be done with this operation: "Who are the people that are born at the same place as a president of the United States?" (in power user's language (?, birth place, ((?, position held, President of the United States of America), birth place, ?)).

The current implementation of the PPP-Wikidata module does Ask queries for each parts that is compound only of union, intersection and (a, b, ?) triples (like (?, office held, president of the U.S.) ∪ (?, position held, president of France) and resolve "by hand" all the triples (a, b, ?) (i.e. retrieve the items in a and get the best statements with a property in b).

JeroenDeDauw commented 9 years ago

Thanks for your answer.

Related question: it seems that the current Mono based implementation can only do strict equality matching. Do you not need non-strict equality, greater than, etc? And are there plans to add support for those?

Tpt commented 9 years ago

Do you not need non-strict equality, greater than, etc?

Yes, currently I have no need for them. But it may change in the future (if, for example, I want to do range queries for dates).

And are there plans to add support for those?

Currently not as it would mean to change the internal storage format (the sclaims field is optimized for equality searches).