SPARQL

From UniDive WG2-T2.2

SPARQL Query examples

Classes and their instances on this Wikibase

#title:Ontology Classes

PREFIX uwb: <https://unidive.wikibase.cloud/entity/>
PREFIX udp: <https://unidive.wikibase.cloud/prop/direct/>
PREFIX up: <https://unidive.wikibase.cloud/prop/>
PREFIX ups: <https://unidive.wikibase.cloud/prop/statement/>
PREFIX upq: <https://unidive.wikibase.cloud/prop/qualifier/>
PREFIX upr: <https://unidive.wikibase.cloud/prop/reference/>
PREFIX uno: <https://unidive.wikibase.cloud/prop/novalue/>

SELECT ?classLabel (count(?item) as ?instances) (sample(?item) as ?example_instance) ?class WHERE {
?item udp:P5 ?class. ?class udp:P5 uwb:Q1.
SERVICE wikibase:label { bd:serviceParam wikibase:language "eu,en". }
} group by ?classLabel ?instances ?example_instance ?class order by desc(?instances)

Try it!


Lexical Entries on this Wikibase

#title: Lexical Entries on this Wikibase
PREFIX uwb: <https://unidive.wikibase.cloud/entity/>
PREFIX udp: <https://unidive.wikibase.cloud/prop/direct/>
PREFIX up: <https://unidive.wikibase.cloud/prop/>
PREFIX ups: <https://unidive.wikibase.cloud/prop/statement/>
PREFIX upq: <https://unidive.wikibase.cloud/prop/qualifier/>
PREFIX upr: <https://unidive.wikibase.cloud/prop/reference/>
PREFIX uno: <https://unidive.wikibase.cloud/prop/novalue/>

SELECT ?lexeme ?lexeme_num ?lemma ?languageLabel ?categoryLabel (count (?sense) as ?senses) 
where {?lexeme wikibase:lemma ?lemma; wikibase:lexicalCategory ?category; dct:language ?language; ontolex:sense ?sense.
      bind(xsd:integer(strafter(str(?lexeme), "https://unidive.wikibase.cloud/entity/L")) as ?lexeme_num) 
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }  }

group by ?lexeme ?lexeme_num ?lemma ?languageLabel ?categoryLabel ?senses order by ?lexeme_num

Try it!