Difference between revisions of "BDI Data:Useful Queries"
From BDI Data
(→All ABCD Concepts: accidentally removed the prefix definitions) |
m (→Concept Groups) |
||
Line 49: | Line 49: | ||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } | SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } | ||
}GROUP BY ?type ?typeLabel | }GROUP BY ?type ?typeLabel | ||
+ | }} | ||
+ | |||
+ | |||
+ | Concept Groups of Properties and Controlled Terms | ||
+ | {{SPARQL2|query= | ||
+ | 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 | ||
}} | }} | ||
Revision as of 12:18, 15 February 2019
Contents
[hide]- 1 BDI specific prefixes
- 2 All ABCD Concepts
- 3 Concept Groups
- 4 Search names by RegEx
- 5 Datatypes used by Datatype Properties
- 6 Classes and their Object Properties
- 7 Concept Names that start with an abbreviation
- 8 Overview of all Qualifiers used in ABCD Model
- 9 Extensive Table for Concept Review
- 10 UsageNotes with references to other elements
- 11 Maintanance Queries
- 11.1 Wrongful Links to Preliminary Concept Pool
- 11.2 Functional Properties that are not also marked as another type
- 11.3 Missing Inverse between associatedConcept and associatedProperty
- 11.4 Missing inverse between inVocabulary and allowedValue
- 11.5 check for Concept Names that occur more than once
- 11.6 Check where mandatory statements are missing
- 11.7 Associated Properties that are of a wrong type
- 11.8 Associated Concepts that are not of type Class
- 11.9 Concept Names do not match Concept Labels
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/>
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:- Items: ABCD 3.0 (Q219)
- 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:- Items: ABCD 3.0 (Q219)
- 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
- 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:- Items: ABCD 3.0 (Q219)
- 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:- Items: ABCD 3.0 (Q219) , Datatype Property (Q34)
- 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 Object Properties
Classes with the number of Object Properties that link to them
The following query uses these:- Items: Object Property (Q33) , ABCD 3.0 (Q219)
- 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:- Items: Object Property (Q33) , ABCD 3.0 (Q219)
- 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
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:- Items: ABCD 3.0 (Q219) , Datatype Property (Q34)
- 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:- Items: ABCD 3.0 (Q219)
- 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 }
Extensive Table for Concept Review
The following query uses these:- Items: Object Property (Q33) , Datatype Property (Q34) , Functional Property (Q81) , ABCD 3.0 (Q219) , Class (Q32) , Controlled Vocabulary (Q14)
- 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:- Items: ABCD 3.0 (Q219)
- 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 }
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
- Functional Properties that are not also marked as another type
- Missing Inverse between associatedConcept and associatedProperty
- Missing inverse between inVocabulary and allowedValuecheck for Concept Names that occur more than once
- check for Concept Names that occur more than once
- Check where mandatory statements are missing
- Associated Properties that are of a wrong type
- Associated Concepts that are not of type Class
- Concept Names do not match Concept Labels
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:- Items: ABCD 3.0 (Q219) , Functional Property (Q81)
- 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:- Items: Object Property (Q33) , Datatype Property (Q34) , Functional Property (Q81) , ABCD 3.0 (Q219) , Class (Q32)
- 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:- Items: ABCD 3.0 (Q219) , Datatype Property (Q34) , Object Property (Q33) , Class (Q32) , Controlled Vocabulary (Q14) , Controlled Term (Q16) , Functional Property (Q81)
- 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:- Items: ABCD 3.0 (Q219) , Datatype Property (Q34) , Object Property (Q33) , Class (Q32) , Controlled Vocabulary (Q14) , Controlled Term (Q16)
- 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:- Items: ABCD 3.0 (Q219) , Property (Q10) , Object Property (Q33) , Datatype Property (Q34) , Functional Property (Q81)
- 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:- Items: ABCD 3.0 (Q219) , Class (Q32)
- 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:- Items: ABCD 3.0 (Q219) , Datatype Property (Q34)
- Properties: is part of (P8) , is of type (P9) , 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:P9 bwd:Q34. 8 ?concept bwdt:P25 ?conceptName. 9 ?concept rdfs:label ?conceptLabel. 10 FILTER (lang(?conceptLabel) = "en") . 11 BIND (LCASE(?conceptName) as ?lcConceptName) 12 BIND (LCASE(REPLACE(STR(?conceptLabel), " ", "")) as ?lcConceptLabel) 13 BIND (?lcConceptName = ?lcConceptLabel as ?result) 14 FILTER ( ?result = false ) 15 }