BDI Data:Useful Queries

From BDI Data
Jump to: navigation, search

BDI specific prefixes

 PREFIX bwdata: <http://wiki.bgbm.org/bdidata/index.php/Special:EntityData/>
 
 PREFIX bwd: <http://wiki.bgbm.org/entity/>
 PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
 PREFIX bwdtn: <http://http://wiki.bgbm.org/prop/direct-normalized/>
 
 PREFIX bwds: <http://wiki.bgbm.org/entity/statement/>
 PREFIX bp: <http://wiki.bgbm.org/prop/>
 PREFIX bwdref: <http://wiki.bgbm.org/reference/>
 PREFIX bwdv: <http://wiki.bgbm.org/value/>
 PREFIX bps: <http://wiki.bgbm.org/prop/statement/>
 PREFIX bpsv: <http://wiki.bgbm.org/prop/statement/value/>
 PREFIX bpsn: <http://wiki.bgbm.org/prop/statement/value-normalized/>
 PREFIX bpq: <http://wiki.bgbm.org/prop/qualifier/>
 PREFIX bpqv: <http://wiki.bgbm.org/prop/qualifier/value/>
 PREFIX bpqn: <http://wiki.bgbm.org/prop/qualifier/value-normalized/>
 PREFIX bpr: <http://wiki.bgbm.org/prop/reference/>
 PREFIX bprv: <http://wiki.bgbm.org/prop/reference/value/>
 PREFIX bprn: <http://wiki.bgbm.org/prop/reference/value-normalized/>
 PREFIX bwdno: <http://wiki.bgbm.org/prop/novalue/>

Snippets

ignore versioned terms

The following query uses these:

All ABCD Concepts

Show all concepts that are part of the Preliminary Concept Pool (Q64) or ABCD 3.0 (Q219).

The following query uses these:
  • Properties: is part of (P8) , is of type (P9) , Concept Name (P25) 
    1 PREFIX bwd: <http://wiki.bgbm.org/entity/>
    2 PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
    3 
    4 SELECT ?concept ?conceptLabel ?name ?type ?typeLabel  WHERE {
    5   ?concept bwdt:P8 bwd:Q219.
    6   ?concept bwdt:P9 ?type.
    7   ?concept bwdt:P25 ?name.
    8   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    9 }
    

Concept Groups

group and count concepts by type

The following query uses these:
  • Properties: is part of (P8) , is of type (P9) 
    1 PREFIX bwd: <http://wiki.bgbm.org/entity/>
    2 PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
    3 
    4 SELECT ?typeLabel (COUNT (?concept) as ?count) WHERE {
    5   ?concept bwdt:P8 bwd:Q219. 
    6   ?concept bwdt:P9 ?type.
    7   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    8 }GROUP BY ?type ?typeLabel
    


Concept Groups of Properties and Controlled Terms

The following query uses these:
  • Properties: is part of (P8) , Concept Name (P25) , is of type (P9) , associated Concept (P46) , in Concept Group (P48) , in Vocabulary (P51) 
     1 PREFIX bwd: <http://wiki.bgbm.org/entity/>
     2 PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
     3 
     4 SELECT ?conceptName (GROUP_CONCAT(DISTINCT ?conceptGroupLabel; SEPARATOR=", ") AS ?conceptGroups) WHERE {
     5   ?propertyOrTerm bwdt:P8 bwd:Q219.
     6   ?propertyOrTerm bwdt:P25 ?conceptName.
     7   {
     8     ?propertyOrTerm bwdt:P9 bwd:Q33.
     9     ?propertyOrTerm bwdt:P46 ?concept.
    10     ?concept bwdt:P48 ?conceptGroup.
    11   } UNION {
    12     ?propertyOrTerm bwdt:P9 bwd:Q34.
    13     ?propertyOrTerm bwdt:P46 ?concept.
    14     ?concept bwdt:P48 ?conceptGroup.
    15   } UNION {
    16     ?propertyOrTerm bwdt:P9 bwd:Q16.
    17     ?propertyOrTerm bwdt:P51 ?vocabulary.
    18     ?vocabulary bwdt:P48 ?conceptGroup.
    19   }
    20   ?conceptGroup rdfs:label ?conceptGroupLabel.
    21   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    22 } GROUP BY ?conceptName
    

