Project:SPARQL/examples: Difference between revisions

Line 2,299: Line 2,299:
              
              
order by ?personLabel  
order by ?personLabel  
</sparql>
=== What sort of info Wikidata has about BN men ===
<sparql tryit="1">
#title: what info is there for BN men in Wikidata (211)
#counts of properties (excluding external IDs, of which there are gazillions)
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/>
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/>
PREFIX bnwdv: <https://beyond-notability.wikibase.cloud/value/>
PREFIX bnwdt: <https://beyond-notability.wikibase.cloud/prop/direct/>
PREFIX bnp: <https://beyond-notability.wikibase.cloud/prop/>
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/>
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/>
PREFIX bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>
SELECT ?prop_label ?prop (count(?prop) as ?count)
WHERE {
    ?person bnwdt:P3 bnwd:Q10 . #select men 211.
    ?person bnp:P117 ?wikidata_ID . #get wikidata ID
    ?wikidata_ID bnpq:P14 ?wikidata_url .
    BIND(IRI(REPLACE(?wikidata_url, "https://www.wikidata.org/wiki/", "http://www.wikidata.org/entity/")) as ?wikidata )
 
    SERVICE <https://query.wikidata.org/sparql> {     
        ?wikidata ?p ?s .
            ?prop wikibase:claim ?p;      # ?prop  url  /entity/P<dd>
                wikibase:propertyType ?prop_type ;
                wikibase:statementProperty ?ps;  #  url /prop/statement/P<dd>  "Links property entity to statement simple value predicate"
                wikibase:statementValue ?psv. #  url /prop/statement/value/P<dd> "Links property entity to statement full value predicate"   
            ?prop rdfs:label ?prop_label. filter(lang(?prop_label)="en") .
        filter(?prop_type in (wikibase:Time, wikibase:WikibaseItem ) ) .
      # types you want for this are wikibase:Item and wikibase:Time. maybe quantity, string, monolingualtext
     
    }  #/ wikidata
     
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en, en-gb". }
}
group by ?prop_label  ?prop     
order by ?prop_label
</sparql>
</sparql>


3,427

edits