User:Thibaut120094/SPARQL
Jump to navigation
Jump to search
Try it!
Try it!
Try it!
Try it!
Try it!
Try it!
Try it!
Try it!
Try it!
Try it!
Try it!
Try it!
Try it!
Try it!
Try it!
Try it!
Try it!
Try it!
Labels ja/fr
[edit]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/>
prefix schema: <http://schema.org/>
Select distinct ?sujet ?sujetLabel ?articleja ?articlefr {
?articleja schema:about ?sujet .
?articleja schema:inLanguage "ja" .
?articleja wikibase:badge wd:Q17437796 .
?articlefr rdf:type schema:Article .
?articlefr schema:about ?sujet .
?articlefr schema:inLanguage "fr" .
filter not exists {
?articlefr wikibase:badge wd:Q17437796 .
}
filter regex(str(?articlefr), "wikipedia") .
filter regex(str(?articleja), "wikipedia") .
SERVICE wikibase:label {
bd:serviceParam wikibase:language "fr" .
}
}
PREFIX bd: <http://www.bigdata.com/rdf#>
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/>
prefix schema: <http://schema.org/>
Select ?sujet ?sujetLabel where {
?article schema:about ?sujet .
?article schema:inLanguage "ja" .
?article wikibase:badge wd:Q17437796 .
minus {
?articlefr schema:about ?sujet .
?articlefr schema:inLanguage "fr" .
}
SERVICE wikibase:label {
bd:serviceParam wikibase:language "fr,ja" .
}
}
PREFIX bd: <http://www.bigdata.com/rdf#>
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/>
prefix schema: <http://schema.org/>
Select ?sujet ?sujetLabel ?badgeLabel where {
?article schema:about ?sujet .
?article schema:inLanguage "ja" .
?article wikibase:badge ?badge .
minus {
?articlefr schema:about ?sujet .
?articlefr schema:inLanguage "fr" .
}
SERVICE wikibase:label {
bd:serviceParam wikibase:language "fr,ja" .
}
}
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/>
prefix schema: <http://schema.org/>
Select distinct ?sujet ?sujetLabel ?articleja ?articlefr ?badgeLabel {
?articleja schema:about ?sujet .
?articleja schema:inLanguage "ja" .
?articleja wikibase:badge ?badge .
?articlefr rdf:type schema:Article .
?articlefr schema:about ?sujet .
?articlefr schema:inLanguage "fr" .
filter not exists {
?articlefr wikibase:badge wd:Q17437796 .
}
filter regex(str(?articlefr), "wikipedia") .
filter regex(str(?articleja), "wikipedia") .
SERVICE wikibase:label {
bd:serviceParam wikibase:language "fr,ja" .
}
}
Autres
[edit]SELECT ?item ?label ?sexe
WHERE
{
?item schema:description "Japanese voice actor"@en.
OPTIONAL {
?item schema:description ?label.}
OPTIONAL{
?item wdt:P21 ?sexe.}
FILTER(LANG(?label) = "fr").
}
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
select ?entity ?value
{
?entity wdt:P31 wd:Q5.
?entity wdt:P1814 ?value.
filter (contains(?value,"ア"))
}
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
select ?entity ?entityLabel ?value
WHERE
{
?entity wdt:P31 wd:Q5.
?entity wdt:P1814 ?value.
filter (contains(?value,"ア")).
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }.
}
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
select ?entity ?entityLabel ?value ?sportLabel ?occLabel ?natLabel
WHERE
{
?entity wdt:P31 wd:Q5.
?entity wdt:P1814 ?value.
?entity wdt:P106 ?occ.
?entity wdt:P27 ?nat.
?entity wdt:P641 ?sport.
filter (contains(?value,"ア")).
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }.
}
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
select ?entity ?entityLabel ?value ?sportLabel ?occLabel ?natLabel
WHERE
{
?entity wdt:P31 wd:Q5.
?entity wdt:P1814 ?value.
?entity wdt:P106 ?occ.
?entity wdt:P27 ?nat.
?entity wdt:P641 ?sport.
filter (contains(?value,"ア")).
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }.
}
P1814 but not P27/Q17
[edit]SELECT ?item ?itemLabel WHERE {
?item wdt:P1814 [];
wdt:P27 [] .
MINUS { ?item wdt:P27 wd:Q17 } .
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
P27/Q17 but no P1814
[edit]SELECT ?item ?itemLabel WHERE {
?item wdt:P27 wd:Q17 .
MINUS { ?item wdt:P1814 [] } .
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
P27/Q17 but no P1814/P1559
SELECT ?item ?itemLabel WHERE {
?item wdt:P27 wd:Q17 .
MINUS { ?item wdt:P1814 [] } .
MINUS { ?item wdt:P1559 [] } .
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
Japanese labels with (
[edit]SELECT ?person ?label (LANG(?label) AS ?lang)
WHERE
{
?person wdt:P31 wd:Q5;
rdfs:label ?label.
FILTER(LANG(?label) IN ("ja")). # tweak to taste
FILTER(CONTAINS(?label, "(")).
}
LIMIT 10
Items with an English label but not French
[edit]SELECT ?person ?label (LANG(?label) AS ?lang)
WHERE
{
?person wdt:P31 wd:Q5;
rdfs:label ?label.
FILTER(LANG(?label) IN ("en")). # tweak to taste
OPTIONAL {?person rdfs:label ?label1 filter(lang(?label1) = "fr")}
FILTER(!BOUND(?label1))
}
LIMIT 100
J-Pop items with Latin characters in ja label but no en label
[edit]SELECT ?item ?label_ja WHERE {
?item wdt:P136 wd:Q131578 .
?item rdfs:label ?label_ja filter(lang(?label_ja) = "ja") .
MINUS { ?item rdfs:label ?label_fr filter(lang(?label_fr) = "en") . }
FILTER regex(?label_ja, "^[A-Z]*$", "i")
}
LIMIT 1000
git protocol but don't end with .git
[edit]SELECT ?item ?itemLabel ?string ?rank {
?item p:P1324 [
pq:P2700 wd:Q186055; ps:P1324 ?string; wikibase:rank ?rank
] .
FILTER ( !STRENDS( STR( ?string ), ".git" ) ) .
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } .
}
Free software but no Debian package and no Free software directory
[edit]SELECT ?item ?itemLabel ?itemDescription {
?item wdt:P31 wd:Q341 .
MINUS { ?item wdt:P3442 [] } .
MINUS { ?item wdt:P2537 [] } .
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } .
}
Japanese family names but not the same kana/Hepburn/kanji
[edit]SELECT ?name1 ?name2 ?name1Label ?name2Label ?orig ?hepburn1 ?hepburn2
WHERE {
?name1 wdt:P31/wdt:P279* wd:Q101352 ;
p:P1814 ?kana1 ;
wdt:P1705 ?count .
?kana1 ps:P1814 ?orig ;
pq:P2125 ?hepburn1 .
?name2 wdt:P31/wdt:P279* wd:Q101352 ;
p:P1814 ?kana2 ;
wdt:P1705 ?count2 .
?kana2 ps:P1814 ?orig ;
pq:P2125 ?hepburn2 .
FILTER (?name1 != ?name2)
FILTER (?hepburn1 != ?hepburn2)
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }
}GROUP BY ?name1 ?name2 ?name1Label ?name2Label ?orig ?hepburn1 ?hepburn2
HAVING((COUNT(?count) = 1) && (COUNT(?count2) = 1))