Search names by RegEx

The following query uses these:
  • Properties: is part of (P8) 
    1 PREFIX bwd: <http://wiki.bgbm.org/entity/>
    2 PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
    3 
    4 SELECT ?concept ?conceptLabel WHERE {
    5   ?concept bwdt:P8 bwd:Q219.
    6   ?concept rdfs:label ?conceptLabel;
    7   FILTER (lang(?conceptLabel) = "en") .
    8   FILTER regex (?conceptLabel, "UR[IL]").
    9 }
    

Datatypes used by Datatype Properties

The following query uses these:
  • Properties: is part of (P8) , is of type (P9) , has datatype (P27) 
     1 PREFIX bwd: <http://wiki.bgbm.org/entity/>
     2 PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
     3 
     4 SELECT ?typeLabel (COUNT (?concept) as ?count) WHERE {
     5   ?concept bwdt:P8 bwd:Q219. 
     6   ?concept bwdt:P9 bwd:Q34.
     7   ?concept bwdt:P27 ?type.
     8   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
     9 }GROUP BY ?typeLabel
    10 ORDER BY DESC(?count)
    

Classes and their Properties

Classes with the number of Object Properties that link to them

The following query uses these:
  • Properties: is of type (P9) , is part of (P8) , has domain (P29) , has range (P13) 
     1 PREFIX bwd: <http://wiki.bgbm.org/entity/>
     2 PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
     3 
     4 SELECT ?range ?rangeLabel ?count WHERE{
     5   {
     6 SELECT ?range (COUNT(?property) as ?count) WHERE {
     7     ?property bwdt:P9 bwd:Q33.
     8   ?property bwdt:P8 bwd:Q219.
     9     OPTIONAL{
    10       ?property bwdt:P29 ?domain.
    11     }
    12     OPTIONAL{
    13       ?property bwdt:P13 ?range.
    14     }
    15 }GROUP BY ?range  
    16           }
    17   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } 
    18 }ORDER BY DESC(?count)
    

Classes and the Properties pointing to them

The following query uses these:
  • Properties: is of type (P9) , is part of (P8) , has domain (P29) , has range (P13) 
     1 PREFIX bwd: <http://wiki.bgbm.org/entity/>
     2 PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
     3 
     4  
     5 SELECT ?property ?propertyLabel ?domain ?domainLabel ?range ?rangeLabel WHERE {
     6     ?property bwdt:P9 bwd:Q33.
     7   ?property bwdt:P8 bwd:Q219.
     8     OPTIONAL{
     9       ?property bwdt:P29 ?domain.
    10     }
    11     OPTIONAL{
    12       ?property bwdt:P13 ?range.
    13     }
    14 
    15   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    16    
    17 }ORDER BY ?rangeLabel
    

Classes and their identifiers

The following query uses these:
  • Properties: is of type (P9) , is part of (P8) , associated Property (P45) 
     1 PREFIX bwd: <http://wiki.bgbm.org/entity/>
     2 PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
     3 
     4 SELECT ?class ?classLabel ?id ?guid ?resourceURI WHERE {
     5   ?class bwdt:P9 bwd:Q32.
     6   ?class bwdt:P8 bwd:Q219.
     7   OPTIONAL{
     8     ?class bwdt:P45 bwd:Q1806.
     9     BIND(true as ?id)
    10   }
    11   OPTIONAL{
    12     ?class bwdt:P45 bwd:Q127.
    13     BIND(true as ?guid)
    14   }
    15   OPTIONAL{
    16     ?class bwdt:P45 bwd:Q163.
    17     BIND(true as ?resourceURI)
    18   }
    19 
    20   MINUS {
    21     ?class bwdt:P9 bwd:Q2244.
    22   }
    23   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    24 }ORDER BY DESC(?id) DESC(?guid) DESC(?resourceURI) ?classLabel
    

Classes and the number of properties they have

The following query uses these:
  • Properties: is part of (P8) , is of type (P9) , associated Property (P45) 
     1 PREFIX bwd: <http://wiki.bgbm.org/entity/>
     2 PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
     3 
     4 SELECT ?concept ?conceptLabel (count(?property) as ?propertyCount)  WHERE {
     5   ?concept bwdt:P8 bwd:Q219.
     6   ?concept bwdt:P9 bwd:Q32.
     7   ?concept bwdt:P45 ?property.
     8   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
     9 } GROUP BY ?concept ?conceptLabel 
    10 ORDER BY DESC(?propertyCount)
    

