Project:SPARQL/examples: Difference between revisions
Jump to navigation
Jump to search
Tdkiv-admin (talk | contribs) No edit summary |
Tdkiv-admin (talk | contribs) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 4: | Line 4: | ||
PREFIX zwb: <https://tdkiv.wikibase.cloud/entity/> | PREFIX zwb: <https://tdkiv.wikibase.cloud/entity/> | ||
PREFIX zdp: <https://tdkiv.wikibase.cloud/prop/direct/> | PREFIX zdp: <https://tdkiv.wikibase.cloud/prop/direct/> | ||
PREFIX | PREFIX wikibase: <http://wikiba.se/ontology#> | ||
PREFIX bd: <http://www.bigdata.com/rdf#> | |||
PREFIX | SELECT ?item ?itemLabel ?vyklad WHERE { | ||
SERVICE wikibase:label { bd:serviceParam wikibase:language "cs,en". } | |||
?item zdp:P16 zwb:Q4397; | |||
zdp:P1 ?vyklad. | |||
} | |||
ORDER BY (?itemLabel)</sparql> | |||
SERVICE wikibase:label { bd:serviceParam wikibase:language "cs,en". } | |||
?item zdp:P16 zwb:Q4397 | |||
===Počty citací použitých zdrojů=== | |||
===Počty citací zdrojů | |||
<sparql tryit="1"> | <sparql tryit="1"> | ||
#defaultView:BubbleChart | #defaultView:BubbleChart | ||
Line 32: | Line 22: | ||
PREFIX owl: <http://www.w3.org/2002/07/owl#> | PREFIX owl: <http://www.w3.org/2002/07/owl#> | ||
PREFIX prov: <http://www.w3.org/ns/prov#> | PREFIX prov: <http://www.w3.org/ns/prov#> | ||
SELECT ?zdroj ?stitek (COUNT(?zdroj) AS ?pocet_citaci) WHERE { | SELECT DISTINCT ?zdroj ?stitek (COUNT(?zdroj) AS ?pocet_citaci) WHERE { | ||
?item zp:P1 ?vykladstatement. | ?item zp:P1 ?vykladstatement. | ||
?vykladstatement zps:P1 ?vyklad; | ?vykladstatement zps:P1 ?vyklad; | ||
Line 44: | Line 34: | ||
?zdroj owl:sameAs ?presmerovany_zdroj. | ?zdroj owl:sameAs ?presmerovany_zdroj. | ||
?presmerovany_zdroj rdfs:label ?presmerovany_label. | ?presmerovany_zdroj rdfs:label ?presmerovany_label. | ||
FILTER((LANG(?presmerovany_label)) = "cs") | |||
} | } | ||
BIND(IF(BOUND(?presmerovany_label), ?presmerovany_label, ?zdrojLabel) AS ?stitek) | BIND(IF(BOUND(?presmerovany_label), ?presmerovany_label, ?zdrojLabel) AS ?stitek) | ||
} | } | ||
GROUP BY ?zdroj ?zdrojLabel ?presmerovany_zdroj ?presmerovany_label ?stitek | GROUP BY ?zdroj ?zdrojLabel ?presmerovany_zdroj ?presmerovany_label ?stitek ?pocet_citaci | ||
ORDER BY DESC (?pocet_citaci) | ORDER BY DESC (?pocet_citaci) | ||
</sparql> | |||
===Obrázky z Wikidat ilustrující jednotlivé pojmy=== | |||
<sparql tryit="1"> | |||
#defaultView:ImageGrid | |||
PREFIX zwb: <https://tdkiv.wikibase.cloud/entity/> | |||
PREFIX zdp: <https://tdkiv.wikibase.cloud/prop/direct/> | |||
PREFIX wdt: <http://www.wikidata.org/prop/direct/> | |||
PREFIX wikibase: <http://wikiba.se/ontology#> | |||
PREFIX bd: <http://www.bigdata.com/rdf#> | |||
SELECT DISTINCT ?item ?itemLabel ?image_from_wikidata WHERE { | |||
?item zdp:P16 zwb:Q4397; | |||
zdp:P27 ?wikidata_id. | |||
BIND(IRI(CONCAT("http://www.wikidata.org/entity/", ?wikidata_id)) AS ?entity) | |||
SERVICE <https://query.wikidata.org/sparql> { ?entity wdt:P18 ?image_from_wikidata. } | |||
SERVICE wikibase:label { bd:serviceParam wikibase:language "cs,en". } | |||
} | |||
ORDER BY ASC(?itemLabel) | |||
</sparql> | </sparql> |
Latest revision as of 12:49, 1 October 2024
Vzorové dotazy
Všechny pojmy s výkladem
PREFIX zwb: <https://tdkiv.wikibase.cloud/entity/>
PREFIX zdp: <https://tdkiv.wikibase.cloud/prop/direct/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?vyklad WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "cs,en". }
?item zdp:P16 zwb:Q4397;
zdp:P1 ?vyklad.
}
ORDER BY (?itemLabel)
Počty citací použitých zdrojů
#defaultView:BubbleChart
PREFIX zp: <https://tdkiv.wikibase.cloud/prop/>
PREFIX zps: <https://tdkiv.wikibase.cloud/prop/statement/>
PREFIX zpr: <https://tdkiv.wikibase.cloud/prop/reference/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX prov: <http://www.w3.org/ns/prov#>
SELECT DISTINCT ?zdroj ?stitek (COUNT(?zdroj) AS ?pocet_citaci) WHERE {
?item zp:P1 ?vykladstatement.
?vykladstatement zps:P1 ?vyklad;
prov:wasDerivedFrom ?ref.
?ref zpr:P22 ?zdroj.
OPTIONAL {
?zdroj rdfs:label ?zdrojLabel.
FILTER((LANG(?zdrojLabel)) = "cs")
}
OPTIONAL {
?zdroj owl:sameAs ?presmerovany_zdroj.
?presmerovany_zdroj rdfs:label ?presmerovany_label.
FILTER((LANG(?presmerovany_label)) = "cs")
}
BIND(IF(BOUND(?presmerovany_label), ?presmerovany_label, ?zdrojLabel) AS ?stitek)
}
GROUP BY ?zdroj ?zdrojLabel ?presmerovany_zdroj ?presmerovany_label ?stitek ?pocet_citaci
ORDER BY DESC (?pocet_citaci)
Obrázky z Wikidat ilustrující jednotlivé pojmy
#defaultView:ImageGrid
PREFIX zwb: <https://tdkiv.wikibase.cloud/entity/>
PREFIX zdp: <https://tdkiv.wikibase.cloud/prop/direct/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item ?itemLabel ?image_from_wikidata WHERE {
?item zdp:P16 zwb:Q4397;
zdp:P27 ?wikidata_id.
BIND(IRI(CONCAT("http://www.wikidata.org/entity/", ?wikidata_id)) AS ?entity)
SERVICE <https://query.wikidata.org/sparql> { ?entity wdt:P18 ?image_from_wikidata. }
SERVICE wikibase:label { bd:serviceParam wikibase:language "cs,en". }
}
ORDER BY ASC(?itemLabel)