727
edits
(→Admin) |
No edit summary |
||
Line 943: | Line 943: | ||
ORDER BY ?womanLabel | ORDER BY ?womanLabel | ||
# Credit to Maarten Zeinstra for developing this query | # Credit to Maarten Zeinstra for developing this query | ||
</sparql> | |||
==Properties== | |||
===All properties in use in the wikibase with property type, label and description (if present) === | |||
<sparql tryit="1"> | |||
## most of these [except skos for alt labels] not needed? to check. | |||
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | |||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | |||
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> | |||
PREFIX wikibase: <http://wikiba.se/ontology#> | |||
PREFIX schema: <http://schema.org/> | |||
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> | |||
SELECT DISTINCT | |||
?property | |||
?propertyType | |||
?propertyLabel # ?propertyAltLabel | |||
?propertyDescription | |||
WHERE { | |||
?property a wikibase:Property ; | |||
rdfs:label ?propertyLabel ; | |||
wikibase:propertyType ?propertyType . | |||
# add alternative labels if you like, but not many of them | |||
# OPTIONAL { ?property skos:altLabel ?propertyAltLabel . } | |||
OPTIONAL { | |||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb,en". | |||
?property schema:description ?propertyDescription . | |||
} | |||
} | |||
FILTER(LANG(?propertyLabel) = 'en') | |||
# fix label language dups; but Q why doesn't SERVICE work? | |||
# A: https://en.wikibooks.org/wiki/SPARQL/FILTER#FILTER_on_values_in_Labels | |||
} | |||
order by ?propertyLabel | |||
</sparql> | |||
=== Counts of items for each value of the property "instance of" (P12) === | |||
<sparql tryit="1"> | |||
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/> | |||
SELECT ?value ?valueLabel (count(*) as ?count) | |||
WHERE { | |||
VALUES (?p) { (bnwdt:P12) } | |||
?s ?p ?value. | |||
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } | |||
} | |||
GROUP BY ?value ?valueLabel | |||
ORDER BY lcase(?valueLabel) # order by is case sensitive | |||
# or to order by count | |||
# order by ?count | |||
</sparql> | |||
=== Fetch any of multiple kinds of EDTF date for a woman === | |||
<sparql tryit="1"> | |||
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/> | |||
SELECT ?person ?personLabel ?date_edtf ?date_type | |||
WHERE { ?person bnwdt:P3 bnwd:Q3 . | |||
FILTER NOT EXISTS { ?person bnwdt:P4 bnwd:Q12 . } | |||
## short form of UNION using | | |||
?person ( bnwdt:P131 | bnwdt:P132 | bnwdt:P133 ) ?date_edtf . | |||
## cf. full length UNION | |||
## {?person bnwdt:P131 ?date_edtf } union {?person bnwdt:P132 ?date_edtf } union {?person bnwdt:P133 ?date_edtf } | |||
## need to know what kind of date it is | |||
?person ?date_type ?date_edtf . | |||
## this filter is important for edtf dates! https://github.com/ProfessionalWiki/WikibaseEdtf | |||
FILTER ( datatype(?date_edtf) = xsd:edtf ) . | |||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en, en-gb". } | |||
} | |||
ORDER BY ?personLabel | |||
</sparql> | </sparql> | ||
Line 1,052: | Line 1,163: | ||
</sparql> | </sparql> | ||
==Tools for batch processing and quality assurance work== | ==Tools for batch processing and quality assurance work== |
edits