Concept Names that start with an abbreviation

this is useful, when we convert the first letter to lower case.

It is determined by looking if the second character is capitalized.

The following query uses these:
  • Properties: is part of (P8) , is of type (P9) , Concept Name (P25) 
     1 PREFIX bwd: <http://wiki.bgbm.org/entity/>
     2 PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
     3 
     4 SELECT ?concept ?conceptLabel ?conceptName WHERE {
     5   ?concept bwdt:P8 bwd:Q219. 
     6   ?concept bwdt:P9 bwd:Q34.
     7   ?concept bwdt:P25 ?conceptName.
     8 
     9   FILTER regex (?conceptName, "^.[A-Z]").
    10 
    11   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    12 }
    

Overview of all Qualifiers used in ABCD Model

The following query uses these:
  • Properties: is part of (P8) , associated Property (P45) 
     1 PREFIX bwd: <http://wiki.bgbm.org/entity/>
     2 PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
     3 PREFIX bp: <http://wiki.bgbm.org/prop/>
     4 PREFIX bpq: <http://wiki.bgbm.org/prop/qualifier/>
     5 PREFIX bps: <http://wiki.bgbm.org/prop/statement/>
     6 
     7 SELECT ?conceptLabel ?ABCDpropertyLabel ?wikiPropertyURL ?wikiPropertyLabel ?value{
     8   ?concept bwdt:P8 bwd:Q219. 
     9   ?concept bp:P45 ?statement.
    10   ?statement bps:P45 ?ABCDproperty.
    11   ?statement ?wikiPropertyURL ?value.
    12   ?wikiProp ?ref ?wikiPropertyURL.
    13   ?wikiProp rdf:type wikibase:Property .
    14   ?wikiProp rdfs:label ?wikiPropertyLabel.
    15                 
    16   FILTER (lang(?wikiPropertyLabel) = 'en' )
    17   FILTER strstarts(str(?wikiPropertyURL),"http://wiki.bgbm.org/prop/qualifier/P")
    18   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    19 }
    

List of Meta Properties

The following query uses these:
  • Properties: is part of (P8) , is of type (P9) , Concept Name (P25) , Special Properties (P64) 
     1 PREFIX bwd: <http://wiki.bgbm.org/entity/>
     2 PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
     3 
     4 SELECT ?concept ?conceptLabel ?name ?type ?typeLabel  WHERE {
     5   ?concept bwdt:P8 bwd:Q219.
     6   ?concept bwdt:P9 ?type.
     7   ?concept bwdt:P25 ?name.
     8   ?concept bwdt:P64 bwd:Q2042.
     9   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    10 }
    


Extensive Table for Concept Review

The following query uses these:
  • Properties: is of type (P9) , is part of (P8) , associated Concept (P46) , in Concept Group (P48) , associated Property (P45) , allowed value (P16) 
     1 PREFIX bwd: <http://wiki.bgbm.org/entity/>
     2 PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
     3 
     4  
     5 SELECT ?group ?groupLabel ?concept ?conceptLabel ?property ?propertyLabel ?term ?termLabel WHERE {
     6  {
     7 SELECT DISTINCT ?group ?property WHERE {
     8     {?property bwdt:P9 bwd:Q33.}
     9     UNION
    10     {?property bwdt:P9 bwd:Q34.}
    11     UNION
    12     {?property bwdt:P9 bwd:Q81.}
    13     ?property bwdt:P8 bwd:Q219.
    14     
    15     MINUS { ?property bwdt:P46 [] }
    16    OPTIONAL {
    17     ?property bwdt:P48 ?group.
    18     }
    19   }
    20 } UNION
    21 {
    22   SELECT ?group ?concept ?property ?term WHERE {
    23     ?concept bwdt:P8 bwd:Q219.
    24     {
    25     ?concept bwdt:P9 bwd:Q32.
    26       }UNION{
    27     ?concept bwdt:P9 bwd:Q14.
    28       }
    29       
    30     OPTIONAL {
    31       ?concept bwdt:P48 ?group.
    32     }
    33     OPTIONAL {
    34       ?concept bwdt:P45 ?property.
    35     }
    36     OPTIONAL {
    37       ?concept bwdt:P16 ?term.
    38      }
    39   }
    40 }
    41  
    42 
    43 SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    44 }ORDER BY ?groupLabel ?conceptLabel ?propertyLabel ?termLabel
    

