Template:SPARQLTableQuery

From Wikibase Personal data
Revision as of 11:58, 13 May 2019 by 192.168.0.1 (talk) (Created page with "#defaultView:Graph SELECT ?rel ?pred ?obj ?item ?domain ?domainLabel ?range ?rangeLabel WHERE { BIND(pdio:{{{table}}} AS ?table). OPTIONAL { ?table pdiop:P26 ?domai...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
  1. defaultView:Graph

SELECT ?rel ?pred ?obj ?item ?domain ?domainLabel ?range ?rangeLabel WHERE {

  BIND(pdio:{{{table}}} AS ?table).
  OPTIONAL {
    ?table pdiop:P26 ?domain_prop.
    ?domain_prop pdiops:P26 ?domain.
    ?domain_prop pdiopq:P27 ?domainLabel
  }.
  OPTIONAL {
    ?table pdiop:P26 ?range_prop.
    ?range_prop pdiops:P26 ?range.
    ?range_prop pdiopq:P27 ?rangeLabel
  }.
  {
    SELECT ?domain ?range WHERE {
         ?table pdiop:P25 ?relationshipStatement.
         ?relationshipStatement pdiopq:P24 ?domain.
         ?relationshipStatement pdiopq:P23 ?range.
      }
    
  }
  UNION
  {  
    SELECT ?domain ?range WHERE {
         ?table pdiop:P58 ?relationshipInStatement.
         ?relationshipInStatement pdiops:P58 ?range.
         ?relationshipInStatement pdiopq:P61 ?domain.
      }
  }
  UNION
  {  
    SELECT ?domain ?range WHERE {
         ?table pdiop:P59 ?relationshipOutStatement.
         ?relationshipOutStatement pdiops:P59 ?domain.
         ?relationshipOutStatement pdiopq:P60 ?range.
      }
  }.

}