query-1e036448e120c0beace6f50eae6b0a36

rq turtle/ttl

Sense with antonyms by lexical category

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX ontolex: <http://www.w3.org/ns/lemon/ontolex#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT
  ?number_of_senses
  (CONCAT("#lexicalcategory/", SUBSTR(STR(?lexical_category), 32), "/antonym") AS ?number_of_sensesUrl)

  ?lexical_category ?lexical_categoryLabel
  (CONCAT("#lexicalcategory/", SUBSTR(STR(?lexical_category), 32)) AS ?lexical_categoryUrl)

  ?example_lexeme ?example_lexemeLabel
  (CONCAT("#lexeme/", SUBSTR(STR(?example_lexeme), 32)) AS ?example_lexemeUrl)
WHERE {
   {
  SELECT
    (COUNT(DISTINCT ?sense) AS ?number_of_senses)
    ?lexical_category
    (SAMPLE(?sense) as ?example_sense)
  WHERE {
    [] wikibase:lexicalCategory ?lexical_category ;
       ontolex:sense ?sense .
    ?sense wdt:P5974 [] .
  }
  GROUP BY ?lexical_category
}  ?example_lexeme ontolex:sense ?example_sense .
  ?example_lexeme wikibase:lemma ?example_lexemeLabel .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY DESC(?number_of_senses)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?example_lexeme"):::projected v6("?example_lexemeLabel"):::projected v9("?example_lexemeUrl") v4("?example_sense") v2("?lexical_category"):::projected v8("?lexical_categoryUrl") v4("?number_of_senses"):::projected v7("?number_of_sensesUrl") v3("?sense") a1((" ")) a2((" ")) c6(["bd:serviceParam"]):::iri c8(["#91;AUTO_LANGUAGE#93;,en"]):::literal a1 --"wikibase:lexicalCategory"--> v2 a1 --"ontolex:sense"--> v3 v3 --"wdt:P5974"--> a2 bind2[/"count(?sense)"/] v3 --o bind2 bind2 --as--o v4 bind3[/"sample(?sense)"/] v3 --o bind3 bind3 --as--o v4 v5 --"ontolex:sense"--> v4 v5 --"wikibase:lemma"--> v6 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c6 --"wikibase:language"--> c8 end bind4[/"concat('#lexicalcategory/',substring(str(?lexical_category),'32^^xsd:integer'),'/antonym')"/] v2 --o bind4 bind4 --as--o v7 bind5[/"concat('#lexicalcategory/',substring(str(?lexical_category),'32^^xsd:integer'))"/] v2 --o bind5 bind5 --as--o v8 bind6[/"concat('#lexeme/',substring(str(?example_lexeme),'32^^xsd:integer'))"/] v5 --o bind6 bind6 --as--o v9