UsageNotes with references to other elements

TODO: add descriptions and additional descriptions, check references (manually)

The following query uses these:
  • Properties: is part of (P8) , Usage Notes (P62) 
    1 PREFIX bwd: <http://wiki.bgbm.org/entity/>
    2 PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
    3 
    4 SELECT ?concept ?conceptLabel ?usageNotes WHERE {
    5   ?concept bwdt:P8 bwd:Q219. 
    6   ?concept bwdt:P62 ?usageNotes.
    7   FILTER regex (?usageNotes, "abcd:").
    8   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    9 }
    


mapping concepts to Wikidata (Federated Query)

This query maps our concepts to Wikidata using exact-Match references to external terms. The Wikidata label has to be extracted manually and the variable must not end with "Label" otherwise the local label service gets triggered and produces an error. Using the short notation for the wikidata properties (e.g. "wdt:P1628"), also doesn't work, hence the long version.

The following query uses these:
  • Properties: is part of (P8) , has exact match (P11) , P1628
     1 PREFIX bwd: <http://wiki.bgbm.org/entity/>
     2 PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
     3 PREFIX wdt: <http://www.wikidata.org/prop/direct/>
     4 
     5 SELECT ?concept ?conceptLabel ?match ?wikidata ?wikidataLb WHERE {
     6   ?concept bwdt:P8 bwd:Q219. 
     7   ?concept bwdt:P11 ?match. 
     8   SERVICE <https://query.wikidata.org/sparql> {
     9       ?wikidata wdt:P1628 ?match.
    10       ?wikidata rdfs:label ?wikidataLb .
    11       filter (lang(?wikidataLb) = "en").
    12   }
    13   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    14 }
    

Wikibase properties that are used to describe ABCD concepts

The following query uses these:
  • Properties: is part of (P8) 
     1 PREFIX bwd: <http://wiki.bgbm.org/entity/>
     2 PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
     3 
     4 SELECT ?property ?propertyLabel (COUNT (?item) as ?count) WHERE{
     5   ?item bwdt:P8 bwd:Q219 ;
     6         ?prop ?statement.
     7   ?property wikibase:directClaim ?prop.
     8   ?property wikibase:propertyType ?type.
     9   SERVICE wikibase:label { bd:serviceParam wikibase:language "en" .}
    10 }
    11 GROUP BY $property ?propertyLabel ?type
    12 ORDER BY DESC(?count)
    

All Class Mappings and Property Chains

The following query uses these:
  • Properties: is part of (P8) , is of type (P9) , Concept Name (P25) 
    1 PREFIX bwd: <http://wiki.bgbm.org/entity/> 
    2 PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/> 
    3 SELECT ?concept ?conceptLabel ?type ?typeLabel ?name WHERE { 
    4   ?concept bwdt:P8 bwd:Q2053. 
    5   ?concept bwdt:P9 ?type.
    6   ?concept bwdt:P25 ?name.
    7   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    8 }
    

Property Chains with segments

