Open main menu

Symac

Joined 24 November 2012

Find me on French WP, mainly working there with my bot.

Revue LeavesEdit

SPARQLEdit

Docteurs Honoris Causa avec leur université de rattachement

SELECT ?person ?personLabel ?universityLabel
WHERE 
{
  ?person p:P166 ?distinction.
  ?distinction ps:P166 wd:Q209896 .
  ?distinction pq:P1027 ?university
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
order by ?universityLabel

Try it!


Wikidata items for writers with more than one interwiki and without a ICAO airport code (P239) :

SELECT distinct ?s ?writer ?sitelink ?linkcount
WHERE
{
  {?s wdt:P106 wd:Q36180 .} UNION { ?s wdt:P106 wd:Q482980 . } UNION { ?s wdt:P106 wd:Q49757 . }
  ?s wdt:P27 wd:Q142 .
  ?s wikibase:sitelinks ?linkcount .
  { ?sitelink schema:about ?s . ?sitelink schema:inLanguage "fr" . ?sitelink schema:isPartOf <https://fr.wikipedia.org/> .}
  MINUS { ?s wdt:P269 [] } .
  OPTIONAL {
     ?s rdfs:label ?writer filter (lang(?writer) = "fr").
   }
} GROUP BY ?s ?writer ?sitelink ?linkcount HAVING (?linkcount > 1) ORDER BY DESC(?linkcount)

Try it!


Parents that are not linked back from their child's page.

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wd: <http://www.wikidata.org/entity/> 
PREFIX wdt: <http://www.wikidata.org/prop/direct/>

SELECT ?son ?sonLabel ?parent ?parentLabel WHERE {
	{?son wdt:P25 ?parent}
  	UNION
  	{?son wdt:P22 ?parent}
	FILTER
	(
      NOT EXISTS{?parent wdt:P40 ?son}
	) 
   SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en" .
   }
 }

Try it!


Living people with a wikipedia article (to debug)

prefix schema: <http://schema.org/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wd: <http://www.wikidata.org/entity/> 
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
SELECT (count(distinct ?p) as ?numberOfHumans) WHERE {
	?p wdt:P31 wd:Q5 .
	?p wdt:P569 ?date .
    ?page schema:about ?p
	OPTIONAL {?p wdt:P570 ?d } .
	FILTER (?date > "1900-01-01T00:00:00Z"^^xsd:dateTime)
	FILTER (!bound(?d))
}

Try it!


French writer born after 1800 and without a Bibliothèque nationale de France ID (P268) :

SELECT distinct ?s ?writer ?born ?linkcount
WHERE
{
  {?s wdt:P106 wd:Q36180 .} UNION { ?s wdt:P106 wd:Q482980 . } UNION { ?s wdt:P106 wd:Q49757 . }
  ?s wdt:P27 wd:Q142 .
  ?s wikibase:sitelinks ?linkcount .
  MINUS { ?s wdt:P268 [] }.
  ?s wdt:P569 ?born .
  FILTER (?born >= "1800-01-01T00:00:00Z"^^xsd:dateTime) .
  OPTIONAL {
     ?s rdfs:label ?writer filter (lang(?writer) = "fr").
   }
} GROUP BY ?s ?writer ?born ?linkcount HAVING (?linkcount > 1) ORDER BY DESC(?linkcount)

Try it!


Actor that are in the distribution of a movie that was published before they were born :

SELECT ?actor ?actorLabel ?movie ?movieLabel ?dob ?age WHERE {
  {
    SELECT ?actor ?dob {
		?dob_node wikibase:timePrecision "11"^^xsd:integer . 
        ?dob_node wikibase:timeValue ?dob . 
		?actor p:P569/psv:P569 ?dob_node . 
    }
  }
  ?actor wdt:P21 ?genre .
  ?actor wdt:P106 wd:Q33999 .
  ?actor wdt:P27 wd:Q142 .
  ?movie wdt:P161 ?actor .
  ?movie wdt:P577 ?dateMovie .
  BIND(YEAR(?dateMovie)-YEAR(?dob) as ?age) . 
  FILTER(?age < 0) .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],fr". }
}

Try it!