SPARQL examples

From Dariah-Lab
Revision as of 14:26, 16 May 2022 by Gmyrda@ihpan.edu.pl (talk | contribs) (Poprawa błędnego URLa)
Jump to navigation Jump to search

This page is parsed by the web interface of the query service to fill the query example dialog.


Institutions

  SELECT ?institution ?institutionLabel 
  WHERE
  {
      ?institution wdt:P47 wd:Q467. # instance of Institution
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  }

Try it!

Humans

#Lists all humans with values of selected fields
SELECT ?human ?humanLabel ?fatherLabel ?motherLabel ?date_of_birth WHERE {
  ?human wdt:P47 wd:Q32.
  OPTIONAL { ?human wdt:P66 ?father. }
  OPTIONAL { ?human wdt:P68 ?mother. }
  OPTIONAL { ?human wdt:P7 ?date_of_birth. }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

Try it!

Humans without parents

#Lists all humans without parents
SELECT ?human ?humanLabel WHERE {
  ?human wdt:P47 wd:Q32. #find humans
  MINUS {
    ?human wdt:P68 [] . # without father
    ?human wdt:P66 [] . # without mother
    ?human wdt:P65 [] . # without any unspecified parent
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

Try it!


Elements from Bogumiłowice

SELECT ?item ?itemLabel WHERE {
  ?item wdt:P30 wd:Q24. # element posiada właściwość miejsca i ta właściwość ma wartość Bogumiłowice
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

Try it!