The following query uses these:
  • Properties: is part of (P8) , is of type (P9) , Concept Name (P25) , chain link (P72) , order (P73) 
     1 PREFIX bwd: <http://wiki.bgbm.org/entity/> 
     2 PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/> 
     3 PREFIX bp: <http://wiki.bgbm.org/prop/>
     4 PREFIX bpq: <http://wiki.bgbm.org/prop/qualifier/>
     5 PREFIX bps: <http://wiki.bgbm.org/prop/statement/>
     6 
     7 SELECT ?concept ?conceptLabel ?name (count(?link) as ?count) ?firstLink ?firstLinkLabel ?secondLink ?secondLinkLabel ?thirdLink ?thirdLinkLabel WHERE { 
     8   ?concept bwdt:P8 bwd:Q2053. 
     9   ?concept bwdt:P9 bwd:Q2050.
    10   ?concept bwdt:P25 ?name.
    11   ?concept bwdt:P72 ?link.
    12   
    13   ?concept bp:P72 ?firstLinkStatement.
    14   ?firstLinkStatement bps:P72 ?firstLink.
    15   ?firstLinkStatement bpq:P73 "1".
    16   
    17   ?concept bp:P72 ?secondLinkStatement.
    18   ?secondLinkStatement bps:P72 ?secondLink.
    19   ?secondLinkStatement bpq:P73 "2".
    20   
    21   OPTIONAL{
    22     ?concept bp:P72 ?thirdLinkStatement.
    23     ?thirdLinkStatement bps:P72 ?thirdLink.
    24     ?thirdLinkStatement bpq:P73 "3".
    25   }
    26   
    27   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    28 }GROUP BY ?concept ?conceptLabel ?name ?firstLink ?firstLinkLabel ?secondLink ?secondLinkLabel ?thirdLink ?thirdLinkLabel
    

Maintanance Queries

TODO:

  • Versioning: only one element with the same concept name get's to have the current flag

Queries that are supposed to have 0 results:


Wrongful Links to Preliminary Concept Pool

The following query uses these:
  • Properties: is part of (P8) 
     1 #Wrongful Links to Preliminary Concept Pool
     2 PREFIX bwd: <http://wiki.bgbm.org/entity/>
     3 PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
     4 
     5 SELECT ?concept ?conceptLabel ?linkedConcept ?linkedConceptLabel WHERE {
     6   ?concept bwdt:P8 bwd:Q219.
     7   ?concept ?property ?linkedConcept.
     8   ?linkedConcept bwdt:P8 bwd:Q64.
     9   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    10 }
    

Functional Properties that are not also marked as another type

The following query uses these:
  • Properties: is part of (P8) , is of type (P9) 
     1 #Functional Properties that are not also marked as another type
     2 PREFIX bwd: <http://wiki.bgbm.org/entity/>
     3 PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
     4 
     5 SELECT ?concept ?conceptLabel (COUNT(?otherType) AS ?count) WHERE {
     6   ?concept bwdt:P8 bwd:Q219.
     7   ?concept bwdt:P9 bwd:Q81.
     8   ?concept bwdt:P9 ?otherType
     9   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    10 
    11 }GROUP BY ?concept ?conceptLabel
    12 HAVING (?count = 1)
    

Missing Inverse between associatedConcept and associatedProperty

The following query uses these:
  • Properties: is of type (P9) , is part of (P8) , associated Property (P45) , associated Concept (P46) 
     1 #Missing Inverse between associatedConcept and associatedProperty
     2 PREFIX bwd: <http://wiki.bgbm.org/entity/>
     3 PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
     4 
     5 SELECT DISTINCT ?property ?propertyLabel ?class ?classLabel ?issue WHERE{
     6   {
     7     {?property bwdt:P9 bwd:Q33.}
     8     UNION
     9     {?property bwdt:P9 bwd:Q34.}
    10     UNION
    11     {?property bwdt:P9 bwd:Q81.}
    12    
    13     ?property bwdt:P8 bwd:Q219.
    14     ?class bwdt:P8 bwd:Q219.
    15     ?class bwdt:P9 bwd:Q32.
    16     ?class bwdt:P45 ?property
    17     MINUS {?property bwdt:P46 ?class}
    18     BIND("missing associatedConcept in Property" AS ?issue )
    19   }
    20   UNION
    21   {
    22     {?property bwdt:P9 bwd:Q33.}
    23     UNION
    24     {?property bwdt:P9 bwd:Q34.}
    25     UNION
    26     {?property bwdt:P9 bwd:Q81.}
    27    
    28     ?property bwdt:P8 bwd:Q219.
    29     ?class bwdt:P8 bwd:Q219.
    30     ?class bwdt:P9 bwd:Q32.
    31     ?property bwdt:P46 ?class    
    32     MINUS {?class bwdt:P45 ?property}
    33     BIND("missing associatedProperty in Class" AS ?issue )
    34   }
    35   
    36   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    37 }
    

Missing inverse between inVocabulary and allowedValue

