Project:SPARQL/examples: Difference between revisions

From Beyond Notability
(add mrs query)
(add all triples query)
Line 24: Line 24:
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }  
}
}
</sparql>
===All triples in the wiki, limited to 500===
<sparql tryit="1">
SELECT ?a ?aLabel ?b ?c WHERE {
    ?a ?b ?c
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }
}
LIMIT 1000
</sparql>
</sparql>

Revision as of 10:05, 14 September 2021

Examples

People whose elections were proposed by men

PREFIX a: <http://beyond-notability.wiki.opencura.com/entity/>
PREFIX b: <http://beyond-notability.wiki.opencura.com/prop/direct/>
SELECT ?personLabel ?persongenderLabel ?electorLabel ?Date
WHERE {  
  ?person b:P7 ?elector ;
          b:P3 ?persongender .
  ?elector b:P3 a:Q10 .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }
}

Try it!


People whose name in the records begin with 'Mrs'

SELECT ?id ?name
WHERE {  
  ?id rdfs:label ?name .
  FILTER regex(?name, "mrs *", "i")
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". } 
}

Try it!


All triples in the wiki, limited to 500

SELECT ?a ?aLabel ?b ?c WHERE {
    ?a ?b ?c
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }
}
LIMIT 1000

Try it!