User:JotaCartas/Queries

index edit

Portugal edit

  • página de desambiguação da Wikimedia (Q4167410)
  • categoria de Wikimedia (Q4167836)
  • artigo de lista da Wikimedia (Q13406463)


  • human settlement (Q486972)
  • third-level administrative country subdivision (Q13221722)
  • single entity of population (Q3055118) retirar


  • village (Q532)village - aldeia
  • suburb (Q188509) subúrbio - arredores
  • quarter (Q2983893) - bairro
  • neighborhood (Q123705) - subúrbio - arredores
  • locality (Q3257686) - localidade
  • human settlement (Q486972) - povoamento humano - povoação - povoação
EN WD PT EN pai
city of Portugal Q15647906 cidade de Portugal Q515 city
district of Portugal Q3032141 distrito de Portugal
mancomunidad Q531230 entidade intermunicipal
Intermunicipal communitie of Portugal Q27995043 entidade Intermunicipal de Portugal
freguesia Q1131296 freguesia Q13221722 third-level administrative country subdivision
lugar Q130360 lugar
municipality of Portugal Q13217644 município de Portugal Q15284 municipality
province of Portugal Q24206770 província de Portugal
overseas province of Portugal Q333542 província ultramarina
autonomous region of Portugal Q2914565 região autónoma de Portugal
region of Portugal Q17297619 região de Portugal
reitoria of Portugal Q21528797 reitoria
subregion of Portugal Q15630525 sub-região de Portugal
town of Portugal Q19833170 vila de Portugal Q3957 town

Cebuano tradutor edit

  • freguesia - parokya
  • minicípio -munisipyo
  • distrito - distrito


  • cidade - lungsod - syudad (city)
  • vila - lungsod (town)


  • capital _ kapital

Working with sitelinks edit

Countries that have sitelinks to en-wiki edit

SELECT ?country ?countryLabel ?article WHERE {

    ?country wdt:P31 wd:Q3624078 . # sovereign state
    ?article schema:about ?country .
    ?article schema:isPartOf <https://en.wikipedia.org/>.

    SERVICE wikibase:label {
       bd:serviceParam wikibase:language "en"
    }
}
Try it!

Last monumentos edit

  1. ?item (wdt:P131/wdt:P279?) wd:Q36433. #Porto
  2. minus {
  3. ?article2 schema:about ?item .
  4. ?article2 schema:isPartOf <https://commons.wikimedia.org/> . #Commons
  5. }
  6. ?desig wdt:P31 wd:Q45580643 .
  7. ?article schema:about ?item;
  8. schema:isPartOf <https://pt.wikipedia.org/>.
SELECT ?item ?itemLabel ?wiki ?iges ?sipa ?coo WHERE {
  { ?item wdt:P2186 ?wiki. }
  { ?item wdt:P17 wd:Q45. }
  { ?item wdt:P1435 wd:Q54163210. }
  MINUS { ?item wdt:P625 ?coo. }
  { ?item wdt:P1702 ?iges. }
  MINUS { ?item wdt:P1700 ?sipa. }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "pt". }
}
Try it!

Obter páginas wikipedias pt,en,commons edit

SELECT ?item ?itemLabel ?article ?article1 ?article2  WHERE {

   ?item (wdt:P131/wdt:P279?) wd:Q36433.      #Porto
  
    {?item wdt:P1702 [] .   }                 #iges
  UNION
    { ?item wdt:P1700 [] .  }                  #sipa          

  ?article schema:about ?item . 
  ?article schema:isPartOf <https://pt.wikipedia.org/> .   #WP.pt

  ?article1 schema:about ?item . 
  ?article1 schema:isPartOf <https://en.wikipedia.org/> .   #WP.en
  
  ?article2 schema:about ?item . 
  ?article2 schema:isPartOf <https://commons.wikimedia.org/> . #Commons

  SERVICE wikibase:label {
       bd:serviceParam wikibase:language "pt"
    }
}
Try it!

Query by natural language edit

Falta label em Braileiro com label em Portuguese edit

Search for labels in other languages that do not exist in a target language. Can be input for QuickStatements.

Example: instance of human with country of citizenship Belgium with missing Brasilia label:

SELECT ?item ?itemLabel ?itemDescription ?langlabel1Label ?langlabelLabel WHERE {

# ?item wdt:P31 wd:Q5.
# ?item wdt:P27 wd:Q31.
  ?item (p:P31/ps:P31/wdt:P279*) wd:Q28797.  #item é instance of  applied science (Q28797) e todas as subclasses

 SERVICE wikibase:label { bd:serviceParam wikibase:language "pt,pt-br,en". }

  ?item rdfs:label ?langlabel1.
  FILTER((LANG(?langlabel1)) = "pt")   #tem label em Portugues

 FILTER(NOT EXISTS {
   ?item rdfs:label ?langlabel.
   FILTER(LANG(?langlabel) = "pt-br")    #falta label em Brasileiro 
 })
}
ORDER BY ?itemLabel
Try it!

Query de qualifiers edit

SELECT ?item ?itemLabel  ?instaceOfStatement ?endTime WHERE {
  ?item wdt:P31 wd:Q1131296 .                #instance of 'freguesia'

  ?item p:P31 ?instaceOfStatement .          #obtem qual o statment of P31
  ?instaceOfStatement ps:P31 wd:Q1131296 .   #o statment será igual a 'freguesia'
  ?instaceOfStatement pq:P582 ?endTime .     #o qualifier será 'end time'

  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }    
}
Try it!

LIMIT 100

Obter aliases edit

SELECT DISTINCT ?item ?label ?alias WHERE {
  {?item wdt:P131/wdt:P279? wd:Q36433 .} 
  {?item wdt:P1702 ?omim }
  
  ?item rdfs:label ?label . FILTER(lang(?label) = 'pt' )
  
  OPTIONAL {
     ?item skos:altLabel ?alias . FILTER(lang(?alias) = 'pt' )
  }
}
Try it!


convert labels minuscula edit