The following query uses these:
  • Properties: is of type (P9) , is part of (P8) , in Vocabulary (P51) , allowed value (P16) 
     1 #Missing inverse between inVocabulary and allowedValue
     2 PREFIX bwd: <http://wiki.bgbm.org/entity/>
     3 PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
     4 
     5 SELECT DISTINCT ?vocab ?vocabLabel ?term ?termLabel ?issue WHERE{
     6   {
     7     ?vocab bwdt:P9 bwd:Q14.
     8     ?vocab bwdt:P8 bwd:Q219.
     9     ?term bwdt:P8 bwd:Q219.
    10     ?term bwdt:P9 bwd:Q16.
    11     ?term bwdt:P51 ?vocab.
    12     MINUS {?vocab bwdt:P16 ?term.}
    13     BIND("missing allowedValue for Vocabulary" AS ?issue )
    14   }
    15   UNION
    16   {
    17     ?vocab bwdt:P9 bwd:Q14.
    18     ?vocab bwdt:P8 bwd:Q219.
    19     ?term bwdt:P8 bwd:Q219.
    20     ?term bwdt:P9 bwd:Q16.
    21     ?vocab bwdt:P16 ?term.
    22     MINUS {?term bwdt:P51 ?vocab.}
    23     BIND("missing inVocabulary for Term" AS ?issue )
    24   }
    25   
    26   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    27 }
    

check for Concept Names that occur more than once

The following query uses these:
  • Properties: is part of (P8) , Concept Name (P25) , is of type (P9) 
     1 #check for Concept Names that occur more than onc
     2 PREFIX bwd: <http://wiki.bgbm.org/entity/>
     3 PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
     4 
     5 SELECT ?name ?concept ?conceptLabel ?count ?typeLabel ?functionalLabel WHERE{
     6   {
     7     SELECT ?name (COUNT(?concept) AS ?count) WHERE {
     8       ?concept bwdt:P8 bwd:Q219.
     9       ?concept bwdt:P25 ?name
    10     }
    11     GROUP BY ?name
    12   }
    13   
    14   FILTER(?count > 1)
    15   ?concept bwdt:P8 bwd:Q219.
    16   ?concept bwdt:P25 ?name.
    17   ?concept bwdt:P9 ?type.
    18   VALUES ?type {bwd:Q34 bwd:Q33 bwd:Q32 bwd:Q14 bwd:Q16}
    19   OPTIONAL{
    20     ?concept bwdt:P9 ?functional.
    21     VALUES ?functional {bwd:Q81}
    22   }
    23                  
    24   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    25 }ORDER BY DESC(?count) ?name
    


Check where mandatory statements are missing

