wikidata · 2019-11-12 · sparql #matemàtiques i polítiques amb imatges opcionals #nascudes...
Post on 06-Jul-2020
10 Views
Preview:
TRANSCRIPT
Introducció aIntroducció aSPARQL a partir deSPARQL a partir de
WikidataWikidata
Toni Hermoso Pulido@Toniher
Amical Wikimedia
https://w.wiki/Bw$
SSPARQL PARQL PProtocolrotocol
AAndnd
RRDF DF QQuery uery LLanguageanguage
SPARQLSPARQL
RResource esource DDescriptionescriptionFFrameworkramework
RDFRDF
TriplesTriples
Serialització RDFSerialització RDFElements de WikidataElements de Wikidata
Documentació aMediaWiki
JSON:
XML/RDF:
Turtle/RDF:
etc.
https://www.wikidata.org/wiki/Special:EntityData/Q1492.json
https://www.wikidata.org/wiki/Special:EntityData/Q1492.rdf
https://www.wikidata.org/wiki/Special:EntityData/Q1492.ttl
Accés de dades aWikidata
SPARQLSPARQL
#GatsSELECT ?itemWHERE { ?item wdt:P31 wd:Q146 .}
123456
https://query.wikidata.org/
SPARQLSPARQLhttps://query.wikidata.org/
wdt: Propertieswd: Entities
...others:
rdfsschema
PREFIXESPREFIXES
SPARQLSPARQL
#GatsSELECT ?item ?itemLabel WHERE { ?item wdt:P31 wd:Q146 . ?item rdfs:label ?itemLabel .}
1234567
https://w.wiki/Buw
SPARQLSPARQL
#GatsSELECT ?item ?itemLabel WHERE { ?item wdt:P31 wd:Q146 ; rdfs:label ?itemLabel .}
1234567
https://w.wiki/Buy
SPARQLSPARQL
#GatsSELECT ?item ?itemLabel WHERE { ?item wdt:P31 wd:Q146 ; rdfs:label ?itemLabel . FILTER(LANG(?itemLabel) = "ca").}
12345678
https://w.wiki/Buz
SPARQLSPARQL
#GatsSELECT ?item ?itemLabel WHERE { ?item wdt:P31 wd:Q146 . SERVICE wikibase:label { bd:serviceParam wikibase:language "ca". }}
123456789
1011
https://w.wiki/Bu$
SPARQLSPARQL
#GatsSELECT ?item ?itemLabel WHERE { ?item wdt:P31 wd:Q146 . SERVICE wikibase:label { bd:serviceParam wikibase:language "es,fr,ca". }}ORDER BY ?itemLabelLIMIT 10
123456789
101112
https://w.wiki/Bv2
SPARQLSPARQL
#Matemàtiques i polítiques SELECT ?item ?itemLabel WHERE { ?item wdt:P31 wd:Q5; wdt:P106 wd:Q170790, wd:Q82955; rdfs:label ?itemLabel . ?item wdt:P21 wd:Q6581072 .}
12345678
https://w.wiki/Bv5
SPARQLSPARQL
#Matemàtiques i polítiques SELECT ?item ?itemLabel WHERE { ?item wdt:P31 wd:Q5; wdt:P106 wd:Q170790, wd:Q82955; rdfs:label ?itemLabel . ?item wdt:P21 wd:Q6581072 . FILTER(LANG(?itemLabel) = "ca") . }
123456789
https://w.wiki/Bv6
SPARQLSPARQL
#Matemàtiques i polítiques SELECT ?item ?itemLabel ?itemDescription WHERE { ?item wdt:P31 wd:Q5; wdt:P106 wd:Q170790, wd:Q82955; rdfs:label ?itemLabel ; schema:description ?itemDescription . ?item wdt:P21 wd:Q6581072 . FILTER(LANG(?itemLabel) = "ca") . FILTER(LANG(?itemDescription) = "ca") . }
123456789101112
https://w.wiki/Bv7
SPARQLSPARQL
#Matemàtiques i polítiques SELECT ?item ?itemLabel WHERE { ?item wdt:P31 wd:Q5; wdt:P106 wd:Q170790, wd:Q82955 . ?item wdt:P21 wd:Q6581072 . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca". }}
123456789
1011
https://w.wiki/Bv8
SPARQLSPARQL
#Matemàtiques i polítiques amb imatges SELECT DISTINCT ?item ?itemLabel ?image WHERE { ?item wdt:P31 wd:Q5; wdt:P106 wd:Q170790, wd:Q82955 . ?item wdt:P21 wd:Q6581072 . ?item wdt:P18 ?image . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca". }}
123456789
101112
https://w.wiki/Bv9
SPARQLSPARQL#Matemàtiques i polítiques amb imatges opcionals SELECT DISTINCT ?item ?itemLabel ?image WHERE { ?item wdt:P31 wd:Q5; wdt:P106 wd:Q170790, wd:Q82955 . ?item wdt:P21 wd:Q6581072 . OPTIONAL { ?item wdt:P18 ?image . } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca". }}
123456789
1011121314
https://w.wiki/BvC
SPARQLSPARQL
#Matemàtiques i polítiques només amb imatges SELECT DISTINCT ?item ?itemLabel ?image WHERE { ?item wdt:P31 wd:Q5; wdt:P106 wd:Q170790, wd:Q82955 . ?item wdt:P21 wd:Q6581072 . FILTER EXISTS { ?item wdt:P18 ?image . } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca". }}
123456789
1011121314
https://w.wiki/BvD
SPARQLSPARQL
#Matemàtiques i polítiques sense imatgesSELECT DISTINCT ?item ?itemLabel ?image WHERE { ?item wdt:P31 wd:Q5; wdt:P106 wd:Q170790, wd:Q82955 . ?item wdt:P21 wd:Q6581072 . FILTER NOT EXISTS { ?item wdt:P18 ?image . } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca". }}
123456789
10111213
https://w.wiki/BvE
SPARQLSPARQLhttps://w.wiki/BvH
#Matemàtiques i polítiques amb imatges opcionals #nascudes després del 1961 SELECT DISTINCT ?item ?itemLabel ?born ?image WHERE { ?item wdt:P31 wd:Q5; wdt:P106 wd:Q170790, wd:Q82955 . ?item wdt:P21 wd:Q6581072 ; wdt:P569 ?born . FILTER (?born >= "1961-01-01T00:00:00Z"^^xsd:dateTime) . OPTIONAL { ?item wdt:P18 ?image . } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca". }}
1234567891011121314151617
SPARQLSPARQLhttps://w.wiki/BvJ
# Subclasses de matemàtic SELECT DISTINCT ?item ?itemLabel WHERE { ?item wdt:P279* wd:Q170790; SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca". }}
12345678
SPARQLSPARQLhttps://w.wiki/BvL
#Matemàtiques (ampli) amb imatges opcionals #nascudes després del 1961 SELECT DISTINCT ?item ?born ?image WHERE { ?item wdt:P31 wd:Q5; wdt:P106/wdt:P279* wd:Q170790; wdt:P21 wd:Q6581072; wdt:P569 ?born. FILTER(?born >= "1961-01-01T00:00:00Z"^^xsd:dateTime) OPTIONAL { ?item wdt:P18 ?image. } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca". }}
123456789
1011121314
SPARQLSPARQLhttps://w.wiki/BvM
#Matemàtiques (ampli) amb imatges opcionals #nascudes després del 1961 i amb lloc de naixement conegut SELECT DISTINCT ?item ?born ?birthPlace ?image WHERE { ?item wdt:P31 wd:Q5; wdt:P106/wdt:P279* wd:Q170790; wdt:P21 wd:Q6581072; wdt:P569 ?born ; wdt:P19 ?birthPlace . FILTER(?born >= "1961-01-01T00:00:00Z"^^xsd:dateTime) OPTIONAL { ?item wdt:P18 ?image. } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca". }}
123456789
101112131415
SPARQLSPARQLhttps://w.wiki/BvN
#Matemàtiques (ampli) amb imatges opcionals #nascudes després del 1961 i amb lloc de naixement conegut SELECT DISTINCT ?item ?born ?birthPlace ?coordinate ?image WHERE { ?item wdt:P31 wd:Q5; wdt:P106/wdt:P279* wd:Q170790; wdt:P21 wd:Q6581072; wdt:P569 ?born ; wdt:P19 ?birthPlace . ?birthPlace wdt:P625 ?coordinate . FILTER(?born >= "1961-01-01T00:00:00Z"^^xsd:dateTime) OPTIONAL { ?item wdt:P18 ?image. } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],ca". }}
123456789
10111213141516
Més informacióMés informació
Wikidata Query Service in BriefPresentacions de Wikidata i SPARQLExemples de consultes SPARQL
top related