query-eb336400e22a4ed649740c80c29e1d96

rq turtle/ttl

PropertiesWikiTree person ID (P2949)father (P22)mother (P25)spouse (P26)child (P40)P7P9sex or gender (P21)

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:Table
SELECT ?p ?pLabel ?pDescription ?pWikiTree ?pGenderLabel ?rel ?w ?wLabel ?wDescription ?wGenderLabel WHERE {
  {
FILTER(STRSTARTS(?pWikiTreeID, 'Dal'))
    ?p wdt:P2949 ?pWikiTreeID. # wikitreeID set

    { ?p wdt:P22 ?w. values ?rel {'Father'}.}  UNION
    { ?p wdt:P25 ?w. values ?rel {'Mother'}.}  UNION
    { ?p wdt:P26 ?w. values ?rel {'Spouse'}.}  UNION
    { ?p wdt:P40 ?w. values ?rel {'Child'}.}   UNION
    { ?p wdt:P7  ?w. values ?rel {'Brother'}.} UNION
    { ?p wdt:P9  ?w. values ?rel {'Sister'}.}

    FILTER NOT EXISTS {?w wdt:P2949 ?wWikiTreeID.}  # wikitreeID empty

    BIND (URI(CONCAT("http://www.wikitree.com/wiki/",?pWikiTreeID)) AS ?pWikiTree) # extend wikitreeID
    OPTIONAL { ?p wdt:P21 ?pGender.}
    OPTIONAL { ?w wdt:P21 ?wGender.}
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
LIMIT 100

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?p"):::projected v7("?pGender") v6("?pWikiTree"):::projected v3("?pWikiTreeID") v6("?rel"):::projected v1("?w"):::projected v8("?wGender") v2("?wWikiTreeID") c13(["en"]):::literal c11(["bd:serviceParam"]):::iri f0[["not "]] subgraph f0e0["Exists Clause"] e0v1 --"wdt:P2949"--> e0v2 e0v1("?w"):::projected e0v2("?wWikiTreeID"):::projected end f0--EXISTS--> f0e0 f0 --> v1 f0 --> c1 f0 --> v2 v1 --"wdt:P2949"--> v2 f1[["starts-with(?pWikiTreeID,'Dal')"]] f1 --> v3 v4 --"wdt:P2949"--> v3 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; subgraph union2[" Union "] subgraph union2l[" "] style union2l fill:#abf,stroke-dasharray: 3 3; subgraph union3[" Union "] subgraph union3l[" "] style union3l fill:#abf,stroke-dasharray: 3 3; subgraph union4[" Union "] subgraph union4l[" "] style union4l fill:#abf,stroke-dasharray: 3 3; v4 --"wdt:P9"--> v1 bind2[/VALUES ?rel/] bind2-->v6 bind20(["Sister"]) bind20 --> bind2 end subgraph union4r[" "] style union4r fill:#abf,stroke-dasharray: 3 3; v4 --"wdt:P7"--> v1 bind3[/VALUES ?rel/] bind3-->v6 bind30(["Brother"]) bind30 --> bind3 end union4r <== or ==> union4l end end subgraph union3r[" "] style union3r fill:#abf,stroke-dasharray: 3 3; v4 --"wdt:P40"--> v1 bind4[/VALUES ?rel/] bind4-->v6 bind40(["Child"]) bind40 --> bind4 end union3r <== or ==> union3l end end subgraph union2r[" "] style union2r fill:#abf,stroke-dasharray: 3 3; v4 --"wdt:P26"--> v1 bind5[/VALUES ?rel/] bind5-->v6 bind50(["Spouse"]) bind50 --> bind5 end union2r <== or ==> union2l end end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v4 --"wdt:P25"--> v1 bind6[/VALUES ?rel/] bind6-->v6 bind60(["Mother"]) bind60 --> bind6 end union1r <== or ==> union1l end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v4 --"wdt:P22"--> v1 bind7[/VALUES ?rel/] bind7-->v6 bind70(["Father"]) bind70 --> bind7 end union0r <== or ==> union0l end bind8[/"concat('http://www.wikitree.com/wiki/',?pWikiTreeID)"/] v3 --o bind8 bind8 --as--o v6 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v4 -."wdt:P21".-> v7 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P21".-> v8 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c11 --"wikibase:language"--> c13 end