query-647ce4ae2789eff1a5e9d0aede9a33b2
Statement-required constraints involving properties related to gender
Use at
- https://query.wikidata.org/sparql
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
#defaultView:Tree
select ?reqPropKind ?reqPropKindDesc ?reqProp ?reqPropDesc ?constraintStatus ?constraintStatusDesc ?prop ?propDesc {
  ?reqPropKind wdt:P279* wd:Q107417492.
  ?reqProp wdt:P31 ?reqPropKind.
  ?prop p:P2302 [
    ps:P2302 wd:Q21503247;
    pq:P2306 ?reqProp;
    pq:P2316 ?constraintStatus;
  ].
  ?reqPropKind rdfs:label ?reqPropKindLabel.
  FILTER(lang(?reqPropKindLabel) = "en")
  ?reqProp rdfs:label ?reqPropLabel.
  FILTER(lang(?reqPropLabel) = "en")
  ?constraintStatus rdfs:label ?constraintStatusLabel.
  FILTER(lang(?constraintStatusLabel) = "en")
  BIND(
    IF(?constraintStatus = <http://www.wikidata.org/entity/Q62026391>, "is suggested to be used", 
      IF(?constraintStatus = <http://www.wikidata.org/entity/Q21502408>, "is mandated to be used",
        "is implied in a constraint that applies"
      )
    )
    AS ?constraintStatusPhraseStr
  )
  ?prop rdfs:label ?propLabel.
  FILTER(lang(?propLabel) = "en")
  BIND(CONCAT("Property of kind “", ?reqPropKindLabel, "”, namely …") as ?reqPropKindDesc)
  BIND(CONCAT("“", ?reqPropLabel, "” (", str(?reqProp), "), …") as ?reqPropDesc)
  BIND(CONCAT(?constraintStatusPhraseStr, " (", str(?constraintStatus), ") on items that have property …") as ?constraintStatusDesc)
  BIND(CONCAT("“", ?propLabel, "” (", str(?prop), ").") as ?propDesc)
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v7("?constraintStatus"):::projected 
  v12("?constraintStatusDesc"):::projected 
  v2("?constraintStatusLabel")
  v9("?constraintStatusPhraseStr")
  v8("?prop"):::projected 
  v13("?propDesc"):::projected 
  v1("?propLabel")
  v6("?reqProp"):::projected 
  v11("?reqPropDesc"):::projected 
  v5("?reqPropKind"):::projected 
  v10("?reqPropKindDesc"):::projected 
  v4("?reqPropKindLabel")
  v3("?reqPropLabel")
  a1((" "))
  c6(["wd:Q21503247"]):::iri 
  c3(["wd:Q107417492"]):::iri 
  f0[["?propLabel = 'en'"]]
  f0 --> v1
  f1[["?constraintStatusLabel = 'en'"]]
  f1 --> v2
  f2[["?reqPropLabel = 'en'"]]
  f2 --> v3
  f3[["?reqPropKindLabel = 'en'"]]
  f3 --> v4
  v5 --"p:direct/P279"-->  c3
  v6 --"p:direct/P31"-->  v5
  a1 --"p:statement/P2302"-->  c6
  a1 --"p:qualifier/P2306"-->  v6
  a1 --"p:qualifier/P2316"-->  v7
  v8 --"p:P2302"-->  a1
  v5 --"rdfs:label"-->  v4
  v6 --"rdfs:label"-->  v3
  v7 --"rdfs:label"-->  v2
  bind4[/"if(?constraintStatus = 'wd:Q62026391','is suggested to be used',if(?constraintStatus = 'wd:Q21502408','is mandated to be used','is implied in a constraint that applies'))"/]
  v7 --o bind4
  bind4 --as--o v9
  v8 --"rdfs:label"-->  v1
  bind5[/"concat('Property of kind “',?reqPropKindLabel,'”, namely …')"/]
  v4 --o bind5
  bind5 --as--o v10
  bind6[/"concat('“',?reqPropLabel,'” (',str(?reqProp),'), …')"/]
  v3 --o bind6
  v6 --o bind6
  bind6 --as--o v11
  bind7[/"concat(?constraintStatusPhraseStr,' (',str(?constraintStatus),') on items that have property …')"/]
  v9 --o bind7
  v7 --o bind7
  bind7 --as--o v12
  bind8[/"concat('“',?propLabel,'” (',str(?prop),').')"/]
  v1 --o bind8
  v8 --o bind8
  bind8 --as--o v13