SELECT ?item ?langlabelLabel ?langlabel2Label   ?langlabel3Label ?itemDescription WHERE {

  { ?item wdt:P279/wdt:P279? wd:Q811979	  . }  #sub classes
 UNION
  { ?item wdt:P31/wdt:P279? wd:Q811979	  . }   #items
  
   MINUS { ?item wdt:P31  wd:Q4167410 . }   #disambig
   MINUS { ?item wdt:P31  wd:Q4167836 . }   #category
   MINUS { ?item wdt:P31  wd:Q13406463 . }  #list article
   MINUS { ?item wdt:P17 [].  }             #sem pais
   
   ?item rdfs:label ?langlabel.
   FILTER((LANG(?langlabel)) = "en")   #tem label em ingles
   
  ?item rdfs:label ?langlabel2.
  FILTER((LANG(?langlabel2)) = "pt")   #tem label em Portugues
   
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en,pt". }

}
LIMIT 5000
Try it!

convert labels minuscula v3 edit

#alterar MAIUS - minus Thesaurus encylopedia
SELECT ?item  ?langlabelEN  ?langlabelPT
WHERE 
{
      
   ?item wdt:P1711  []  .      #British Museum person-institution
  
   MINUS { ?item wdt:P1014  [] .  }    #AAT ID ID -tratado
   MINUS { ?item wdt:P3916  [] .  }    #UNESCO Thesaurus ID -tratado
   MINUS { ?item wdt:P508  [] .  }     #BNCF Thesaurus ID -tratado
   MINUS { ?item wdt:P3219  [] .  }    #Encyclopædia Universalis -tratado
   MINUS { ?item wdt:P2581  [] .  }    #babelNET  -tratado
   MINUS { ?item wdt:P1417 [] .   }    #britanica -tratado
   MINUS { ?item wdt:P3417 [] .  }     #Quora ID -tratado
#  MINUS { ?item wdt:P830  []  .  }    #encylopedia of LIFE
#  MINUS { ?item wdt:P1566 [] .  }     #geonames
#  MINUS { ?item wdt:P213   [] .  }    #ISNI
 
#  MINUS { ?item wdt:P31 wd:Q5 . }     #human
  
  ?item rdfs:label ?langlabelPT.
  FILTER(LANG(?langlabelPT) = "pt")

  ?item rdfs:label ?langlabelEN.
  FILTER(LANG(?langlabelEN) = "en")
  
 # SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}

OFFSET 0
LIMIT  100000
Try it!

exemplo the uso de regexp, rank edit

SELECT ?item ?itemLabel ?value  ?rank
WHERE
{
	{
		SELECT ?item ?value ?rank
		WHERE
		{
			?item p:P345 [ ps:P345 ?value; wikibase:rank ?rank ]
			FILTER( REGEX( STR( ?value ), "^(ch)\\d{7}$" )  ) .
            FILTER( ?rank != wikibase:DeprecatedRank ) 
			FILTER( ?item NOT IN ( wd:Q4115189, wd:Q13406268, wd:Q15397819 ) ) .
		} 
	} .
	SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } .
}
Try it!

exemplo the uso de qualifiers edit

SELECT ?item   ?itemLabel  ?itemdesc ?concelhoLabel  ?distritoLabel   
WHERE {
  ?item wdt:P17 wd:Q45 .
  ?item wdt:P31 wd:Q1131296. 
  ?item wdt:P131 ?concelho . 
  ?concelho  wdt:P131 ?distrito .
   ?item schema:description ?itemdesc.
    FILTER(LANG(?itemdesc) = "pt")
  
   MINUS  { ?item wdt:P1566 [] . }
  
     ?item p:P31 ?statement.
     ?statement ps:P31 ?instance .
      MINUS  { ?statement pq:P582 ?endtime . }
      MINUS  { ?statement pq:P580 ?starttime . }
  
  MINUS { ?item wdt:P31/wdt:P279* wd:Q486972. }     #povoamento
  MINUS {
   ?article1 schema:about ?item . 
   ?article1 schema:isPartOf <https://ceb.wikipedia.org/> .   #WP.pt
    }
  
   SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
Try it!

Ordens edit

#CATEGORIA PARA RECIPIENTES DE UM GRAU DE ORDEM SEM COMMONS

SELECT DISTINCT ?item ?itemLabel  ?grau ?grauLabel  ?order ?orderLabel
WHERE 
{
  ?item wdt:P301  ?grau .               #catego art princ  grau
  ?grau wdt:P361  ?order .              #grau   parte de   ordem
  ?order wdt:P31/wdt:P279* wd:Q193622 . #ordem   intance   order
  
  ?order wdt:P17   wd:Q45 .  
  ?grau wdt:P17   wd:Q45 .
  
  MINUS {    ?article2 schema:about ?item . 
      ?article2 schema:isPartOf <https://commons.wikimedia.org/> . #Commons
        }
 SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en , pt". }
}
Try it!


Todos recipientes ordens port edit

#Todos recipientes ordens port

SELECT ?item ?itemLabel ?article
WHERE 
{
{  ?item  wdt:P166 ?rank  .
  ?rank  wdt:P361 ?order  .
  ?order wdt:P31/wdt:P279* wd:Q193622 .
  ?order wdt:P17 wd:Q45.  
  ?rank wdt:P17 wd:Q45.  
  ?article schema:about ?item . 
  ?article schema:isPartOf <https://pt.wikipedia.org/> .   #WP.pt
}
UNION  
  
{ ?item  wdt:P166 ?order  .
  ?order wdt:P31/wdt:P279* wd:Q193622 .
  ?order wdt:P17 wd:Q45. 
  ?article schema:about ?item . 
  ?article schema:isPartOf <https://pt.wikipedia.org/> .   #WP.pt
}


  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Try it!


Carregar referências edit

#Carregar referênciaa

SELECT  ?itemLabel ?item ?rank
WHERE  {
  ?item  wdt:P166 ?rank  .
{ ?rank  wdt:P361  wd:Q93932  .  }  UNION
{ ?rank  wdt:P361  wd:Q11696769  .  }  UNION
{ ?rank  wdt:P361  wd:Q23657078  .  }  UNION
{ ?rank  wdt:P361  wd:Q1515829  .  }  UNION
{ ?rank  wdt:P361  wd:Q2083850  .  }  UNION
{ ?rank  wdt:P361  wd:Q743230  .  }  UNION
{ ?rank  wdt:P361  wd:Q93488  .  }  UNION
{ ?rank  wdt:P361  wd:Q639335  .  }  UNION
{ ?rank  wdt:P361  wd:Q495686  .  } 
  
 MINUS {    ?item  wdt:P17  wd:Q45 .  } 
 MINUS {   ?item  wdt:P31   wd:Q5  .  }
  
     SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],pt,en". }
 }
Try it!


COUNT, DISTINCT, GROUP BY edit

#COUNT, DISTINCT, GROUP BY
SELECT ?item ?itemLabel (COUNT (DISTINCT ?order ) AS ?count) WHERE {
  
  ?item  wdt:P166  ?rank  .
  ?rank  wdt:P361  ?order .
      
 {?rank   wdt:P361  wd:Q23657078  . } 
UNION
 {?rank  wdt:P361  wd:Q639358 . }
   
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],pt,en". }
 }

