SPARQL queries: Difference between revisions

From Qichwabase
Jump to navigation Jump to search
Line 25: Line 25:
</sparql>
</sparql>
=Part of speech (lexical category)=
=Part of speech (lexical category)=
==Course-grained (lexical category superclasses)==
<sparql tryit="1">
<sparql tryit="1">
#defaultView:BarChart
#defaultView:BarChart
Line 35: Line 36:
       wikibase:lexicalCategory ?pos_finegrained.
       wikibase:lexicalCategory ?pos_finegrained.
       ?pos_finegrained qdp:P4 ?pos. ?pos rdfs:label ?posLabel . filter(lang(?posLabel)="en")
       ?pos_finegrained qdp:P4 ?pos. ?pos rdfs:label ?posLabel . filter(lang(?posLabel)="en")
} group by ?pos ?posLabel ?count
order by desc(?count)
</sparql>
==Fine-grained (lexical categories as in Runasimi Dictionary)==
<sparql tryit="1">
#defaultView:BarChart
#this shows pos distribution (fine-grained categories as in Runasimi dictionary)
select ?pos ?posLabel (count(?entry) as ?count)
where {
?entry a ontolex:LexicalEntry;
      wikibase:lemma ?lemma;
      wikibase:lexicalCategory ?pos. ?pos rdfs:label ?posLabel . filter(lang(?posLabel)="en")
} group by ?pos ?posLabel ?count
} group by ?pos ?posLabel ?count
order by desc(?count)  
order by desc(?count)  
</sparql>
</sparql>

Revision as of 21:54, 2 February 2023

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!

Part of speech (lexical category)

Course-grained (lexical category superclasses)

#defaultView:BarChart
PREFIX qdp: <https://qichwa.wikibase.cloud/prop/direct/>

select ?pos ?posLabel (count(?entry) as ?count)
where {
?entry a ontolex:LexicalEntry; 
       wikibase:lemma ?lemma;
       wikibase:lexicalCategory ?pos_finegrained.
       ?pos_finegrained qdp:P4 ?pos. ?pos rdfs:label ?posLabel . filter(lang(?posLabel)="en")
} group by ?pos ?posLabel ?count
order by desc(?count)

Try it!

Fine-grained (lexical categories as in Runasimi Dictionary)

#defaultView:BarChart
#this shows pos distribution (fine-grained categories as in Runasimi dictionary)
select ?pos ?posLabel (count(?entry) as ?count)
where {
?entry a ontolex:LexicalEntry; 
       wikibase:lemma ?lemma;
       wikibase:lexicalCategory ?pos. ?pos rdfs:label ?posLabel . filter(lang(?posLabel)="en")
} group by ?pos ?posLabel ?count
order by desc(?count)

Try it!