FactGrid:Sample queries: Difference between revisions

From FactGrid
Jump to navigation Jump to search
Line 70: Line 70:
[[File:Age at death of all FacGrid humans.JPG|thumb|right|200px|[https://tinyurl.com/yhzquxwf Age at death of all Human beings (Q7) noted on FactGrid, statistical distribution]]]
[[File:Age at death of all FacGrid humans.JPG|thumb|right|200px|[https://tinyurl.com/yhzquxwf Age at death of all Human beings (Q7) noted on FactGrid, statistical distribution]]]
* [https://database.factgrid.de/query/embed.html#%23defaultView%3ABubbleChart%0ASELECT%20%3FSectorLabel%20(count(distinct(%3FA))%20as%20%3Fcount)%20WHERE%20%7B%0A%20%20%0A%20%20SELECT%20%3FA%20%3FALabel%20%3FADescription%20%3Ffamily_nameLabel%20%3FEntry%20%3FBnF_ID%20%3FDate_of_birth%20%3FSector%20%3FSectorLabel%20WHERE%20%7B%0A%20%20%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22en%22.%20%7D%0A%20%20%20%20%3FA%20wdt%3AP91%20wd%3AQ11161.%0A%20%20%20%20%3FA%20wdt%3AP165%20%3FOccupation.%20%0A%20%20%20%20%3FOccupation%20wdt%3AP626%20%3FSector.%0A%7D%0A%20%20%0A%20%20%7D%20group%20by%20%3FSectorLabel The members of Frankfurt's Union-Lodge, branches of occupation, bubble chart]
* [https://database.factgrid.de/query/embed.html#%23defaultView%3ABubbleChart%0ASELECT%20%3FSectorLabel%20(count(distinct(%3FA))%20as%20%3Fcount)%20WHERE%20%7B%0A%20%20%0A%20%20SELECT%20%3FA%20%3FALabel%20%3FADescription%20%3Ffamily_nameLabel%20%3FEntry%20%3FBnF_ID%20%3FDate_of_birth%20%3FSector%20%3FSectorLabel%20WHERE%20%7B%0A%20%20%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22en%22.%20%7D%0A%20%20%20%20%3FA%20wdt%3AP91%20wd%3AQ11161.%0A%20%20%20%20%3FA%20wdt%3AP165%20%3FOccupation.%20%0A%20%20%20%20%3FOccupation%20wdt%3AP626%20%3FSector.%0A%7D%0A%20%20%0A%20%20%7D%20group%20by%20%3FSectorLabel The members of Frankfurt's Union-Lodge, branches of occupation, bubble chart]
* [https://database.factgrid.de/query/index.html#%23defaultView%3ABubbleChart%0ASELECT%20%3FGenderLabel%20%28count%28distinct%28%3FA%29%29%20as%20%3Fcount%29%20WHERE%20%7B%0A%20%20%0A%20%20SELECT%20%3FA%20%3FALabel%20%3FADescription%20%3Ffamily_nameLabel%20%3FEntry%20%3FBnF_ID%20%3FDate_of_birth%20%3FGender%20%3FGenderLabel%20WHERE%20%7B%0A%20%20%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22en%22.%20%7D%0A%20%20%20%20%3FA%20wdt%3AP300%20wd%3AQ255080.%0A%20%20%20%20OPTIONAL%20%7B%20%3FA%20%28p%3AP300%2Fpq%3AP49%29%20%3FEntry.%20%7D%0A%20%20%20%20OPTIONAL%20%7B%20%3FA%20wdt%3AP247%20%3Ffamily_name.%20%7D%0A%20%20%20%20%3FA%20wdt%3AP154%20%3FGender.%20%0A%7D%0A%20%20%0A%20%20%7D%20group%20by%20%3FGenderLabel The distribution of males and females who became followers of the early 18th-century "French Prophets"]
* [https://database.factgrid.de/query/index.html#%23defaultView%3ABarChart%0ASELECT%20%3FGenderLabel%20%28count%28distinct%28%3FA%29%29%20as%20%3Fcount%29%20WHERE%20%7B%0A%20%20%0A%20%20SELECT%20%3FA%20%3FALabel%20%3FADescription%20%3Ffamily_nameLabel%20%3FEntry%20%3FBnF_ID%20%3FDate_of_birth%20%3FGender%20%3FGenderLabel%20WHERE%20%7B%0A%20%20%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22en%22.%20%7D%0A%20%20%20%20%3FA%20wdt%3AP300%20wd%3AQ255080.%0A%20%20%20%20OPTIONAL%20%7B%20%3FA%20%28p%3AP300%2Fpq%3AP49%29%20%3FEntry.%20%7D%0A%20%20%20%20OPTIONAL%20%7B%20%3FA%20wdt%3AP247%20%3Ffamily_name.%20%7D%0A%20%20%20%20%3FA%20wdt%3AP154%20%3FGender.%20%0A%7D%0A%20%20%0A%20%20%7D%20group%20by%20%3FGenderLabel Followers of the "French Prophets", gender ratio, bar chart]
* [https://database.factgrid.de/query/index.html#%23defaultView%3ABubbleChart%0ASELECT%20%3FReligionLabel%20%28count%28distinct%28%3FA%29%29%20as%20%3Fcount%29%20WHERE%20%7B%0A%20%20%0A%20%20SELECT%20%3FA%20%3FALabel%20%3FADescription%20%3Ffamily_nameLabel%20%3FEntry%20%3FBnF_ID%20%3FDate_of_birth%20%3FReligion%20%3FReligionLabel%20WHERE%20%7B%0A%20%20%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22en%22.%20%7D%0A%20%20%20%20%3FA%20wdt%3AP300%20wd%3AQ255080.%0A%20%20%20%20OPTIONAL%20%7B%20%3FA%20%28p%3AP300%2Fpq%3AP49%29%20%3FEntry.%20%7D%0A%20%20%20%20OPTIONAL%20%7B%20%3FA%20wdt%3AP247%20%3Ffamily_name.%20%7D%0A%20%20%20%20%3FA%20wdt%3AP172%20%3FReligion.%20%0A%7D%0A%20%20%0A%20%20%7D%20group%20by%20%3FReligionLabel Adherents of the French Prophets and their religious affiliation]
* [https://database.factgrid.de/query/index.html#%23defaultView%3ABubbleChart%0ASELECT%20%3FReligionLabel%20%28count%28distinct%28%3FA%29%29%20as%20%3Fcount%29%20WHERE%20%7B%0A%20%20%0A%20%20SELECT%20%3FA%20%3FALabel%20%3FADescription%20%3Ffamily_nameLabel%20%3FEntry%20%3FBnF_ID%20%3FDate_of_birth%20%3FReligion%20%3FReligionLabel%20WHERE%20%7B%0A%20%20%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22en%22.%20%7D%0A%20%20%20%20%3FA%20wdt%3AP300%20wd%3AQ255080.%0A%20%20%20%20OPTIONAL%20%7B%20%3FA%20%28p%3AP300%2Fpq%3AP49%29%20%3FEntry.%20%7D%0A%20%20%20%20OPTIONAL%20%7B%20%3FA%20wdt%3AP247%20%3Ffamily_name.%20%7D%0A%20%20%20%20%3FA%20wdt%3AP172%20%3FReligion.%20%0A%7D%0A%20%20%0A%20%20%7D%20group%20by%20%3FReligionLabel Adherents of the French Prophets and their religious affiliation]
* [https://database.factgrid.de/query/index.html#%23defaultView%3ABubbleChart%0ASELECT%20%3FSpracheLabel%20%28count%28distinct%28%3Fitem%29%29%20as%20%3Fcount%29%20WHERE%20%7B%0A%0ASELECT%20%3Fitem%20%3FitemLabel%20%3FFamiliennameLabel%20%3FitemDescription%20%3FGeschlechtLabel%20%3FSpracheLabel%20%3FFactGrid_Benutzerseite%20%3FDate%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%20OPTIONAL%20%7B%20%3Fitem%20wdt%3AP163%20%3FFactGrid_Benutzerseite.%20%7D%0A%20%20OPTIONAL%20%7B%20%3Fitem%20%28p%3AP163%2Fpq%3AP49%29%20%3FDate.%20%7D%0A%20%20OPTIONAL%20%7B%20%3Fitem%20wdt%3AP154%20%3FGeschlecht.%20%7D%0A%20%20OPTIONAL%20%7B%20%3Fitem%20wdt%3AP247%20%3FFamilienname.%20%7D%0A%20%20OPTIONAL%20%7B%20%3Fitem%20wdt%3AP460%20%3FSprache.%20%7D%0A%7D%0AORDER%20BY%20%28%3FFamiliennameLabel%29%0A%20%20%0A%20%20%20%20%7D%20group%20by%20%3FSpracheLabel Those with a FactGrid account - first languages]
* [https://database.factgrid.de/query/index.html#%23defaultView%3ABubbleChart%0ASELECT%20%3FSpracheLabel%20%28count%28distinct%28%3Fitem%29%29%20as%20%3Fcount%29%20WHERE%20%7B%0A%0ASELECT%20%3Fitem%20%3FitemLabel%20%3FFamiliennameLabel%20%3FitemDescription%20%3FGeschlechtLabel%20%3FSpracheLabel%20%3FFactGrid_Benutzerseite%20%3FDate%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%20OPTIONAL%20%7B%20%3Fitem%20wdt%3AP163%20%3FFactGrid_Benutzerseite.%20%7D%0A%20%20OPTIONAL%20%7B%20%3Fitem%20%28p%3AP163%2Fpq%3AP49%29%20%3FDate.%20%7D%0A%20%20OPTIONAL%20%7B%20%3Fitem%20wdt%3AP154%20%3FGeschlecht.%20%7D%0A%20%20OPTIONAL%20%7B%20%3Fitem%20wdt%3AP247%20%3FFamilienname.%20%7D%0A%20%20OPTIONAL%20%7B%20%3Fitem%20wdt%3AP460%20%3FSprache.%20%7D%0A%7D%0AORDER%20BY%20%28%3FFamiliennameLabel%29%0A%20%20%0A%20%20%20%20%7D%20group%20by%20%3FSpracheLabel Those with a FactGrid account - first languages]

Revision as of 14:48, 23 June 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

Filter based on strings

Filtering results containing certain strings (texts) can be archieved with `FILTER()`

SPARQL patterns for reuse

Count properties

Get all properties of an item

SELECT ?p ?o WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  wd:Q406029 ?p ?o
 }

count statements per item within a certain project

or within any other property-object relation

 SELECT DISTINCT ?item ?itemLabel ?statementcount WHERE {
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
   # change property item relation
   ?item wdt:P131 wd:Q400012 .
   ?item wikibase:statements ?statementcount.
 }

Wishful thinking

Notes

  1. Adapted from here.