User:Ádám Harangozó/SPARQL

From FactGrid
Jump to navigation Jump to search

FactGrid is a vaste repository of data. Besides looking up specific items in the database, we can also get lists of items by running queries. The language of the queries is called SPARQL. You can reach this method of searching under "Query service" in the left menu. SPARQL queries are not difficult to get used to, in a way they are as easy or difficult as the question you want to ask with them.

By using SPARQL, you will be able to formulate questions like:

  • Who are all the people who lived in Gotha in the 19th century?
  • What are all the events that happened in 1889?
  • Which city is mentioned the most in the correspondence of the Illuminati?

Using the query help

Query structure

A simple query looks like this:

SELECT ?child WHERE {

  1. ?child father Bach
 ?child wdt:P141 wd:Q147798.

}

Group of Items

I want to get information about a sub-group of items which share a property.

Example all documents that are letters.


SELECT ?document ?title WHERE {

 ?book wdt:P50 wd:Q35610.
 SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }

}



  • I mant to limit this group and get information about this smaller group




  • I have a class of items (like all humans) and want to extract information from all items in this group (that is the trivial one)
  • I want to run queries on two or more groups
  • I am looking for all items that have a certain property (like a FactGrid account) and want more information about these (still easy)
  • I have a group of items and am interested in a particular property - and want this with all the qualifiers.
  • I am interested in particular qualifiers - as in all people who studied in Göttingen in the 1770s
  • I want a timeline with the different spans of time during which an organisation was active (see Q10575)
  • I want a timeline with the different names of an organisation (see Q10575)

...

Sources


Further reading