query-9a536a6c3b1e14b2849b77395d1e3837

rq turtle/ttl

Language-independent queries

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ontolex: <http://www.w3.org/ns/lemon/ontolex#>
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?subject ?subjectLabel ?category ?categoryLabel ?languages ?image ?video WHERE {
  {
    SELECT DISTINCT ?subject ?category (COUNT(DISTINCT ?language) AS ?languages) ?image ?video WHERE {
      #VALUES ?subject {wd:Q2}
      ?sense wdt:P5137 ?subject.
      ?lexeme ontolex:sense ?sense.
      ?lexeme wikibase:lexicalCategory ?category.
      ?lexeme dct:language ?language.
      #OPTIONAL {?subject wdt:P18 ?image.}
      #OPTIONAL {?subject wdt:P10 ?video.}
    }
    GROUP BY ?subject ?category ?image ?video
  }
  SERVICE wikibase:label {bd:serviceParam wikibase:language "en".}
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?category"):::projected v5("?language") v6("?languages"):::projected v3("?lexeme") v1("?sense") v2("?subject"):::projected c6(["bd:serviceParam"]):::iri c8(["en"]):::literal v1 --"wdt:P5137"--> v2 v3 --"ontolex:sense"--> v1 v3 --"wikibase:lexicalCategory"--> v4 v3 --"dct:language"--> v5 bind1[/"count(?language)"/] v5 --o bind1 bind1 --as--o v6 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c6 --"wikibase:language"--> c8 end