GROUP BY ?item ?itemLabel
Try it!

Sem referencias edit

#Sem referencias

SELECT ?itemLabel ?item ?rank ?ref ?refLabel
WHERE {
  ?item     wdt:P166  ?rank  .
  
{ ?rank  wdt:P361  wd:Q93932  .  }  UNION  #militar torre espada
{ ?rank  wdt:P361  wd:Q11696769  .  }  UNION  #militar cristo
{ ?rank  wdt:P361  wd:Q23657078  .  }  UNION  #militar avis
{ ?rank  wdt:P361  wd:Q1515829  .  }  UNION  #militar santiago
{ ?rank  wdt:P361  wd:Q2083850  .  }  UNION  #imperio
{ ?rank  wdt:P361  wd:Q743230  .  }  UNION  #liberdade
{ ?rank  wdt:P361  wd:Q93488  .  }  UNION  #infante
{ ?rank  wdt:P361  wd:Q639335  .  }  UNION  #Merito
{ ?rank  wdt:P361  wd:Q495686  .  }  UNION  #Public Instruction 
{ ?rank  wdt:P361  wd:Q2029023  .  }  UNION  #Merito empresarial
{ ?rank  wdt:P361  wd:Q10341302  .  }  UNION  #torre espada
{ ?rank  wdt:P361  wd:Q840941  .  }  UNION  #cristo
{ ?rank  wdt:P361  wd:Q639358  .  }  UNION  #avis
{ ?rank  wdt:P361  wd:Q67041645  .  }  UNION  #santiago
{ ?rank  wdt:P361  wd:Q16142399  .  }  UNION  #duas bandas
{ ?rank  wdt:P361  wd:Q347377  .  }  UNION  #tres bandas
{ ?rank  wdt:P361  wd:Q1604729  .  }  UNION  #vila vico
{ ?rank  wdt:P361  wd:Q1228761  .  }  UNION  #isabel
{ ?rank  wdt:P361  wd:Q1696581  .  }   #miguel ala
    
   MINUS {
     ?item p:P166 ?statement.
     ?statement ps:P166 ?rank.
     ?statement prov:wasDerivedFrom ?refnode.
     
    { ?refnode   pr:P854 ?ref. } UNION
    { ?refnode   pr:P143 ?ref. } UNION  
    { ?refnode   pr:P4656 ?ref. } UNION    
    { ?refnode   pr:P248 ?ref. }      
 }
  
#  FILTER (SUBSTR(str(?ref), 1 , 40) = "http://www.ordens.presidencia.pt/?idc=15") .    
  
     SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
ORDER BY ?itemLabel
Try it!

Qualifiers edit

#Qualifiers

SELECT ?item ?itemLabel ?itemDescription ?propLabel ?pq_pred  ?pq_obj WHERE {
   ?item wdt:P17 wd:Q45 .
   ?item wdt:P31 wd:Q1131296 .
    
   ?item p:P31 ?award_statement .
   ?award_statement ps:P31 wd:Q1131296 .  # freguesia
  
 #  FILTER NOT EXISTS {
     	?award_statement pq:P582 ?pq_obj . # a triple involving the freguesia ...  
        ?prop wikibase:qualifier pq:P582 . # ... with a predicate pq:P582 that is a qualifier
 #  }

SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Try it!

Freguesias antigas edit

#Freguesias antigas

SELECT distinct ?item ?itemLabel ?locadm ?locadmLabel ?conadm  ?conadmLabel ?locloc ?loclocLabel ?conloc ?conlocLabel ?locendTime 
WHERE 
{
 {  ?item wdt:P131/wdt:P131* wd:Q2915956  .  } #portugal
  
         { ?item wdt:P131   ?locadm . } #locadm
  
       { ?locadm wdt:P131   ?conadm  . } #conadm  
        { ?conadm  wdt:P31   wd:Q13217644  . } #freguesia  
  
       { ?locadm wdt:P31  wd:Q1131296 . } #freguesia 
#  ?locadm p:P31 ?instaceOfStatement .          #obtem qual o statment of P31
#  ?instaceOfStatement ps:P31 wd:Q1131296 .   #o statment será igual a 'freguesia'
#  ?instaceOfStatement pq:P580 ?admstarTime .     #o qualifier será 'start time'

  
       { ?item wdt:P276  ?locloc . } #local
         { ?locloc wdt:P131   ?conloc  . } #conadm  
        { ?conloc  wdt:P31   wd:Q13217644  . } #freguesia  
  
       { ?locloc wdt:P31  wd:Q1131296 . } #freguesia 
  ?locloc p:P31 ?instaceOfStatement .          #obtem qual o statment of P31
 ?instaceOfStatement ps:P31 wd:Q1131296 .   #o statment será igual a 'freguesia'
  ?instaceOfStatement pq:P582 ?locendTime .     #o qualifier será 'end time'  
        
  SERVICE wikibase:label { bd:serviceParam wikibase:language "pt". }
}
Try it!

Farois selecionar para AWB edit

  1. Farois selecionar para AWB

SELECT ?place ?elev ?unit ?unitLabel ?comm WHERE {

  ?place wdt:P31/wdt:P279* wd:Q39715. # Must be of a lighthouse
 
 ?place p:P2923/psv:P2923 ?placeElev.
 ?placeElev wikibase:quantityAmount ?elev.
 ?placeElev wikibase:quantityUnit ?unit.
 
 ?comm schema:about ?place ; schema:isPartOf <https://commons.wikimedia.org/> .
 
 bind(1 as ?km).
 filter( (?elev < ?km*11 && ?unit = wd:Q11573)
      || (?elev < ?km*36.091 && ?unit = wd:Q3710)
      || (?elev < ?km      && ?unit = wd:Q828224) ).
 

SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,fr,es,de" } }

LIMIT 2000

Farois analisar tudo edit

#Farois analisar tudo

SELECT ?itemLabel ?item ?wikiLabel ?sipa ?dgpc  ?heritageLabel  ?cultLabel
#  ?marine  ?partof  ?data   ?arlhs   ?official ?cultLabel ?focal ?alt ?pornum ?admiral  ?nga  ?retir ?charact ?range 
WHERE 
{
  ?item wdt:P31/wdt:P279* wd:Q39715. # Must be of a lighthouse
  ?item wdt:P17 wd:Q45.  # Must be of a heritage

    OPTIONAL {    ?item wdt:P2186  ?wiki . }
  
        OPTIONAL {    ?item wdt:P730  ?retir . }
   OPTIONAL {    ?item wdt:P706  ?official . } 
  OPTIONAL{    ?item wdt:P1030  ?charact . }
  OPTIONAL{   ?item wdt:P2923  ?focal  . }
  OPTIONAL{ ?item wdt:P31   ?cult . } 
  OPTIONAL {   ?item wdt:P2048 ?alt . }
   OPTIONAL {   ?item wdt:P1702   ?dgpc . } 
       OPTIONAL {   ?item wdt:P2929   ?range . } 
        OPTIONAL {   ?item wdt:P1435  ?heritage . } 
     OPTIONAL {   ?item wdt:P361   ?partof . }
        OPTIONAL {   ?item wdt:P2980  ?arlhs . }
        OPTIONAL {   ?item wdt:P571   ?data . }
      OPTIONAL {   ?item wdt:P1700  ?sipa . }
      OPTIONAL {   ?item wdt:P3563  ?nga . }
        OPTIONAL {   ?item wdt:P3601  ?marine . }  
       OPTIONAL {   ?item wdt:P4423  ?pornum . } 
          OPTIONAL {   ?item wdt:P3562  ?admiral . } 
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en language
}
ORDER BY DESC(?elev)
LIMIT 20000
Try it!

Marinha analisar tudo edit

#Marinha analisar tudo
SELECT  ?item ?itemLabel ?instLabel ?subclaLabel ?vesselLabel  ?serv ?incep ?pennant
WHERE 
{
  ?item wdt:P31 ?inst . # instance classe navio e subclasses  
    OPTIONAL {    ?item wdt:P571   ?incep  . }    #numero vessel class 
    OPTIONAL {    ?item wdt:P18   ?foto  . }    #numero vessel class  
    OPTIONAL {    ?item wdt:P289   ?vessel  . }    #numero vessel class  
    OPTIONAL {    ?item wdt:P879   ?pennant  . }    #numero amura
    OPTIONAL {    ?item wdt:P279   ?subcla . }    #numero subcal  
    OPTIONAL {    ?item wdt:P1813   ?short  . }    # short
    OPTIONAL  {    ?item wdt:P729 ?serv .  } # operator portuguese navy
  ?item wdt:P137 wd:Q588089 . # operator portuguese navy  
# FILTER NOT EXISTS  {     ?item wdt:P18 ?foto .  } # operator portuguese navy 
      ?item wdt:P137 ?navy . # Must be of a ca
      optional {?comm schema:about ?item ; schema:isPartOf <https://commons.wikimedia.org/> .}
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en language
}
Try it!

Marinha sem fotos edit

#Marinha sem fotos
SELECT  ?item ?itemLabel ?serv ?servret 
WHERE 
{
  ?item wdt:P31 ?inst . # instance classe navio e subclasses  
      ?item wdt:P137 wd:Q588089 . # operator portuguese navy  
  
        ?item wdt:P137 ?navy . # Must be of a ca
       OPTIONAL {    ?item wdt:P729   ?serv     . }    # operator portuguese navy
  
       OPTIONAL {    ?item wdt:P730   ?servret     . }    # operator portuguese navy
        FILTER NOT EXISTS  {     ?item wdt:P18 ?foto .  } # operator portuguese navy 
      optional {?comm schema:about ?item ; schema:isPartOf <https://commons.wikimedia.org/> .}
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en language
}
Try it!


Marinha ultimo edit

SELECT  distinct ?item  ?itemLabel ?instLabel ?powered ?serv ?foto # ?instLabel ?lenght # ?draft ?beam  ?serv  ?refurl  ?evento  ?eventoLabel 
# ?operatorLabel ?propriLabel ?itemDescription
# ?foto # ?instLabel ?itemDescription   # ?foto  # ?itemAltLabel # ?servret  ?pennant ?differ ?instLabel
# ?operatorLabel ?topic ?classLabel   ?foto    # ?mass ?serv 
# ?countryLabel  ?manufLabel ?manuf  ?incep  ?catshipname ?imo  ?manuf  
# ?vesselLabel  ?namedLabel ?subclaLabel ?vesselLabel 
# ?itemDescription ?itemAltLabel
WHERE 
{
 
            { ?item wdt:P31 ?inst .                 }    #  instance  -  tipo de navio
            { ?item wdt:P31/wdt:P279* wd:Q1229765 . }    #  instancia -  watercraft e subclasses
   UNION    { ?item wdt:P31/wdt:P279* wd:Q559026 .  }    #  instancia -  ship class
  
          { ?item wdt:P137 ?navy .             }    # operator ?navi
          { ?item wdt:P137 wd:Q588089 .        }    # operator portuguese navy   

 #ver daqui
 #      { ?item wdt:P495/wdt:P361* wd:Q200464 .  }  #  pais origem - imperio portugues
 #      { ?item wdt:P495/wdt:P361* wd:Q148 .  }  #  pais origem - imperio portugues  
 # ate aqui 
  
  # { ?item wdt:P31 wd:Q5258439 .           }  # inst - galeota real
  # { ?item wdt:P516   wd:Q25999 .          }  # powered by sail
  # { ?item wdt:P31/wdt:P279*  wd:Q559026 . } 
  # FILTER NOT EXISTS  { ?item wdt:P373   ?comcat .            }  # comons cat
  # FILTER NOT EXISTS  { ?item wdt:P186   ?made .              }  # made from material 
  # FILTER NOT EXISTS  { ?item wdt:P31/wdt:P279*  wd:Q559026 . } 
  # FILTER NOT EXISTS  { ?item   wdt:P176   ?manuf  .          }  #numero vessel class
 
# filter not exists { ?item wdt:P31 wd:Q12859788 . }
#  { ?item wdt:P31 wd:Q214196. }  #canhoneira
    

#caracte ----------------------------------------------------------------------
  OPTIONAL          {    ?item wdt:P516   ?powered .     }    # 1 powered by - motores
  optional          {    ?item wdt:P2067  ?mass .        }    # 2 mass
  OPTIONAL          {    ?item wdt:P2043  ?lenght .      }    # 31 length  comprimento
  OPTIONAL          {    ?item wdt:P2261  ?beam .        }    # 32 beam boca
  OPTIONAL          {    ?item wdt:P2262  ?draft .       }    # 33 draft  calado
  OPTIONAL          {    ?item wdt:P4511  ?pontal .      }    # 34 vertical depth - (ver PetScan) pontal (P2048)
  Optional          {    ?item wdt:P1083  ?guarn .       }    # 4 capacidade maxima - guarniçao
  Optional          {    ?item wdt:P520   ?armament .    }    # 5 armamento (ver PetScan) Q1330003 torpedo tube
  OPTIONAL          {    ?item wdt:P2052  ?speed .       }    # 6 speed
#fim caracte ----------------------------------------------------------------------
  
 OPTIONAL {    ?item wdt:P7782  ?catshipname . }    # operator portuguese navy
 OPTIONAL {    ?item wdt:P289   ?class  .      }    # numero vessel class 
 OPTIONAL {    ?item wdt:P607   ?conflit  .    }    # numero conflit war 
 OPTIONAL {    ?item wdt:P373   ?commonscat .  }    # operator portuguese navy
 OPTIONAL {    ?item wdt:P495   ?country  .    }    # numero vessel clas 
 OPTIONAL {    ?item wdt:P1071  ?criado  .     }    # criado em
 OPTIONAL {    ?item wdt:P1889  ?differ  .     }    # different
 OPTIONAL {    ?item wdt:P793   ?evento  .     }    # evento
 OPTIONAL {    ?item wdt:P18    ?foto  .       }    # foto
 OPTIONAL {    ?item wdt:P458   ?imo .         }    # operator portuguese navy
 OPTIONAL {    ?item wdt:P571   ?incep  .      }    # numero vessel class 
 OPTIONAL {    ?item wdt:P1071  ?local  .      }    # location of cration
 OPTIONAL {    ?item wdt:P176   ?manuf  .      }    # numero vessel class
 OPTIONAL {    ?item wdt:P138   ?named  .      }    # numero vessel class 
 OPTIONAL {    ?item wdt:P137   ?operator  .   }    # numero amura 
 OPTIONAL {    ?item wdt:P495   ?paisori  .    }    # pais de origem
 OPTIONAL {    ?item wdt:P879   ?pennant  .    }    # numero amura 
 OPTIONAL {    ?item wdt:P127   ?propri .      }    # proprietario owned b
 OPTIONAL {    ?item wdt:P973   ?refurl .      }    # proprietario referencia URL
 OPTIONAL {    ?item wdt:P729   ?serv .        }    # operator portuguese navy
 OPTIONAL {    ?item wdt:P730   ?servret .     }    # operator portuguese navy
 OPTIONAL {    ?item wdt:P1813  ?short  .      }    # short
 OPTIONAL {    ?item wdt:P279   ?subcla .      }    # numero subcal 
 OPTIONAL {    ?item wdt:P910   ?topic .       }    # topico
      
#  OPTIONAL {?comm schema:about ?item ; schema:isPartOf <https://commons.wikimedia.org/> .}
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language,
  #defaultView:Map if not, then en language

#  ?article2 schema:about ?item . 
#  ?article2 schema:isPartOf <https://commons.wikimedia.org/> . #Commons
   
#FILTER(NOT EXISTS {
#    ?item schema:description ?itemdesc.
#    FILTER(LANG(?itemdesc) = "pt")
#  })
  
#  ?article1 schema:about ?item . 
#  ?article1 schema:isPartOf <https://pt.wikipedia.org/> .   #WP.en
}

#Limit 50
# order by ?serverv
Try it!

Obter propriedades edit

# items with most values of the property P1700
# added by User:Infovarius, 2019-07-15
SELECT ?item ?itemLabel ?event ?eventLabel
{
 
    #      ?item wdt:P1700 ?value  
         
          { ?item wdt:P137 wd:Q172771 . }   UNION    #navy hms
          { ?item wdt:P137 wd:Q11220 .  }   UNION    #uss
          { ?item wdt:P137 wd:Q217406 . }            #frenca
         
                  { ?item wdt:P793 ?event . }        #evento notavel

       #         ?item ?propri ?value .
                      
     
 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY DESC(?cnt)
LIMIT 20000
Try it!

Contar propriedades edit

# items with most values of the property P1700
# added by User:Infovarius, 2019-07-15
SELECT ?item ?itemLabel ?cnt
{
  {
       SELECT ?item (COUNT(?value) AS ?cnt)
       {
    #      ?item wdt:P1700 ?value  
         
          { ?item wdt:P137 wd:Q172771 . }   UNION    #navy hms
          { ?item wdt:P137 wd:Q11220 .  }   UNION    #uss
          { ?item wdt:P137 wd:Q217406 . }            #frenca
         
        #          { ?item wdt:P793 ?event . }        #evento notavel

                ?item ?propri ?value .
                      
       }
       GROUP BY ?item ORDER BY DESC(?cnt) LIMIT 100
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY DESC(?cnt)
Try it!


Marinha ultimo novembro edit

SELECT  distinct ?item  ?itemLabel ?lenght ?refURL #?serv ?manufLabel ?criadoLabel ?countryLabel # ?localLabel  # ?foto # ?instLabel ?powered ?serv # ?foto # ?instLabel ?lenght # ?draft ?beam  ?serv  ?refurl  ?evento  ?eventoLabel 
# ?operatorLabel ?propriLabel ?itemDescription
# ?foto # ?instLabel ?itemDescription   # ?foto  # ?itemAltLabel # ?servret  ?pennant ?differ ?instLabel
# ?operatorLabel ?topic ?classLabel   ?foto    # ?mass ?serv 
# ?countryLabel  ?manufLabel ?manuf  ?incep  ?catshipname ?imo  ?manuf  
# ?vesselLabel  ?namedLabel ?subclaLabel ?vesselLabel 
# ?itemDescription ?itemAltLabel
WHERE 
{
 
            { ?item wdt:P31 ?inst .                 }    #  instance  -  tipo de navio
           { ?item wdt:P31/wdt:P279* wd:Q1229765 . }    #  instancia -  watercraft e subclasses
 # UNION 
  #          { ?item wdt:P31/wdt:P279* wd:Q559026 .  }    #  instancia -  ship class
  
          { ?item wdt:P137 ?navy .             }    # operator ?navi
          { ?item wdt:P137 wd:Q588089 .        }    # operator portuguese navy   
#novo
 # ?item wdt:P2043  ?lenght . 
 # ?item p:P2043 [ prov:wasDerivedFrom [ pr:P958 ?refURL ] ] .
#novo fim
  
 #ver daqui
 #      { ?item wdt:P495/wdt:P361* wd:Q200464 .  }  #  pais origem - imperio portugues
 #      { ?item wdt:P495/wdt:P361* wd:Q148 .  }  #  pais origem - imperio portugues  
 # ate aqui 
  
  # { ?item wdt:P31 wd:Q5258439 .           }  # inst - galeota real
  # { ?item wdt:P516   wd:Q25999 .          }  # powered by sail
  # { ?item wdt:P31/wdt:P279*  wd:Q559026 . } 
  # FILTER NOT EXISTS  { ?item wdt:P373   ?comcat .            }  # comons cat
  # FILTER NOT EXISTS  { ?item wdt:P186   ?made .              }  # made from material 
  # FILTER NOT EXISTS  { ?item wdt:P31/wdt:P279*  wd:Q559026 . } 
  # FILTER NOT EXISTS  { ?item   wdt:P176   ?manuf  .          }  #numero vessel class
 
# filter not exists { ?item wdt:P31 wd:Q12859788 . }
#  { ?item wdt:P31 wd:Q214196. }  #canhoneira
    

#caracte ----------------------------------------------------------------------
#  OPTIONAL          {    ?item wdt:P516   ?powered .     }    # 1 powered by - motores
#  optional          {    ?item wdt:P2067  ?mass .        }    # 2 mass
  OPTIONAL          {    ?item wdt:P2043  ?lenght .      }    # 31 length  comprimento
#  OPTIONAL          {    ?item wdt:P2261  ?beam .        }    # 32 beam boca
#  OPTIONAL          {    ?item wdt:P2262  ?draft .       }    # 33 draft  calado
#  OPTIONAL          {    ?item wdt:P4511  ?pontal .      }    # 34 vertical depth - (ver PetScan) pontal (P2048)
#  Optional          {    ?item wdt:P1083  ?guarn .       }    # 4 capacidade maxima - guarniçao
#  Optional         {    ?item wdt:P520   ?armament .    }    # 5 armamento (ver PetScan) Q1330003 torpedo tube
#  OPTIONAL          {    ?item wdt:P2052  ?speed .       }    # 6 speed
#fim caracte ----------------------------------------------------------------------
  
 OPTIONAL {    ?item wdt:P7782  ?catshipname . }    # operator portuguese navy
 OPTIONAL {    ?item wdt:P289   ?class  .      }    # numero vessel class 
 OPTIONAL {    ?item wdt:P607   ?conflit  .    }    # numero conflit war 
 OPTIONAL {    ?item wdt:P373   ?commonscat .  }    # operator portuguese navy
 OPTIONAL {    ?item wdt:P495   ?country  .    }    # numero vessel clas 
 OPTIONAL {    ?item wdt:P1071  ?criado  .     }    # criado em
 OPTIONAL {    ?item wdt:P1889  ?differ  .     }    # different
 OPTIONAL {    ?item wdt:P793   ?evento  .     }    # evento
  OPTIONAL {    ?item wdt:P18    ?foto  .       }    # foto
 OPTIONAL {    ?item wdt:P458   ?imo .         }    # operator portuguese navy
 OPTIONAL {    ?item wdt:P571   ?incep  .      }    # numero vessel class 
 OPTIONAL {    ?item wdt:P1071  ?local  .      }    # location of cration
 OPTIONAL   {    ?item wdt:P176   ?manuf  .      }    # numero vessel class
 OPTIONAL {    ?item wdt:P138   ?named  .      }    # numero vessel class 
 OPTIONAL {    ?item wdt:P137   ?operator  .   }    # numero amura 
 OPTIONAL {    ?item wdt:P495   ?paisori  .    }    # pais de origem
# OPTIONAL {    ?item wdt:P879   ?pennant  .    }    # numero amura 
# OPTIONAL {    ?item wdt:P127   ?propri .      }    # proprietario owned b
 OPTIONAL {    ?item wdt:P973   ?refurl .      }    # proprietario referencia URL
 OPTIONAL {    ?item wdt:P729   ?serv .        }    # operator portuguese navy
# OPTIONAL {    ?item wdt:P730   ?servret .     }    # operator portuguese navy
# OPTIONAL {    ?item wdt:P1813  ?short  .      }    # short
 # OPTIONAL {    ?item wdt:P279   ?subcla .      }    # numero subcal 
 # OPTIONAL {    ?item wdt:P910   ?topic .       }    # topico
      
#  OPTIONAL {?comm schema:about ?item ; schema:isPartOf <https://commons.wikimedia.org/> .}
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language,
  #defaultView:Map if not, then en language

#  ?article2 schema:about ?manuf . 
#  ?article2 schema:isPartOf <https://commons.wikimedia.org/> . #Commons
   
#FILTER(NOT EXISTS {
#    ?item schema:description ?itemdesc.
#    FILTER(LANG(?itemdesc) = "pt")
#  })
  
#  ?article1 schema:about ?item . 
#  ?article1 schema:isPartOf <https://pt.wikipedia.org/> .   #WP.en
}
ORDER BY ?serv
LIMIT 700
Try it!

Nome ultimo abril edit

SELECT distinct ?item  ?itemLabel  ?commcat  ?slink ?stat   # ?datnas  ?datmor ?fleu ?foto 
# ?nick  ?pseu    ?alias # ?native ?label  #?ptwiki # ?itemDescription ?paisLabel
WHERE {
  
#    { ?item wdt:P69 wdt:Q66814784 . }  #FEBAUP
  
   #   optional { ?item wdt:P569 ?datnas . }
   #    optional { ?item wdt:P570 ?datmor . }
   #    optional { ?item wdt:P27  ?pais  }  
  #   optional { ?item wdt:P1317  ?fleuri  . }    
    
  

     #    filter not exists { ?item wdt:P18  ?foto  . }     #passa a not
     #      filter not exists  { ?item wdt:P569 ?datnas . } 
       #       filter not exists   { ?item wdt:P570 ?datmor . }
      #   filter not exists { ?item wdt:P106 ?occup . } 
            #   ?item wdt:P21 wd:Q6581072 .    #mulher
            #   ?item wdt:P166 ?premio .    #premios recebidos
  
   ?item wdt:P31 wd:Q5. 
 
    { ?item wdt:P27 wd:Q45.}    union
  { ?item wdt:P27 wd:Q45670. }  
 
    
       ?item wdt:P31 ?value ; wikibase:statements ?stat .  #numero de site links
       ?item wdt:P31 ?value ; wikibase:sitelinks ?slink .   #numero de statments
 
  
  
#  filter not exists  { ?item wdt:P1559 ?native . }   # name in native
          
 filter not exists  { ?item wdt:P734 ?gnome . }   # famili name
  
     { ?item wdt:P373 ?commcat . }   # comm cat

#label e alias
     #  { ?item rdfs:label ?label FILTER(lang(?label) = 'pt') .     }
# optional    { ?item rdfs:label ?label  .     }

       #  { ?item skos:altLabel ?alias FILTER (LANG (?alias) =  'pt')  }
#optional  { ?item skos:altLabel ?alias   }
 
  #   filter (regex (?itemDescription , ".*[a].*"  ))
  
  #      FILTER (?itemDescription != " ") 
  #     FILTER (?native = ?alias)
 
  #   {  ?ptwiki schema:about ?item ; schema:isPartOf <https://en.wikipedia.org/> . }
 # {  ?ptwiki schema:about ?item ; schema:isPartOf <https://pt.wikipedia.org/> . }
  
  {  ?comm schema:about ?item ; schema:isPartOf <https://commons.wikimedia.org/> . }
    
     SERVICE wikibase:label { bd:serviceParam wikibase:language "pt". }  
    #  SERVICE wikibase:label { bd:serviceParam wikibase:language "nl,fr,en,de,it,es,no,pt". }
     
        
# FILTER(NOT EXISTS {
 #  ?item rdfs:label ?lang_label.
#   FILTER(LANG(?lang_label) = "pt")
# })
}

ORDER BY desc (?slink) desc (?stat) 
LIMIT 15000
Try it!

persons surnames 12 maio edit

SELECT distinct ?person  ?personLabel  ?surname  ?surnameLabel  ?commcat ?familyLabel # ?comm
WHERE {
    
   ?person   wdt:P31    wd:Q5 .        # é pessoa
#    ?person   wdt:P21    wd:Q6581072 .        # é mulher
   ?person   wdt:P734   ?surname .    # tem famyli name   
  
   ?person   wdt:P27     wd:Q38  .      # pais ou continente         ortugal   # /wdt:P361* 
  
   ?commpe schema:about ?person ; schema:isPartOf <https://commons.wikimedia.org/> .   #esta na commons
  
               ?surname   wdt:P31             ?family  . 
            {  ?surname   wdt:P31   wd:Q101352  .    }  # UNION          #  /wdt:P279*   #é family name  Q101352
         #   {  ?surname   wdt:P31   wd:Q66480858  .  } UNION          #affixed
       #      { ?surname   wdt:P31   wd:Q29042997  .  } UNION          #double
     #        { ?surname   wdt:P31   wd:Q106319018  . }                #hyphenated
  

    optional  { ?surname   wdt:P373   ?commcat  . }
   filter not exists { ?commsu schema:about ?surname ; schema:isPartOf <https://commons.wikimedia.org/> .  }  # nao esta na commons   
  
   SERVICE wikibase:label { bd:serviceParam wikibase:language "en,pt". } 
}
LIMIT 15000
Try it!

persons surnames 21 jun edit

SELECT distinct  ?surname  ?a ?b ?c ?d ?surnameLabel  ?commcat   ?person ?personLabel  ?familyLabel 
{
     {  ?surname   wdt:P31             ?family  .      }
     {  ?surname   wdt:P31   wd:Q101352  .    }    #/wdt:P279*
  
     { ?surname   rdfs:label ?label FILTER(lang(?label) = 'en') .     }
      filter (regex (?label , "^.*"  ))  
  
 #     minus { ?commsu schema:about ?surname ; schema:isPartOf <https://commons.wikimedia.org/> .  }  
 #     { ?surname   wdt:P407     wd:Q9043  .  }        # lingua norway

      filter not exists { ?surname   wdt:P373   ?commcat  . }
 
 
     { ?commper schema:about ?person ; schema:isPartOf <https://commons.wikimedia.org/> .  } 
  
   { ?person wdt:P569 ?birth .   }      # birth date
#g     { ?person wdt:P570 ?death .   }      # death date
  
   { ?person   wdt:P31    wd:Q5 .   }       # é pessoa

          { ?person   wdt:P734   ?surname .    }   union   # tem famyli name   <======
          { ?person   wdt:P1950   ?surname .    }  union   # tem second famyli name   <======
          { ?person   wdt:P9139   ?surname .    }         # tem first famyli name   <======
  

 #  ?person   wdt:P27     wd:Q183  .      # pais ou continente         ortugal   # /wdt:P361*  
 #  ?person   wdt:P21    wd:Q6581072 .    # mulher
 #  ?person   wdt:P373   ?commcatper .    # comm cat
 #  ?person   wdt:P18    ?image .         # comm cat 
    
  hint:Prior hint:rangeSafe true .    #???????
  #  tell the optimizer that fields doesn’t mix dates, strings, integers or other data types, which simplifies the range comparison

#g   FILTER (?death < "1900-01-01"^^xsd:dateTime)                                              # death     3N  65 act 
#g   FILTER (?death > "1900-01-01"^^xsd:dateTime && ?death < "1950-01-01"^^xsd:dateTime)       #  death    4N  72 act 
#g   FILTER (?death > "1950-01-01"^^xsd:dateTime && ?death < "2024-01-01"^^xsd:dateTime)       #  birth    0N  106 act
  
#g   FILTER (?birth < "1900-01-01"^^xsd:dateTime)                                              #  birth    7N  175 act 
   FILTER (?birth > "1900-01-01"^^xsd:dateTime && ?birth < "1950-01-01"^^xsd:dateTime)       #  birth    0N  act
#g   FILTER (?birth > "1950-01-01"^^xsd:dateTime && ?birth < "2024-01-01"^^xsd:dateTime)       #  birth    1N  act
      
  
     SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } 
}
Try it!

mostra laguage (native) edit

#Popular eye colors among humans
#title:Popular eye colors among humans
#illustrates bubblechart view, count

#defaultView:BubbleChart
SELECT ?item  ?itemLabel ?langwork ?langworkLabel  ?langnat  ?som #(COUNT(?human) AS ?count)
WHERE
{
  ?item wdt:P31 wd:Q101352 .
#    ?human wdt:P407 wd:Q7913 . 
minus  { ?item wdt:P407 ?langwork.    }
    { ?item wdt:P443 ?som.    } 
  
  { ?comm schema:about ?item ; schema:isPartOf <https://commons.wikimedia.org/> . }  
#   { ?rowiki schema:about ?item ; schema:isPartOf <https://ro.wikipedia.org/> . }  
#   { ?enwiki schema:about ?item ; schema:isPartOf <https://en.wikipedia.org/> . } 
  
  
    OPTIONAL { ?item wdt:P1705 ?nativename.
              BIND( LANG(?nativename) AS ?langnat). }
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY DESC(?langnat)
LIMIT 5000
#GROUP BY ?eyeColor ?eyeColorLabel ?rgb
Popular eye colors among humans


procurar surnames wikidata (04Jul) edit

SELECT distinct  ?surname  ?a ?b ?c ?d ?surnameLabel  ?commcat   ?person ?personLabel  ?familyLabel 
{
     {  ?surname   wdt:P31             ?family  .      }
     {  ?surname   wdt:P31/wdt:P279*   wd:Q101352  .    }    #/wdt:P279*
  
     { ?surname   rdfs:label ?label FILTER(lang(?label) = 'en') .     }
  
#g       filter (regex (?label , "^[A-B].*"  ))                      # 7 act
#g        filter (regex (?label , "^C.*"  ))                      # 5 act
#g        filter (regex (?label , "^D.*"  ))                      # 4 act
#g        filter (regex (?label , "^[A-E].*"  ))                                  # 0 act
#g        filter (regex (?label , "^F.*"  ))                                  # 0 act  
#g        filter (regex (?label , "^G.*"  ))                      # 2 act
#g        filter (regex (?label , "^H.*"  ))                      # 5 act    
#g        filter (regex (?label , "^I.*"  ))                      # 1 act
#g        filter (regex (?label , "^J.*"  ))                                  # 0 act
#g        filter (regex (?label , "^K.*"  ))                      # 4 act
#g        filter (regex (?label , "^[L-N].*"  ))                  # 12 act
#g        filter (regex (?label , "^O.*"  ))                      # 3 act
#g        filter (regex (?label , "^[P-Q].*"  ))                  # 4 act
#g        filter (regex (?label , "^[R-T].*"  ))                  # 11 act
#g        filter (regex (?label , "^[U-Z].*"  ))                  # 7 act
#g        filter (regex (?label , "^[A-Z].*"  ))                               # 64 act
  
 #     minus { ?commsu schema:about ?surname ; schema:isPartOf <https://commons.wikimedia.org/> .  }  
 #     { ?surname   wdt:P407     wd:Q9043  .  }        # lingua norway

      filter not exists { ?surname   wdt:P373   ?commcat  . }
 
 
     { ?commper schema:about ?person ; schema:isPartOf <https://commons.wikimedia.org/> .  } 
  
   { ?person wdt:P569 ?birth .   }      # birth date
# { ?person wdt:P570 ?death .   }      # death date
  
   { ?person   wdt:P31    wd:Q5 .   }       # é pessoa

          { ?person   wdt:P734   ?surname .    }   union   # tem famyli name   <======
          { ?person   wdt:P1950   ?surname .    }  union   # tem second famyli name   <======
          { ?person   wdt:P9139   ?surname .    }         # tem first famyli name   <======
  

 #  ?person   wdt:P27     wd:Q183  .      # pais ou continente         ortugal   # /wdt:P361*  
 #  ?person   wdt:P21    wd:Q6581072 .    # mulher
 #  ?person   wdt:P373   ?commcatper .    # comm cat
 #  ?person   wdt:P18    ?image .         # comm cat 
    
  hint:Prior hint:rangeSafe true .    #???????
  #  tell the optimizer that fields doesn’t mix dates, strings, integers or other data types, which simplifies the range comparison

#g   FILTER (?death < "1900-01-01"^^xsd:dateTime)                                              # death     3N  65  act 
#g   FILTER (?death > "1900-01-01"^^xsd:dateTime && ?death < "1950-01-01"^^xsd:dateTime)       #  death    4N  72  act 
#g   FILTER (?death > "1950-01-01"^^xsd:dateTime && ?death < "2024-01-01"^^xsd:dateTime)       #  birth    0N  106 act
    
#g   FILTER (?birth < "1900-01-01"^^xsd:dateTime)                                              #  birth    7N  175 act 
#g   FILTER (?birth > "1900-01-01"^^xsd:dateTime && ?birth < "1950-01-01"^^xsd:dateTime)       #  birth    0N  97  act
#g   FILTER (?birth > "1950-01-01"^^xsd:dateTime && ?birth < "2024-01-01"^^xsd:dateTime)       #  birth    1N  235 act
  
  
       SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } 
}
Try it!