FactGrid:Sample queries: Difference between revisions

From FactGrid
Jump to navigation Jump to search
Line 77: Line 77:


== Grammatically intricate searches ==
== Grammatically intricate searches ==
=== Wimimedia sources ===
* [https://database.factgrid.de/query/#SELECT%20%3Fplace%20%3FplaceLabel%20%3Flink%20WHERE%20%7B%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22.%20%7D%0A%20%20%3Fplace%20wdt%3AP2%20wd%3AQ8.%0A%20%20%3Flink%20schema%3Aabout%20%3Fplace%20%3B%20schema%3AisPartOf%20%3Chttps%3A%2F%2Fwww.wikidata.org%2F%3E%20.%0A%7D all places - with their respective Wikidata numbers]
* [https://database.factgrid.de/query/#SELECT%20%3Fplace%20%3FplaceLabel%20%3Flink%20WHERE%20%7B%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22.%20%7D%0A%20%20%3Fplace%20wdt%3AP2%20wd%3AQ8.%0A%20%20%3Flink%20schema%3Aabout%20%3Fplace%20%3B%20schema%3AisPartOf%20%3Chttps%3A%2F%2Fwww.wikidata.org%2F%3E%20.%0A%7D all places - with their respective Wikidata numbers]
=== Statements with sources ===
* [https://database.factgrid.de/query/#%23Content%20of%20a%20reference%20for%20a%20specific%20statement%0A%23%20See%20also%20the%20SPARQL%20manual%0A%23%20https%3A%2F%2Fen.wikibooks.org%2Fwiki%2FSPARQL%2FWIKIDATA_Qualifiers%2C_References_and_Ranks%0A%23%20In%20this%20example%20we%20look%20for%20statements%20which%20assign%20a%20specific%20value%20%28Q38779%29%0A%23%20to%20the%20property%20P91%20and%20then%20look%20for%20references%20of%20that%20property%2C%20specifically%0A%23%20the%20string%20associated%20to%20P51%20for%20the%20reference.%20May%20actually%20bring%20up%20references%0A%23%20for%20other%20P1343%20statements%3B%20uses%20the%20shortened%20expression%20syntax%20with%20brackets.%0ASELECT%20%3Fitem%20%3FitemLabel%20%3Freference%20%3FreferenceLabel%20WHERE%20%7B%0A%20%20%3Fitem%20p%3AP91%20%3FpNode.%0A%20%20%3FpNode%20ps%3AP91%20wd%3AQ10677%3B%0A%20%20%20%20prov%3AwasDerivedFrom%20%3Freferences.%0A%20%20%3Freferences%20pr%3AP51%20%3Freference.%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22.%20%7D%0A%7D Member of the Illuminati, state the primary document reference that we have for this statement]
* [https://database.factgrid.de/query/#%23Content%20of%20a%20reference%20for%20a%20specific%20statement%0A%23%20See%20also%20the%20SPARQL%20manual%0A%23%20https%3A%2F%2Fen.wikibooks.org%2Fwiki%2FSPARQL%2FWIKIDATA_Qualifiers%2C_References_and_Ranks%0A%23%20In%20this%20example%20we%20look%20for%20statements%20which%20assign%20a%20specific%20value%20%28Q38779%29%0A%23%20to%20the%20property%20P91%20and%20then%20look%20for%20references%20of%20that%20property%2C%20specifically%0A%23%20the%20string%20associated%20to%20P51%20for%20the%20reference.%20May%20actually%20bring%20up%20references%0A%23%20for%20other%20P1343%20statements%3B%20uses%20the%20shortened%20expression%20syntax%20with%20brackets.%0ASELECT%20%3Fitem%20%3FitemLabel%20%3Freference%20%3FreferenceLabel%20WHERE%20%7B%0A%20%20%3Fitem%20p%3AP91%20%3FpNode.%0A%20%20%3FpNode%20ps%3AP91%20wd%3AQ10677%3B%0A%20%20%20%20prov%3AwasDerivedFrom%20%3Freferences.%0A%20%20%3Freferences%20pr%3AP51%20%3Freference.%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22.%20%7D%0A%7D Member of the Illuminati, state the primary document reference that we have for this statement]
* [https://database.factgrid.de/query/index.html#SELECT%20%3Fitem%20%3FitemLabel%20%3FitemDescription%20%3FVater%20%3FVaterLabel%20%3FBildung_Vater%20%3FBildung_VaterLabel%20%3FBeruf_Vater%20%3FBeruf_VaterLabel%20%3FMutter%20%3FMutterLabel%20%3FMutters_Vater%20%3FMutters_VaterLabel%20%3FBildung_Mutters_Vater%20%3FBildung_Mutters_VaterLabel%20%3FBeruf_Mutters_Vater%20%3FBeruf_Mutters_VaterLabel%20WHERE%20%7B%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22de%22.%20%7D%0A%20%20%3Fitem%20wdt%3AP160%20wd%3AQ23295%3B%0A%20%20%20%20wdt%3AP141%20%3FVater.%0A%20%20%3FVater%20wdt%3AP160%20%3FBildung_Vater%3B%0A%20%20%20%20wdt%3AP165%20%3FBeruf_Vater.%0A%20%20OPTIONAL%20%7B%20%3Fitem%20wdt%3AP142%20%3FMutter.%0A%20%20%20%20%20%20%20%20%20%20%20%3FMutter%20wdt%3AP141%20%3FMutters_Vater.%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3FMutters_Vater%20wdt%3AP160%20%3FBildung_Mutters_Vater%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20wdt%3AP165%20%3FBeruf_Mutters_Vater.%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20%20%20%20%7D%0A%7D The graduates of Gotha's Gymnasium Illustre/Ernestinum: their fathers with career information, their mothers and the fathers of the mothers (i.e. maternal grandfathers) with the respective career information]] The search is intricate as it goes into related database objects and brings information located there into the table.
 
=== Get information from connected items ===
* [https://database.factgrid.de/query/index.html#SELECT%20%3Fitem%20%3FitemLabel%20%3FitemDescription%20%3FVater%20%3FVaterLabel%20%3FBildung_Vater%20%3FBildung_VaterLabel%20%3FBeruf_Vater%20%3FBeruf_VaterLabel%20%3FMutter%20%3FMutterLabel%20%3FMutters_Vater%20%3FMutters_VaterLabel%20%3FBildung_Mutters_Vater%20%3FBildung_Mutters_VaterLabel%20%3FBeruf_Mutters_Vater%20%3FBeruf_Mutters_VaterLabel%20WHERE%20%7B%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22de%22.%20%7D%0A%20%20%3Fitem%20wdt%3AP160%20wd%3AQ23295%3B%0A%20%20%20%20wdt%3AP141%20%3FVater.%0A%20%20%3FVater%20wdt%3AP160%20%3FBildung_Vater%3B%0A%20%20%20%20wdt%3AP165%20%3FBeruf_Vater.%0A%20%20OPTIONAL%20%7B%20%3Fitem%20wdt%3AP142%20%3FMutter.%0A%20%20%20%20%20%20%20%20%20%20%20%3FMutter%20wdt%3AP141%20%3FMutters_Vater.%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3FMutters_Vater%20wdt%3AP160%20%3FBildung_Mutters_Vater%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20wdt%3AP165%20%3FBeruf_Mutters_Vater.%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20%20%20%20%7D%0A%7D The graduates of Gotha's Gymnasium Illustre/Ernestinum: their fathers with career information, their mothers and the fathers of the mothers (i.e. maternal grandfathers) with the respective career information]] The search is intricate as it goes into related database objects and brings information located there into the table.
 
=== Search for specific Qualifiers on a Statement ===
* [https://tinyurl.com/y2w3aa5s Authors writing all kind of satires]
* [https://tinyurl.com/yxbtatbw Authors writing satire and all its subclasses] (you just add /wdt:P3* to pq:P122)
* [https://tinyurl.com/y3ktcf38 The people writing all kind of satires (not necessarily authors)] (very simple: remove ps:P165 wd:Q23190)
 
=== You already know one related value ===
* [https://database.factgrid.de/query/#SELECT%20DISTINCT%20%3Flodge%20%3FlodgeLabel%20%3Fbegin%20%3Fend%20%3Fgeo%0AWHERE%0A%7B%0A%20%20%20%20VALUES%20%3Fterritory%20%7Bwd%3AQ176240%7D%0A%20%20%20%20%3Flodge%20wdt%3AP2%20wd%3AQ11211%20.%0A%20%20%20%20%3Flodge%20wdt%3AP83%20%3Fplace%20.%0A%20%20%20%20%3Fplace%20wdt%3AP297%20%3Fterritory%20.%0A%20%20%20%20%3Flodge%20wdt%3AP49%20%3Fbegin.%0A%20%20%20%20%3Flodge%20wdt%3AP49%20%3Fend.%0A%20%20%20%20%3Fplace%20wdt%3AP48%20%3Fgeo%0A%20%20%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22en%22%20%7D%0A%7D%0AORDER%20BY%20%3Fbegin all the lodges of Saint Domingue/Haiti] the intricate part is, that the lodges only have information on places, the places have information on the territorial affiliation - we ask for Q176240 (Haiti) as the must have value. The bracket can also have more countries.
* [https://database.factgrid.de/query/#SELECT%20DISTINCT%20%3Flodge%20%3FlodgeLabel%20%3Fbegin%20%3Fend%20%3Fgeo%0AWHERE%0A%7B%0A%20%20%20%20VALUES%20%3Fterritory%20%7Bwd%3AQ176240%7D%0A%20%20%20%20%3Flodge%20wdt%3AP2%20wd%3AQ11211%20.%0A%20%20%20%20%3Flodge%20wdt%3AP83%20%3Fplace%20.%0A%20%20%20%20%3Fplace%20wdt%3AP297%20%3Fterritory%20.%0A%20%20%20%20%3Flodge%20wdt%3AP49%20%3Fbegin.%0A%20%20%20%20%3Flodge%20wdt%3AP49%20%3Fend.%0A%20%20%20%20%3Fplace%20wdt%3AP48%20%3Fgeo%0A%20%20%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22en%22%20%7D%0A%7D%0AORDER%20BY%20%3Fbegin all the lodges of Saint Domingue/Haiti] the intricate part is, that the lodges only have information on places, the places have information on the territorial affiliation - we ask for Q176240 (Haiti) as the must have value. The bracket can also have more countries.



Revision as of 11:25, 10 May 2022

Help:



Looking for people

  • Search all people of the same family name, sort by given names, state everyone with information about life dates and family details. Table
  • Name of people who ever were a residents of place with basic personal information. Table

Looking for documents

  • All documents written by N.N. with corresponding documents. Table
  • All documents sent to N.N. with corresponding documents. Table
  • All documents mentioning N.N. with corresponding documents. Table
  • All documents of a file listed in sequence. Table
  • All documents sent from (place) by date. Table
  • All documents of a specific archive and research interest by date. Table

Maps

Dots

Lines

Tables

  • no functional query yet, but a first attempt is here, modeled after the "academic tree" graph in Scholia's author aspect

Graphs

Timelines

Statistics

Grammatically intricate searches

Wimimedia sources

Statements with sources

Get information from connected items

Search for specific Qualifiers on a Statement

You already know one related value

  • all the lodges of Saint Domingue/Haiti the intricate part is, that the lodges only have information on places, the places have information on the territorial affiliation - we ask for Q176240 (Haiti) as the must have value. The bracket can also have more countries.


Looking for a statement - give it with all the qualifying statements

This search is especially useful if the data model needs to be changed. It searches the database for a particular statement and gives all the instances with the respective qualifying sub-statements:

SELECT * WHERE {
  ?s wdt:P2 wd:Q7.
  ?s p:P266 ?st. # ?s is the the statement node
  ?st ps:P266 ?o. # that simulates the predicate
  ?st ?qualifier ?value. # this is an attribute (a qualifier)
}

Filters

Wishful thinking

Notes

  1. Adapted from here.