query-82aa8bb725846621c71d288d1cb535cb

rq turtle/ttl

English-speaking people whose given and family names are a noun and an adjective (or vice versa) SELECT ?item ?givenNameLabel ?familyNameLabel WHERE { hint:Query hint:optimizer "None". BIND(wd:Q3122156 AS ?item) ?item wdt:P31 wd:Q5; wdt:P735 ?givenName; wdt:P734 ?familyName; wdt:P103|wdt:P1412 wd:Q1860. ?givenName wdt:P407 wd:Q1860; wdt:P1705 ?givenNameLabel_. ?familyName wdt:P407 wd:Q1860; wdt:P1705 ?familyNameLabel_. # original value may have had language code "mul", explicitly change to "en" BIND(STRLANG(STR(?givenNameLabel_), "en") AS ?givenNameLabel) BIND(STRLANG(STR(?familyNameLabel_), "en") AS ?familyNameLabel) # names are typically title case, noun and adjective lemmas are typically lower case BIND(LCASE(?givenNameLabel) AS ?_givenNameLabel) BIND(LCASE(?familyNameLabel) AS ?_familyNameLabel) { ?adjective wikibase:lemma ?_givenNameLabel; dct:language wd:Q1860; wikibase:lexicalCategory/wdt:P279 wd:Q34698. ?noun wikibase:lemma ?_familyNameLabel; dct:language wd:Q1860; wikibase:lexicalCategory/wdt:P279 wd:Q1084. } UNION { ?noun wikibase:lemma ?_givenNameLabel; dct:language wd:Q1860; wikibase:lexicalCategory/wdt:P279 wd:Q1084. ?adjective wikibase:lemma ?_familyNameLabel; dct:language wd:Q1860; wikibase:lexicalCategory/wdt:P279 wd:Q34698. } } LIMIT 10

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX dct: <http://purl.org/dc/terms/>
# English-speaking people whose given and family names are a noun and an adjective (or vice versa)
SELECT ?item ?givenNameLabel ?familyNameLabel WHERE {

  BIND(wd:Q3122156 AS ?item)
  ?item wdt:P31 wd:Q5;
        wdt:P735 ?givenName;
        wdt:P734 ?familyName;
        wdt:P103|wdt:P1412 wd:Q1860.
  ?givenName wdt:P407 wd:Q1860;
             wdt:P1705 ?givenNameLabel_.
  ?familyName wdt:P407 wd:Q1860;
              wdt:P1705 ?familyNameLabel_.
  # original value may have had language code "mul", explicitly change to "en"
  BIND(STRLANG(STR(?givenNameLabel_), "en") AS ?givenNameLabel)
  BIND(STRLANG(STR(?familyNameLabel_), "en") AS ?familyNameLabel)
  # names are typically title case, noun and adjective lemmas are typically lower case
  BIND(LCASE(?givenNameLabel) AS ?_givenNameLabel)
  BIND(LCASE(?familyNameLabel) AS ?_familyNameLabel)
  {
    ?adjective wikibase:lemma ?_givenNameLabel;
               dct:language wd:Q1860;
               wikibase:lexicalCategory/wdt:P279* wd:Q34698.
    ?noun wikibase:lemma ?_familyNameLabel;
          dct:language wd:Q1860;
          wikibase:lexicalCategory/wdt:P279* wd:Q1084.
  } UNION {
    ?noun wikibase:lemma ?_givenNameLabel;
          dct:language wd:Q1860;
          wikibase:lexicalCategory/wdt:P279* wd:Q1084.
    ?adjective wikibase:lemma ?_familyNameLabel;
               dct:language wd:Q1860;
               wikibase:lexicalCategory/wdt:P279* wd:Q34698.
  }
}
LIMIT 10

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v9("?_familyNameLabel") v8("?_givenNameLabel") v10("?adjective") v3("?familyName") v7("?familyNameLabel"):::projected v5("?familyNameLabel_") v2("?givenName") v6("?givenNameLabel"):::projected v4("?givenNameLabel_") v1("?item"):::projected v11("?noun") a1((" ")) a2((" ")) a3((" ")) a4((" ")) c15(["wd:Q1084"]):::iri c2(["wd:Q5"]):::iri c6(["wd:Q1860"]):::iri c14(["wd:Q34698"]):::iri bind0[/"'wd:Q3122156'"/] bind0 --as--o v1 v1 --"wdt:P31"--> c2 v1 --"wdt:P735"--> v2 v1 --"wdt:P734"--> v3 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P1412"--> c6 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P103"--> c6 end union0r <== or ==> union0l end v2 --"wdt:P407"--> c6 v2 --"wdt:P1705"--> v4 v3 --"wdt:P407"--> c6 v3 --"wdt:P1705"--> v5 bind1[/"STRLANG(str(?givenNameLabel_),'en')"/] v4 --o bind1 bind1 --as--o v6 bind2[/"STRLANG(str(?familyNameLabel_),'en')"/] v5 --o bind2 bind2 --as--o v7 bind3[/"lower-case(?givenNameLabel)"/] v6 --o bind3 bind3 --as--o v8 bind4[/"lower-case(?familyNameLabel)"/] v7 --o bind4 bind4 --as--o v9 subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; v11 --"wikibase:lemma"--> v8 v11 --"dct:language"--> c6 v11 --"wikibase:lexicalCategory"--> a3 a3 --"wdt:P279"--> c15 v10 --"wikibase:lemma"--> v9 v10 --"dct:language"--> c6 v10 --"wikibase:lexicalCategory"--> a4 a4 --"wdt:P279"--> c14 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v10 --"wikibase:lemma"--> v8 v10 --"dct:language"--> c6 v10 --"wikibase:lexicalCategory"--> a1 a1 --"wdt:P279"--> c14 v11 --"wikibase:lemma"--> v9 v11 --"dct:language"--> c6 v11 --"wikibase:lexicalCategory"--> a2 a2 --"wdt:P279"--> c15 end union1r <== or ==> union1l end