query-7fb2b5754e5c318f474587c2b2673d03

rq turtle/ttl

Licenses1. Return a graph of the class/subclass relationships for software licenses: ?licenseLabel ORDER BY } } "en" language:wikibase serviceParam:bd { label:wikibase SERVICE . } ?subclassOf P279:wdt ?license { OPTIONAL . Q207621:wd P279:wdt ?license { WHERE ?subclassOf ?licenseLabel ?license DISTINCT SELECT #defaultView:Graph DISTINCT %3Flicense %3FlicenseLabel %3FsubclassOf WHERE {%0A %3Flicense wdt%3AP279 wd%3AQ207621 .%0A OPTIONAL { %3Flicense wdt%3AP279 %3FsubclassOf } .%0A SERVICE wikibase%3Alabel { bd%3AserviceParam wikibase%3Alanguage "en" }%0A}%0AORDER BY %3FlicenseLabel Try it!2. Return a list of software titles, their licenses, and the superclass of licenses to which they belong: Propertiessubclass of (P279)copyright license (P275)instance of (P31) Software titles by license name and license type:

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?app ?appLabel ?licenseLabel ?classLabel
WHERE {
  ?app (p:P31/ps:P31/wdt:P279*) wd:Q7397.
  ?app wdt:P275 ?license.
  ?license wdt:P279 ?class

  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; v1("?app"):::projected v3("?class") v2("?license") a1((" ")) a2((" ")) c4(["wd:Q7397"]):::iri c7(["bd:serviceParam"]):::iri c9(["en"]):::literal v1 --"p:P31"--> a1 a1 --"p:statement/P31"--> a2 a2 --"p:direct/P279"--> c4 v1 --"p:direct/P275"--> v2 v2 --"p:direct/P279"--> v3 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c7 --"wikibase:language"--> c9 end