User:MichaelSchoenitzer/FLOSS

Here I list some useful SPARQL-Queries about Free- and OpenSource-Software. If you don't know SPARQL, don't be scared about the source-code, just follow the links and press the 'Execute'-Button.
If you wan't to learn a bit of SPARQL I recommend first watching this video and then reading this page and this tutorial. If you know more good ressources, please let me know.

List all FLOSS edit

List all Item with instance of (P31) being anything witch is a subclass of (P279) of free and open-source software (Q506883), free software (Q341) or open-source software (Q1130645).

SELECT ?floss ?flossLabel WHERE {
  {
   ?floss p:P31/ps:P31/wdt:P279* wd:Q506883.
  } Union {
   ?floss p:P31/ps:P31/wdt:P279* wd:Q341.
  } Union {
   ?floss p:P31/ps:P31/wdt:P279* wd:Q1130645.
  } Union {
   ?floss p:P31/ps:P31/wdt:P279* wd:Q19652.
   ?floss p:P31/ps:P31/wdt:P279* wd:Q7397.
  } Union {
    ?floss p:P31/ps:P31/wdt:P279* wd:Q7397.
    ?floss wdt:P275 ?licens.
    ?licens p:P31/ps:P31/(wdt:P31|wdt:P279)* ?kind.
    VALUES ?kind { wd:Q196294 wd:Q1156659 }.
  }

         
   SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en" .
   }
 }
Try it!
 

Statistics edit

License Statistics edit

SELECT ?licenseLabel (COUNT (DISTINCT ?floss) as ?count) WHERE {
  {
   ?floss p:P31 ?val.
   ?val ps:P31/wdt:P279* wd:Q506883.
  } Union {
   ?floss p:P31 ?val.
   ?val ps:P31/wdt:P279* wd:Q341.
  } Union {
   ?floss p:P31 ?val.
   ?val ps:P31/wdt:P279* wd:Q1130645.
  }
  
  ?floss wdt:P275 ?license
      
   SERVICE wikibase:label {
     bd:serviceParam wikibase:language "en" .
   }  
 } group by ?licenseLabel order by desc(?count)
Try it!

Programming Language Statistics edit

SELECT ?langLabel (COUNT (DISTINCT ?floss) as ?count) WHERE {
  {
   ?floss p:P31 ?val.
   ?val ps:P31/wdt:P279* wd:Q506883.
  } Union {
   ?floss p:P31 ?val.
   ?val ps:P31/wdt:P279* wd:Q341.
  } Union {
   ?floss p:P31 ?val.
   ?val ps:P31/wdt:P279* wd:Q1130645.
  }
  
  ?floss wdt:P277 ?lang
      
   SERVICE wikibase:label {
     bd:serviceParam wikibase:language "en" .
   }  
 } group by ?langLabel order by desc(?count)
Try it!

OS Statistics edit

SELECT ?os ?osLabel (COUNT (DISTINCT ?floss) as ?count) WHERE {
  {
   ?floss p:P31 ?val.
   ?val ps:P31/wdt:P279* wd:Q506883.
  } Union {
   ?floss p:P31 ?val.
   ?val ps:P31/wdt:P279* wd:Q341.
  } Union {
   ?floss p:P31 ?val.
   ?val ps:P31/wdt:P279* wd:Q1130645.
  }
  
  ?floss wdt:P306 ?os
      
   SERVICE wikibase:label {
     bd:serviceParam wikibase:language "en" .
   }  
 } group by ?os ?osLabel order by desc(?count)
Try it!

Type of Software edit

SELECT ?typeLabel (count(?typeLabel) as ?count) WHERE {
  {
   ?floss p:P31 ?val.
   ?val ps:P31/wdt:P279* wd:Q506883.
  } Union {
   ?floss p:P31 ?val.
   ?val ps:P31/wdt:P279* wd:Q341.
  } Union {
   ?floss p:P31 ?val.
   ?val ps:P31/wdt:P279* wd:Q1130645.
  }
  
  ?floss p:P31 ?val2.
  filter(?val2 != ?val).
  ?val2 ps:P31 ?type.
         
   SERVICE wikibase:label {
    bd:serviceParam wikibase:language "de" .
   }
 } group by ?typeLabel order by desc(?count)
Try it!

Missing license edit

Create a List of all FLOSS without a License (P275)-Statement, sorted by the number of language-links. Linux-Distributions are left out.

SELECT distinct ?floss ?flossLabel ?count WHERE {
   {
   SELECT ?floss (COUNT (DISTINCT ?labels) as ?count) WHERE {
     {
       ?floss p:P31 ?val.
       ?val ps:P31/wdt:P279* wd:Q506883.
     } Union {
       ?floss p:P31 ?val.
       ?val ps:P31/wdt:P279* wd:Q341.
     } Union {
       ?floss p:P31 ?val.
       ?val ps:P31/wdt:P279* wd:Q1130645.
     } Minus {
       ?floss wdt:P275 ?license
     }
     
     Filter Not Exists {
       ?floss p:P31 ?val2.
       ?val2 ps:P31 wd:Q131669.
     }
          
     ?floss rdfs:label ?labels .
     
     SERVICE wikibase:label {
         bd:serviceParam wikibase:language "en" .
     }  
   } group by ?floss order by desc(?count)
   } .
     
   SERVICE wikibase:label {
     bd:serviceParam wikibase:language "en" .
   }
} order by DESC(?count)
Try it!