query-ad73d8cf6b879a32446df44160991c81

rq turtle/ttl

... (advanced)

Use at

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/>
SELECT DISTINCT (?w as $Source) (?p AS $Target) ("Directed" AS ?Type) (?affiliationTypeLabel AS ?Label) ?Weight
WHERE 
{
  ?p wdt:P31 wd:Q98270496 .
  ?p p:P1416 ?statement .
  ?statement ps:P1416 ?w .
  OPTIONAL { 
    ?statement pq:P3831 ?affiliationType . 
    ?affiliationType rdfs:label ?affiliationTypeLabel 
    OPTIONAL { FILTER (?affiliationTypeLabel = "Beteiligter"@de)
      BIND("1" AS ?Weight)
    } 
    OPTIONAL { FILTER (?affiliationTypeLabel = "Mitantragsteller"@de)
      BIND("2" AS ?Weight)
    } 
    OPTIONAL { FILTER (?affiliationTypeLabel = "Bewerber"@de)
      BIND("3" AS ?Weight)
    } 
  }  

  FILTER (lang(?affiliationTypeLabel) = 'de')
} ORDER BY ASC(?affiliationTypeLabel)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v10("?Label") v7("?Source") v8("?Target") v9("?Type") v7("?Weight"):::projected v5("?affiliationType") v1("?affiliationTypeLabel"):::projected v2("?p"):::projected v3("?statement") v4("?w"):::projected c3(["wd:Q98270496"]):::iri f0[["?affiliationTypeLabel = 'de'"]] f0 --> v1 v2 --"p:direct/P31"--> c3 v2 --"p:P1416"--> v3 v3 --"p:statement/P1416"--> v4 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:qualifier/P3831".-> v5 v5 --"rdfs:label"--> v1 subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; bind1[/"'1'"/] bind1 --as--o v7 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; bind2[/"'2'"/] bind2 --as--o v7 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; bind3[/"'3'"/] bind3 --as--o v7 end end bind4[/"?w"/] v4 --o bind4 bind4 --as--o v7 bind5[/"?p"/] v2 --o bind5 bind5 --as--o v8 bind6[/"'Directed'"/] bind6 --as--o v9 bind7[/"?affiliationTypeLabel"/] v1 --o bind7 bind7 --as--o v10