BDI Data:Useful Queries

From BDI Data
Jump to navigation Jump to 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 (Q64) or (Q219).

The following query uses these:

  • Properties: is part of (P8) , is of type (P9) , Concept Name (P25) 
    PREFIX bwd: <http://wiki.bgbm.org/entity/>
    PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
    
    SELECT ?concept ?conceptLabel ?name ?type ?typeLabel  WHERE {
      ?concept bwdt:P8 bwd:Q219.
      ?concept bwdt:P9 ?type.
      ?concept bwdt:P25 ?name.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    

Concept Groups

group and count concepts by type

The following query uses these:

  • Properties: is part of (P8) , is of type (P9) 
    PREFIX bwd: <http://wiki.bgbm.org/entity/>
    PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
    
    SELECT ?typeLabel (COUNT (?concept) as ?count) WHERE {
      ?concept bwdt:P8 bwd:Q219. 
      ?concept bwdt:P9 ?type.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }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) 
    PREFIX bwd: <http://wiki.bgbm.org/entity/>
    PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
    
    SELECT ?conceptName (GROUP_CONCAT(DISTINCT ?conceptGroupLabel; SEPARATOR=", ") AS ?conceptGroups) WHERE {
      ?propertyOrTerm bwdt:P8 bwd:Q219.
      ?propertyOrTerm bwdt:P25 ?conceptName.
      {
        ?propertyOrTerm bwdt:P9 bwd:Q33.
        ?propertyOrTerm bwdt:P46 ?concept.
        ?concept bwdt:P48 ?conceptGroup.
      } UNION {
        ?propertyOrTerm bwdt:P9 bwd:Q34.
        ?propertyOrTerm bwdt:P46 ?concept.
        ?concept bwdt:P48 ?conceptGroup.
      } UNION {
        ?propertyOrTerm bwdt:P9 bwd:Q16.
        ?propertyOrTerm bwdt:P51 ?vocabulary.
        ?vocabulary bwdt:P48 ?conceptGroup.
      }
      ?conceptGroup rdfs:label ?conceptGroupLabel.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    } GROUP BY ?conceptName
    

Search names by RegEx

The following query uses these:

  • Properties: is part of (P8) 
    PREFIX bwd: <http://wiki.bgbm.org/entity/>
    PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
    
    SELECT ?concept ?conceptLabel WHERE {
      ?concept bwdt:P8 bwd:Q219.
      ?concept rdfs:label ?conceptLabel;
      FILTER (lang(?conceptLabel) = "en") .
      FILTER regex (?conceptLabel, "UR[IL]").
    }
    

Datatypes used by Datatype Properties

The following query uses these:

  • Properties: is part of (P8) , is of type (P9) , has datatype (P27) 
    PREFIX bwd: <http://wiki.bgbm.org/entity/>
    PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
    
    SELECT ?typeLabel (COUNT (?concept) as ?count) WHERE {
      ?concept bwdt:P8 bwd:Q219. 
      ?concept bwdt:P9 bwd:Q34.
      ?concept bwdt:P27 ?type.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }GROUP BY ?typeLabel
    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) 
    PREFIX bwd: <http://wiki.bgbm.org/entity/>
    PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
    
    SELECT ?range ?rangeLabel ?count WHERE{
      {
    SELECT ?range (COUNT(?property) as ?count) WHERE {
        ?property bwdt:P9 bwd:Q33.
      ?property bwdt:P8 bwd:Q219.
        OPTIONAL{
          ?property bwdt:P29 ?domain.
        }
        OPTIONAL{
          ?property bwdt:P13 ?range.
        }
    }GROUP BY ?range  
              }
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } 
    }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) 
    PREFIX bwd: <http://wiki.bgbm.org/entity/>
    PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
    
     
    SELECT ?property ?propertyLabel ?domain ?domainLabel ?range ?rangeLabel WHERE {
        ?property bwdt:P9 bwd:Q33.
      ?property bwdt:P8 bwd:Q219.
        OPTIONAL{
          ?property bwdt:P29 ?domain.
        }
        OPTIONAL{
          ?property bwdt:P13 ?range.
        }
    
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
       
    }ORDER BY ?rangeLabel
    