The following query uses these:
  • Properties: is part of (P8) , is of type (P9) , Concept Name (P25) , has datatype (P27) , has range (P13) , in Concept Group (P48) , allowed value (P16) , in Vocabulary (P51) 
      1 #Check where mandatory statements are missing
      2 PREFIX bwd: <http://wiki.bgbm.org/entity/>
      3 PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
      4 
      5 SELECT ?concept ?conceptLabel ?issue WHERE {
      6 	{ # Datatype Property
      7 		SELECT ?concept ?conceptLabel ?issue WHERE {
      8 			?concept bwdt:P8 bwd:Q219.
      9 			?concept bwdt:P9 bwd:Q34.
     10 			{
     11 				MINUS {?concept bwdt:P25 []}
     12 				BIND ("missing Concept Name" as ?issue)
     13 			}
     14 			UNION {
     15 				MINUS {?concept bwdt:P27 []}
     16 				BIND ("missing Datatype" as ?issue)
     17 			}
     18 			UNION {
     19 				FILTER (NOT EXISTS {
     20 					?concept rdfs:label ?conceptLabel.
     21 				})
     22 				BIND ("missing Label" as ?issue)
     23 			}
     24 			UNION {
     25 				FILTER (NOT EXISTS {
     26 					?concept schema:description ?conceptDescription.
     27 				})
     28 				BIND ("missing Description" as ?issue)
     29 			}
     30 			SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
     31 		}
     32 	} 
     33 	UNION { # Object Property
     34 		SELECT ?concept ?conceptLabel ?issue WHERE {
     35 			?concept bwdt:P8 bwd:Q219.
     36 			?concept bwdt:P9 bwd:Q33.
     37 			{
     38 				MINUS {?concept bwdt:P25 []}
     39 				BIND ("missing Concept Name" as ?issue)
     40 			}
     41 			UNION {
     42 				MINUS {?concept bwdt:P13 []}
     43 				BIND ("missing Range" as ?issue)
     44 			}
     45 			UNION {
     46 				FILTER (NOT EXISTS {
     47 					?concept rdfs:label ?conceptLabel.
     48 				})
     49 				BIND ("missing Label" as ?issue)
     50 			}
     51 			UNION {
     52 				FILTER (NOT EXISTS {
     53 					?concept schema:description ?conceptDescription.
     54 				})
     55 				BIND ("missing Description" as ?issue)
     56 			}
     57 			SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
     58 		}
     59 	}
     60 	UNION { # Class
     61 		SELECT ?concept ?conceptLabel ?issue WHERE {
     62 			?concept bwdt:P8 bwd:Q219.
     63 			?concept bwdt:P9 bwd:Q32.
     64 			{
     65 				MINUS {?concept bwdt:P25 []}
     66 				BIND ("missing Concept Name" as ?issue)
     67 			}
     68 			UNION {
     69 				MINUS {?concept bwdt:P48 []}
     70 				BIND ("missing Concept Group" as ?issue)
     71 			}
     72 			UNION {
     73 				FILTER (NOT EXISTS {
     74 					?concept rdfs:label ?conceptLabel.
     75 				})
     76 				BIND ("missing Label" as ?issue)
     77 			}
     78 			UNION {
     79 				FILTER (NOT EXISTS {
     80 					?concept schema:description ?conceptDescription.
     81 				})
     82 				BIND ("missing Description" as ?issue)
     83 			}
     84 			SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
     85 		}
     86 	}
     87 	UNION { # Controlled Vocabulary
     88 		SELECT ?concept ?conceptLabel ?issue WHERE {
     89 			?concept bwdt:P8 bwd:Q219.
     90 			?concept bwdt:P9 bwd:Q14.
     91 			{
     92 				MINUS {?concept bwdt:P25 []}
     93 				BIND ("missing Concept Name" as ?issue)
     94 			}
     95 			UNION {
     96 				MINUS {?concept bwdt:P16 []}
     97 				BIND ("missing Allowed Value" as ?issue)
     98 			}
     99 			UNION {
    100 				FILTER (NOT EXISTS {
    101 					?concept rdfs:label ?conceptLabel.
    102 				})
    103 				BIND ("missing Label" as ?issue)
    104 			}
    105 			UNION {
    106 				FILTER (NOT EXISTS {
    107 					?concept schema:description ?conceptDescription.
    108 				})
    109 				BIND ("missing Description" as ?issue)
    110 			}
    111 			SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    112 		}
    113 	}
    114 	UNION { # Controlled Term
    115 		SELECT ?concept ?conceptLabel ?issue WHERE {
    116 			?concept bwdt:P8 bwd:Q219.
    117 			?concept bwdt:P9 bwd:Q16.
    118 			{
    119 				MINUS {?concept bwdt:P25 []}
    120 				BIND ("missing Concept Name" as ?issue)
    121 			}
    122 			UNION {
    123 				MINUS {?concept bwdt:P51 []}
    124 				BIND ("missing In Vocabulary" as ?issue)
    125 			}
    126 			UNION {
    127 				FILTER (NOT EXISTS {
    128 					?concept rdfs:label ?conceptLabel.
    129 				})
    130 				BIND ("missing Label" as ?issue)
    131 			}
    132 			UNION {
    133 				FILTER (NOT EXISTS {
    134 					?concept schema:description ?conceptDescription.
    135 				})
    136 				BIND ("missing Description" as ?issue)
    137 			}
    138 			SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    139 		}
    140 	}			
    141 }
    

Associated Properties that are of a wrong type

