SPARQL queries

From Qichwabase
Revision as of 21:34, 2 February 2023 by DavidL (talk | contribs) (Created page with "Here you find some SPARQL queries that you can use, and also modify or combine. =Lexical Entries= <sparql tryit="1"> # this lists all lexcial entries, with lemma and pos, ordered alphabetically by lemma select ?entry ?lemma ?posLabel where {?entry a ontolex:LexicalEntry; wikibase:lemma ?lemma; wikibase:lexicalCategory [rdfs:label ?posLabel]. filter(lang(?posLabel)="en")} order by lcase(?lemma) </sparql> =Dialectal lemm...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Here you find some SPARQL queries that you can use, and also modify or combine.

Lexical Entries

# this lists all lexcial entries, with lemma and pos, ordered alphabetically by lemma
select ?entry ?lemma ?posLabel 
where {?entry a ontolex:LexicalEntry; 
                wikibase:lemma ?lemma;
                wikibase:lexicalCategory [rdfs:label ?posLabel]. 
                  filter(lang(?posLabel)="en")}
order by lcase(?lemma)

Try it!

Dialectal lemma variants

#defaultView:BarChart
#This shows the distribution of dialectal lemma variants
PREFIX qp: <https://qichwa.wikibase.cloud/prop/>
PREFIX qps: <https://qichwa.wikibase.cloud/prop/statement/>
PREFIX qpq: <https://qichwa.wikibase.cloud/prop/qualifier/>

SELECT ?dialect ?dialectLabel (count (?variant) as ?variants)
WHERE { ?lemma qp:P16 [ qps:P16 ?variant ; qpq:P17 ?dialect ] .
        SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
      }
GROUP BY ?dialect ?dialectLabel ?variants ORDER BY DESC(?variants)

Try it!