User:Realworldobject/ShowTell

From Wikidata
Jump to navigation Jump to search

Explore Wikidata's classes and properties:

Here are some show and tell SPARQL queries:

Passage

[edit]

Properties for a type

[edit]

The following query uses these:

  • Properties: properties for this type (P1963)  View with Reasonator View with SQID
    SELECT ?type ?typeLabel (COUNT(DISTINCT ?propertyForType) AS ?numPropsForType) 
    WHERE {
      ?type wdt:P1963 ?propertyForType .
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    GROUP BY ?type ?typeLabel 
    ORDER BY DESC(?numPropsForType)
    

Toponym analysis

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID
    #SELECT ?item ?itemLabel ?propLabel ?toponym ?toponymLabel 
    SELECT DISTINCT ?p ?propLabel (COUNT(?item) AS ?itemCount)
    WHERE {
      ?item ?p ?toponym.
      ?prop wikibase:directClaim ?p.
      ?toponym wdt:P31 wd:Q7884789 .
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    GROUP BY ?p ?propLabel
    ORDER BY DESC(?itemCount)
    

Translations

[edit]

The following query uses these:

  • Properties: edition or translation of (P629)  View with Reasonator View with SQID, language of work or name (P407)  View with Reasonator View with SQID, instance of (P31)  View with Reasonator View with SQID, translator (P655)  View with Reasonator View with SQID
    SELECT ?translation ?translationLabel ?translationLanguageLabel ?translatorLabel ?sourceLabel ?sourceLanguageLabel
    WHERE {
      {
        ?translation wdt:P629 ?source;
              wdt:P407 ?translationLanguage.
        ?source wdt:P407 ?sourceLanguage ;
                wdt:P31 wd:Q571 .
        OPTIONAL {?translation wdt:P655 ?translator}
        FILTER(?translationLanguage != ?sourceLanguage)
        
      }
      FILTER(?source != wd:Q428 && ?source != wd:Q1845)
    #  UNION 
    #  {?item wdt:P31 wd:Q7553 .}
      
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,de,fr". }
    }
    
[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, edition or translation of (P629)  View with Reasonator View with SQID, language of work or name (P407)  View with Reasonator View with SQID, ISO 639-1 code (P218)  View with Reasonator View with SQID, of (P642)  View with Reasonator View with SQID
    # Declared translations that don't link to a source work
    SELECT ?translation (SAMPLE(?nativeLabel) AS ?title) ?translationDescription ?sitelinks
    WHERE {
      {
        ?translation wdt:P31 wd:Q7553.
      }
      UNION
      {
        ?translation wdt:translator [].
      }
      MINUS {?translation wdt:P629 []}
      MINUS {?translation p:P31/pq:P642 []}
      ?translation rdfs:label ?nativeLabel .
      OPTIONAL {
        ?translation wdt:P407 ?language. 
        ?language wdt:P218 ?langcode.
        FILTER(LANG(?nativeLabel)=?langcode)
      }
      ?translation wikibase:sitelinks ?sitelinks.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    GROUP BY ?translation ?translationDescription ?sitelinks
    ORDER BY DESC(?sitelinks)
    LIMIT 100
    

The most prolific translators

[edit]

The following query uses these:

  • Properties: translator (P655)  View with Reasonator View with SQID
    SELECT DISTINCT ?translator ?translatorLabel (COUNT(DISTINCT ?item) AS ?numTranslations)
    WHERE {
      ?item wdt:P655 ?translator.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,ru,fr". }
    }
    GROUP BY ?translator ?translatorLabel
    ORDER BY DESC(?numTranslations)
    LIMIT 100
    

Works translated by the most prolific translator

[edit]

The following query uses these:

  • Properties: translator (P655)  View with Reasonator View with SQID, author (P50)  View with Reasonator View with SQID, edition or translation of (P629)  View with Reasonator View with SQID
    SELECT DISTINCT ?source ?sourceLabel ?author ?authorLabel ?translation ?translationLabel
    WHERE {
      ?translation wdt:P655 wd:Q964250.
      OPTIONAL {?translation wdt:P50 ?author.}
      OPTIONAL {?translation wdt:P629 ?source.}
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,ru,fr". }
    }
    ORDER BY ?translationLabel
    

Literary works with the most translations

[edit]

The following query uses these:

  • Properties: edition or translation of (P629)  View with Reasonator View with SQID, instance of (P31)  View with Reasonator View with SQID, subclass of (P279)  View with Reasonator View with SQID
    # by Realworldobject, 2019-12-04
    # Literary works with the most translations
    SELECT ?work ?workLabel (COUNT(DISTINCT ?translation) AS ?count)
    WHERE {
      ?translation wdt:P629 ?work .
      ?work wdt:P31/wdt:P279* wd:Q7725634.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    GROUP BY ?work ?workLabel
    ORDER BY DESC(?count)
    LIMIT 100
    

Short tail works that have been translated into English

[edit]

The following query uses these:

  • Properties: has edition or translation (P747)  View with Reasonator View with SQID, language of work or name (P407)  View with Reasonator View with SQID, title (P1476)  View with Reasonator View with SQID, author (P50)  View with Reasonator View with SQID, translator (P655)  View with Reasonator View with SQID
    # by Realworldobject, 2019-12-04
    # Short tail works that have been translated into English
    SELECT DISTINCT ?original (SAMPLE(?originalTitle) AS ?originalTitle) (GROUP_CONCAT(DISTINCT ?authorLabel) AS ?authors) (GROUP_CONCAT(DISTINCT ?originalLangLabel) AS ?originalLangs) ?translation ?translationTitle ?translationLangLabel ?translatorLabel ?sitelinks
    WHERE {
      VALUES ?translationLang {
        wd:Q1860  # English
      }
      ?original wdt:P747 ?translation ;
                wdt:P407 ?originalLang ;
                wdt:P1476 ?originalTitle ;
                wdt:P50 ?author ;
                wikibase:sitelinks ?sitelinks .
      ?translation wdt:P655 ?translator ;
                   wdt:P407 ?translationLang ;
                   wdt:P1476 ?translationTitle;
                   wdt:P655 ?translator .
    
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". ?author rdfs:label ?authorLabel .?originalLang rdfs:label ?originalLangLabel}
    }
    GROUP BY ?original ?translation ?translationTitle ?translationLangLabel ?translatorLabel ?sitelinks
    ORDER BY DESC(?sitelinks)
    LIMIT 100
    

Cornell employees, ordered by their start time

[edit]

The following query uses these:

  • Properties: employer (P108)  View with Reasonator View with SQID, start time (P580)  View with Reasonator View with SQID, end time (P582)  View with Reasonator View with SQID
    SELECT ?person ?personLabel ?employer ?employerLabel ?startTime ?endTime
    WHERE {
      VALUES ?employer {
        wd:Q49115
      }
      ?person p:P108 ?statement.
      ?statement ps:P108 ?employer.
      OPTIONAL {?statement pq:P580 ?startTime}
      OPTIONAL {?statement pq:P582 ?endTime}
      
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    ORDER BY DESC(?startTime)
    

employees of Cornell who have author the most academic writings (not necessarily within that tenure though)

[edit]

The following query uses these:

  • Properties: employer (P108)  View with Reasonator View with SQID, parent organization (P749)  View with Reasonator View with SQID, author (P50)  View with Reasonator View with SQID, instance of (P31)  View with Reasonator View with SQID, subclass of (P279)  View with Reasonator View with SQID
    # employees of Cornell who have author the most academic writings (not necessarily within that tenure though)
    SELECT ?institution ?institutionLabel ?scholar ?scholarLabel (COUNT(DISTINCT ?work) AS ?numWorks)
    WHERE
    {
      VALUES ?institution {
        wd:Q49115
      }
      ?scholar wdt:P108/wdt:P749* ?institution. 
      ?work wdt:P50 ?scholar;
            wdt:P31/wdt:P279* wd:Q4119870.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    GROUP BY ?scholar ?scholarLabel ?institution ?institutionLabel
    ORDER BY DESC(?numWorks)
    LIMIT 100
    

Death date of Jane Austen

[edit]

The following query uses these:

  • Properties: date of death (P570)  View with Reasonator View with SQID
    #Death date of Jane Austen
    SELECT ?deathdate
    WHERE {
      wd:Q36322 wdt:P570 ?deathdate. 
    }
    

Field of work of the author of "De re metallica"

[edit]

The following query uses these:

  • Properties: author (P50)  View with Reasonator View with SQID, field of work (P101)  View with Reasonator View with SQID
    #Field of work of author of "De re metallica"
    SELECT ?fieldOfWork ?fieldOfWorkLabel 
    WHERE {
      wd:Q3193676 wdt:P50 ?author.
      ?author wdt:P101 ?fieldOfWork.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    

Modern country where Mary Magdaline died

[edit]

The following query uses these:

  • Properties: place of death (P20)  View with Reasonator View with SQID, country (P17)  View with Reasonator View with SQID
    #Modern country where Mary Magdaline died
    SELECT ?placeOfDeath ?placeOfDeathLabel ?country ?countryLabel
    WHERE {
      wd:Q63070 wdt:P20 ?placeOfDeath.
      ?placeOfDeath wdt:P17 ?country.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    

first names of main characters of notable works written by Jane Austen

[edit]

The following query uses these:

  • Properties: notable work (P800)  View with Reasonator View with SQID, characters (P674)  View with Reasonator View with SQID, given name (P735)  View with Reasonator View with SQID
    #first name of main characters of notable works written by Jane Austen
    SELECT ?notableWork ?notableWorkLabel ?character ?characterLabel ?givenName ?givenNameLabel
    WHERE {
      wd:Q36322 wdt:P800 ?notableWork.
      ?notableWork wdt:P674 ?character.
      ?character wdt:P735 ?givenName.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    

Women Computer Scientists

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, sex or gender (P21)  View with Reasonator View with SQID, occupation (P106)  View with Reasonator View with SQID, VIAF ID (P214)  View with Reasonator View with SQID
    #Women Computer Scientists
    SELECT ?item ?itemLabel ?itemDescription ?itemAltLabel ?viafID
    WHERE 
    {
      ?item wdt:P31 wd:Q5;  # instance of: human
            wdt:P21 wd:Q6581072;  # gender: female
            wdt:P106 wd:Q82594.  # occupation: computer scientist
      OPTIONAL {?item wdt:P214 ?viafID}
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    

Item types associated with translator property

[edit]

The following query uses these:

  • Properties: translator (P655)  View with Reasonator View with SQID, instance of (P31)  View with Reasonator View with SQID
    #Item types associated with the translator property
    SELECT DISTINCT ?type ?typeLabel (COUNT(DISTINCT ?translation) AS ?numOccurs)
    #SELECT ?translation ?translationLabel ?translator ?translatorLabel (COUNT(DISTINCT ?translation) AS ?numOccurs)
    WHERE 
    {
      ?translation wdt:P655 ?translator;
                   wdt:P31 ?type.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    #LIMIT 100
    GROUP BY ?type ?typeLabel
    ORDER BY DESC(?numOccurs)
    

Buildings

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID
    #Buildings
    SELECT ?item ?itemLabel 
    WHERE 
    {
      ?item wdt:P31 wd:Q41176.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    

Greek dieties

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID
    #Greek Dieties
    SELECT ?item ?itemLabel ?itemDescription
    WHERE 
    {
      ?item wdt:P31 wd:Q22989102.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    

Human settlements in Brazil

[edit]

The following query uses these:

[edit]

The following query uses these:

  • Items: Francesco Francia (Q260057)  View with Reasonator View with SQID
    # Items related to Francesco Francia
    SELECT ?item ?itemLabel ?p ?propLabel
    WHERE 
    {
      ?item ?p wd:Q260057.
      ?prop wikibase:directClaim ?p.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    

Joint ventures

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID
    #Joint ventures
    SELECT ?item ?itemLabel 
    WHERE 
    {
      ?item wdt:P31 wd:Q489209.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    

Publishers etc

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, subclass of (P279)  View with Reasonator View with SQID, inception (P571)  View with Reasonator View with SQID, dissolved, abolished or demolished date (P576)  View with Reasonator View with SQID, has subsidiary (P355)  View with Reasonator View with SQID
    #Publishers, etc.
    SELECT ?publisher ?publisherLabel ?publisherDescription (COUNT(DISTINCT ?label) AS ?numLabel) ?sitelinks ?inception ?dissolved (COUNT(DISTINCT ?subsidiary) AS ?numSubsidiaries)
    WHERE 
    {
      VALUES ?type {
        wd:Q2085381  # publisher
        wd:Q2608849  # imprint
        wd:Q18127  # record label
        }
      ?publisher wdt:P31/wdt:P279 ?type;
                 wikibase:sitelinks ?sitelinks.
      OPTIONAL {?publisher rdfs:label|skos:altLabel ?label}
      OPTIONAL {?publisher wdt:P571 ?inception}
      OPTIONAL {?publisher wdt:P576 ?dissolved}
      OPTIONAL {?publisher wdt:P355 ?subsidiary}
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,de,fr,ja,es,eo,ru,it". }
    }
    GROUP BY ?publisher ?publisherLabel ?publisherDescription ?inception ?dissolved ?sitelinks
    ORDER BY DESC(?sitelinks)
    

Properties associated with Publishers etc

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, subclass of (P279)  View with Reasonator View with SQID
    #Properties associated with publishers, etc.
    SELECT ?p ?propLabel (COUNT(?p) AS ?numOccurs)
    WHERE 
    {
      VALUES ?type {
        wd:Q2085381  # publisher
        wd:Q2608849  # imprint
        wd:Q18127  # record label
        }
      ?publisher wdt:P31/wdt:P279 ?type;
                 ?p [].
      ?prop wikibase:directClaim ?p.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    GROUP BY ?p ?propLabel
    ORDER BY DESC(?numOccurs)
    

List of Wikidata property to indicate a constraint

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID
    SELECT ?item ?itemLabel 
    WHERE {
      ?item wdt:P31 wd:Q21504947 .
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    

Exclude a few things

[edit]

The following query uses these:

  • Properties: sibling (P3373)  View with Reasonator View with SQID
    SELECT DISTINCT ?include ?includeLabel
    WHERE {
      wd:Q36322 wdt:P3373 ?include .
      FILTER NOT EXISTS { 
        wd:Q36322 wdt:P3373 ?include .
        VALUES ?include { wd:Q3101398 wd:Q2505245 }
      }
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } 
    
    }
    
[edit]

Top 1000 sitelinked women that lack VIAF IDs

[edit]

The following query uses these:

  • Properties: sex or gender (P21)  View with Reasonator View with SQID, VIAF ID (P214)  View with Reasonator View with SQID
    SELECT ?item ?itemLabel ?itemDescription ?sitelinks
    WHERE {
      {
      SELECT ?item ?sitelinks
      WHERE {
        ?item wdt:P21 wd:Q6581072 ;
              wikibase:sitelinks ?sitelinks.
        MINUS {?item wdt:P214 []}
      }
      ORDER BY DESC(?sitelinks)
      LIMIT 1000
      }
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    ORDER BY DESC(?sitelinks)
    

People with the most fields of work (dated)

[edit]

The following query uses these:

  • Properties: field of work (P101)  View with Reasonator View with SQID, start time (P580)  View with Reasonator View with SQID
    SELECT ?item ?itemLabel (COUNT(?field) AS ?numFields) (GROUP_CONCAT(?fieldname) AS ?fields)
    WHERE {
      ?item p:P101 ?stmt. 
      ?stmt ps:P101 ?field;
            pq:P580 ?starttime.
      ?field rdfs:label ?fieldname FILTER(LANG(?fieldname)="en")
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    GROUP BY ?item ?itemLabel
    HAVING(?numFields>1)
    ORDER BY DESC(?numFields) 
    LIMIT 10
    

List of external equivalent/sub classes

[edit]

The following query uses these:

  • Properties: subclass of (P279)  View with Reasonator View with SQID, equivalent class (P1709)  View with Reasonator View with SQID
    #External equivalent/sub classes
    PREFIX wikibase: <http://wikiba.se/ontology#>
    SELECT ?wdClass ?label ?equivalentClass ?subclassOfExternal
    WHERE {
      {?wdClass wdt:P279+/wdt:P1709 ?subclassOfExternal}
      UNION
      {?wdClass wdt:P1709 ?equivalentClass}
      ?wdClass rdfs:label ?label.
      FILTER(LANG(?label)="en")
    #  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    LIMIT 1000
    

List of equivalent properties

[edit]

The following query uses these:

  • Properties: equivalent property (P1628)  View with Reasonator View with SQID, external subproperty (P2236)  View with Reasonator View with SQID, external superproperty (P2235)  View with Reasonator View with SQID
    PREFIX wikibase: <http://wikiba.se/ontology#>
    SELECT ?wdt ?wdLabel ?equivalent ?externalSubproperty ?externalSuperproperty
    WHERE {
      ?wd wikibase:directClaim ?wdt.
      OPTIONAL {?wd wdt:P1628 ?equivalent}
      OPTIONAL {?wd wdt:P2236 ?externalSubproperty}
      OPTIONAL {?wd wdt:P2235 ?externalSuperproperty}
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
      FILTER(BOUND(?equivalent) || BOUND(?externalSubproperty) || BOUND(?externalSuperproperty))
    }
    ORDER BY ?wd ?equivalent ?externalSubproperty ?externalSuperproperty
    

Subclasses for selected high-level classes

[edit]

The following query uses these:

  • Properties: subclass of (P279)  View with Reasonator View with SQID
    # Subclasses for selected high-level classes
    SELECT DISTINCT ?class ?classLabel ?subclass ?subclassLabel
    WHERE
    {
    	?subclass wdt:P279* ?class .
    	SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
        VALUES ?class {
          wd:Q5	# human
          wd:Q571	# book
          wd:Q2221906	# geographic location
          wd:Q43229	# organization
        }
    }
    ORDER BY ?classLabel ?subclassLabel
    

Manuscripts

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID
    #Manuscripts
    SELECT ?item ?itemLabel
    WHERE
    {
    	?item wdt:P31 wd:Q87167 .
    	SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    

Collective Pseudonyms

[edit]

Limited to those who authored something

The following query uses these:

  • Properties: author (P50)  View with Reasonator View with SQID, instance of (P31)  View with Reasonator View with SQID, subclass of (P279)  View with Reasonator View with SQID
    SELECT DISTINCT ?collectivePseudonymLabel ?collectivePseudonym ?humanLabel ?human ?evidence
    WHERE {
      ?evidence schema:about ?collectivePseudonym.
      ?work wdt:P50 ?collectivePseudonym.
      ?collectivePseudonym wdt:P31 wd:Q16017119.
      MINUS {?collectivePseudonym wdt:P31/wdt:P279* wd:Q10648343}
      ?human wdt:P31 wd:Q5.
      { ?collectivePseudonym ?p ?human }
      UNION
      { ?human ?p ?collectivePseudonym }
      FILTER regex(STR(?evidence), 'https://en.wikipedia.org/wiki/')
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    ORDER BY ?collectivePseudonym ?human
    LIMIT 100
    

The people behind collective pseudonyms (at one stage or another)

[edit]

Limited to those who authored something

The following query uses these:

  • Properties: author (P50)  View with Reasonator View with SQID, instance of (P31)  View with Reasonator View with SQID
    SELECT DISTINCT ?collectivePseudonymLabel ?collectivePseudonym ?humanLabel ?human ?evidence
    WHERE {
      ?evidence schema:about ?collectivePseudonym.
      ?work wdt:P50 ?collectivePseudonym.
      ?collectivePseudonym wdt:P31 wd:Q16017119.
      ?human wdt:P31 wd:Q5.
      { ?collectivePseudonym ?p ?human }
      UNION
      { ?human ?p ?collectivePseudonym }
      FILTER regex(STR(?evidence), 'https://en.wikipedia.org/wiki/')
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    ORDER BY ?collectivePseudonym ?human
    LIMIT 100
    

Works authored by a collective pseudonym along with the person(s) who did the actual writing

[edit]

The following query uses these:

  • Properties: author (P50)  View with Reasonator View with SQID, instance of (P31)  View with Reasonator View with SQID
    SELECT DISTINCT ?workLabel ?work ?collectivePseudonymLabel ?collectivePseudonym ?humanLabel ?human ?evidence
    WHERE {
      ?evidence schema:about ?work.
      ?work wdt:P50 ?collectivePseudonym;
            wdt:P50 ?human.
      ?collectivePseudonym wdt:P31 wd:Q16017119.
      ?human wdt:P31 wd:Q5.
      {
        ?work ?workhumanrelationship ?human.
        ?collectivePseudonym ?p ?human
      }
      UNION
      {
        ?work ?workhumanrelationship ?human.
        ?human ?p ?collectivePseudonym
      }
      FILTER regex(STR(?evidence), 'https://en.wikipedia.org/wiki/')
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    ORDER BY ?enWorkLabel
    LIMIT 100
    

10 Miscellaneous Works

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID
    PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
    PREFIX schema: <http://schema.org/>
    PREFIX wdt: <http://www.wikidata.org/prop/direct/>
    PREFIX wd: <http://www.wikidata.org/entity/>
    SELECT DISTINCT ?work ?workLabel ?evidence
    WHERE {
      ?evidence schema:about ?work.
      ?work wdt:P31 wd:Q571.
      FILTER regex(STR(?evidence), 'https://en.wikipedia.org/wiki/')
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    ORDER BY ?workLabel
    LIMIT 10
    

10 Miscellaneous Editions

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID
    PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
    PREFIX schema: <http://schema.org/>
    PREFIX wdt: <http://www.wikidata.org/prop/direct/>
    PREFIX wd: <http://www.wikidata.org/entity/>
    SELECT DISTINCT ?edition ?editionLabel ?evidence
    WHERE {
      ?evidence schema:about ?edition.
      ?edition wdt:P31 wd:Q3331189.
      FILTER regex(STR(?evidence), 'https://en.wikipedia.org/wiki/')
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    ORDER BY ?editionLabel
    LIMIT 10
    

Editions of Encyclopedia Britannica (Q455) in publication date order

[edit]

The following query uses these:

  • Properties: edition or translation of (P629)  View with Reasonator View with SQID, publication date (P577)  View with Reasonator View with SQID
    PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
    PREFIX schema: <http://schema.org/>
    PREFIX wdt: <http://www.wikidata.org/prop/direct/>
    PREFIX wd: <http://www.wikidata.org/entity/>
    SELECT DISTINCT ?editionLabel ?publicationDate ?edition
    WHERE {
      ?edition wdt:P629 wd:Q455;
               wdt:P577 ?publicationDate.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    ORDER BY ?publicationDate
    

Editions of Diary of a Young Girl (Q6911)

[edit]

It's cool how the English labels for editions contain the title as it would appear in the language of that edition. You have to go to the work level to see the English language title (whether there is an English language edition or not.)

The following query uses these:

  • Properties: original language of film or TV show (P364)  View with Reasonator View with SQID, publication date (P577)  View with Reasonator View with SQID, has edition or translation (P747)  View with Reasonator View with SQID, language of work or name (P407)  View with Reasonator View with SQID, translator (P655)  View with Reasonator View with SQID, publisher (P123)  View with Reasonator View with SQID
    PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
    PREFIX schema: <http://schema.org/>
    PREFIX wdt: <http://www.wikidata.org/prop/direct/>
    PREFIX wd: <http://www.wikidata.org/entity/>
    SELECT DISTINCT ?work ?workLabel ?workLanguageLabel ?edition ?editionLabel ?publisherLabel ?editionLanguageLabel ?editionDate ?translatorLabel ?translator
    WHERE {
      FILTER (?work = wd:Q6911)
      {
        ?work wdt:P364 ?workLanguage;
              wdt:P577 ?originalPublicationDate;
              wdt:P747 ?edition.
    
        OPTIONAL {?work wdt:P407 ?workLanguage}
        OPTIONAL {?edition wdt:P655 ?translator}
        OPTIONAL {?edition wdt:P407 ?editionLanguage}
        OPTIONAL {?edition wdt:P577 ?editionDate}
        OPTIONAL {?edition wdt:P123 ?publisher}
      }
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    ORDER BY ?editionDate ?translatorLabel
    

Works authored by baseball players

[edit]

The following query uses these:

  • Properties: author (P50)  View with Reasonator View with SQID, occupation (P106)  View with Reasonator View with SQID
    PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
    PREFIX wdt: <http://www.wikidata.org/prop/direct/>
    PREFIX wd: <http://www.wikidata.org/entity/>
    SELECT DISTINCT ?player ?playerLabel ?work ?workLabel ?evidence
    WHERE
    {
      ?evidence schema:about ?work.
      ?work wdt:P50 ?player.
      ?player wdt:P106 wd:Q10871364. # occupation: baseball player
      FILTER regex(STR(?evidence), 'https://en.wikipedia.org/wiki/')
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    ORDER BY ?playerLabel ?workLabel
    

Top 50 for P31 (instance of) and P279 (subclass of) of items using P243 (OCLC control number)

[edit]

The following query uses these:

  • Properties: OCLC control number (P243)  View with Reasonator View with SQID, instance of (P31)  View with Reasonator View with SQID, subclass of (P279)  View with Reasonator View with SQID
    SELECT ?class ?classLabel ?count ?use_as_Label
    {	{	SELECT ?class (COUNT(*) AS ?count) (wd:P31 as ?use_as_)
    		{	?a	wdt:P243	?p	; wdt:P31	?class}
            GROUP BY ?class ORDER BY DESC(?count) LIMIT 50
      	}
      	UNION
    	{	SELECT ?class (COUNT(*) AS ?count) (wd:P279 as ?use_as_)
    		{	?a	wdt:P243	?p	; wdt:P279	?class}
            GROUP BY ?class ORDER BY DESC(?count) LIMIT 50
      	}
      	SERVICE wikibase:label { bd:serviceParam wikibase:language "en,en" }
    }
    ORDER BY DESC(?count) ?class
    

List of properties associated with OCLC control numbers

[edit]

The following query uses these:

  • Properties: OCLC control number (P243)  View with Reasonator View with SQID
    SELECT ?qual ?qualLabel ?count WHERE {
      {
        SELECT ?qual (COUNT(DISTINCT ?item) AS ?count) WHERE {
             hint:Query hint:optimizer "None" .
             ?item p:P243 ?statement .
             ?statement ?pq_qual ?pq_obj .
             ?qual wikibase:qualifier ?pq_qual .
        }  GROUP BY ?qual
      } .
    
      OPTIONAL {
        ?qual rdfs:label ?qualLabel filter (lang(?qualLabel) = "en") .
      }
    }
    ORDER BY DESC(?count) ASC(?qualLabel)
    

Top 50 for P31 (instance of) and P279 (subclass of) of items using P214 (VIAF identifier)

[edit]

The following query uses these:

  • Properties: VIAF ID (P214)  View with Reasonator View with SQID, instance of (P31)  View with Reasonator View with SQID, subclass of (P279)  View with Reasonator View with SQID
    SELECT ?class ?classLabel ?count ?use_as_Label
    {	{	SELECT ?class (COUNT(*) AS ?count) (wd:P31 as ?use_as_)
    		{	?a	wdt:P214	?p	; wdt:P31	?class}
            GROUP BY ?class ORDER BY DESC(?count) LIMIT 50
      	}
      	UNION
    	{	SELECT ?class (COUNT(*) AS ?count) (wd:P279 as ?use_as_)
    		{	?a	wdt:P214	?p	; wdt:P279	?class}
            GROUP BY ?class ORDER BY DESC(?count) LIMIT 50
      	}
      	SERVICE wikibase:label { bd:serviceParam wikibase:language "en,en" }
    }
    ORDER BY DESC(?count) ?class
    

Properties associated with (VIAF identifiers)

[edit]

The following query uses these:

  • Properties: VIAF ID (P214)  View with Reasonator View with SQID
    SELECT ?qual ?qualLabel ?count WHERE {
      {
        SELECT ?qual (COUNT(DISTINCT ?item) AS ?count) WHERE {
             hint:Query hint:optimizer "None" .
             ?item p:P214 ?statement .
             ?statement ?pq_qual ?pq_obj .
             ?qual wikibase:qualifier ?pq_qual .
        }  GROUP BY ?qual
      } .
    
      OPTIONAL {
        ?qual rdfs:label ?qualLabel filter (lang(?qualLabel) = "en") .
      }
    }
    ORDER BY DESC(?count) ASC(?qualLabel)
    

Top 50 for P31 (instance of) and P279 (subclass of) of items using P2163 (FAST identifier)

[edit]

The following query uses these:

  • Properties: FAST ID (P2163)  View with Reasonator View with SQID, instance of (P31)  View with Reasonator View with SQID, subclass of (P279)  View with Reasonator View with SQID
    SELECT ?class ?classLabel ?count ?use_as_Label
    {	{	SELECT ?class (COUNT(*) AS ?count) (wd:P31 as ?use_as_)
    		{	?a	wdt:P2163	?p	; wdt:P31	?class}
            GROUP BY ?class ORDER BY DESC(?count) LIMIT 50
      	}
      	UNION
    	{	SELECT ?class (COUNT(*) AS ?count) (wd:P279 as ?use_as_)
    		{	?a	wdt:P2163	?p	; wdt:P279	?class}
            GROUP BY ?class ORDER BY DESC(?count) LIMIT 50
      	}
      	SERVICE wikibase:label { bd:serviceParam wikibase:language "en,en" }
    }
    ORDER BY DESC(?count) ?class
    

Properties associated with P2163 (FAST identifiers)

[edit]

The following query uses these:

  • Properties: FAST ID (P2163)  View with Reasonator View with SQID
    SELECT ?qual ?qualLabel ?count WHERE {
      {
        SELECT ?qual (COUNT(DISTINCT ?item) AS ?count) WHERE {
             hint:Query hint:optimizer "None" .
             ?item p:P2163 ?statement .
             ?statement ?pq_qual ?pq_obj .
             ?qual wikibase:qualifier ?pq_qual .
        }  GROUP BY ?qual
      } .
    
      OPTIONAL {
        ?qual rdfs:label ?qualLabel filter (lang(?qualLabel) = "en") .
      }
    }
    ORDER BY DESC(?count) ASC(?qualLabel)
    

List of law reviews that are identified/described in both Wikidata and WorldCat

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, OCLC control number (P243)  View with Reasonator View with SQID
    PREFIX wikibase: <http://wikiba.se/ontology#>
    PREFIX wdt: <http://www.wikidata.org/prop/direct/>
    PREFIX wd: <http://www.wikidata.org/entity/>
    SELECT ?sLabel ?s ?worldcatURI
    WHERE {
      ?s wdt:P31 wd:Q746654;
         wdt:P243 ?ocn.
      BIND (URI(CONCAT("http://www.worldcat.org/oclc/",?ocn)) AS ?worldcatURI)
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    ORDER BY ?sLabel
    

List of ISSN-identified serials that are identified/described in both Wikidata and WorldCat

[edit]

The following query uses these:

  • Properties: title (P1476)  View with Reasonator View with SQID, instance of (P31)  View with Reasonator View with SQID, OCLC control number (P243)  View with Reasonator View with SQID, ISSN (P236)  View with Reasonator View with SQID
    PREFIX wikibase: <http://wikiba.se/ontology#>
    PREFIX wdt: <http://www.wikidata.org/prop/direct/>
    PREFIX wd: <http://www.wikidata.org/entity/>
    SELECT DISTINCT ?titleLabel ?s ?typeLabel ?worldcatURI ?issn
    WHERE {
      ?s wdt:P1476 ?title;
         wdt:P31 ?type;
         wdt:P243 ?ocn;
         wdt:P236 ?issn.
      BIND (URI(CONCAT("http://www.worldcat.org/oclc/",?ocn)) AS ?worldcatURI)
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    ORDER BY ?issn ?titleLabel
    

Work/Editions that are identified/described in both Wikidata and WorldCat

[edit]

The following query uses these:

  • Properties: OCLC control number (P243)  View with Reasonator View with SQID, has edition or translation (P747)  View with Reasonator View with SQID, edition number (P393)  View with Reasonator View with SQID, language of work or name (P407)  View with Reasonator View with SQID
    PREFIX wikibase: <http://wikiba.se/ontology#>
    PREFIX wdt: <http://www.wikidata.org/prop/direct/>
    PREFIX wd: <http://www.wikidata.org/entity/>
    SELECT DISTINCT ?wdWork ?wcWork ?wdWorkLabel ?wdEdition ?wcEdition ?wdEditionLabel ?languageLabel ?editionNumber
    WHERE {
      ?wdWork wdt:P243 ?ocnWork ;
              wdt:P747 ?wdEdition.
      ?wdEdition wdt:P243 ?ocnEdition .
      OPTIONAL {?wdEdition wdt:P393 ?editionNumber}
      OPTIONAL {?wdEdition wdt:P407 ?language}
      BIND (URI(CONCAT("http://www.worldcat.org/oclc/",?ocnWork)) AS ?wcWork)
      BIND (URI(CONCAT("http://www.worldcat.org/oclc/",?ocnEdition)) AS ?wcEdition)
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    ORDER BY ?wdWorkLabel ?editionNumber
    LIMIT 100
    

Works identified/described in both Wikidata and WorldCat that were authored by Jane Austen

[edit]

The following query uses these:

  • Properties: author (P50)  View with Reasonator View with SQID, OCLC control number (P243)  View with Reasonator View with SQID
    PREFIX wikibase: <http://wikiba.se/ontology#>
    PREFIX wdt: <http://www.wikidata.org/prop/direct/>
    PREFIX wd: <http://www.wikidata.org/entity/>
    SELECT DISTINCT ?work ?workLabel ?worldcatURI
    WHERE {
      ?work wdt:P50 wd:Q36322;
            wdt:P243 ?ocn.
      BIND (URI(CONCAT("http://www.worldcat.org/oclc/",?ocn)) AS ?worldcatURI)
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    ORDER BY ?workLabel
    

Characters in books in WorldCat

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, OCLC control number (P243)  View with Reasonator View with SQID, characters (P674)  View with Reasonator View with SQID
    PREFIX wikibase: <http://wikiba.se/ontology#>
    PREFIX wdt: <http://www.wikidata.org/prop/direct/>
    PREFIX wd: <http://www.wikidata.org/entity/>
    SELECT DISTINCT ?character ?characterLabel ?wcWork ?workLabel
    WHERE {
      ?work wdt:P31 wd:Q7725634;
            rdfs:label ?workLabel;
            wdt:P243 ?ocn;
            wdt:P674 ?character.
      ?character rdfs:label ?characterLabel.
      BIND (URI(CONCAT("http://www.worldcat.org/oclc/",?ocn)) AS ?wcWork)
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    ORDER BY ?characterLabel ?workLabel
    LIMIT 100
    

Book Series

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, OCLC control number (P243)  View with Reasonator View with SQID
    PREFIX wikibase: <http://wikiba.se/ontology#>
    PREFIX wdt: <http://www.wikidata.org/prop/direct/>
    PREFIX wd: <http://www.wikidata.org/entity/>
    SELECT DISTINCT ?bookSeries ?bookSeriesLabel ?worldCat
    WHERE {
      ?bookSeries wdt:P31 wd:Q277759;
         rdfs:label ?bookSeriesLabel.
      OPTIONAL {?bookSeries wdt:P243 ?ocn}
      BIND (URI(CONCAT("http://www.worldcat.org/oclc/",?ocn)) AS ?worldCat)
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    ORDER BY ?bookSeriesLabel
    

Characters and the Series (where they originate?)

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, characters (P674)  View with Reasonator View with SQID, OCLC control number (P243)  View with Reasonator View with SQID
    PREFIX wikibase: <http://wikiba.se/ontology#>
    PREFIX wdt: <http://www.wikidata.org/prop/direct/>
    PREFIX wd: <http://www.wikidata.org/entity/>
    SELECT DISTINCT ?characterLabel ?character ?bookSeriesLabel ?bookSeries
    WHERE {
      ?bookSeries wdt:P31 wd:Q277759;
         wdt:P674 ?character;
         rdfs:label ?bookSeriesLabel.
      ?character rdfs:label ?characterLabel .
      OPTIONAL {?bookSeries wdt:P243 ?ocn}
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    ORDER BY ?characterLabel ?bookSeriesLabel
    
[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID
    PREFIX wikibase: <http://wikiba.se/ontology#>
    PREFIX wdt: <http://www.wikidata.org/prop/direct/>
    PREFIX wd: <http://www.wikidata.org/entity/>
    SELECT DISTINCT ?seriesMember ?seriesMemberLabel ?typeLabel
    WHERE {
      ?seriesMember ?p wd:Q2316684;
        wdt:P31 ?type;
      	rdfs:label ?seriesMemberLabel.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    ORDER BY ?typeLabel ?seriesMemberLabel
    

Publishers

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, VIAF ID (P214)  View with Reasonator View with SQID, publisher (P123)  View with Reasonator View with SQID
    PREFIX wikibase: <http://wikiba.se/ontology#>
    PREFIX wdt: <http://www.wikidata.org/prop/direct/>
    PREFIX wd: <http://www.wikidata.org/entity/>
    SELECT DISTINCT ?publisherLabel ?publisher ?typeLabel ?viafURI (COUNT(?publisher) as ?count)
    WHERE {
      ?publisher wdt:P31 ?type.
      OPTIONAL {?publisher wdt:P214 ?viaf}
      { ?publisher wdt:P31 wd:Q2085381}
      UNION
      { ?s wdt:P123 ?publisher . }
      BIND (URI(CONCAT("http://viaf.org/viaf/",?viaf)) AS ?viafURI)
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    GROUP BY ?publisher ?publisherLabel ?typeLabel ?viafURI
    ORDER BY DESC(?count)
    LIMIT 100
    

Imprints

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID
    PREFIX wikibase: <http://wikiba.se/ontology#>
    PREFIX wdt: <http://www.wikidata.org/prop/direct/>
    PREFIX wd: <http://www.wikidata.org/entity/>
    SELECT DISTINCT ?imprintLabel ?imprint
    WHERE {
      ?imprint wdt:P31 wd:Q2608849;
               rdfs:label ?imprintLabel.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    ORDER BY ?imprintLabel
    

100 book topics and the type of thing(s) they are

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, main subject (P921)  View with Reasonator View with SQID
    PREFIX wikibase: <http://wikiba.se/ontology#>
    PREFIX wdt: <http://www.wikidata.org/prop/direct/>
    PREFIX wd: <http://www.wikidata.org/entity/>
    SELECT DISTINCT ?topic ?topicLabel ?topicType ?topicTypeLabel
    WHERE {
      ?book wdt:P31 wd:Q571;
            wdt:P921 ?topic.
      ?topic wdt:P31 ?topicType.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    ORDER BY ?topic ?topicType
    LIMIT 100
    

Cookbooks

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, genre (P136)  View with Reasonator View with SQID, OCLC control number (P243)  View with Reasonator View with SQID
    SELECT DISTINCT ?cookbook ?cookbookLabel ?worldcatURI
    WHERE
    {
      ?cookbook wdt:P31|wdt:P136 wd:Q605076.
      OPTIONAL {
        ?cookbook wdt:P243 ?ocn.
        BIND (URI(CONCAT("http://www.worldcat.org/oclc/",?ocn)) AS ?worldcatURI)
      }
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    

Russian scifi

[edit]

The following query uses these:

  • Properties: language of work or name (P407)  View with Reasonator View with SQID, genre (P136)  View with Reasonator View with SQID, title (P1476)  View with Reasonator View with SQID, OCLC control number (P243)  View with Reasonator View with SQID
    SELECT DISTINCT ?scifi ?title ?scifiLabel ?languageLabel ?worldcatURI
    WHERE
    {
      ?scifi wdt:P407 ?language;
                 wdt:P136 wd:Q24925.
    
      OPTIONAL {?scifi wdt:P1476 ?title}
    
      OPTIONAL {?scifi wdt:P243 ?ocn }
    
      BIND (URI(CONCAT("http://www.worldcat.org/oclc/",?ocn)) AS ?worldcatURI)
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
      FILTER (?language = wd:Q7737)
    }
    
[edit]

The following query uses these:

  • Items: vegetarianism (Q83364)  View with Reasonator View with SQID, vegetarian (Q18338317)  View with Reasonator View with SQID, vegetarian cuisine (Q638022)  View with Reasonator View with SQID
    SELECT DISTINCT ?p ?propLabel (COUNT(?p) as ?occurrences)
    WHERE
    {
      ?s rdfs:label ?sLabel.
      { ?s ?p wd:Q83364 }
      UNION
      { ?s ?p wd:Q18338317 }
      UNION
      { ?s ?p wd:Q638022}
      ?prop wikibase:directClaim ?p
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    GROUP BY ?p ?propLabel
    ORDER BY DESC(?occurrences)
    
[edit]

The following query uses these:

  • Items: New York City (Q60)  View with Reasonator View with SQID
    SELECT DISTINCT ?p ?propLabel (COUNT(?p) as ?occurrences)
    WHERE
    {
      {wd:Q60 ?p ?o}
      UNION
      {?o ?p wd:Q60}
      ?prop wikibase:directClaim ?p
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    GROUP BY ?p ?propLabel
    ORDER BY DESC(?occurrences)
    

Autobiographies (inferred by author = about)

[edit]

The following query uses these:

  • Properties: main subject (P921)  View with Reasonator View with SQID, author (P50)  View with Reasonator View with SQID
    SELECT DISTINCT ?s ?sLabel
    WHERE
    {
      ?s wdt:P921 ?o;
         wdt:P50 ?o;
         rdfs:label ?sLabel.
      ?prop wikibase:directClaim ?p
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    

Autobiographies (declared)

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID
    SELECT DISTINCT ?s ?sLabel
    WHERE
    {
      ?s wdt:P31 wd:Q4184;
         rdfs:label ?sLabel.
      ?prop wikibase:directClaim ?p
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    

External identifiers

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID
    SELECT DISTINCT ?externalID ?externalIDLabel ?typeLabel
    WHERE {
      ?externalID wdt:P31 ?type.
      {?externalID wdt:P31 wd:Q19847637 .}
      UNION
      {?externalID wdt:P31 wd:Q18614948.}
      UNION
      {?externalID wdt:P31 wd:Q19595382 .}
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en,en" }
    }
    ORDER BY ?externalIDLabel ?typeLabel
    

Works authored by entities with ISNI identifiers

[edit]

The following query uses these:

  • Properties: author (P50)  View with Reasonator View with SQID, ISNI (P213)  View with Reasonator View with SQID
    SELECT DISTINCT ?workLabel ?work ?authorLabel ?author ?isniID
    WHERE {
      ?work wdt:P50 ?author;
            rdfs:label ?workLabel.
      ?author wdt:P213 ?isniID.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    LIMIT 100
    

Comparison of author coverage between VIAF, ORCID, ISNI, and FAST

[edit]

The following query uses these:

  • Properties: author (P50)  View with Reasonator View with SQID, ORCID iD (P496)  View with Reasonator View with SQID, ISNI (P213)  View with Reasonator View with SQID, VIAF ID (P214)  View with Reasonator View with SQID, FAST ID (P2163)  View with Reasonator View with SQID
    SELECT DISTINCT ?workLabel ?work ?authorLabel ?author ?orcid ?isni ?viaf ?fast
    WHERE {
      ?work wdt:P50 ?author ;
            rdfs:label ?workLabel .
      OPTIONAL { ?author wdt:P496 ?orcidID }
      OPTIONAL { ?author wdt:P213 ?isniID }
      OPTIONAL { ?author wdt:P214 ?viafID }
      OPTIONAL { ?author wdt:P2163 ?fastID }
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
      BIND (URI(CONCAT('http://orcid.org/', ?orcidID)) AS ?orcid)
      BIND (URI(CONCAT('http:/viaf.org/viaf/', ?viafID)) AS ?viaf)
      BIND (URI(CONCAT('http://isni.org/', ?orcidID)) AS ?isni)
      BIND (URI(CONCAT('http://id.worldcat.org/fast/', ?fastID)) AS ?fast)
    }
    LIMIT 1000
    

Things in Wikidata that have associated FAST identifiers

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, FAST ID (P2163)  View with Reasonator View with SQID
    SELECT ?s ?sLabel ?typeLabel ?fastURI
    WHERE {
      ?s wdt:P31 ?type;
      	wdt:P2163 ?fast.
      BIND (URI(CONCAT("http://id.worldcat.org/fast/",?fast)) AS ?fastURI)
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    LIMIT 100
    

Multilingual labels/descriptions for things in Wikidata that have associated FAST identifiers

[edit]

The following query uses these:

  • Properties: FAST ID (P2163)  View with Reasonator View with SQID
    SELECT ?wdItem ?fastURI ?label ?description ?labelLang
    WHERE {
      ?wdItem wdt:P2163 ?fast;
         rdfs:label ?label;
        schema:description ?description.
      BIND (LANG(?label) as ?labelLang)
      BIND (LANG(?description) as ?descriptionLang)
      BIND (URI(CONCAT("http://id.worldcat.org/fast/",?fast)) AS ?fastURI)
    #  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
      FILTER (?labelLang = ?descriptionLang)
    }
    LIMIT 100
    

A few of the types that Wikidata assigns (via wdt:P31 'instance of') to things that have FAST identifiers

[edit]

In effect, this is Wikidata's version of Product Ontology. The difference is that PTO was limited to English Wikipedia, whereas the Wikidata mechanism can be anything in the WikiData namespace, which includes multi-lingual labels and descriptions.

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, FAST ID (P2163)  View with Reasonator View with SQID
    SELECT DISTINCT ?typeLabel ?type
    WHERE {
      ?s wdt:P31 ?type;
      	wdt:P2163 ?fast.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    LIMIT 50
    
[edit]

The following query uses these:

  • Properties: language of work or name (P407)  View with Reasonator View with SQID, OCLC control number (P243)  View with Reasonator View with SQID, Internet Archive ID (P724)  View with Reasonator View with SQID, Wikisource index page URL (P1957)  View with Reasonator View with SQID
    SELECT DISTINCT ?wdItemLabel ?wdItem ?wcItem ?languageLabel ?iaContent ?wikicommonsContent
    WHERE {
      ?wdItem
        wdt:P407 ?language;
      	?contentProperty ?o;
        rdfs:label ?wdItemLabel.
      OPTIONAL {?wdItem wdt:P243 ?ocn}
      OPTIONAL {?wdItem wdt:P724 ?ia}
      OPTIONAL {?wdItem wdt:P1957 ?wikicommonsContent}
      BIND (URI(CONCAT("http://www.worldcat.org/oclc/", ?ocn)) AS ?wcItem)
      BIND (URI(CONCAT("https://archive.org/details/", ?ia)) AS ?iaContent)
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" .}
      FILTER (?contentProperty=wdt:P1957 || ?contentProperty=wdt:P724)
    }
    ORDER BY ?wdItemLabel
    LIMIT 100
    

Properties associated with editions

[edit]

The following query uses these:

SELECT DISTINCT ?propLabel ?p
WHERE {
  ?s ?p ?o .
  ?prop wikibase:directClaim ?p
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
ORDER BY ?propLabel

Wikidata items that have VIAF identifiers

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, VIAF ID (P214)  View with Reasonator View with SQID
    SELECT ?s ?sLabel ?typeLabel ?viafURI
    WHERE {
      ?s wdt:P31 ?type;
      	wdt:P214 ?viaf.
      BIND (URI(CONCAT("http://viaf.org/viaf/",?viaf)) AS ?viafURI)
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    LIMIT 100
    

Wikidata items that have DOI identifiers

[edit]

The following query uses these:

  • Properties: DOI (P356)  View with Reasonator View with SQID, instance of (P31)  View with Reasonator View with SQID, published in (P1433)  View with Reasonator View with SQID
    SELECT ?wdItem ?wdItemLabel ?journalLabel ?journal ?typeLabel ?doiURI
    WHERE {
      ?wdItem wdt:P356 ?doi;
              wdt:P31 ?type.
      ?wdItem wdt:P1433 ?journal .
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
      BIND(URI(CONCAT('http://dx.doi.org/', ?doi)) AS ?doiURI)
    }
    LIMIT 100
    

Books in Wikidata with OCLC identifiers

[edit]

The following query uses these:

  • Properties: OCLC control number (P243)  View with Reasonator View with SQID, instance of (P31)  View with Reasonator View with SQID
    SELECT ?wdItem ?wdItemLabel ?typeLabel ?ocnURI ?ocnTurtle
    WHERE {
      ?wdItem wdt:P243 ?ocn;
              wdt:P31 ?type.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
      BIND(URI(CONCAT('http://www.worldcat.org/oclc/', ?ocn)) AS ?ocnURI)
      BIND(URI(CONCAT('http://experiment.worldcat.org/oclc/', ?ocn, '.ttl')) AS ?ocnTurtle)
    }
    LIMIT 100
    
[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, author (P50)  View with Reasonator View with SQID, OCLC control number (P243)  View with Reasonator View with SQID
    SELECT ?wdItem ?ocnURI ?wdItemLabel ?authorLabel ?ocnSuggest
    WHERE {
      ?wdItem wdt:P31 wd:Q571;
              rdfs:label ?wdItemLabel;
              wdt:P50 ?author.
      ?author rdfs:label ?authorLabel.
      OPTIONAL { ?wdItem wdt:P243 ?ocn }
    #  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
      BIND(URI(CONCAT('http://www.worldcat.org/search?qt=worldcat_org_all&q=', ENCODE_FOR_URI(?wdItemLabel), ' ', ENCODE_FOR_URI(?authorLabel))) AS ?ocnSuggest)
      FILTER(!bound(?ocn))
      FILTER (LANG(?wdItemLabel)='en')
      FILTER (LANG(?authorLabel)='en')
    }
    LIMIT 10
    

Properties of The Illuminatus! Trilogy

[edit]

The Illuminatus! Trilogy

  • It's odd that this query response doesn't include rdfs:label and schema:description statements. If you want those, you have to request those properties explicitly (see 2nd query below). This seems to imply they are stored in a separate graph and there is a gizmo behind the scenes that merges them into the result when the properties are explicitly requested.

The following query uses these:

  • Items: The Illuminatus! Trilogy (Q1460253)  View with Reasonator View with SQID
    SELECT ?propLabel ?oLabel ?o
    WHERE {
      wd:Q1460253 ?p ?o .
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
      ?prop wikibase:directClaim ?p
    }
    ORDER BY ?p
    
  • labels/descriptions

The following query uses these:

  • Items: The Illuminatus! Trilogy (Q1460253)  View with Reasonator View with SQID
    SELECT DISTINCT ?label ?description (LANG(?description) AS ?langTag)
    WHERE {
      wd:Q1460253 rdfs:label ?label;
        schema:description ?description .
      FILTER (LANG(?label)=LANG(?description))
    }
    

Exploring the Notable works property

[edit]

This property is interesting, but it reveals the need for provenance and constraint checking on these statements.

The following query uses these:

  • Properties: notable work (P800)  View with Reasonator View with SQID, instance of (P31)  View with Reasonator View with SQID
    SELECT ?creatorLabel ?creator ?notableWorkLabel ?notableWork ?workTypeLabel
    WHERE {
      ?creator wdt:P800 ?notableWork .
      ?notableWork wdt:P31 ?workType.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    LIMIT 100
    

Types of Notable Works

[edit]

Some of these types imply that some constraint checking on wdt:P800 is in order...

The following query uses these:

  • Properties: notable work (P800)  View with Reasonator View with SQID, instance of (P31)  View with Reasonator View with SQID
    SELECT DISTINCT ?workTypeLabel ?workType ?executeForSample
    WHERE {
      ?creator wdt:P800 ?notableWork .
      ?notableWork wdt:P31 ?workType.
      ?workType rdfs:label ?workTypeLabel.
    #  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
      FILTER (LANG(?workTypeLabel)='en')
      BIND(URI(CONCAT('https://query.wikidata.org/#SELECT%20%3FsLabel%20%3Fs%0AWHERE%20%7B%0A%20%20%3Fs%20wdt%3AP31%20%3C', ENCODE_FOR_URI(STR(?workType)), '%3E%3B%0A%20%20%20%20%20rdfs%3Alabel%20%3FsLabel.%0A%20%20FILTER%20(LANG(%3FsLabel)%3D\'en\')%0A%7D%0AORDER%20BY%20%3FsLabel%0ALIMIT%20100')) AS ?executeForSample)
    }
    ORDER BY ?workTypeLabel
    

Works authored and illustrated by the same individual

[edit]

The following query uses these:

  • Properties: author (P50)  View with Reasonator View with SQID, illustrator (P110)  View with Reasonator View with SQID, OCLC control number (P243)  View with Reasonator View with SQID
    SELECT DISTINCT ?workLabel ?work ?authorIllustratorLabel ?authorIllustrator ?ocnURI
    WHERE {
      ?work wdt:P50 ?authorIllustrator;
            rdfs:label ?workLabel ;
            wdt:P110 ?authorIllustrator .
      OPTIONAL {
        ?work wdt:P243 ?ocn .
      }
      BIND(URI(CONCAT('http://www.worldcat.org/oclc/', ?ocn)) AS ?ocnURI)
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    ORDER BY ?workLabel
    

People who perform in movies that are based on books they authored

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, author (P50)  View with Reasonator View with SQID, cast member (P161)  View with Reasonator View with SQID, based on (P144)  View with Reasonator View with SQID
    SELECT DISTINCT ?bookLabel ?book ?movieLabel ?movie ?personLabel ?person
    WHERE {
      ?book wdt:P31 wd:Q571;
            wdt:P50 ?person .
      ?movie wdt:P31 wd:Q11424;
             wdt:P161 ?person .
      ?movie wdt:P144 ?book .
    #  ?prop wikibase:directClaim ?p
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    ORDER BY ?bookLabel ?movieLabel
    LIMIT 100
    

People who author a book that is based on a movie they performed in

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, author (P50)  View with Reasonator View with SQID, cast member (P161)  View with Reasonator View with SQID, based on (P144)  View with Reasonator View with SQID
    SELECT DISTINCT ?bookLabel ?book ?movieLabel ?movie ?personLabel ?person
    WHERE {
      ?book wdt:P31 wd:Q571;
            wdt:P50 ?person .
      ?movie wdt:P31 wd:Q11424;
             wdt:P161 ?person .
      ?book wdt:P144 ?movie .
    #  ?prop wikibase:directClaim ?p
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    ORDER BY ?bookLabel ?movieLabel
    LIMIT 100
    

People who form a production company and then perform in one of its movies

[edit]

The following query uses these:

  • Properties: production company (P272)  View with Reasonator View with SQID, cast member (P161)  View with Reasonator View with SQID, founded by (P112)  View with Reasonator View with SQID
    SELECT DISTINCT ?movieLabel ?movie ?personLabel ?person ?productionCompanyLabel ?productionCompany
    WHERE {
      ?movie wdt:P272 ?productionCompany;
             wdt:P161 ?person ;
             rdfs:label ?movieLabel.
      ?productionCompany wdt:P112 ?person .
    #  ?prop wikibase:directClaim ?p
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    ORDER BY ?movieLabel
    LIMIT 100
    

Authors that self-publish

[edit]

The following query uses these:

  • Properties: author (P50)  View with Reasonator View with SQID, publisher (P123)  View with Reasonator View with SQID, OCLC control number (P243)  View with Reasonator View with SQID
    SELECT DISTINCT ?bookLabel ?book ?authorPublisherLabel ?authorPublisher ?ocnURI
    WHERE {
      ?book wdt:P50 ?authorPublisher;
            rdfs:label ?bookLabel;
            wdt:P123 ?authorPublisher .
      OPTIONAL {
        ?book wdt:P243 ?ocn
      }
      BIND(URI(CONCAT('http://www.worldcat.org/oclc/', ?ocn)) AS ?ocnURI)
    #  ?prop wikibase:directClaim ?p
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    ORDER BY ?bookLabel
    LIMIT 100
    

Editions (reified form)

[edit]

The following query uses these:

  • Properties: OCLC control number (P243)  View with Reasonator View with SQID, publication date (P577)  View with Reasonator View with SQID, language of work or name (P407)  View with Reasonator View with SQID, translator (P655)  View with Reasonator View with SQID
    SELECT DISTINCT ?workLabel ?work ?workOCNURI ?editionOCNURI ?languageLabel ?language ?year ?translatorLabel ?translator
    WHERE {
      ?work p:P577 ?edition ;
            rdfs:label ?workLabel .
      ?edition pq:P407 ?language ;
    	ps:P577 ?date .
      OPTIONAL { ?work wdt:P243 ?workOCN }
      OPTIONAL { ?edition pq:P243 ?editionOCN }
      OPTIONAL { ?edition pq:P655 ?translator }
      BIND(URI(CONCAT('http://www.worldcat.org/oclc/', ?workOCN)) AS ?workOCNURI)
      BIND(URI(CONCAT('http://www.worldcat.org/oclc/', ?editionOCN)) AS ?editionOCNURI)
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
      BIND(YEAR(?date) AS ?year)
    #  FILTER (?work=wd:Q2222)
    }
    ORDER BY ?workLabel ?date
    LIMIT 100
    

Editions of Uncle Tom's Cabin (reified form)

[edit]

The following query uses these:

  • Properties: OCLC control number (P243)  View with Reasonator View with SQID, publication date (P577)  View with Reasonator View with SQID, language of work or name (P407)  View with Reasonator View with SQID, translator (P655)  View with Reasonator View with SQID
    SELECT DISTINCT ?workLabel ?work ?workOCNURI ?editionOCNURI ?editionLanguageLabel ?year ?translatorLabel ?translator
    WHERE {
      ?work p:P577 ?edition ;
            rdfs:label ?workLabel .
      ?edition pq:P407 ?editionLanguage ;
    	ps:P577 ?date .
      OPTIONAL { ?work wdt:P243 ?workOCN }
      OPTIONAL { ?edition pq:P243 ?editionOCN }
      OPTIONAL { ?edition pq:P655 ?translator }
      BIND(URI(CONCAT('http://www.worldcat.org/oclc/', ?workOCN)) AS ?workOCNURI)
      BIND(URI(CONCAT('http://www.worldcat.org/oclc/', ?editionOCN)) AS ?editionOCNURI)
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
      BIND(YEAR(?date) AS ?year)
      FILTER (?work=wd:Q2222)
    }
    ORDER BY ?workLabel ?date
    

Variations of a work that aren't in the original language

[edit]

The following query uses these:

Properties associated with work variants that are referenced in multiple languages

[edit]

The following query uses these:

  • Properties: original language of film or TV show (P364)  View with Reasonator View with SQID, language of work or name (P407)  View with Reasonator View with SQID
    SELECT DISTINCT ?propLabel ?p
    WHERE {
      ?s wdt:P364 ?originalLanguage .
      ?s wdt:P407 ?variantWorkLanguage .
      OPTIONAL {
        ?s ?p ?o .
      }
      ?prop wikibase:directClaim ?p .
      FILTER (?originalLanguage != ?variantWorkLanguage)
      FILTER (STRSTARTS(STR(?p), STR(wdt:)))
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    ORDER BY ?propLabel
    

A bespoke example of a work with language variants

[edit]

It looks like somebody experimented with this shape, but it didn't catch on.

The following query uses these:

  • Properties: original language of film or TV show (P364)  View with Reasonator View with SQID, language of work or name (P407)  View with Reasonator View with SQID, has edition or translation (P747)  View with Reasonator View with SQID
    SELECT DISTINCT ?sLabel ?s ?originalLanguageLabel ?variantWorkLanguageLabel ?editionLabel ?edition
    WHERE {
      ?s wdt:P364 ?originalLanguage ;
         wdt:P407 ?variantWorkLanguage ;
         wdt:P747 ?edition ;
         rdfs:label ?sLabel .
      ?edition rdfs:label ?editionLabel .
      FILTER(?originalLanguage != ?variantWorkLanguage)
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    ORDER BY ?sLabel
    LIMIT 100
    

Uses of OCNs in a "qualified" form

[edit]

These look like one-off oddballs

The following query uses these:

  • Properties: OCLC control number (P243)  View with Reasonator View with SQID
    SELECT DISTINCT ?sLabel ?s ?p ?ocnURI
    WHERE {
      ?s ?p ?stmt ;
         rdfs:label ?sLabel .
      ?stmt pq:P243 ?ocn .
    #  ?prop wikibase:directClaim ?p  .
      BIND(URI(CONCAT('http://www.worldcat.org/oclc/', ?ocn)) AS ?ocnURI)
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    ORDER BY ?sLabel
    LIMIT 100
    

OCNs with an associated edition literal

[edit]

The following query uses these:

  • Properties: OCLC control number (P243)  View with Reasonator View with SQID, edition number (P393)  View with Reasonator View with SQID
    SELECT DISTINCT ?sLabel ?s ?editionNumber ?ocnURI
    WHERE {
      ?s wdt:P243 ?ocn ;
         rdfs:label ?sLabel ;
         wdt:P393 ?editionNumber .
    #  ?prop wikibase:directClaim ?p  .
      BIND(URI(CONCAT('http://www.worldcat.org/oclc/', ?ocn)) AS ?ocnURI)
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    ORDER BY ?sLabel
    LIMIT 100
    

Things with OCNs and ISBNs

[edit]

The following query uses these:

  • Properties: OCLC control number (P243)  View with Reasonator View with SQID, ISBN-10 (P957)  View with Reasonator View with SQID, ISBN-13 (P212)  View with Reasonator View with SQID
    SELECT DISTINCT ?sLabel ?s ?ocnURI ?isbn
    WHERE {
      ?s wdt:P243 ?ocn ;
         rdfs:label ?sLabel;
         ?isbnP ?isbn .
      FILTER (?isbnP=wdt:P957 || ?isbnP=wdt:P212)
    #  ?prop wikibase:directClaim ?p  .
      BIND(URI(CONCAT('http://www.worldcat.org/oclc/', ?ocn)) AS ?ocnURI)
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    ORDER BY ?sLabel
    LIMIT 100
    

Things with OCNs and DNB identifiers

[edit]

The following query uses these:

  • Properties: language of work or name (P407)  View with Reasonator View with SQID, OCLC control number (P243)  View with Reasonator View with SQID, DNB edition ID (P1292)  View with Reasonator View with SQID
    SELECT DISTINCT ?sLabel ?s ?languageLabel ?ocnURI ?dnbURI
    WHERE {
      ?s rdfs:label ?sLabel ;
         wdt:P407 ?language ;
         wdt:P243 ?ocn ;
         wdt:P1292 ?dnb .
      BIND(URI(CONCAT('http://www.worldcat.org/oclc/', ?ocn)) AS ?ocnURI)
      BIND(URI(CONCAT('http://d-nb.info/', ?dnb)) AS ?dnbURI)
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    ORDER BY ?sLabel
    LIMIT 100
    
[edit]

The following query uses these:

  • Properties: OCLC control number (P243)  View with Reasonator View with SQID, instance of (P31)  View with Reasonator View with SQID, VIAF ID (P214)  View with Reasonator View with SQID
    SELECT DISTINCT ?sLabel ?s ?ocnURI ?p ?oLabel ?o ?viafURI
    WHERE {
      ?s wdt:P243 ?ocn ;
    #     wdt:P31 ?sType ;
         ?p ?o .
      ?o wdt:P214 ?viafID ;
    #     wdt:P31 ?oType
         .
    #  ?prop wikibase:directClaim ?p
      BIND(URI(CONCAT('http://www.worldcat.org/oclc/', ?ocn)) AS ?ocnURI)
      BIND(URI(CONCAT('http://viaf.org/viaf/', ?viafID)) AS ?viafURI)
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    LIMIT 100
    
[edit]

The following query uses these:

  • Properties: OCLC control number (P243)  View with Reasonator View with SQID, instance of (P31)  View with Reasonator View with SQID, equivalent property (P1628)  View with Reasonator View with SQID, VIAF ID (P214)  View with Reasonator View with SQID
    PREFIX wdt:  <http://www.wikidata.org/prop/direct/>
    PREFIX wikibase:  <http://wikiba.se/ontology#>
    
    CONSTRUCT {
      ?ocnURI ?schemaP ?viafURI.
    } WHERE {
      ?s wdt:P243 ?ocn ;
    #     wdt:P31 ?sType ;
         ?p ?o .
      ?wd  wikibase:directClaim ?p.
      ?wd wdt:P1628 ?schemaP.
      ?o wdt:P214 ?viafID ;
    #     wdt:P31 ?oType
         .
      BIND(URI(CONCAT('http://www.worldcat.org/oclc/', ?ocn)) AS ?ocnURI)
      BIND(URI(CONCAT('http://viaf.org/viaf/', ?viafID)) AS ?viafURI)
      FILTER(CONTAINS(STR(?schemaP), "schema.org"))
    #  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    LIMIT 100
    

Test identical id value template

[edit]

TODO Not sure what this template does or even how to inject a clickable label on it.

[1]

Collections with items represented in Wikidata

[edit]

The following query uses these:

  • Properties: collection (P195)  View with Reasonator View with SQID
    SELECT DISTINCT ?collectionLabel ?collection
    WHERE {
      ?item wdt:P195 ?collection .
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    LIMIT 100
    

Who played M in Quantum of Solace?

[edit]

TODO

The following query uses these:

Fictional Animal Characters

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID
    SELECT DISTINCT ?fictionalAnimalLabel ?fictionalAnimal
    WHERE {
      ?fictionalAnimal wdt:P31 wd:Q3542731;
                       rdfs:label ?fictionalAnimalLabel .
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    

Fictional Universes

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID
    SELECT ?fictionalUniverseLabel ?fictionalUniverse
    WHERE {
      ?fictionalUniverse wdt:P31 wd:Q559618 .
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    LIMIT 100
    

States that don't have VIAF IDs

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, VIAF ID (P214)  View with Reasonator View with SQID
    SELECT ?stateLabel ?state ?viafID
    WHERE {
      ?state wdt:P31 wd:Q35657;
      OPTIONAL {?state wdt:P214 ?viafID}
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
      FILTER(!BOUND(?viafID))
    }
    

Real people who are fictionalized in the context of a work

[edit]

TODO

The following query uses these:

List of publishers

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID
    SELECT DISTINCT ?publisherLabel ?publisher
    WHERE {
      ?publisher wdt:P31 wd:Q2085381;
                 rdfs:label ?publisherLabel .
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    ORDER BY ?publisherLabel
    

List of publisher imprints

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, owned by (P127)  View with Reasonator View with SQID, part of (P361)  View with Reasonator View with SQID
    SELECT DISTINCT ?imprintLabel ?imprint ?ownerLabel ?owner ?partOfLabel ?partOf
    WHERE {
      ?imprint wdt:P31 wd:Q2608849;
    	rdfs:label ?imprintLabel .
      OPTIONAL {?imprint wdt:P127 ?owner }
      OPTIONAL {?imprint wdt:P361 ?partOf }
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    ORDER BY ?imprintLabel ?ownerLabel ?partOfLabel
    

Serial/Volume/Issue

[edit]

The volume and issue aren't separately identified, they are treated as properties of the articles contained in the issue.

The following query uses these:

  • Properties: published in (P1433)  View with Reasonator View with SQID, volume (P478)  View with Reasonator View with SQID, issue (P433)  View with Reasonator View with SQID
    SELECT DISTINCT ?serialLabel ?serial ?volume ?issue
    WHERE {
      ?article wdt:P1433 ?serial;
        wdt:P478 ?volume ;
        wdt:P433 ?issue .
      ?serial rdfs:label ?serialLabel .
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    ORDER BY ?serialLabel ?volume ?issue
    LIMIT 100
    

Some licensed works

[edit]

The following query uses these:

  • Properties: copyright license (P275)  View with Reasonator View with SQID
    SELECT ?sLabel ?s ?license ?licenseLabel
    WHERE {
      ?s wdt:P275 ?license .
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    LIMIT 100
    

Some identified licenses

[edit]

Some of these are bugs in the data.

The following query uses these:

  • Properties: copyright license (P275)  View with Reasonator View with SQID, instance of (P31)  View with Reasonator View with SQID
    SELECT DISTINCT ?license ?licenseLabel ?instanceOfLabel
    WHERE {
      ?s wdt:P275 ?license .
      ?license rdfs:label ?licenseLabel ;
               wdt:P31 ?instanceOf .
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    LIMIT 100
    

Types of licenses

[edit]

Some of these are bugs in the data.

The following query uses these:

  • Properties: copyright license (P275)  View with Reasonator View with SQID, instance of (P31)  View with Reasonator View with SQID
    SELECT DISTINCT ?licenseTypeLabel ?licenseType
    WHERE {
      ?s wdt:P275 ?license .
      ?license wdt:P31 ?licenseType .
      ?licenseType rdfs:label ?licenseTypeLabel .
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    ORDER BY ?licenseTypeLabel
    

Identified licenses (declared)

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID
    SELECT DISTINCT ?licenseLabel ?license
    WHERE {
      ?license wdt:P31 wd:Q79719 ;
        rdfs:label ?licenseLabel .
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    ORDER BY ?licenseLabel
    

Creative Commons licenses

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID
    SELECT DISTINCT ?ccLicenseLabel ?ccLicense
    WHERE {
      ?ccLicense wdt:P31 wd:Q284742 ;
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    ORDER BY ?ccLicenseLabel
    

Form/genre

[edit]

Novels

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID
    SELECT DISTINCT ?sLabel ?s
    WHERE
    {
    	?s wdt:P31 wd:Q8261;
           rdfs:label ?sLabel.
    	SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    LIMIT 10
    

Plays

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID
    SELECT DISTINCT ?sLabel ?s
    WHERE
    {
    	?s wdt:P31 wd:Q25379;
           rdfs:label ?sLabel.
    	SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    LIMIT 10
    

Drawings

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID
    SELECT DISTINCT ?sLabel ?s
    WHERE
    {
    	?s wdt:P31 wd:Q93184;
           rdfs:label ?sLabel.
    	SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    LIMIT 10
    

Public Libraries

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID
    SELECT DISTINCT ?publicLibraryLabel ?publicLibrary
    WHERE
    {
    	?publicLibrary wdt:P31 wd:Q28564 ;
                       rdfs:label ?publicLibraryLabel.
    	SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    ORDER BY ?publicLibraryLabel
    

Properties associated with public libraries

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID
    SELECT DISTINCT ?propLabel ?p
    WHERE {
      ?s wdt:P31 wd:Q28564 .
      OPTIONAL {
        ?s ?p ?o .
      }
      ?prop wikibase:directClaim ?p .
      FILTER (STRSTARTS(STR(?p), STR(wdt:)))
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    ORDER BY ?propLabel
    

Academic Libraries

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID
    SELECT DISTINCT ?academicLibraryLabel ?academicLibrary
    WHERE
    {
    	?academicLibrary wdt:P31 wd:Q856234 ;
                       rdfs:label ?academicLibraryLabel.
    	SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    ORDER BY ?academicLibraryLabel
    

University Presses

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, named after (P138)  View with Reasonator View with SQID, subclass of (P279)  View with Reasonator View with SQID
    SELECT DISTINCT ?item ?itemLabel ?propLabel ?university ?universityLabel
    WHERE {
      ?item wdt:P31 wd:Q479716 ;
            wikibase:sitelinks ?sitelinks ;
            ?p ?university .
      FILTER(?p != wdt:P138)
      ?university wdt:P31/wdt:P279* wd:Q3918.
      ?prop wikibase:directClaim ?p .
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    ORDER BY DESC(?sitelinks) ?propLabel
    

Properties associated with academic libraries

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID
    SELECT DISTINCT ?propLabel ?p
    WHERE {
      ?s wdt:P31 wd:Q856234 .
      OPTIONAL {
        ?s ?p ?o .
      }
      ?prop wikibase:directClaim ?p .
      FILTER (STRSTARTS(STR(?p), STR(wdt:)))
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    ORDER BY ?propLabel
    

Properties associated with libraries

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID
    SELECT DISTINCT ?propLabel ?p
    WHERE {
      ?s wdt:P31 wd:Q7075 .
      OPTIONAL {
        ?s ?p ?o .
      }
      ?prop wikibase:directClaim ?p .
      FILTER (STRSTARTS(STR(?p), STR(wdt:)))
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    ORDER BY ?propLabel
    

Scientific articles

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID
    SELECT DISTINCT ?scientificArticleLabel ?scientificArticle
    WHERE {
      ?scientificArticle wdt:P31 wd:Q13442814 .
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    

Properties associated with scientific articles

[edit]

Limited to scientific articles that have authors

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, author (P50)  View with Reasonator View with SQID
    SELECT DISTINCT ?propLabel ?p
    WHERE {
      ?s wdt:P31 wd:Q13442814;
         wdt:P50 ?author .
      OPTIONAL {
        ?s ?p ?o .
      }
      ?prop wikibase:directClaim ?p .
      FILTER (STRSTARTS(STR(?p), STR(wdt:)))
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    ORDER BY ?propLabel
    
[edit]

The following query uses these:

Oddities

[edit]

WikiData Books with OCNs but without authors

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, OCLC control number (P243)  View with Reasonator View with SQID, author (P50)  View with Reasonator View with SQID
    SELECT *
    WHERE {
      ?wd wdt:P31 wd:Q571;
          wdt:P243 ?ocn.
      OPTIONAL {?wd wdt:P50 ?author}
      FILTER(!BOUND(?author))
      BIND(URI(CONCAT("http://www.worldcat.org/oclc/", ?ocn)) AS ?wc)
    }
    LIMIT 100
    

Star Wars novels

[edit]

The following query uses these:

Erin Hunter analysis

[edit]

Scholarly articles that have Wikipedia articles about them

[edit]

Types of things that are classified as "unknown"

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, subclass of (P279)  View with Reasonator View with SQID
    #Cats
    SELECT ?type ?typeLabel (COUNT(DISTINCT ?item) AS ?numItems)
    WHERE 
    {
      ?item wdt:P31/wdt:P279* wd:Q24238356;
            wdt:P31 ?type .
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    GROUP BY ?type ?typeLabel
    ORDER BY DESC(?numItems)
    

Types of entities that have ISSNs

[edit]

The following query uses these:

  • Properties: ISSN (P236)  View with Reasonator View with SQID, instance of (P31)  View with Reasonator View with SQID
    SELECT DISTINCT ?type ?typeLabel (COUNT(DISTINCT ?item) AS ?itemCount) 
    WHERE {
      ?item wdt:P236 [];
            wdt:P31 ?type .
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    GROUP BY ?type ?typeLabel 
    ORDER BY DESC(?itemCount)
    

Follows claims where the types aren't the same

[edit]

The following query uses these:

  • Properties: follows (P155)  View with Reasonator View with SQID, instance of (P31)  View with Reasonator View with SQID
    SELECT DISTINCT ?follow ?followLabel ?followTypeLabel ?precede ?precedeLabel ?precedeTypeLabel
    WHERE {
      ?follow wdt:P155 ?precede ;
             wdt:P31 ?followType .
      ?precede wdt:P31 ?precedeType .
      FILTER NOT EXISTS {
        ?follow wdt:P31 ?precedeType
      }
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    LIMIT 100
    

Replaces claims where the types aren't the same

[edit]

The following query uses these:

  • Properties: replaces (P1365)  View with Reasonator View with SQID, instance of (P31)  View with Reasonator View with SQID
    SELECT DISTINCT ?follow ?followLabel ?followTypeLabel ?precede ?precedeLabel ?precedeTypeLabel
    WHERE {
      ?follow wdt:P1365 ?precede ;
             wdt:P31 ?followType .
      ?precede wdt:P31 ?precedeType .
      FILTER NOT EXISTS {
        ?follow wdt:P31 ?precedeType
      }
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    LIMIT 100
    

Types of things that get replaced by something else (P1366)

[edit]

The following query uses these:

  • Properties: replaced by (P1366)  View with Reasonator View with SQID, instance of (P31)  View with Reasonator View with SQID
    # Types of things that get replaced by something else (P1366)
    SELECT ?typeReplaced ?typeReplacedLabel (COUNT(DISTINCT ?item) AS ?numItems)
    WHERE {
      ?item wdt:P1366 [] ;
            wdt:P31 ?typeReplaced .
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    GROUP BY ?typeReplaced ?typeReplacedLabel
    ORDER BY DESC(?numItems)
    LIMIT 100
    

Type of things that replace something else (P1365)

[edit]

The following query uses these:

  • Properties: followed by (P156)  View with Reasonator View with SQID, instance of (P31)  View with Reasonator View with SQID
    # Types of things that are followed by something else (P1366)
    SELECT ?typeFollowed ?typeFollowedLabel ?numItems
    WHERE {
      {
        SELECT ?typeFollowed (COUNT(DISTINCT ?item) AS ?numItems)
        {
        ?item wdt:P156 [] ;
            wdt:P31 ?typeFollowed .
        }
        GROUP BY ?typeFollowed
        ORDER BY DESC(?numItems)
        LIMIT 100
      }
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    ORDER BY DESC(?numItems)
    

Types of things that are followed by something else (P156)

[edit]

The following query uses these:

  • Properties: followed by (P156)  View with Reasonator View with SQID, instance of (P31)  View with Reasonator View with SQID
    # Types of things that are followed by something else (P1366)
    SELECT ?typeFollowed ?typeFollowedLabel ?numItems
    WHERE {
      {
        SELECT ?typeFollowed (COUNT(DISTINCT ?item) AS ?numItems)
        {
        ?item wdt:P156 [] ;
            wdt:P31 ?typeFollowed .
        }
        GROUP BY ?typeFollowed
        ORDER BY DESC(?numItems)
        LIMIT 100
      }
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    ORDER BY DESC(?numItems)
    

Types of things that follow something else (P155)

[edit]

The following query uses these:

  • Properties: follows (P155)  View with Reasonator View with SQID, instance of (P31)  View with Reasonator View with SQID
    #SELECT ?item1 ?item1Label ?item1TypeLabel ?item2 ?item2Label ?item2TypeLabel
    SELECT DISTINCT ?follow ?followLabel ?followTypeLabel ?precede ?precedeLabel ?precedeTypeLabel
    WHERE {
      ?follow wdt:P155 ?precede ;
             wdt:P31 ?followType .
      ?precede wdt:P31 ?precedeType .
      FILTER NOT EXISTS {
        ?follow wdt:P31 ?precedeType
      }
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    LIMIT 100
    

Nice example of using VALUES clause with multiple variables

[edit]

The following query uses these:

  • Properties: author (P50)  View with Reasonator View with SQID, main subject (P921)  View with Reasonator View with SQID
    SELECT ?item ?itemLabel ?p ?propLabel ?o ?oLabel
    WHERE {
      ?item ?p ?o .
      VALUES (?p ?o) {
        (wdt:P50 wd:Q36322)
        (wdt:P921 wd:Q34969)
      }
      ?prop wikibase:directClaim ?p .
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    

VIAF Single Value Constraint violations

[edit]

The following query uses these:

  • Properties: VIAF ID (P214)  View with Reasonator View with SQID, property constraint (P2302)  View with Reasonator View with SQID
    SELECT ?item (COUNT(?s) AS ?count)
    WHERE {
      ?s ps:P2302 wd:Q19474404.
      ?stmt wikibase:hasViolationForConstraint ?s .
      ?item p:P214 ?stmt .
    }
    GROUP BY ?item
    ORDER BY DESC(?count)
    
[edit]

The following query uses these:

  • Properties: from narrative universe (P1080)  View with Reasonator View with SQID
    #Fictional universes with the most related entities
    SELECT DISTINCT ?universe ?universeLabel (COUNT(DISTINCT ?item) AS ?itemCount)
    WHERE 
    {
      ?item wdt:P1080 ?universe.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    GROUP BY ?universe ?universeLabel
    ORDER BY DESC(?itemCount)
    

Names according to the Discogs master database

[edit]

The following query uses these:

  • Properties: Discogs master ID (P1954)  View with Reasonator View with SQID, subject named as (P1810)  View with Reasonator View with SQID
    SELECT ?item ?itemLabel ?discogsID ?discogsName 
    WHERE {
      ?item p:P1954 [
        ps:P1954 ?discogsID; 
        pq:P1810 ?discogsName 
      ].
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    

Wikidata items with the most external ID associated labels

[edit]

The following query uses these:

  • Properties: subject named as (P1810)  View with Reasonator View with SQID
    SELECT ?p ?propLabel (COUNT(?item) AS ?count)
      WHERE {
        {
        SELECT DISTINCT ?p ?prop
        WHERE {
          ?prop wikibase:propertyType wikibase:ExternalId ;
                wikibase:claim ?p .
        }
        }
        ?item ?p [
          pq:P1810 ?name
        ].
        SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
      }
      GROUP BY ?p ?propLabel
      ORDER BY DESC(?count)
      LIMIT 100
    

Things with the most names in external databases

[edit]

The following query uses these:

  • Properties: subject named as (P1810)  View with Reasonator View with SQID
    SELECT ?item ?itemLabel ?count 
    WHERE {
      {
    SELECT ?item (COUNT(?name) AS ?count)
    WHERE {
        ?item ?p [
          pq:P1810 ?name
        ].
    }
    GROUP BY ?item
    ORDER BY DESC(?count)
    LIMIT 100
      }
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    ORDER BY DESC(?count)
    

Digital Collections

[edit]

Examples to follow...

Digital Repository

[edit]

This can be imagined in terms of the emerging Wikidata+WikiSource effort:

Examples to follow...

Constraint violation

[edit]

Examples

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, property constraint (P2302)  View with Reasonator View with SQID
    # Example constraint violations for various types
    SELECT ?example ?itemLabel ?p ?numOccurs ?constraint ?constraintTypeLabel
    WHERE {
      {
        SELECT (SAMPLE(?item) AS ?item) ?p ?constraint (COUNT(?stmt) AS ?numOccurs)
        WHERE {
          ?stmt wikibase:hasViolationForConstraint ?constraint.
          ?item ?p ?stmt ;
    #          wdt:P31 wd:Q5 .
    #          wdt:P31 wd:Q43229 .
                wdt:P31 wd:Q515 . # city
        } 
        GROUP BY ?p ?constraint
    #    ORDER BY DESC(?numOccurs)
    #    LIMIT 30
      }
      ?constraint ps:P2302 ?constraintType .
      BIND(URI(CONCAT(STR(?item), "#", STRAFTER(STR(?p), STR(p:)))) AS ?example)
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    ORDER BY DESC(?numOccurs)
    

Misc

[edit]

Hybrid search/query example

[edit]

The following query uses these:

  • Properties: subclass of (P279)  View with Reasonator View with SQID
    SELECT DISTINCT ?item ?itemLabel ?type ?typeLabel
    WHERE {
      SERVICE wikibase:mwapi {
        bd:serviceParam wikibase:api "EntitySearch";
                        wikibase:endpoint "www.wikidata.org";
                        mwapi:search "cheese";
                        mwapi:language "en".
        ?item wikibase:apiOutputItem mwapi:item.
        }
      ?item (wdt:P279
    

OCN/page as claim references

[edit]

The following query uses these:

One-of constraints

[edit]

The following query uses these:

  • Properties: property constraint (P2302)  View with Reasonator View with SQID, item of property constraint (P2305)  View with Reasonator View with SQID
    SELECT ?prop ?propLabel (COUNT(?value) AS ?numValues)
    WHERE {
      ?prop p:P2302 ?qual .
      ?qual ps:P2302 wd:Q21510859 ;
            pq:P2305 ?value .
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    GROUP BY ?prop ?propLabel
    ORDER BY DESC(?numValues)
    

Languages with/without LCSH ID

[edit]

The following query uses these:

Who followed President Buchanan in various political offices?

[edit]

The following query uses these:

  • Properties: position held (P39)  View with Reasonator View with SQID, replaced by (P1366)  View with Reasonator View with SQID
    SELECT ?positionLabel ?afterBuchananLabel
    WHERE {
      wd:Q12325 p:P39 [
        ps:P39 ?position;
        pq:P1366 ?afterBuchanan
      ] .
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    

Family names with the most variants

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID
    SELECT ?item ?itemLabel ?itemDescription (COUNT(DISTINCT STR(?prefLabel)) AS ?strCount)
    WHERE {
      VALUES ?item {
        wd:Q845648
        wd:Q934262
        wd:Q10450274
        wd:Q1059073
        wd:Q431758
        wd:Q1699018
        wd:Q127578
        wd:Q804988
        wd:Q1634177
        wd:Q1159973
        wd:Q611733
        wd:Q804970
        wd:Q1679557
      }
      ?item wdt:P31 wd:Q101352 ;
            rdfs:label ?prefLabel .
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    GROUP BY ?item ?itemLabel ?itemDescription
    ORDER BY DESC(?strCount)
    

Wikidata -> BF Crosswalks

[edit]

I wouldn't suggest that SPARQL is the best mechanism to do these crosswalks, it's just a semi-convenient way to do it using online data and tools.

Identifiers and Notes

[edit]

Crosswalk ISBN identifiers from Wikidata to BF 2.0 (method 1)

[edit]

Unfortunately, WDQS doesn't return Turtle and the RDF/XML option is pretty-much unreadable. Here's the output of the query, though, that runs through the RDF Translator service to re-serialize the RDF/XML into Turtle.

http://rdf-translator.appspot.com/convert/xml/n3/html/http%3A%2F%2Fbit.ly%2F1MpDCGh

The following query uses these:

  • Properties: ISBN-10 (P957)  View with Reasonator View with SQID
    PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
    PREFIX wdt: <http://www.wikidata.org/prop/direct/>
    PREFIX wd: <http://www.wikidata.org/entity/>
    PREFIX bf: <http://bibframe.org/vocab/>
    Prefix identifier: <http://id.loc.gov/vocabulary/identifiers/>
    
    CONSTRUCT {
      ?s bf:identifiedBy [
        a identifier:Isbn;
        rdf:value ?isbn
      ]
    } WHERE {
      ?s wdt:P957 ?isbn
    }
    LIMIT 10
    

Crosswalk ISBN identifiers from Wikidata to BF 2.0 (method 2)

[edit]

Here's a variation where the bf:scheme is treated as text instead of an identifier.

The following query uses these:

  • Properties: ISBN-10 (P957)  View with Reasonator View with SQID
    PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
    PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
    PREFIX wdt: <http://www.wikidata.org/prop/direct/>
    PREFIX wd: <http://www.wikidata.org/entity/>
    PREFIX bf: <http://bibframe.org/vocab/>
    PREFIX identifier: <http://id.loc.gov/vocabulary/identifiers/>
    
    CONSTRUCT {
      ?s bf:identifiedBy [
        a bf:Identifier;
        bf:scheme "xyz";
        rdf:value ?isbn
      ]
    } WHERE {
      ?s wdt:P957 ?isbn
    }
    LIMIT 10
    

Crosswalk Wikidata into a BF 2.0 Note (example 1)

[edit]

The following query uses these:

  • Properties: producer (P162)  View with Reasonator View with SQID
    PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
    PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
    PREFIX wdt: <http://www.wikidata.org/prop/direct/>
    PREFIX wd: <http://www.wikidata.org/entity/>
    PREFIX bf: <http://bibframe.org/vocab/>
    PREFIX identifier: <http://id.loc.gov/vocabulary/identifiers/>
    PREFIX note: <http://id.loc.gov/vocabulary/noteTypes/>
    
    CONSTRUCT {
      ?s bf:note [
        a note:Credits;
        rdf:value ?value
      ]
    } WHERE {
      ?s wdt:P162 ?producer.
      ?producer rdfs:label ?producerLabel.
      BIND(CONCAT("Produced by ", ?producerLabel) AS ?value)
      FILTER (LANG(?producerLabel)='en')
    }
    LIMIT 10
    

Agents and Roles

[edit]

Crosswalk Wikidata contributor to BF 2.0 (combined methods)

[edit]

Pretty-printed Turle result: http://rdf-translator.appspot.com/convert/xml/n3/html/http%3A%2F%2Fbit.ly%2F22osPZv

The following query uses these:

  • Properties: contributor to the creative work or subject (P767)  View with Reasonator View with SQID, instance of (P31)  View with Reasonator View with SQID, Library of Congress authority ID (P244)  View with Reasonator View with SQID
    PREFIX bf: <http://bibframe.org/vocab/>
    PREFIX relators: <http://id.loc.gov/vocabulary/relators/>
    CONSTRUCT {
      ?s bf:contributor ?lccnURI;
        relators:cbt ?lccnURI;
         bf:contributor [
           a bf:Contributor;
             bf:role "creator";
             bf:agent ?lccnURI
         ].
      ?lccnURI a bf:Person;
                 rdfs:label ?contributorLabel;
    } WHERE {
      ?s wdt:P767 ?contributor .
      ?contributor wdt:P31 wd:Q5;
                   rdfs:label ?contributorLabel;
                   wdt:P244 ?lccn .
      BIND(URI(CONCAT('http://id.loc.gov/rwo/', ?lccn)) AS ?lccnURI)
    #  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
      FILTER (LANG(?contributorLabel)='en')
      FILTER (?s=wd:Q7785623)
    }
    LIMIT 100
    

Baseball

[edit]

Shortstops for the San Francisco Giants

[edit]

Shortstops for the San Francisco Giants and when they were born.

The following query uses these:

  • Properties: position played on team / speciality (P413)  View with Reasonator View with SQID, member of sports team (P54)  View with Reasonator View with SQID, date of birth (P569)  View with Reasonator View with SQID
    PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
    PREFIX wdt: <http://www.wikidata.org/prop/direct/>
    PREFIX wd: <http://www.wikidata.org/entity/>
    SELECT DISTINCT ?shortstop ?shortstopLabel ?birthdate ?evidence
    WHERE
    {
      ?evidence schema:about ?shortstop.
      ?shortstop wdt:P413 wd:Q1143358; # shortstop.
        wdt:P54 wd:Q308966;	# San Francisco Giants
      	wdt:P569 ?birthdate.
      FILTER regex(STR(?evidence), 'https://en.wikipedia.org/wiki/')
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    ORDER BY ?shortstopLabel
    

All the shortstops, when they were born, and which teams they played for

[edit]

The following query uses these:

  • Properties: position played on team / speciality (P413)  View with Reasonator View with SQID, member of sports team (P54)  View with Reasonator View with SQID, date of birth (P569)  View with Reasonator View with SQID
    PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
    PREFIX wdt: <http://www.wikidata.org/prop/direct/>
    PREFIX wd: <http://www.wikidata.org/entity/>
    SELECT DISTINCT ?shortstop ?shortstopLabel ?birthdate ?teamLabel ?evidence
    WHERE
    {
      ?evidence schema:about ?shortstop.
      ?shortstop wdt:P413 wd:Q1143358; # shortstop
        wdt:P54 ?team;
        wdt:P569 ?birthdate.
      FILTER regex(STR(?evidence), 'https://en.wikipedia.org/wiki/')
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    ORDER BY ?teamLabel ?shortstopLabel
    

operas

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, subclass of (P279)  View with Reasonator View with SQID, composer (P86)  View with Reasonator View with SQID, inception (P571)  View with Reasonator View with SQID, based on (P144)  View with Reasonator View with SQID, date of first performance (P1191)  View with Reasonator View with SQID, language of work or name (P407)  View with Reasonator View with SQID, librettist (P87)  View with Reasonator View with SQID, full work available at URL (P953)  View with Reasonator View with SQID, dedicated to (P825)  View with Reasonator View with SQID
    # Traditional knowledge
    SELECT ?opera ?operaLabel 
    ?composerLabel 
    (YEAR(?inception) AS ?year) 
    ?basedOn ?basedOnLabel 
    ?firstPerformanceDate 
    ?languageLabel 
    ?librettistLabel 
    ?fullWork 
    ?dedicatedToLabel
    (URI(REPLACE(STR(?enwiki), "/wiki/", "/w/api.php?action=query&prop=extracts&format=json&exintro=&titles=")) AS ?synopsis)
    WHERE {
      ?opera wdt:P31/wdt:P279* wd:Q1344 .
      OPTIONAL {?opera wdt:P86 ?composer}
      OPTIONAL {?opera wdt:P571 ?inception}
      OPTIONAL {?opera wdt:P144 ?basedOn}
      OPTIONAL {?opera wdt:P1191 ?firstPerformanceDate}
      OPTIONAL {?opera wdt:P407 ?language}
      OPTIONAL {?opera wdt:P87 ?librettist}
      OPTIONAL {?opera wdt:P953 ?fullWork}
      ?enwiki schema:about ?opera;
              schema:isPartOf <https://en.wikipedia.org/>.
      OPTIONAL {?opera wdt:P825 ?dedicatedTo}
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    

composers without a composition

[edit]

The following query uses these:

  • Properties: occupation (P106)  View with Reasonator View with SQID, composer (P86)  View with Reasonator View with SQID
    SELECT ?composer ?composerLabel
    WHERE {
      ?composer wdt:P106 wd:Q36834 ;
                wikibase:sitelinks ?sitelinks .
      MINUS {?work wdt:P86 ?composer}
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    ORDER BY DESC(?sitelinks)
    LIMIT 100
    

Network of Resources

[edit]

Wikidata doesn't have a tailored notion of these classes, but it's a place to start imagining and exploring the possibilities.

Teams

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID
    SELECT DISTINCT ?team ?teamLabel
    WHERE {
      ?team wdt:P31 wd:Q327245;
         rdfs:label ?teamLabel
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    ORDER BY ?teamLabel
    LIMIT 100
    

People

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID
    SELECT DISTINCT ?person ?personLabel
    WHERE {
      ?person wdt:P31 wd:Q5;
              rdfs:label ?personLabel;
      FILTER (LANG(?personLabel) = 'en')
    }
    LIMIT 100
    

Systems

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID
    SELECT DISTINCT ?system ?systemLabel ?additionalTypeLabel
    WHERE {
      ?system wdt:P31 wd:Q58778;
              rdfs:label ?systemLabel;
              wdt:P31 ?additionalType.
      FILTER (?additionalType != wd:Q58778)
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    LIMIT 100
    

Roles

[edit]

In Linked Data, "roles" are expressed as named properties. For example:

:Plan9 :evilGenius :Pinky .

The list of roles that are useful and practical to maintain is often domain or application-specific. Reusing terms from existing vocabularies, whenever possible, is generally considered best practice.

Skills

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID
    SELECT DISTINCT ?skill ?skillLabel
    WHERE {
      ?skill wdt:P31 wd:Q205961;
              rdfs:label ?skillLabel.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    LIMIT 100
    

Products

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID
    SELECT DISTINCT ?product ?productLabel
    WHERE {
      ?product wdt:P31 wd:Q2424752;
              rdfs:label ?productLabel.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    LIMIT 100
    

Work

[edit]

Some notions of "work" as a discrete identifiable/describable "entity" may be difficult. Here's a list based on the notion of "work" as a "distinct intellectual or artistic creation":

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID
    SELECT DISTINCT ?work ?workLabel
    WHERE {
      ?work wdt:P31 wd:Q386724;
              rdfs:label ?workLabel.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    LIMIT 100
    

Quality

[edit]

Treating "quality" as an existential class seems odd. It should be possible to quantify "quality" in various contexts, but the use cases would have to be examined. Here is the English Wikipedia disambiguation page for "Quality" that splits a few of those hairs: https://en.wikipedia.org/wiki/Quality

Metrics/KPIs

[edit]

These would have to be analyzed for patterns.

Variations of the the personal name "Jeff"

[edit]

The following query uses these:

  • Properties: said to be the same as (P460)  View with Reasonator View with SQID, language of work or name (P407)  View with Reasonator View with SQID
    SELECT ?item ?itemLabel ?languageLabel
    WHERE {
      ?item wdt:P460* wd:Q13028078 .
      OPTIONAL {?item wdt:P407 ?language}
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    ORDER BY (?itemLabel)
    

Lexical analysis

[edit]

Common properties for Lexemes

[edit]

The following query uses these:

SELECT ?p ?propLabel (COUNT(?l) AS ?numOccurs) 
WHERE {
  ?l a ontolex:LexicalEntry ;
       ?p [] .
  OPTIONAL {?prop wikibase:directClaim ?p }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?p ?propLabel
ORDER BY DESC(?numOccurs)
LIMIT 100

Lexeme languages

[edit]

The following query uses these:

SELECT ?language ?languageLabel (COUNT(?le) AS ?numOccurs) 
WHERE {
  ?le a ontolex:LexicalEntry ;
       dct:language ?language .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?language ?languageLabel
ORDER BY DESC(?numOccurs)
LIMIT 100

Common lexical categories

[edit]

The following query uses these:

SELECT ?lexicalCategory ?lexicalCategoryLabel (COUNT(?le) AS ?numOccurs) 
WHERE {
  ?le a ontolex:LexicalEntry ;
       wikibase:lexicalCategory ?lexicalCategory .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?lexicalCategory ?lexicalCategoryLabel
ORDER BY DESC(?numOccurs)
LIMIT 100

List of wikibase:grammaticalFeatures

[edit]

The following query uses these:

SELECT DISTINCT ?grammaticalFeature ?grammaticalFeatureLabel (COUNT(DISTINCT ?s) AS ?numOccurs)
WHERE {
  ?s wikibase:grammaticalFeature ?grammaticalFeature .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?grammaticalFeature ?grammaticalFeatureLabel
ORDER BY DESC(?numOccurs)

Book topics with their plural lexical form(s)

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, main subject (P921)  View with Reasonator View with SQID, item for this sense (P5137)  View with Reasonator View with SQID
    SELECT ?book ?bookLabel ?mainSubjectLabel ?sense ?lexeme ?pluralForm
    WHERE {
      ?book wdt:P31 wd:Q571 ;
            wdt:P921 ?mainSubject .
      ?sense wdt:P5137 ?mainSubject .
      ?lexeme ontolex:sense ?sense ;
              dct:language wd:Q1860 ;
              ontolex:lexicalForm ?lexicalForm .
      ?lexicalForm wikibase:grammaticalFeature wd:Q146786; 
                   ontolex:representation ?pluralForm .
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    LIMIT 1000
    

Plural form of an Wikibase Item

[edit]

The following query uses these:

  • Properties: item for this sense (P5137)  View with Reasonator View with SQID
    SELECT ?item ?itemLabel ?sense ?senseDefinition ?lexeme ?pluralForm
    WHERE {
      ?sense wdt:P5137 ?item ;
             skos:definition ?senseDefinition .
      FILTER(LANG(?senseDefinition)="en")
      ?lexeme ontolex:sense ?sense ;
              dct:language wd:Q1860 ;
              ontolex:lexicalForm ?lexicalForm .
      ?lexicalForm wikibase:grammaticalFeature wd:Q146786; 
                   ontolex:representation ?pluralForm .
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    LIMIT 1000
    

Lexemes with the most senses

[edit]

The following query uses these:

SELECT ?lexeme ?languageLabel ?lemma (COUNT(DISTINCT ?sense) AS ?numSenses)
WHERE {
  ?lexeme ontolex:sense ?sense ;
          wikibase:lemma ?lemma ;
          dct:language ?language .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?lexeme ?lemma ?languageLabel
ORDER BY DESC(?numSenses)

English Lexemes with the most forms

[edit]

The following query uses these:

SELECT ?lexeme ?lemma (COUNT(DISTINCT ?form) AS ?numForms) (GROUP_CONCAT(DISTINCT ?featuredForm;SEPARATOR="

Lexemes with the most entitifed senses

[edit]

The following query uses these:

  • Properties: item for this sense (P5137)  View with Reasonator View with SQID
    # Lexemes with the most entified senses
    SELECT DISTINCT ?lexeme ?languageLabel ?lemma (COUNT(DISTINCT ?item) AS ?numItems)
    WHERE {
      ?lexeme ontolex:sense ?sense ;
              wikibase:lemma ?lemma ;
              dct:language ?language .
      ?sense wdt:P5137 ?item.
      OPTIONAL {
        ?sense skos:definition ?definition.
        FILTER(LANG(?definition)="en")
      }
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    GROUP BY ?lexeme ?languageLabel ?lemma
    ORDER BY DESC(?numItems)
    LIMIT 100
    

Stuff

[edit]

The following query uses these:

  • Properties: external superproperty (P2235)  View with Reasonator View with SQID
    # List of external superproperty declarations in Wikidata
    # These connections allow data to be automatically or semi-automatically reshaped into higher resolution internal properties 
    # or conversely dumbed down to external terms on export.
    SELECT ?prop ?propLabel ?externalSuperprop
    WHERE {
      ?prop wdt:P2235 ?externalSuperprop .
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    ORDER BY xsd:integer(STRAFTER(STR(?prop), "http://www.wikidata.org/entity/P"))
    

Perry Mason Works

[edit]
SELECT ?item ?itemLabel ?itemDescription ?typeLabel ?originalLanguageLabel ?numberOfSeasons ?numberOfEpisodes
WHERE {
  VALUES ?item {
    wd:Q165356
    wd:Q16553472
    wd:Q25215457
  }
  ?item wdt:P31 ?type.
  OPTIONAL {?item wdt:P2437 ?numberOfSeasons}
  OPTIONAL {?item wdt:P1113 ?numberOfEpisodes}
  OPTIONAL {?item wdt:P364 ?originalLanguage}
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Try it!

Selected places

[edit]

The following query uses these:

  • Properties: VIAF ID (P214)  View with Reasonator View with SQID, FAST ID (P2163)  View with Reasonator View with SQID, Library of Congress authority ID (P244)  View with Reasonator View with SQID, instance of (P31)  View with Reasonator View with SQID
    # Place reference query
    # Caveat: The lack of Wikidata identifiers doesn't necessarily mean Wikidata doesn't know these things exist. It just means they aren't reconciled.
    # Caveat: The lack of VIAF IDs doesn't necessarily mean Wikidata doesn't know the VIAF IDs. It might only mean the FAST ID isn't reconciled.
    # Caveat: Multiple VIAF IDs may mean there are duplicates in VIAF or that Wikidata has allowed mismatches. Blame in the latter case can be diagnosed via "References" and/or the "History" tab.
    PREFIX fast: <http://id.worldcat.org/fast/>
    PREFIX viaf: <http://viaf.org/viaf/>
    SELECT ?fast ?heading 
    #?viaflookup 
    ?viaflookupDeref 
    ?us_vs_them
    (GROUP_CONCAT(DISTINCT ?wdfastID;SEPARATOR=" | ") AS ?wdFASTS) 
    (GROUP_CONCAT(DISTINCT ?viaf;SEPARATOR=" | ") AS ?wdVIAFS) 
    (GROUP_CONCAT(DISTINCT ?lccn;SEPARATOR=" | " ) AS ?wdLCCNs)
    ?wd ?wdLabel ?wdDescription 
    (GROUP_CONCAT(DISTINCT ?typeQ;SEPARATOR=" | ") AS ?types) 
    WHERE {
      VALUES (?fast ?heading ?viaflookupDeref) {
        (fast:1204155 "aUnited States." viaf:130168302)
        (fast:1219920 "aEngland." viaf:142995804)
        (fast:1204623 "aGreat Britain." viaf:127756949)
        (fast:1204289 "aFrance." viaf:170385099)
        (fast:1204333 "aNew York (State) zNew York." viaf:266415900)
        (fast:1204271 "aEngland zLondon." viaf:261467287)
        (fast:1204928 "aCalifornia." viaf:147680367)
        (fast:1245064 "aEurope. " viaf:124144648501726049254)
        (fast:1210272 "aGermany." viaf:189116956)
        (fast:1204565 "aItaly." viaf:152361066)
        (fast:1205283 "aFrance zParis." viaf:158822968)
        (fast:1244550 "aSouthern States. " viaf:315526862)
        (fast:1204310 "aCanada." viaf:136600716)
        (fast:1210280 "aNew York (State)" viaf:146785329)
        (fast:1204885 "aRome (Empire) " viaf:145348938)
        (fast:1243255 "aWest United States." viaf:129296938)
        (fast:1204540 "aCalifornia zLos Angeles." viaf:124053622)
        (fast:1204304 "aNorth Carolina." viaf:127824921)
        (fast:1204303 "aSpain." viaf:133609710)
        (fast:1241913 "aNew England." viaf:236811278)
        (fast:1206715 "aScotland." viaf:134799371)
        (fast:1204505 "aWashington (D.C.)" viaf:312739635)
        (fast:1204270 "aMaine." viaf:151253777)
        (fast:1208379 "aNew Jersey." viaf:157102040)
        (fast:1239509 "aAfrica." viaf:127043766)
        (fast:1205427 "aIreland." viaf:158208597)
        (fast:1210281 "aSoviet Union." viaf:124251745)
        (fast:1207312 "aRussia." viaf:247149066396265601002)
        (fast:1204481 "aCalifornia zSan Francisco." viaf:143700861)
        (fast:1205012 "aMassachusetts zBoston." viaf:133676669)
        (fast:1205076 "aOhio zColumbus" viaf:247586192)
        (fast:1240359 "aMoon zTranquility Base" viaf:315125366)
        (fast:1333516 "aAlaska zMount Denali" viaf:241195889)
        (fast:1020337 "aMiddle Earth (Imaginary place)" viaf:NA)
        (fast:1243528 "aPacific Ocean" viaf:304910555)
        (fast:1896842 "aTurkey zTroy (Extinct city)" viaf:150894506)
      }
      
      OPTIONAL {
        ?wd wdtn:P2163 ?fast .
        OPTIONAL {?wd wdt:P214 ?viaf}
        OPTIONAL {?wd wdt:P2163 ?wdfastID}
        OPTIONAL {?wd wdt:P244 ?lccn}
        OPTIONAL {
          ?wd p:P31 [ ps:P31 ?type ]. 
          ?type rdfs:label ?typeLabel .
          FILTER(LANG(?typeLabel)="en")
          BIND(CONCAT(?typeLabel, " (", STRAFTER(STR(?type), STR(wd:)), ")") AS ?typeQ)
        }
      }
      OPTIONAL {
        ?wd wdtn:P214 ?viaflookupDeref .
        OPTIONAL {?wd wdt:P2163 ?wdfastID}
        OPTIONAL {?wd wdt:P214 ?viaf}
        OPTIONAL {?wd wdt:P244 ?lccn}
        OPTIONAL {
          ?wd p:P31 [ ps:P31 ?type ]. 
          ?type rdfs:label ?typeLabel .
          FILTER(LANG(?typeLabel)="en")
          BIND(CONCAT(?typeLabel, " (", STRAFTER(STR(?type), STR(wd:)), ")") AS ?typeQ)
        }
      }
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
      
      BIND(STRAFTER(STR(?fast), STR(fast:)) AS ?fastID)
      BIND(CONCAT("00000000", ?fastID) AS ?fast000ID)
      BIND(SUBSTR(?fast000ID, STRLEN(?fast000ID)-7) AS ?fstID)
      BIND (URI(CONCAT("http://viaf.org/viaf/sourceID/FAST|fst", ?fstID)) AS ?viaflookup)
    }
    GROUP BY ?fast ?heading ?wd ?wdLabel ?wdDescription ?viaflookup ?viaflookupDeref ?us_vs_them
    ORDER BY xsd:integer(STRAFTER(STR(?fast), STR(fast:)))
    

What novels did Jane Austen and Douglas Adams write?

[edit]

The following query uses these:

  • Properties: author (P50)  View with Reasonator View with SQID, genre (P136)  View with Reasonator View with SQID, subclass of (P279)  View with Reasonator View with SQID
    SELECT DISTINCT ?author ?authorLabel ?work ?workLabel
    WHERE {
      VALUES ?author {
        wd:Q36322
        wd:Q42
      }
      ?work wdt:P50 ?author;
            wdt:P136/wdt:P279 wd:Q8261 .
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    ORDER BY ?authorLabel ?workLabel
    

Famous authors that wrote one or more book series

[edit]

This shape doesn't produce satisfying results

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, subclass of (P279)  View with Reasonator View with SQID, author (P50)  View with Reasonator View with SQID
    SELECT ?author ?authorLabel ?sitelinks (COUNT(DISTINCT ?series) AS ?seriesCount) (GROUP_CONCAT(?seriesQ;SEPARATOR=" | ") AS ?seriesList) #(GROUP_CONCAT(DISTINCT ?languageLabel) AS ?langs)
    WHERE {
      ?series wdt:P31/wdt:P279* wd:Q277759 ;
              wdt:P50 ?author .
      MINUS {?series wdt:P31 wd:Q3331189}
      ?author wikibase:sitelinks ?sitelinks .
      SERVICE wikibase:label {
        bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,zh". 
        ?author rdfs:label ?authorLabel .
        ?series rdfs:label ?seriesLabel .
        ?language rdfs:label ?languageLabel .
      }
      BIND(STR(?seriesLabel) AS ?seriesQ)
    }
    GROUP BY ?author ?authorLabel ?sitelinks
    HAVING (?seriesCount > 1)
    ORDER BY DESC(?sitelinks)
    LIMIT 10
    

Casebook of Sherlock Holmes

[edit]

The following query uses these:

  • Properties: part of the series (P179)  View with Reasonator View with SQID, instance of (P31)  View with Reasonator View with SQID, series ordinal (P1545)  View with Reasonator View with SQID
    SELECT ?series ?seriesLabel (GROUP_CONCAT(?seriesTypeLabel) AS ?seriesTypes) ?item ?itemLabel (GROUP_CONCAT(?itemTypeLabel;SEPARATOR=" | ") AS ?itemTypes) ?ordinal
    WHERE {
      VALUES ?series {
        wd:Q1129378
        wd:Q165356
      }
      ?item wdt:P179 ?series .
      OPTIONAL {?item wdt:P31 ?itemType}
      OPTIONAL {?series wdt:P31 ?seriesType}
      OPTIONAL {
        ?item p:P179 [
          pq:P1545 ?ordinal; 
          ps:P179 ?series
        ]
      }
      SERVICE wikibase:label { 
        ?item rdfs:label ?itemLabel .
        ?series rdfs:label ?seriesLabel .
        ?seriesType rdfs:label ?seriesTypeLabel.
        ?itemType rdfs:label ?itemTypeLabel .
        bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". 
      }
    }
    GROUP BY ?series ?seriesLabel ?item ?itemLabel ?ordinal
    ORDER BY ?series xsd:integer(?ordinal)
    

Types of series

[edit]

The following query uses these:

  • Properties: part of the series (P179)  View with Reasonator View with SQID, instance of (P31)  View with Reasonator View with SQID, subclass of (P279)  View with Reasonator View with SQID
    SELECT ?seriesType ?seriesTypeLabel ?instanceCount 
    WHERE {
      {
        SELECT ?seriesType (COUNT(DISTINCT ?series) AS ?instanceCount)
        WHERE {
          ?item wdt:P179 ?series .
          ?series wdt:P31/wdt:P279* ?seriesType.
          ?seriesType wdt:P279* wd:Q7725310 .
        }
        GROUP BY ?seriesType 
        ORDER BY DESC(?instanceCount)
        LIMIT 100
      }
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    ORDER BY DESC(?instanceCount)
    

Translations

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, subclass of (P279)  View with Reasonator View with SQID, edition or translation of (P629)  View with Reasonator View with SQID, title (P1476)  View with Reasonator View with SQID, language of work or name (P407)  View with Reasonator View with SQID, translator (P655)  View with Reasonator View with SQID
    SELECT ?work ?workLabel (GROUP_CONCAT(?workLanguageLabel) AS ?workLanguages) ?sitelinks ?translation ?title ?translationLanguageLabel (GROUP_CONCAT(DISTINCT ?translatorLabel;SEPARATOR=" | ") AS ?translators)
    WHERE {
      ?translation wdt:P31/wdt:P279* wd:Q39811647 ;
            wdt:P629 ?work .
      ?work wikibase:sitelinks ?sitelinks .
      OPTIONAL {
        ?translation wdt:P1476 ?title .
      }
      OPTIONAL {?work wdt:P407 ?workLanguage}
      OPTIONAL {
        ?translation wdt:P407 ?translationLanguage .
      }
      OPTIONAL {
        ?translation rdfs:label ?title .
        FILTER(LANG(?title)="en")
      }
      OPTIONAL {
        ?translation wdt:P655 ?translator .
      }
      SERVICE wikibase:label { 
        bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". 
        ?workLanguage rdfs:label ?workLanguageLabel .
        ?translation rdfs:label ?title .
        ?work rdfs:label ?workLabel .
        ?translationLanguage rdfs:label ?translationLanguageLabel .
        ?translator rdfs:label ?translatorLabel .
      }
    }
    GROUP BY ?sitelinks ?translation ?translationLabel ?title ?translationLanguageLabel ?work ?workLabel
    ORDER BY DESC(?sitelinks) ?work ?translationLanguageLabel
    

non-work types associated with OCN external IDs

[edit]

The following query uses these:

  • Properties: OCLC control number (P243)  View with Reasonator View with SQID, instance of (P31)  View with Reasonator View with SQID, subclass of (P279)  View with Reasonator View with SQID
    SELECT ?type ?typeLabel ?itemCount 
    WHERE {
      {
        SELECT ?type (COUNT(DISTINCT ?item) AS ?itemCount)
        WHERE {
          ?item wdt:P243 ?ocn ;
                wdt:P31 ?type .
        }
        GROUP BY ?type
        ORDER BY DESC(?itemCount)  
      }
      MINUS {
        ?type wdt:P279* wd:Q386724.
        hint:Prior hint:gearing "forward".
      }
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    ORDER BY DESC(?itemCount)
    

Usage Instructions

[edit]

The following query uses these:

  • Properties: Wikidata usage instructions (P2559)  View with Reasonator View with SQID, instance of (P31)  View with Reasonator View with SQID
    SELECT ?item ?itemLabel ?itemDescription ?usageInstructions 
    WHERE {
      ?item wdt:P2559 ?usageInstructions ;
            wikibase:sitelinks ?sitelinks .
      MINUS {?item wdt:P31 wd:Q11266439}
      FILTER(LANG(?usageInstructions)="en")
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    ORDER BY DESC(?sitelinks)
    LIMIT 100
    

Type constraint violations

[edit]

The following query uses these:

  • Properties: property constraint (P2302)  View with Reasonator View with SQID, subclass of (P279)  View with Reasonator View with SQID, instance of (P31)  View with Reasonator View with SQID, class (P2308)  View with Reasonator View with SQID
    SELECT (URI(CONCAT(STR(?item), "#", STRAFTER(STR(?wdt), STR(wdt:)))) AS ?violation)
    WHERE {
      ?prop wikibase:directClaim ?wdt ;
            wdt:P2302 wd:Q21503250 .
      ?item ?wdt [] .
      MINUS {
        ?prop p:P2302 [
          ps:P2302 wd:Q21503250 ;
                   pq:P2308 ?declaredClass
        ] .
        ?acceptableClass wdt:P279* ?declaredClass .
        hint:Prior hint:gearing "forward" .
        ?item ?wdt [];
              wdt:P31 ?acceptableClass .
      }
    }
    LIMIT 10
    

Translations of Les Miserables

[edit]

The following query uses these:

  • Properties: has edition or translation (P747)  View with Reasonator View with SQID, language of work or name (P407)  View with Reasonator View with SQID, title (P1476)  View with Reasonator View with SQID, translator (P655)  View with Reasonator View with SQID
    SELECT ?work ?originalTitle ?originalLanguageLabel ?translation ?translationTitle ?translationLanguageLabel ?translator ?translatorLabel 
    WHERE {
      VALUES ?work {
        wd:Q180736
      }
      ?work wdt:P747 ?translation ;
            wdt:P407 ?originalLanguage ;
            wdt:P1476 ?originalTitle .
      ?translation wdt:P407 ?translationLanguage ;
                   wdt:P1476 ?translationTitle .
      OPTIONAL {
        ?translation wdt:P655 ?translator .
      }
      FILTER(?originalLanguage != ?translationLanguage)
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    
[edit]

Attribution

[edit]

Thanks and apologies to User:Pyb for borrowing User:Pyb/Test4 as a template for my own tests. The jump start on useful links was especially nice.