Classes and their identifiers

The following query uses these:

  • Properties: is of type (P9) , is part of (P8) , associated Property (P45) 
    PREFIX bwd: <http://wiki.bgbm.org/entity/>
    PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
    
    SELECT ?class ?classLabel ?id ?guid ?resourceURI WHERE {
      ?class bwdt:P9 bwd:Q32.
      ?class bwdt:P8 bwd:Q219.
      OPTIONAL{
        ?class bwdt:P45 bwd:Q1806.
        BIND(true as ?id)
      }
      OPTIONAL{
        ?class bwdt:P45 bwd:Q127.
        BIND(true as ?guid)
      }
      OPTIONAL{
        ?class bwdt:P45 bwd:Q163.
        BIND(true as ?resourceURI)
      }
    
      MINUS {
        ?class bwdt:P9 bwd:Q2244.
      }
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }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) 
    PREFIX bwd: <http://wiki.bgbm.org/entity/>
    PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
    
    SELECT ?concept ?conceptLabel (count(?property) as ?propertyCount)  WHERE {
      ?concept bwdt:P8 bwd:Q219.
      ?concept bwdt:P9 bwd:Q32.
      ?concept bwdt:P45 ?property.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    } GROUP BY ?concept ?conceptLabel 
    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) 
    PREFIX bwd: <http://wiki.bgbm.org/entity/>
    PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
    
    SELECT ?concept ?conceptLabel ?conceptName WHERE {
      ?concept bwdt:P8 bwd:Q219. 
      ?concept bwdt:P9 bwd:Q34.
      ?concept bwdt:P25 ?conceptName.
    
      FILTER regex (?conceptName, "^.[A-Z]").
    
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    

Overview of all Qualifiers used in ABCD Model

The following query uses these:

  • Properties: is part of (P8) , associated Property (P45) 
    PREFIX bwd: <http://wiki.bgbm.org/entity/>
    PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
    PREFIX bp: <http://wiki.bgbm.org/prop/>
    PREFIX bpq: <http://wiki.bgbm.org/prop/qualifier/>
    PREFIX bps: <http://wiki.bgbm.org/prop/statement/>
    
    SELECT ?conceptLabel ?ABCDpropertyLabel ?wikiPropertyURL ?wikiPropertyLabel ?value{
      ?concept bwdt:P8 bwd:Q219. 
      ?concept bp:P45 ?statement.
      ?statement bps:P45 ?ABCDproperty.
      ?statement ?wikiPropertyURL ?value.
      ?wikiProp ?ref ?wikiPropertyURL.
      ?wikiProp rdf:type wikibase:Property .
      ?wikiProp rdfs:label ?wikiPropertyLabel.
                    
      FILTER (lang(?wikiPropertyLabel) = 'en' )
      FILTER strstarts(str(?wikiPropertyURL),"http://wiki.bgbm.org/prop/qualifier/P")
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    

List of Meta Properties

The following query uses these:

  • Properties: is part of (P8) , is of type (P9) , Concept Name (P25) , Special Properties (P64) 
    PREFIX bwd: <http://wiki.bgbm.org/entity/>
    PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
    
    SELECT ?concept ?conceptLabel ?name ?type ?typeLabel  WHERE {
      ?concept bwdt:P8 bwd:Q219.
      ?concept bwdt:P9 ?type.
      ?concept bwdt:P25 ?name.
      ?concept bwdt:P64 bwd:Q2042.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    


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) 
    PREFIX bwd: <http://wiki.bgbm.org/entity/>
    PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
    
     
    SELECT ?group ?groupLabel ?concept ?conceptLabel ?property ?propertyLabel ?term ?termLabel WHERE {
     {
    SELECT DISTINCT ?group ?property WHERE {
        {?property bwdt:P9 bwd:Q33.}
        UNION
        {?property bwdt:P9 bwd:Q34.}
        UNION
        {?property bwdt:P9 bwd:Q81.}
        ?property bwdt:P8 bwd:Q219.
        
        MINUS { ?property bwdt:P46 [] }
       OPTIONAL {
        ?property bwdt:P48 ?group.
        }
      }
    } UNION
    {
      SELECT ?group ?concept ?property ?term WHERE {
        ?concept bwdt:P8 bwd:Q219.
        {
        ?concept bwdt:P9 bwd:Q32.
          }UNION{
        ?concept bwdt:P9 bwd:Q14.
          }
          
        OPTIONAL {
          ?concept bwdt:P48 ?group.
        }
        OPTIONAL {
          ?concept bwdt:P45 ?property.
        }
        OPTIONAL {
          ?concept bwdt:P16 ?term.
         }
      }
    }
     
    
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }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) 
    PREFIX bwd: <http://wiki.bgbm.org/entity/>
    PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
    
    SELECT ?concept ?conceptLabel ?usageNotes WHERE {
      ?concept bwdt:P8 bwd:Q219. 
      ?concept bwdt:P62 ?usageNotes.
      FILTER regex (?usageNotes, "abcd:").
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    


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
    PREFIX bwd: <http://wiki.bgbm.org/entity/>
    PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
    PREFIX wdt: <http://www.wikidata.org/prop/direct/>
    
    SELECT ?concept ?conceptLabel ?match ?wikidata ?wikidataLb WHERE {
      ?concept bwdt:P8 bwd:Q219. 
      ?concept bwdt:P11 ?match. 
      SERVICE <https://query.wikidata.org/sparql> {
          ?wikidata wdt:P1628 ?match.
          ?wikidata rdfs:label ?wikidataLb .
          filter (lang(?wikidataLb) = "en").
      }
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    

Wikibase properties that are used to describe ABCD concepts

The following query uses these:

  • Properties: is part of (P8) 
    PREFIX bwd: <http://wiki.bgbm.org/entity/>
    PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
    
    SELECT ?property ?propertyLabel (COUNT (?item) as ?count) WHERE{
      ?item bwdt:P8 bwd:Q219 ;
            ?prop ?statement.
      ?property wikibase:directClaim ?prop.
      ?property wikibase:propertyType ?type.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" .}
    }
    GROUP BY $property ?propertyLabel ?type
    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) 
    PREFIX bwd: <http://wiki.bgbm.org/entity/> 
    PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/> 
    SELECT ?concept ?conceptLabel ?type ?typeLabel ?name WHERE { 
      ?concept bwdt:P8 bwd:Q2053. 
      ?concept bwdt:P9 ?type.
      ?concept bwdt:P25 ?name.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    

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) 
    PREFIX bwd: <http://wiki.bgbm.org/entity/> 
    PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/> 
    PREFIX bp: <http://wiki.bgbm.org/prop/>
    PREFIX bpq: <http://wiki.bgbm.org/prop/qualifier/>
    PREFIX bps: <http://wiki.bgbm.org/prop/statement/>
    
    SELECT ?concept ?conceptLabel ?name (count(?link) as ?count) ?firstLink ?firstLinkLabel ?secondLink ?secondLinkLabel ?thirdLink ?thirdLinkLabel WHERE { 
      ?concept bwdt:P8 bwd:Q2053. 
      ?concept bwdt:P9 bwd:Q2050.
      ?concept bwdt:P25 ?name.
      ?concept bwdt:P72 ?link.
      
      ?concept bp:P72 ?firstLinkStatement.
      ?firstLinkStatement bps:P72 ?firstLink.
      ?firstLinkStatement bpq:P73 "1".
      
      ?concept bp:P72 ?secondLinkStatement.
      ?secondLinkStatement bps:P72 ?secondLink.
      ?secondLinkStatement bpq:P73 "2".
      
      OPTIONAL{
        ?concept bp:P72 ?thirdLinkStatement.
        ?thirdLinkStatement bps:P72 ?thirdLink.
        ?thirdLinkStatement bpq:P73 "3".
      }
      
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }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) 
    #Wrongful Links to Preliminary Concept Pool
    PREFIX bwd: <http://wiki.bgbm.org/entity/>
    PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
    
    SELECT ?concept ?conceptLabel ?linkedConcept ?linkedConceptLabel WHERE {
      ?concept bwdt:P8 bwd:Q219.
      ?concept ?property ?linkedConcept.
      ?linkedConcept bwdt:P8 bwd:Q64.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    

Functional Properties that are not also marked as another type

The following query uses these:

  • Properties: is part of (P8) , is of type (P9) 
    #Functional Properties that are not also marked as another type
    PREFIX bwd: <http://wiki.bgbm.org/entity/>
    PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
    
    SELECT ?concept ?conceptLabel (COUNT(?otherType) AS ?count) WHERE {
      ?concept bwdt:P8 bwd:Q219.
      ?concept bwdt:P9 bwd:Q81.
      ?concept bwdt:P9 ?otherType
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    
    }GROUP BY ?concept ?conceptLabel
    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) 
    #Missing Inverse between associatedConcept and associatedProperty
    PREFIX bwd: <http://wiki.bgbm.org/entity/>
    PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
    
    SELECT DISTINCT ?property ?propertyLabel ?class ?classLabel ?issue WHERE{
      {
        {?property bwdt:P9 bwd:Q33.}
        UNION
        {?property bwdt:P9 bwd:Q34.}
        UNION
        {?property bwdt:P9 bwd:Q81.}
       
        ?property bwdt:P8 bwd:Q219.
        ?class bwdt:P8 bwd:Q219.
        ?class bwdt:P9 bwd:Q32.
        ?class bwdt:P45 ?property
        MINUS {?property bwdt:P46 ?class}
        BIND("missing associatedConcept in Property" AS ?issue )
      }
      UNION
      {
        {?property bwdt:P9 bwd:Q33.}
        UNION
        {?property bwdt:P9 bwd:Q34.}
        UNION
        {?property bwdt:P9 bwd:Q81.}
       
        ?property bwdt:P8 bwd:Q219.
        ?class bwdt:P8 bwd:Q219.
        ?class bwdt:P9 bwd:Q32.
        ?property bwdt:P46 ?class    
        MINUS {?class bwdt:P45 ?property}
        BIND("missing associatedProperty in Class" AS ?issue )
      }
      
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    

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) 
    #Missing inverse between inVocabulary and allowedValue
    PREFIX bwd: <http://wiki.bgbm.org/entity/>
    PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
    
    SELECT DISTINCT ?vocab ?vocabLabel ?term ?termLabel ?issue WHERE{
      {
        ?vocab bwdt:P9 bwd:Q14.
        ?vocab bwdt:P8 bwd:Q219.
        ?term bwdt:P8 bwd:Q219.
        ?term bwdt:P9 bwd:Q16.
        ?term bwdt:P51 ?vocab.
        MINUS {?vocab bwdt:P16 ?term.}
        BIND("missing allowedValue for Vocabulary" AS ?issue )
      }
      UNION
      {
        ?vocab bwdt:P9 bwd:Q14.
        ?vocab bwdt:P8 bwd:Q219.
        ?term bwdt:P8 bwd:Q219.
        ?term bwdt:P9 bwd:Q16.
        ?vocab bwdt:P16 ?term.
        MINUS {?term bwdt:P51 ?vocab.}
        BIND("missing inVocabulary for Term" AS ?issue )
      }
      
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    

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) 
    #check for Concept Names that occur more than onc
    PREFIX bwd: <http://wiki.bgbm.org/entity/>
    PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
    
    SELECT ?name ?concept ?conceptLabel ?count ?typeLabel ?functionalLabel WHERE{
      {
        SELECT ?name (COUNT(?concept) AS ?count) WHERE {
          ?concept bwdt:P8 bwd:Q219.
          ?concept bwdt:P25 ?name
        }
        GROUP BY ?name
      }
      
      FILTER(?count > 1)
      ?concept bwdt:P8 bwd:Q219.
      ?concept bwdt:P25 ?name.
      ?concept bwdt:P9 ?type.
      VALUES ?type {bwd:Q34 bwd:Q33 bwd:Q32 bwd:Q14 bwd:Q16}
      OPTIONAL{
        ?concept bwdt:P9 ?functional.
        VALUES ?functional {bwd:Q81}
      }
                     
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }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) 
    #Check where mandatory statements are missing
    PREFIX bwd: <http://wiki.bgbm.org/entity/>
    PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
    
    SELECT ?concept ?conceptLabel ?issue WHERE {
    	{ # Datatype Property
    		SELECT ?concept ?conceptLabel ?issue WHERE {
    			?concept bwdt:P8 bwd:Q219.
    			?concept bwdt:P9 bwd:Q34.
    			{
    				MINUS {?concept bwdt:P25 []}
    				BIND ("missing Concept Name" as ?issue)
    			}
    			UNION {
    				MINUS {?concept bwdt:P27 []}
    				BIND ("missing Datatype" as ?issue)
    			}
    			UNION {
    				FILTER (NOT EXISTS {
    					?concept rdfs:label ?conceptLabel.
    				})
    				BIND ("missing Label" as ?issue)
    			}
    			UNION {
    				FILTER (NOT EXISTS {
    					?concept schema:description ?conceptDescription.
    				})
    				BIND ("missing Description" as ?issue)
    			}
    			SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    		}
    	} 
    	UNION { # Object Property
    		SELECT ?concept ?conceptLabel ?issue WHERE {
    			?concept bwdt:P8 bwd:Q219.
    			?concept bwdt:P9 bwd:Q33.
    			{
    				MINUS {?concept bwdt:P25 []}
    				BIND ("missing Concept Name" as ?issue)
    			}
    			UNION {
    				MINUS {?concept bwdt:P13 []}
    				BIND ("missing Range" as ?issue)
    			}
    			UNION {
    				FILTER (NOT EXISTS {
    					?concept rdfs:label ?conceptLabel.
    				})
    				BIND ("missing Label" as ?issue)
    			}
    			UNION {
    				FILTER (NOT EXISTS {
    					?concept schema:description ?conceptDescription.
    				})
    				BIND ("missing Description" as ?issue)
    			}
    			SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    		}
    	}
    	UNION { # Class
    		SELECT ?concept ?conceptLabel ?issue WHERE {
    			?concept bwdt:P8 bwd:Q219.
    			?concept bwdt:P9 bwd:Q32.
    			{
    				MINUS {?concept bwdt:P25 []}
    				BIND ("missing Concept Name" as ?issue)
    			}
    			UNION {
    				MINUS {?concept bwdt:P48 []}
    				BIND ("missing Concept Group" as ?issue)
    			}
    			UNION {
    				FILTER (NOT EXISTS {
    					?concept rdfs:label ?conceptLabel.
    				})
    				BIND ("missing Label" as ?issue)
    			}
    			UNION {
    				FILTER (NOT EXISTS {
    					?concept schema:description ?conceptDescription.
    				})
    				BIND ("missing Description" as ?issue)
    			}
    			SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    		}
    	}
    	UNION { # Controlled Vocabulary
    		SELECT ?concept ?conceptLabel ?issue WHERE {
    			?concept bwdt:P8 bwd:Q219.
    			?concept bwdt:P9 bwd:Q14.
    			{
    				MINUS {?concept bwdt:P25 []}
    				BIND ("missing Concept Name" as ?issue)
    			}
    			UNION {
    				MINUS {?concept bwdt:P16 []}
    				BIND ("missing Allowed Value" as ?issue)
    			}
    			UNION {
    				FILTER (NOT EXISTS {
    					?concept rdfs:label ?conceptLabel.
    				})
    				BIND ("missing Label" as ?issue)
    			}
    			UNION {
    				FILTER (NOT EXISTS {
    					?concept schema:description ?conceptDescription.
    				})
    				BIND ("missing Description" as ?issue)
    			}
    			SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    		}
    	}
    	UNION { # Controlled Term
    		SELECT ?concept ?conceptLabel ?issue WHERE {
    			?concept bwdt:P8 bwd:Q219.
    			?concept bwdt:P9 bwd:Q16.
    			{
    				MINUS {?concept bwdt:P25 []}
    				BIND ("missing Concept Name" as ?issue)
    			}
    			UNION {
    				MINUS {?concept bwdt:P51 []}
    				BIND ("missing In Vocabulary" as ?issue)
    			}
    			UNION {
    				FILTER (NOT EXISTS {
    					?concept rdfs:label ?conceptLabel.
    				})
    				BIND ("missing Label" as ?issue)
    			}
    			UNION {
    				FILTER (NOT EXISTS {
    					?concept schema:description ?conceptDescription.
    				})
    				BIND ("missing Description" as ?issue)
    			}
    			SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    		}
    	}			
    }
    

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) 
    #Associated Properties that are of a wrong type
    PREFIX bwd: <http://wiki.bgbm.org/entity/>
    PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
    
    SELECT DISTINCT ?property ?propertyLabel WHERE {
      {
        ?concept bwdt:P8 bwd:Q219.
        ?concept bwdt:P45 ?property.
        MINUS {
          {?property bwdt:P9 bwd:Q10.}
          UNION
          {?property bwdt:P9 bwd:Q33.}
          UNION
          {?property bwdt:P9 bwd:Q34.}
          UNION
          {?property bwdt:P9 bwd:Q33.
           ?property bwdt:P9 bwd:Q81.}
          UNION
          {?property bwdt:P9 bwd:Q34.
           ?property bwdt:P9 bwd:Q81.}
        }
       }
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    
    }
    

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) 
    #Associated Concepts that are not of type Class
    PREFIX bwd: <http://wiki.bgbm.org/entity/>
    PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
    
    SELECT DISTINCT ?concept ?conceptLabel WHERE {
      {
        ?property bwdt:P8 bwd:Q219.
        ?property bwdt:P46 ?concept.
        MINUS {
          ?concept bwdt:P9 bwd:Q32.
        }
       }
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    
    }
    

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) 
    #Concept Names do not match Concept Labels
    PREFIX bwd: <http://wiki.bgbm.org/entity/>
    PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
    
    SELECT ?concept ?conceptLabel ?conceptName WHERE {
      ?concept bwdt:P8 bwd:Q219. 
      ?concept bwdt:P25 ?conceptName.
      ?concept rdfs:label ?conceptLabel.
      FILTER (lang(?conceptLabel) = "en") .
      BIND (LCASE(?conceptName) as ?lcConceptName)
      BIND (LCASE(REPLACE(STR(?conceptLabel), " ", "")) as ?lcConceptLabel)
      BIND (?lcConceptName = ?lcConceptLabel as ?result)
      FILTER ( ?result = false )
    }
    

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) 
    PREFIX bwd: <http://wiki.bgbm.org/entity/>
    PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
    
    SELECT ?parent ?parentLabel ?concept ?conceptLabel   WHERE {
      {
        ?concept bwdt:P8 bwd:Q219.
        ?concept bwdt:P50 ?parent.
        ?concept bwdt:P9 ?type.
        MINUS{?parent bwdt:P9 ?type.}
      }UNION{
        ?concept bwdt:P8 bwd:Q219.
        ?concept bwdt:P50 ?parent.
        MINUS{?parent bwdt:P9 bwd:Q33.}
        MINUS{?parent bwdt:P9 bwd:Q34.}
      }
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    

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) 
    PREFIX bwd: <http://wiki.bgbm.org/entity/>
    PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/>
    
    SELECT ?parent ?parentLabel ?concept ?conceptLabel   WHERE {
      {
        ?concept bwdt:P8 bwd:Q219.
        ?concept bwdt:P1 ?parent.
        MINUS{?concept bwdt:P9 bwd:Q32.}
      }UNION{
        ?concept bwdt:P8 bwd:Q219.
        ?concept bwdt:P1 ?parent.
        MINUS{?parent bwdt:P9 bwd:Q32.}
      }
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    

Misc

show last updated time

The following query uses these:

SELECT * WHERE {
  <http://wiki.bgbm.org> schema:dateModified ?lastUpdated.
}