User:YULdigitalpreservation/SPARQL

Wikidata Query Service QueriesEdit

For: https://query.wikidata.org

Status: https://searchdata.wmflabs.org/wdqs/

Technical RegistriesEdit

Authority ControlEdit

1. Return the names of all applications for which there is a PUID in Wikidata:

SELECT ?software ?softwareLabel ?puid

WHERE {
  ?software wdt:P31 wd:Q166142 .
  ?software wdt:P2749 ?puid .
            
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

2. Return the names of all fileformats for which there is a PUID in Wikidata:

SELECT ?format ?formatLabel ?puid

WHERE {
  
  ?format wdt:P2748 ?puid .
            
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

Operating SystemsEdit

1. Return a list of all instances of operating system in Wikidata

SELECT ?os ?osLabel 

WHERE {
  
  ?os wdt:P31 wd:Q9135 .
            
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

EmulatorsEdit

1. Return a list of all instances of emulator in Wikidata

SELECT ?emulator ?emulatorLabel 

WHERE {
  
  ?emulator wdt:P31 wd:Q202871 .
            
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

2. Return a list of emulators and what they emulate:

SELECT ?emulator ?emulatorLabel ?targetLabel

WHERE {
  
  ?emulator wdt:P31 wd:Q202871 .
  ?emulator wdt:P4043 ?target          
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

PlatformsEdit

1. Return a graph of subclasses of computing platform:

#defaultView:Graph
SELECT DISTINCT ?item ?itemLabel ?subclassOf WHERE {
  ?item wdt:P279* wd:Q241317 .
  OPTIONAL { ?item wdt:P279 ?subclassOf } .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
ORDER BY ?itemLabel

Try it!

BrowsersEdit

1. Return a list of all browsers in Wikidata

SELECT ?browser ?browserLabel 

WHERE {
  
  ?browser wdt:P31 wd:Q6368 .
            
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

File FormatsEdit

1. Return a list of file extensions and their media types

SELECT DISTINCT ?idExtension ?extension ?mediaType ?idExtensionLabel 
WHERE
{
	?idExtension wdt:P31 wd:Q235557
	; wdt:P1195 ?extension .
	OPTIONAL { ?idExtension wdt:P1163 ?mediaType }
	SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
} 
ORDER BY ?extension ?mediaType

2. Return a list of file formats that are for 3D graphics:

SELECT DISTINCT ?format ?formatLabel 

WHERE {
  
  ?format wdt:P31 wd:Q235557 .
  ?format wdt:P366 wd:Q189177 .
  
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

3. Return a list of all items that are an instance of file format:

SELECT DISTINCT ?fileformat ?fileformatLabel
WHERE
{
	?fileformat wdt:P31 wd:Q235557
	
	SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}

Try it!

SoftwareEdit

1. How many pieces of software are there (this is limited to 50,000 results because query was timing out if unlimited)

SELECT ?app ?appLabel WHERE {
  ?app (p:P31/ps:P31/wdt:P279*) wd:Q7397.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
LIMIT 50000

2. How many pieces of software have minimal set of props

SELECT DISTINCT ?app ?appLabel ?url ?devLabel ?osLabel ?lanLabel ?repoLabel ?licenseLabel ?rfflabel ?wffLabel WHERE {
  ?app (p:P31/ps:P31/wdt:P279*) wd:Q7397.
  ?app wdt:P856 ?url.
  ?app wdt:P178 ?dev.
  ?app wdt:P306 ?os.
  ?app wdt:P277 ?lan.
  ?app wdt:P1324 ?repo.
  ?app wdt:P275 ?license.
  ?app wdt:P1072 ?rff.
  ?app wdt:P1073 ?wff.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
LIMIT 100

Readable & Writable File FormatEdit

1. Return the names of all of the writable file formats that have been described for instances of software applications in Wikidata:

SELECT ?software ?softwareLabel ?writableffLabel

WHERE {
  ?software wdt:P31/wdt:P279*  wd:Q166142 .
  ?software wdt:P1073 ?writableff .
  
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

2.Return the names of all of the readable file formats that have been described for instances of software applications in Wikidata:

SELECT ?software ?softwareLabel ?readableffLabel

WHERE {
  ?software wdt:P31/P279*  wd:Q166142 .
  ?software wdt:P1072 ?readableff .
  
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

3. Return a list of software applications ranked in descending order by the number of writable file formats that have been listed in Wikidata:

#defaultView:BubbleChart
SELECT ?app ?appLabel (COUNT(?format) AS ?count)

WHERE {
  ?app (p:P31/ps:P31/wdt:P279*) wd:Q7397 .
  ?app wdt:P1073 ?format .
            
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

GROUP BY ?app ?appLabel
ORDER BY DESC(?count)

Try it!

4. Return a list of software applications ranked in descending order by the number of readable file formats that have been listed in Wikidata:

#defaultView:BubbleChart
SELECT ?app ?appLabel (COUNT(?format) AS ?count)

WHERE {
  ?app (p:P31/ps:P31/wdt:P279*) wd:Q7397 .
  ?app wdt:P1072 ?format .
            
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

GROUP BY ?app ?appLabel
ORDER BY DESC(?count)

Try it!

File Format Items Missing PropertiesEdit

1. Return a list of all file formats missing P1163 media type:

SELECT ?fileformat ?fileformatLabel 

WHERE {
  ?fileformat wdt:P31 wd:Q235557 .
  
 FILTER NOT EXISTS { ?fileformat p:P1163 ?mediatype }
  
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

2. Return a list of all file formats missing P1195 file extension:

SELECT ?fileformat ?fileformatLabel 

WHERE {
  ?fileformat wdt:P31 wd:Q235557 .
  
 FILTER NOT EXISTS { ?fileformat p:P1195 ?fileextension }
  
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

EndiannessEdit

1. Return a list of all file formats for which endianness has been stated

SELECT ?format ?formatLabel ?oLabel

WHERE {
  
  ?format wdt:P31 wd:Q235557 .
  ?format wdt:P3374 ?o .
            
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

LoCFDDEdit

3. Return a list of all items for which there is a LocFDD ID

SELECT ?format ?formatLabel ?fdd

WHERE {
  
  ?format wdt:P3266 ?fdd .
            
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

LicensesEdit

1. Return a graph of the class/subclass relationships for software licenses:

#defaultView:Graph
SELECT DISTINCT ?license ?licenseLabel ?subclassOf WHERE {
  ?license wdt:P279* wd:Q207621 .
  OPTIONAL { ?license wdt:P279 ?subclassOf } .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
ORDER BY ?licenseLabel

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:

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". }
}

Try it!

3. Create a bubble chart showing the license superclasses with the most software titles assigned to them.

#defaultView:BubbleChart
SELECT DISTINCT  ?license ?licenseLabel (COUNT(?app) AS ?count)

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". }
}

GROUP BY ?license ?licenseLabel
ORDER BY DESC(?count)

Try it!

Bollingen Prize ProjectEdit

1. Return a list of all winners of the Bollingen Prize

SELECT  ?personLabel  

WHERE {
  ?person wdt:P166 wd:Q194944 .
  
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

1b.

#defaultView:ImageGridlut
SELECT  ?personLabel  ?image

WHERE {
  ?person wdt:P166 wd:Q194944 .
  ?person wdt:P18 ?image
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

2. Return a list of all winners of the Bollingen Prize along with the geocoordinates of their birthplaces

SELECT  ?personLabel  ?birthplaceLabel ?coord ?lat ?lon

WHERE {
  ?person wdt:P166 wd:Q194944 .
  ?person wdt:P19 ?birthplace
  OPTIONAL {?birthplace wdt:P625 ?coord. }
   OPTIONAL {
    ?birthplace p:P625 ?statement.
    ?statement psv:P625 ?node.
    ?node wikibase:geoLatitude ?lat.
    ?node wikibase:geoLongitude ?lon.
   }
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try It!

3. Return a list of winners with their DOBs

SELECT  ?personLabel  ?year

WHERE {
  ?person wdt:P166 wd:Q194944 .
  ?person wdt:P569 ?year .
  
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

4. Return a list of all winners whose archives are held at the Beinecke

SELECT  ?personLabel  

WHERE {
  ?person wdt:P166 wd:Q194944 .
  ?person wdt:P485 wd:Q814779 .
  
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

4b. Return a list of all winners whose archives are held at the Beinecke as a image grid

#defaultView:ImageGridlut
SELECT  ?personLabel  ?image

WHERE {
  ?person wdt:P166 wd:Q194944 .
  ?person wdt:P485 wd:Q814779 .
  ?person wdt:P18  ?image
  
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

5. Return a list of winners where there is information about what institution holds their archvies

SELECT  ?personLabel  ?archiveLabel

WHERE {
  ?person wdt:P166 wd:Q194944 .
  ?person wdt:P485 ?archive .
  
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

6. Winners and employers

SELECT  ?personLabel  ?employerLabel

WHERE {
  ?person wdt:P166 wd:Q194944 .
  ?person wdt:P108 ?employer .
  
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

7. Return a list of winners and their notable works

SELECT  ?personLabel  ?workLabel

WHERE {
  ?person wdt:P166 wd:Q194944 .
  ?person wdt:P800 ?work .
  
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

8. Winners of the Bollingen listed with all other awards received

SELECT  ?personLabel  ?awardLabel

WHERE {
  
   ?person wdt:P166 wd:Q194944.
  ?person wdt:P166 ?award .
  
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
}
  }

Try it!

9. This query is for the Histropedia Wikidata Timeline Viewer

SELECT  ?person ?personLabel  ?year ?image

WHERE {
  ?person wdt:P166 wd:Q194944 .
  ?person wdt:P569 ?year .
  ?person wdt:P18 ?image

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

10. Return a list of all educational institutions attended by winners

SELECT  ?personLabel  ?schoolLabel

WHERE {
  ?person wdt:P166 wd:Q194944 .
  ?person wdt:P69 ?school .
  
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

Windham-Campell PrizeEdit

Winners by year with imageEdit

The following query uses these:

2018 WinnersEdit

The following query uses these:

1. Return a list of all winners of the Windham-Campbell Prize:

SELECT  ?personLabel  

WHERE {
  ?person wdt:P166 wd:Q8024208.
  
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

2. Return a image grid of winners of the Windham-Campbell Prize:

#defaultView:ImageGrid
SELECT  ?personLabel  ?image

WHERE {
  ?person wdt:P166 wd:Q8024208 .
  ?person wdt:P18 ?image
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

3. Return a list of all winners of the Windham-Campbell Prize along with the geocoordinates of their birthplaces:

#defaultView:Map
SELECT  ?personLabel  ?birthplaceLabel ?coord ?lat ?lon

WHERE {
  ?person wdt:P166 wd:Q8024208  .
  ?person wdt:P19 ?birthplace
  OPTIONAL {?birthplace wdt:P625 ?coord. }
   OPTIONAL {
    ?birthplace p:P625 ?statement.
    ?statement psv:P625 ?node.
    ?node wikibase:geoLatitude ?lat.
    ?node wikibase:geoLongitude ?lon.
   }
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

4.Return a list of winners with their DOBs:

SELECT  ?personLabel  ?year

WHERE {
  ?person wdt:P166 wd:Q8024208  .
  ?person wdt:P569 ?year .
  
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

5. Winners of the Windham-Campbell Prize listed with all other awards received

SELECT  ?personLabel  ?awardLabel

WHERE {
  
   ?person wdt:P166 wd:Q8024208.
  ?person wdt:P166 ?award .
  
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
}
  }

Try it!.

SoftwareEdit

1. Return a list of software developers ranked in descending order by the number of pieces of software they have created:

SELECT ?developer ?developerLabel (COUNT(?software) AS ?count)

WHERE {
  ?software (p:P31/ps:P31/wdt:P279*) wd:Q7397.
  ?software wdt:P178 ?developer.
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}

GROUP BY ?developer ?developerLabel
ORDER BY DESC(?count)

Try it!

2. Return a list of software applications and the operating systems they run on:

SELECT ?software ?softwareLabel ?os ?osLabel

WHERE {
  ?software (p:P31/ps:P31/wdt:P279*) wd:Q7397 .
  ?software wdt:P306 ?os
  
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it

3. Return a list of all items that are instances of software for which the use is science:

SELECT ?software ?softwareLabel 

WHERE {
  ?software wdt:P31 wd:Q7397 .
  ?software wdt:P366 wd:Q336 .
            
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

4. Return a list of linux distros and their inception dates:

SELECT ?software ?softwareLabel ?date

WHERE {
  ?software wdt:P31 wd:Q131669.
  ?software wdt:P571 ?date.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}

Try it!

5. Return a list of all software that is used for 3D computer graphics

SELECT ?software ?softwareLabel ?instanceOfLabel

WHERE {
  
  ?software wdt:P31 ?instanceOf .
  ?software wdt:P366 wd:Q189177 .
            
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

Free SoftwareEdit

1. Return a list of all items for which there is an entry in the Free Software Foundation Resource Directory

SELECT ?software ?softwareLabel 

WHERE {
  
  ?software wdt:P31 wd:Q341 .
  ?software wdt:P2537 ?entry.
            
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

2. Return list of all instances of free software that have been described with a MIME type:

SELECT ?software ?softwareLabel ?mime

WHERE {
  ?software wdt:P31  wd:Q341.
  ?software wdt:P1163 ?mime
  
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

3. Return a list of all items that are instances of a linux distro:

SELECT ?software ?softwareLabel 

WHERE {
  ?software wdt:P31 wd:Q131669.
    
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}

Try it!

4. Return a map with the birthplaces of a developers of free software

#defaultView:Map
SELECT ?software ?softwareLabel ?developerLabel ?birthplaceLabel ?coord ?lat ?lon

WHERE {
  
  ?software wdt:P31 wd:Q341 .
  ?software wdt:P178 ?developer .
  ?developer wdt:P19 ?birthplace
  OPTIONAL {?birthplace wdt:P625 ?coord. }
   OPTIONAL {
    ?birthplace p:P625 ?statement.
    ?statement psv:P625 ?node.
    ?node wikibase:geoLatitude ?lat.
    ?node wikibase:geoLongitude ?lon.
   }
  
            
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

5. Return a list of all free software developers and their dates of birth:

SELECT DISTINCT ?softwareLabel ?developerLabel ?year

WHERE {
  
  ?software wdt:P31 wd:Q341 .
  ?software wdt:P178 ?developer .
  ?developer wdt:P569 ?year .
            
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

6. Return a list of all debian packages that have been added to Wikidata:

SELECT ?item ?itemLabel 

WHERE {
	?item wdt:P3442 ?value .
	SERVICE wikibase:label { bd:serviceParam wikibase:language "en,en"  }    
}

Try it!

7. Return a list of linux distributions ranked in order of the number of other distros for which they serve as the base:

SELECT ?baseLabel (COUNT(?software) AS ?count)

WHERE {
  ?software wdt:P31 wd:Q131669.
  ?software wdt:P144 ?base .
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}


GROUP BY ?base ?baseLabel
ORDER BY DESC(?count)

Try it!

Scientific Software that is Free SoftwareEdit

1. Return all items that have an entry in the FSF resource directory and have also been categorized as scientific software by the FSF

SELECT ?software ?softwareLabel 

WHERE {
  
  ?software wdt:P31 wd:Q341 .
  ?software p:P2537 [ pq:P366 wd:Q336 ].
  
            
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

2. Return an Image Grid of developers (who have an image associated to their item) for those who are the developers of a software title that is published under a free license and useful for scientific research:

#defaultView:ImageGrid
SELECT ?software ?softwareLabel ?developerLabel ?image

WHERE {
  
  ?software wdt:P31 wd:Q341 .
  ?software p:P2537 [ pq:P366 wd:Q336 ].
  ?software wdt:P178 ?developer .
  ?developer wdt:P18 ?image.
  
            
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

3. Return a map with the birthplaces of a developers of free software:

#defaultView:Map
SELECT ?software ?softwareLabel ?developerLabel ?birthplaceLabel ?coord ?lat ?lon

WHERE {
  
  ?software wdt:P31 wd:Q341 .
  ?software wdt:P178 ?developer .
  ?developer wdt:P19 ?birthplace
  OPTIONAL {?birthplace wdt:P625 ?coord. }
   OPTIONAL {
    ?birthplace p:P625 ?statement.
    ?statement psv:P625 ?node.
    ?node wikibase:geoLatitude ?lat.
    ?node wikibase:geoLongitude ?lon.
   }
  
            
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
}

Try it!

4.Return an Image Grid of developers (who have an image associated to their item) for those who are the developers of a software title released under a free license

  1. defaultView:ImageGrid

SELECT ?software ?softwareLabel ?developerLabel ?image

WHERE {
  
  ?software wdt:P31 wd:Q341 .
  ?software p:P2537 [ pq:P366 wd:Q336 ].
  ?software wdt:P178 ?developer .
  ?developer wdt:P18 ?image.
  
            
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
}

Try it!

Digital PreservationEdit

Return all items for which the use is digital preservationEdit

SELECT ?item ?itemLabel

WHERE {
  ?item wdt:P366 wd:Q632897 .
  
            
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

Return all items for which the use or main subject is digital preservationEdit

SELECT ?item ?itemLabel

WHERE {
  ?item wdt:P921|wdt:P366 wd:Q632897 .
  
            
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

Return a list of all members of the Digital Preservation CoalitionEdit

SELECT ?member ?memberLabel

WHERE {
   	?member	wdt:P463 wd:Q5275956 .
  
            
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

Return a list of all organizations that members of the OPF belong toEdit

The following query uses these:

  • Properties: member of (P463)     
    SELECT  ?memberLabel ?othersLabel
    
    WHERE {
       	?member	wdt:P463 ?others .
        ?member wdt:P463 wd:Q27981723 . 
                
      SERVICE wikibase:label {
    		bd:serviceParam wikibase:language "en" .
        
    }
      }
    

Return a list of all organizations that members of the DPC belong toEdit

The following query uses these:

  • Properties: member of (P463)     
    SELECT ?member ?othersLabel
    
    WHERE {
       	?member	wdt:P463 wd:Q5275956 .
        ?member	wdt:P463 ?others .
                
      SERVICE wikibase:label {
    		bd:serviceParam wikibase:language "en" .
        
    }
      }
    

All works with digital preservation as main subjectEdit

The following query uses these:

Semantic WebEdit

1. Return all items that are part of the Semantic Web:

SELECT ?item ?itemLabel
WHERE
{
	?item wdt:P361 wd:Q54837 .
	SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}

Try it!

ArchivesEdit

1. Return a list of people ranked in the order of largest number of institutions holding their papers to smallest number of institutions holding their papers:

SELECT ?person ?personLabel (COUNT(?archive) AS ?count)

WHERE {
  ?person wdt:P31 wd:Q5 .
  ?person wdt:P485 ?archive .
            
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

GROUP BY ?person ?personLabel
ORDER BY DESC(?count)

try it!

2. Return a list of institutions ranked in order of largest to smallest number of peoples' papers listed in Wikidata:

#defaultView:BubbleChart
SELECT ?archive ?archiveLabel (COUNT(?person) AS ?count)

WHERE {
  ?person wdt:P31 wd:Q5 .
  ?person wdt:P485 ?archive .
            
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

GROUP BY ?archive ?archiveLabel
ORDER BY DESC(?count)

Try it!

3. Return a list of items in Wikidata that have a SNAC id:

#Items that have an ID from the Social Networks Archival Contex project
SELECT ?itemLabel ?value
WHERE 
{
	?item wdt:P3430 ?value .
 
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
}

Try it!

4. Return a list of people whose papers are held at the Beinecke along with the geocoordinates of their birthplaces plotted on a map:

#defaultView:Map
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>

SELECT ?personLabel ?birthplaceLabel ?coord ?lat ?lon 
WHERE {
  ?person wdt:P485 wd:Q814779.
  ?person wdt:P19 ?birthplace.
  OPTIONAL { ?birthplace wdt:P625 ?coord. }
  OPTIONAL {
    ?birthplace p:P625 ?statement.
    ?statement psv:P625 ?node.
    ?node wikibase:geoLatitude ?lat.
    ?node wikibase:geoLongitude ?lon.
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
  
}

Try it!

5. Return a bubble chart showing the awards received by people whose papers are at the Beinecke in order from largest number of award winners among the group to smallest number of award winners among the group:

#defaultView:BubbleChart
SELECT   ?award ?awardLabel (COUNT(?person) AS ?count)

WHERE {
  
   ?person wdt:P485 wd:Q814779.
  ?person wdt:P166 ?award .
  
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
}
  }
GROUP BY ?award ?awardLabel
ORDER BY DESC(?count)

Try it!

6. Return a list of women whose papers are at the Beinecke and their occupations:

SELECT   ?person ?personLabel ?occLabel

WHERE {
  
  ?person wdt:P21 wd:Q6581072 .
  ?person wdt:P485 wd:Q814779 .
  ?person wdt:P106 ?occ .
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
  
}

Try it!

7. Return an image grid of people who have an image and whose papers are held by YCBA:

#defaultView:ImageGrid
SELECT   ?person ?personLabel ?image

WHERE {
  
 
  ?person wdt:P485 wd:Q6352575 .
  ?person wdt:P18 ?image .
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
  
}

Try it!

Smith CollegeEdit

1. Return an image grid of all people whose archival papers are held at Smith College:

#defaultView:ImageGrid
SELECT  ?personLabel  ?image

WHERE {
  
  ?person wdt:P485 wd:Q49204 .
  ?person wdt:P18 ?image
  
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

Mount Holyoke CollegeEdit

1. Return a list of all people whose papers are held at Mount Holyoke College:

SELECT  ?personLabel  

WHERE {
  
  ?person wdt:P485 wd:Q1140542 .
 
  
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

Five College ConsortiumEdit

1. Return a list of all people whose archival papers are held by an institution that is a member of the Five College Consortium:

SELECT DISTINCT ?person ?personLabel  ?memberLabel

WHERE {
  ?member wdt:P463 wd:Q1331248 .
  ?person wdt:P485 ?member .

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

Try it!

2. Return an image grid of all people whose archival papers are held by an institution that is a member of the Five College Consortium:

SELECT DISTINCT ?person ?personLabel  ?memberLabel ?image

WHERE {
  ?member wdt:P463 wd:Q1331248 .
  ?person wdt:P485 ?member .
  ?person wdt:P18  ?image .
  
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

FeministsEdit

1. Return a list of all notable works by feminists:

SELECT  ?personLabel  ?workLabel

WHERE {
  ?person wdt:P106 wd:Q16830344 .
  ?person wdt:P800 ?work .
  
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

2. Return a list of all feminists listed as such in Wikidata:

SELECT  ?personLabel 

WHERE {
  ?person wdt:P106 wd:Q16830344 .
  
  
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

3. Return a list of all feminists and their DOBs:

SELECT  ?personLabel ?year

WHERE {
  ?person wdt:P106 wd:Q16830344 .
  ?person wdt:P569 ?year .
  
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

4. Return a list of all feminists and geocoordinates for place of birth (defaults to map view):

#defaultView:Map
SELECT  ?personLabel ?birthplaceLabel ?coord ?lat ?lon

WHERE {
  ?person wdt:P106 wd:Q16830344 .
  ?person wdt:P19 ?birthplace
  OPTIONAL {?birthplace wdt:P625 ?coord. }
   OPTIONAL {
    ?birthplace p:P625 ?statement.
    ?statement psv:P625 ?node.
    ?node wikibase:geoLatitude ?lat.
    ?node wikibase:geoLongitude ?lon.
   }
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

Computer History MuseumEdit

1. Return a list of all people whose archives are at the Computer History Museum

SELECT ?person ?personLabel  

WHERE {
  ?person wdt:P485 wd:Q964035.
  
  
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

2. Return a list of people whose archives are at the Computer History Museum as part of the oral history project who have images:

#defaultView:ImageGrid
SELECT  ?personLabel  ?image

WHERE {
  ?person wdt:P485 wd:Q964035 .
  ?person wdt:P18 ?image
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

3. Return a list of all people whose archives are at the Computer history Museum along with the geocoordinates of their places of birth in order to plot on a map:

#defaultView:Map
SELECT  ?personLabel  ?birthplaceLabel ?coord ?lat ?lon

WHERE {
  ?person wdt:P485 wd:Q964035.
  ?person wdt:P19 ?birthplace
  OPTIONAL {?birthplace wdt:P625 ?coord. }
   OPTIONAL {
    ?birthplace p:P625 ?statement.
    ?statement psv:P625 ?node.
    ?node wikibase:geoLatitude ?lat.
    ?node wikibase:geoLongitude ?lon.
   }
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

4. Return a list of all people whose archives are at the Computer History Museum and the educational institutions they attended:

SELECT  ?personLabel  ?schoolLabel

WHERE {
  ?person wdt:P485 wd:Q964035.
  ?person wdt:P69 ?school .
  
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

5. Return a list of all people with archival material at the Computer History Museum along with their employer information:

#defaultView:Dimensions
SELECT  ?personLabel  ?employerLabel

WHERE {
  ?person wdt:P485 wd:Q964035 .
  ?person wdt:P108 ?employer .
 
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

6. Return a list of all awards won by people who have archival material in the Computer History Museum:

#defaultView:Dimensions
SELECT  ?personLabel  ?awardLabel 

WHERE {
  ?person wdt:P485 wd:Q964035 .
    ?person wdt:P166 ?award .
 
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

7. Return a bubble chart of awards rec'd by people who have archival material at the Computer History Museum ranked in order of most recipients to fewest recipients

#defaultView:BubbleChart
SELECT   ?award ?awardLabel (COUNT(?person) AS ?count)

WHERE {
  ?person wdt:P485 wd:Q964035 .
    ?person wdt:P166 ?award .
 
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }
GROUP BY ?award ?awardLabel
ORDER BY DESC(?count)

Try it!

8. Return a list of all people who have archival material at the Computer History Museum along with the name of their doctoral advisors:

SELECT  ?personLabel  ?advisorLabel

WHERE {
  ?person wdt:P485 wd:Q964035 .
  ?person wdt:P184 ?advisor
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

9. Return images & Erdos number for people who have archival material at the Computer History Museum:

#defaultView:ImageGrid
SELECT  ?personLabel  ?image ?Erdos

WHERE {
  ?person wdt:P485 wd:Q964035 .
  ?person wdt:P18 ?image .
  ?person wdt:P2021 ?Erdos
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

Scholarly CommunicationEdit

1. Return a list of scientific articles that have metadata about what software was used in the study:

SELECT ?article ?articleLabel ?softwareLabel

WHERE {
  ?article wdt:P31 wd:Q13442814 .
  ?article wdt:P2283 ?software .
            
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

2. Return a list of all scientific articles for which we know the identities of the reviewers:

SELECT ?article ?articleLabel ?reviewerLabel
WHERE
{
	?article wdt:P31 wd:Q13442814 .
    ?article wdt:P4032 ?reviewer 
  
	SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
}

Try it!

3. Return a ranked list of pieces of software used in scientific articles grouped by the numbers of papers that report use of the software:

#defaultView:BubbleChart
SELECT ?software ?softwareLabel (COUNT(?article) AS ?count)

WHERE {
  ?article wdt:P31 wd:Q13442814.
  ?article wdt:P2283 ?software .
            
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }
GROUP BY ?software ?softwareLabel 
ORDER BY DESC(?count)

%3Fsoftware %3FsoftwareLabel (COUNT(%3Farticle) AS %3Fcount)%0A%0AWHERE {%0A %3Farticle wdt%3AP31 wd%3AQ13442814.%0A %3Farticle wdt%3AP2283 %3Fsoftware .%0A %0A SERVICE wikibase%3Alabel {%0A%09%09bd%3AserviceParam wikibase%3Alanguage "en" .%0A %0A}%0A }%0AGROUP BY %3Fsoftware %3FsoftwareLabel %0AORDER BY DESC(%3Fcount) Try it!

TO BE IMPROVEDEdit

(Maybe try MINUS) 1. I think this query is also counting interwiki links. I would like this query to tell me how many statements there are for each of these file formats. I'm not sure how to do it.

SELECT ?format ?formatLabel (COUNT(?p) AS ?count)

WHERE {
  
  ?format wdt:P31 wd:Q235557 .
  ?format ?p ?s .
            
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

GROUP BY ?format ?formatLabel
ORDER BY DESC(?count)

Try it!

2. Return all predicates and all objects for all items that are instances of emulator:

SELECT ?p ?o

WHERE {
  
  ?emulator wdt:P31 wd:Q202871 .
  ?emulator ?p ?o .          
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

E-ReadersEdit

1. Return a list of all e-readers and all readable file formats they support:

SELECT ?ereader ?ereaderLabel ?format ?formatLabel

WHERE {
  ?ereader wdt:P31  wd:Q726235 .
  ?ereader wdt:P1072 ?format
  
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

2. Return a list of all e-readers that support the Mobipocket file format:

SELECT ?ereader ?ereaderLabel 

WHERE {
  ?ereader wdt:P31  wd:Q726235 .
  ?ereader wdt:P1072 wd:Q1941622 .
  
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

EndpointsEdit

1. Return a list of all items that have a URL that is an instance of a SPARQL endpoint:

SELECT DISTINCT ?sep ?sepLabel

WHERE {
  
  ?sep p:P2699 ?st1 .
        ?st1 pq:P31 wd:Q26261192 .
  
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

2. Return a list of all items in Wikidata that are listed as instances of SPARQL endpoint:

SELECT ?sep ?sepLabel

WHERE {
  
  ?sep wdt:P31 wd:Q26261192 .
  
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

Try it!

3. A third option to get at this data:

SELECT ?database ?databaseLabel ?value WHERE {
  ?database ?p ?wds.
  ?wds ?v ?value.
  ?wdP wikibase:statementProperty ?v.
  ?wdP wikibase:claim ?p.
  ?wds pq:P31 wd:Q26261192.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}

Try it!

AwardsEdit

1. Return a list of all educational institutions attended by winners of Guggenheim Fellowships ranked in order of the number of recipients.

SELECT   ?school ?schoolLabel (COUNT(?person) AS ?count)

WHERE {
  ?person wdt:P166 wd:Q1316544 .
  ?person wdt:P69  ?school .
  SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
    
}
  }

GROUP BY ?school ?schoolLabel
ORDER BY DESC(?count)

Try it!

SPARQL Reference MaterialsEdit

DBpedia QueriesEdit

1.

PREFIX dbc: <http://dbpedia.org/resource/Category:>

PREFIX dc: <http://purl.org/dc/elements/1.1/>

PREFIX dcterms: <http://purl.org/dc/terms/>

SELECT * WHERE {

    ?software dcterms:subject dbc:Science_software

}

Try it!

class subclass software RDFEdit

The following query uses these:

  • Properties: subclass of (P279)     , properties for this type (P1963)     
    CONSTRUCT {
      ?class a owl:Class . 
      ?class rdfs:subClassOf ?superclass . 
      ?class rdfs:label ?classLabel . 
      ?property rdfs:domain ?class . 
      ?property rdfs:label ?classLabel .
    }
    WHERE {
      BIND(wd:Q235557 AS ?mainClass) .    # Q11344 chemical element; Q1420 automobile
      
      # Pick one or the other of the following two triple patterns. 
      #?class wdt:P279* ?mainClass.     # Find subclasses of the main class. 
      ?mainClass wdt:P279* ?class.     # Find superclasses of the main class. 
      
      ?class wdt:P279 ?superclass .     # So we can create rdfs:subClassOf triples
      ?class rdfs:label ?classLabel.
      OPTIONAL {
        ?class wdt:P1963 ?property.
        ?property rdfs:label ?propertyLabel.
        FILTER((LANG(?propertyLabel)) = "en")
        }
      FILTER((LANG(?classLabel)) = "en")
    }
    

Bertrand's construct query for PREMISEdit

The following query uses these:

  • Properties: instance of (P31)     , subclass of (P279)     , operating system (P306)     
    PREFIX relSubType: <http://id.loc.gov/vocabulary/preservation/relationshipSubType/>
    PREFIX envFuncType: <id.loc.gov/vocabulary/preservation/environmentFunctionType/>
    PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
    
    CONSTRUCT {
      ?item rdf:type envFuncType:soa.
      ?item rdfs:label ?itemLabel.
      ?item relSubType:req ?operatingSystem.
      ?operatingSystem rdf:type envFuncType:ops.
      ?operatingSystem rdfs:label ?operatingSystemLabel.
    }
    WHERE {
      ?item (wdt:P31/wdt:P279*) wd:Q7397.
      ?item wdt:P306 ?operatingSystem.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en,en". }
    }
    

Using Wikidata data for PREMIS emulatesEdit

The following query uses these:

  • Properties: instance of (P31)     , subclass of (P279)     , emulates (P4043)     
    PREFIX relSubType: <http://id.loc.gov/vocabulary/preservation/relationshipSubType/>
    PREFIX envFuncType: <id.loc.gov/vocabulary/preservation/environmentFunctionType/>
    PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
    
    CONSTRUCT {
      ?item rdf:type envFuncType:soa.
      ?item rdfs:label ?itemLabel.
      ?item relSubType:emu ?software.
      ?software rdf:type envFuncType:sof.
      ?software rdfs:label ?softwareLabel.
    }
    WHERE {
      ?item (wdt:P31/wdt:P279*) wd:Q7397.
      ?item wdt:P4043 ?software.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en,en". }
    }
    

Using Wikidata data for PREMIS hasDependencyEdit

The following query uses these:

  • Properties: instance of (P31)     , subclass of (P279)     , depends on software (P1547)     
    PREFIX relationshipType: <http://id.loc.gov/vocabulary/preservation/relationshipType.html>
    PREFIX envFuncType: <id.loc.gov/vocabulary/preservation/environmentFunctionType/>
    PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
    
    CONSTRUCT {
      ?item rdf:type envFuncType:soa.
      ?item rdfs:label ?itemLabel.
      ?item relationshipType:dep ?software.
      ?software rdf:type envFuncType:sof.
      ?software rdfs:label ?softwareLabel.
    }
    WHERE {
      ?item (wdt:P31/wdt:P279*) wd:Q7397.
      ?item wdt:P1547 ?software.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en,en". }
    }
    

Finn's query about worksEdit

The following query uses these:

=Counting classes in WDEdit

The following query uses these:

  • Properties: instance of (P31)     
    SELECT ?o (count(*) AS ?c)
    WHERE 
    {
      ?x wdt:P31 ?o
    }
    GROUP BY (?o)