Page MenuHomePhabricator
Paste P8462

Example queries for WDQS testing
ActivePublic

Authored by Smalyshev on Apr 30 2019, 11:09 PM.
Tags
None
Referenced Files
F28929706: raw.txt
May 5 2019, 2:53 AM
F28925855: raw.txt
May 4 2019, 7:55 AM
F28875597: raw.txt
Apr 30 2019, 11:09 PM
Subscribers
None
SELECT ?item WHERE {
?item wdt:P31 wd:Q11879590 .
FILTER NOT EXISTS {
?item wdt:P31 wd:Q4167410
}
OPTIONAL {
?item schema:description ?des .
FILTER ((LANG(?des)) = "ar")
}
FILTER (!BOUND(?des))
}
LIMIT 5000
================
SELECT ?l ?lemma ?posLabel WHERE {
?l a ontolex:LexicalEntry ;
dct:language ?language ;
wikibase:lemma ?lemma .
?language wdt:P424 'fr' .
OPTIONAL {
?l wikibase:lexicalCategory ?pos .
SERVICE wikibase:label
{
bd:serviceParam wikibase:language "en" .
}
}
FILTER NOT EXISTS {
?l ontolex:sense ?sense
}
}
ORDER BY ?lemma
================
SELECT ?ville ?b WHERE {
?ville wdt:P31 wd:Q515 .
?ville rdfs:label ?b .
FILTER (?b = "Paris"@fr)
}
LIMIT 100
================
SELECT DISTINCT ?city ?cityLabel ?location ?populatie2 WHERE {
wd:Q9832 wdt:P1082 ?populatie .
?city wdt:P1082 ?populatie2 ;
wdt:P625 ?location .
FILTER (ABS(?populatie - ?populatie2) < 1000) SERVICE wikibase:label
{
bd:serviceParam wikibase:language "en,nl"
}
}
====================
PREFIX wikibase: <http://wikiba.se/ontology>
SELECT DISTINCT ?property ?label {
{
SELECT ?property ?label WHERE
{
?property a wikibase:Property ;
rdfs:label ?label
FILTER (LANG(?label) = "en") .
FILTER (CONTAINS(LCASE(?label) , LCASE("software")))
}
}
UNION {
SELECT ?property ?label WHERE
{
[ rdfs:label ?ilabel ] wdt:P1963 ?property .
?property rdfs:label ?label
FILTER (LANG(?label) = "en") .
FILTER (LANG(?ilabel) = "en" && CONTAINS(LCASE(?ilabel) , LCASE("software")))
}
}
UNION {
SELECT DISTINCT ?property ?label WHERE
{
?property a wikibase:Property ;
wdt:P31 [ rdfs:label ?ilabel ] ;
rdfs:label ?label
FILTER (LANG(?label) = "en") .
FILTER (LANG(?ilabel) = "en" && CONTAINS(LCASE(?ilabel) , LCASE("software")))
}
}
}
ORDER BY ?label
================
SELECT ?item ?itemLabel ?dod ?fecha_de_nacimiento ?sexo_o_g_nero ?pa_s_de_nacionalidad ?modified WHERE {
?item wdt:P570 ?dod .
?item wdt:P31 wd:Q5 .
?item schema:dateModified ?modified SERVICE wikibase:label
{
bd:serviceParam wikibase:language "es,en,it,fr,de,cs" .
}
OPTIONAL {
?item wdt:P569 ?fecha_de_nacimiento .
}
OPTIONAL {
?item wdt:P21 ?sexo_o_g_nero .
}
FILTER (?dod > "2017-12-31T00:00:00Z"^^xsd:dateTime)
FILTER (?dod < (NOW ()))
FILTER (?modified > "2019-03-05T00:00:00Z"^^xsd:dateTime) OPTIONAL {
?item wdt:P27 ?pa_s_de_nacionalidad .
}
}
ORDER BY DESC(?modified) DESC(?dod) ?item
====================
SELECT ?botanist ?abbrev ?botanistLabel ?articleEn ?articleFr WHERE {
?botanist wdt:P428 ?abbrev .
OPTIONAL {
?articleEn schema:about ?botanist .
FILTER (SUBSTR(STR(?articleEn) , 1 , 25) = "https://en.wikipedia.org/")
}
OPTIONAL {
?articleFr schema:about ?botanist .
FILTER (SUBSTR(STR(?articleFr) , 1 , 25) = "https://fr.wikipedia.org/")
}
SERVICE wikibase:label
{
bd:serviceParam wikibase:language "fr,en,en" .
}
}
====================
SELECT DISTINCT ?entity ?wikiUrl ?gender ?birth_date ?death_date ?birth_place ?birth_country_code WHERE {
?wikiUrl schema:about ?entity ;
rdf:type schema:Article ;
schema:isPartOf / wikibase:wikiGroup "wikipedia" ;
schema:name "Dav Pilkey"@en .
?entity wdt:P460 * / wdt:P31 / wdt:P279 * wd:Q5 .
OPTIONAL {
?entity wdt:P569 ?birth_date
}
OPTIONAL {
?entity wdt:P570 ?death_date
}
OPTIONAL {
?entity wdt:P21 ?gender_entity .
BIND (IF(?gender_entity = wd:Q6581097 , "M" , IF(?gender_entity = wd:Q6581072 , "F" , "")) AS ?gender)
}
OPTIONAL {
?entity wdt:P19 / rdfs:label ?birth_place .
FILTER (LANG(?birth_place) = 'en')
}
OPTIONAL {
?entity wdt:P19 * / wdt:P17 / wdt:P297 ?birth_country_code
}
}
====================
ELECT DISTINCT ?species ?taxid ?gene ?gene_id WHERE {
VALUES ?taxid
{
"9606"
}
VALUES ?gene_id
{
"A1CF"@en "A1CF"
}
?gene rdfs:label | wdt:P2393 ?gene_id .
{
?gene wdt:P703 ?species .
}
UNION {
?gene wdt:P703 ?species2 .
?species2 wdt:P460 ?species .
}
?species wdt:P685 ?taxid .
}
====================
SELECT DISTINCT ?item {
?item (wdt:P570) ?time0 .
FILTER (?time0 >= "365-01-01T00:00:00Z"^^xsd:dateTime && ?time0 <= "365-12-31T23:59:59Z"^^xsd:dateTime)
}
====================
SELECT ?entityLabel ?date ?url WHERE {
?entity wdt:P569 ?date .
?entity wdt:P485 wd:Q814779 .
?entity p:P485 ?statement .
?statement prov:wasDerivedFrom ?ref .
?ref pr:P854 ?url .
FILTER REGEX(STR(?url) , "hdl.handle.net/10079/fa/beinecke") SERVICE wikibase:label
{
bd:serviceParam wikibase:language "en" .
}
}
ORDER BY MONTH(?date) DAY(?date)
=====================
SELECT ?city ?countrycode ?population ?cityLabel ?language ?lat ?long WHERE {
?city wdt:P17 ?country .
?country wdt:P297 ?countrycode .
?city rdfs:label ?citysearchLabel .
?city p:P625 ?statement .
OPTIONAL {
?city wdt:P1082 ?population .
}
?statement psv:P625 ?coordinate_node .
?coordinate_node wikibase:geoLatitude ?lat .
?coordinate_node wikibase:geoLongitude ?long .
?city rdfs:label ?cityLabel .
BIND (LANG(?cityLabel) AS ?language)
FILTER (REGEX(?countrycode , UCASE("co")))
FILTER ((LANG(?citysearchLabel)) = "en")
FILTER (REGEX(?citysearchLabel , "^Acacías$"))
FILTER ((ABS(?lat - "3.98749995231628"^^xsd:decimal)) < "0.5"^^xsd:decimal)
FILTER ((ABS(?long - "-73.7566680908203"^^xsd:decimal)) < "0.5"^^xsd:decimal)
}

Event Timeline

Smalyshev changed the title of this paste from untitled to Example queries for WDQS testing.