The following query uses these:
  • Properties: is part of (P8) , associated Property (P45) , is of type (P9) 
     1 #Associated Properties that are of a wrong type
     2 PREFIX bwd: <http://wiki.bgbm.org/entity/>
     3 PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
     4 
     5 SELECT DISTINCT ?property ?propertyLabel WHERE {
     6   {
     7     ?concept bwdt:P8 bwd:Q219.
     8     ?concept bwdt:P45 ?property.
     9     MINUS {
    10       {?property bwdt:P9 bwd:Q10.}
    11       UNION
    12       {?property bwdt:P9 bwd:Q33.}
    13       UNION
    14       {?property bwdt:P9 bwd:Q34.}
    15       UNION
    16       {?property bwdt:P9 bwd:Q33.
    17        ?property bwdt:P9 bwd:Q81.}
    18       UNION
    19       {?property bwdt:P9 bwd:Q34.
    20        ?property bwdt:P9 bwd:Q81.}
    21     }
    22    }
    23   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    24 
    25 }
    

Associated Concepts that are not of type Class

The following query uses these:
  • Properties: is part of (P8) , associated Concept (P46) , is of type (P9) 
     1 #Associated Concepts that are not of type Class
     2 PREFIX bwd: <http://wiki.bgbm.org/entity/>
     3 PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
     4 
     5 SELECT DISTINCT ?concept ?conceptLabel WHERE {
     6   {
     7     ?property bwdt:P8 bwd:Q219.
     8     ?property bwdt:P46 ?concept.
     9     MINUS {
    10       ?concept bwdt:P9 bwd:Q32.
    11     }
    12    }
    13   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    14 
    15 }
    

Concept Names do not match Concept Labels

The concept label has all of its spaces removed and the strings are compared in lower case.

The following query uses these:
  • Properties: is part of (P8) , Concept Name (P25) 
     1 #Concept Names do not match Concept Labels
     2 PREFIX bwd: <http://wiki.bgbm.org/entity/>
     3 PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
     4 
     5 SELECT ?concept ?conceptLabel ?conceptName WHERE {
     6   ?concept bwdt:P8 bwd:Q219. 
     7   ?concept bwdt:P25 ?conceptName.
     8   ?concept rdfs:label ?conceptLabel.
     9   FILTER (lang(?conceptLabel) = "en") .
    10   BIND (LCASE(?conceptName) as ?lcConceptName)
    11   BIND (LCASE(REPLACE(STR(?conceptLabel), " ", "")) as ?lcConceptLabel)
    12   BIND (?lcConceptName = ?lcConceptLabel as ?result)
    13   FILTER ( ?result = false )
    14 }
    

Wrongly used subproperties

Subproperties that either link to a concept that is not a property (i.e. to a class) or where the types of the property does not match the type of the parent (i.e. a datatype property that has an object property as parent)

The following query uses these:
  • Properties: is part of (P8) , subproperty of (P50) , is of type (P9) 
     1 PREFIX bwd: <http://wiki.bgbm.org/entity/>
     2 PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
     3 
     4 SELECT ?parent ?parentLabel ?concept ?conceptLabel   WHERE {
     5   {
     6     ?concept bwdt:P8 bwd:Q219.
     7     ?concept bwdt:P50 ?parent.
     8     ?concept bwdt:P9 ?type.
     9     MINUS{?parent bwdt:P9 ?type.}
    10   }UNION{
    11     ?concept bwdt:P8 bwd:Q219.
    12     ?concept bwdt:P50 ?parent.
    13     MINUS{?parent bwdt:P9 bwd:Q33.}
    14     MINUS{?parent bwdt:P9 bwd:Q34.}
    15   }
    16   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    17 }
    

Wrongly used subclasses

Uses of subclass, where either the current concept or the parent are not classes.

The following query uses these:
  • Properties: is part of (P8) , subclass of (P1) , is of type (P9) 
     1 PREFIX bwd: <http://wiki.bgbm.org/entity/>
     2 PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
     3 
     4 SELECT ?parent ?parentLabel ?concept ?conceptLabel   WHERE {
     5   {
     6     ?concept bwdt:P8 bwd:Q219.
     7     ?concept bwdt:P1 ?parent.
     8     MINUS{?concept bwdt:P9 bwd:Q32.}
     9   }UNION{
    10     ?concept bwdt:P8 bwd:Q219.
    11     ?concept bwdt:P1 ?parent.
    12     MINUS{?parent bwdt:P9 bwd:Q32.}
    13   }
    14   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    15 }
    

Misc

show last updated time

The following query uses these:
1 SELECT * WHERE {
2   <http://wiki.bgbm.org> schema:dateModified ?lastUpdated.
3 }