Project:SPARQL/examples: Difference between revisions

From TDKIV
Jump to navigation Jump to search
No edit summary
 
(One intermediate revision by the same user not shown)
Line 40: Line 40:
GROUP BY ?zdroj ?zdrojLabel ?presmerovany_zdroj ?presmerovany_label ?stitek ?pocet_citaci
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)

Try it!


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)

Try it!


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)

Try it!