BDI Data:Useful Queries
From BDI Data
Contents
[hide]- 1 BDI specific prefixes
- 2 All ABCD Concepts
- 3 Concept Groups
- 4 Search names by RegEx
- 5 Maintanance Queries
- 5.1 Wrongful Links to Preliminary Concept Pool
- 5.2 Functional Properties that are not also marked as another type
- 5.3 Missing Inverse between associatedConcept and associatedProperty
- 5.4 Missing inverse between inVocabulary and allowedValue
- 5.5 check for Concept Names that occur more than once
- 5.6 Extensive Table for Concept Review
- 5.7 Check where mandatory statements are missing
- 5.8 Associated Properties that are of a wrong type
- 5.9 Associated Concepts that are not of type Class
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:- 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 ?pool ?poolLabel ?type ?typeLabel ?concept ?conceptLabel WHERE { 5 {?concept bwdt:P8 bwd:Q219.} 6 UNION 7 {?concept bwdt:P8 bwd:Q64.} 8 ?concept bwdt:P8 ?pool. 9 ?concept bwdt:P9 ?type. 10 SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } 11 }
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
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 }
Maintanance Queries
TODO:
- Check where documentation (description) is missing
- Versioning: only one element with the same concept name get's to have the current flag
Wrongful Links to Preliminary Concept Pool
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 ?linkedConcept ?linkedConceptLabel WHERE { 5 ?concept bwdt:P8 bwd:Q219. 6 ?concept ?property ?linkedConcept. 7 ?linkedConcept bwdt:P8 bwd:Q64. 8 SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } 9 }
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 PREFIX bwd: <http://wiki.bgbm.org/entity/> 2 PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/> 3 4 SELECT ?concept ?conceptLabel (COUNT(?otherType) AS ?count) WHERE { 5 ?concept bwdt:P8 bwd:Q219. 6 ?concept bwdt:P9 bwd:Q81. 7 ?concept bwdt:P9 ?otherType 8 SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } 9 10 }GROUP BY ?concept ?conceptLabel 11 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 PREFIX bwd: <http://wiki.bgbm.org/entity/> 2 PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/> 3 4 SELECT DISTINCT ?property ?propertyLabel ?class ?classLabel ?issue WHERE{ 5 { 6 {?property bwdt:P9 bwd:Q33.} 7 UNION 8 {?property bwdt:P9 bwd:Q34.} 9 UNION 10 {?property bwdt:P9 bwd:Q81.} 11 12 ?property bwdt:P8 bwd:Q219. 13 ?class bwdt:P8 bwd:Q219. 14 ?class bwdt:P9 bwd:Q32. 15 ?class bwdt:P45 ?property 16 MINUS {?property bwdt:P46 ?class} 17 BIND("missing associatedConcept in Property" AS ?issue ) 18 } 19 UNION 20 { 21 {?property bwdt:P9 bwd:Q33.} 22 UNION 23 {?property bwdt:P9 bwd:Q34.} 24 UNION 25 {?property bwdt:P9 bwd:Q81.} 26 27 ?property bwdt:P8 bwd:Q219. 28 ?class bwdt:P8 bwd:Q219. 29 ?class bwdt:P9 bwd:Q32. 30 ?property bwdt:P46 ?class 31 MINUS {?class bwdt:P45 ?property} 32 BIND("missing associatedProperty in Class" AS ?issue ) 33 } 34 35 SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } 36 }
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 PREFIX bwd: <http://wiki.bgbm.org/entity/> 2 PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/> 3 4 SELECT DISTINCT ?vocab ?vocabLabel ?term ?termLabel ?issue WHERE{ 5 { 6 ?vocab bwdt:P9 bwd:Q14. 7 ?vocab bwdt:P8 bwd:Q219. 8 ?term bwdt:P8 bwd:Q219. 9 ?term bwdt:P9 bwd:Q16. 10 ?term bwdt:P51 ?vocab. 11 MINUS {?vocab bwdt:P16 ?term.} 12 BIND("missing allowedValue for Vocabulary" AS ?issue ) 13 } 14 UNION 15 { 16 ?vocab bwdt:P9 bwd:Q14. 17 ?vocab bwdt:P8 bwd:Q219. 18 ?term bwdt:P8 bwd:Q219. 19 ?term bwdt:P9 bwd:Q16. 20 ?vocab bwdt:P16 ?term. 21 MINUS {?term bwdt:P51 ?vocab.} 22 BIND("missing inVocabulary for Term" AS ?issue ) 23 } 24 25 SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } 26 }
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 PREFIX bwd: <http://wiki.bgbm.org/entity/> 2 PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/> 3 4 SELECT ?name ?concept ?conceptLabel ?count ?typeLabel ?functionalLabel WHERE{ 5 { 6 SELECT ?name (COUNT(?concept) AS ?count) WHERE { 7 ?concept bwdt:P8 bwd:Q219. 8 ?concept bwdt:P25 ?name 9 } 10 GROUP BY ?name 11 } 12 13 FILTER(?count > 1) 14 ?concept bwdt:P8 bwd:Q219. 15 ?concept bwdt:P25 ?name. 16 ?concept bwdt:P9 ?type. 17 VALUES ?type {bwd:Q34 bwd:Q33 bwd:Q32 bwd:Q14 bwd:Q16} 18 OPTIONAL{ 19 ?concept bwdt:P9 ?functional. 20 VALUES ?functional {bwd:Q81} 21 } 22 23 SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } 24 }ORDER BY DESC(?count) ?name
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
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 PREFIX bwd: <http://wiki.bgbm.org/entity/> 2 PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/> 3 4 SELECT ?concept ?conceptLabel ?issue WHERE { 5 { # Datatype Property 6 SELECT ?concept ?conceptLabel ?issue WHERE { 7 ?concept bwdt:P8 bwd:Q219. 8 ?concept bwdt:P9 bwd:Q34. 9 { 10 MINUS {?concept bwdt:P25 []} 11 BIND ("missing Concept Name" as ?issue) 12 } 13 UNION { 14 MINUS {?concept bwdt:P27 []} 15 BIND ("missing Datatype" as ?issue) 16 } 17 UNION { 18 FILTER (NOT EXISTS { 19 ?concept rdfs:label ?conceptLabel. 20 }) 21 BIND ("missing Label" as ?issue) 22 } 23 UNION { 24 FILTER (NOT EXISTS { 25 ?concept schema:description ?conceptDescription. 26 }) 27 BIND ("missing Description" as ?issue) 28 } 29 SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } 30 } 31 } 32 UNION { # Object Property 33 SELECT ?concept ?conceptLabel ?issue WHERE { 34 ?concept bwdt:P8 bwd:Q219. 35 ?concept bwdt:P9 bwd:Q33. 36 { 37 MINUS {?concept bwdt:P25 []} 38 BIND ("missing Concept Name" as ?issue) 39 } 40 UNION { 41 MINUS {?concept bwdt:P13 []} 42 BIND ("missing Range" as ?issue) 43 } 44 UNION { 45 FILTER (NOT EXISTS { 46 ?concept rdfs:label ?conceptLabel. 47 }) 48 BIND ("missing Label" as ?issue) 49 } 50 UNION { 51 FILTER (NOT EXISTS { 52 ?concept schema:description ?conceptDescription. 53 }) 54 BIND ("missing Description" as ?issue) 55 } 56 SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } 57 } 58 } 59 UNION { # Class 60 SELECT ?concept ?conceptLabel ?issue WHERE { 61 ?concept bwdt:P8 bwd:Q219. 62 ?concept bwdt:P9 bwd:Q32. 63 { 64 MINUS {?concept bwdt:P25 []} 65 BIND ("missing Concept Name" as ?issue) 66 } 67 UNION { 68 MINUS {?concept bwdt:P48 []} 69 BIND ("missing Concept Group" as ?issue) 70 } 71 UNION { 72 FILTER (NOT EXISTS { 73 ?concept rdfs:label ?conceptLabel. 74 }) 75 BIND ("missing Label" as ?issue) 76 } 77 UNION { 78 FILTER (NOT EXISTS { 79 ?concept schema:description ?conceptDescription. 80 }) 81 BIND ("missing Description" as ?issue) 82 } 83 SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } 84 } 85 } 86 UNION { # Controlled Vocabulary 87 SELECT ?concept ?conceptLabel ?issue WHERE { 88 ?concept bwdt:P8 bwd:Q219. 89 ?concept bwdt:P9 bwd:Q14. 90 { 91 MINUS {?concept bwdt:P25 []} 92 BIND ("missing Concept Name" as ?issue) 93 } 94 UNION { 95 MINUS {?concept bwdt:P16 []} 96 BIND ("missing Allowed Value" as ?issue) 97 } 98 UNION { 99 FILTER (NOT EXISTS { 100 ?concept rdfs:label ?conceptLabel. 101 }) 102 BIND ("missing Label" as ?issue) 103 } 104 UNION { 105 FILTER (NOT EXISTS { 106 ?concept schema:description ?conceptDescription. 107 }) 108 BIND ("missing Description" as ?issue) 109 } 110 SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } 111 } 112 } 113 UNION { # Controlled Term 114 SELECT ?concept ?conceptLabel ?issue WHERE { 115 ?concept bwdt:P8 bwd:Q219. 116 ?concept bwdt:P9 bwd:Q16. 117 { 118 MINUS {?concept bwdt:P25 []} 119 BIND ("missing Concept Name" as ?issue) 120 } 121 UNION { 122 MINUS {?concept bwdt:P51 []} 123 BIND ("missing In Vocabulary" as ?issue) 124 } 125 UNION { 126 FILTER (NOT EXISTS { 127 ?concept rdfs:label ?conceptLabel. 128 }) 129 BIND ("missing Label" as ?issue) 130 } 131 UNION { 132 FILTER (NOT EXISTS { 133 ?concept schema:description ?conceptDescription. 134 }) 135 BIND ("missing Description" as ?issue) 136 } 137 SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } 138 } 139 } 140 }
Associated Properties that are of a wrong type
The following query uses these:- Items: ABCD 3.0 (Q219) , Object Property (Q33) , Datatype Property (Q34) , Functional Property (Q81)
- Properties: is part of (P8) , associated Property (P45) , is of type (P9)
1 PREFIX bwd: <http://wiki.bgbm.org/entity/> 2 PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/> 3 4 SELECT DISTINCT ?property ?propertyLabel WHERE { 5 { 6 ?concept bwdt:P8 bwd:Q219. 7 ?concept bwdt:P45 ?property. 8 MINUS { 9 {?property bwdt:P9 bwd:Q33.} 10 UNION 11 {?property bwdt:P9 bwd:Q34.} 12 UNION 13 {?property bwdt:P9 bwd:Q33. 14 ?property bwdt:P9 bwd:Q81.} 15 UNION 16 {?property bwdt:P9 bwd:Q34. 17 ?property bwdt:P9 bwd:Q81.} 18 } 19 } 20 SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } 21 22 }
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 PREFIX bwd: <http://wiki.bgbm.org/entity/> 2 PREFIX bwdt: <http://wiki.bgbm.org/prop/direct/> 3 4 SELECT DISTINCT ?concept ?conceptLabel WHERE { 5 { 6 ?property bwdt:P8 bwd:Q219. 7 ?property bwdt:P46 ?concept. 8 MINUS { 9 ?concept bwdt:P9 bwd:Q32. 10 } 11 } 12 SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } 13 14 }