see WolfgangFahl/pyLoDStorage#119
When sending the query
# Count all Q44613:monastery items
# with the given street address(P6375) https://www.wikidata.org/wiki/Property:P6375
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX schema: <http://schema.org/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?count (COUNT(?count) AS ?frequency) WHERE {{
SELECT ?item ?itemLabel (COUNT (?value) AS ?count)
WHERE
{
# instance of monastery
?item wdt:P31 wd:Q44613.
?item rdfs:label ?itemLabel.
FILTER (LANG(?itemLabel) = "en").
# street address
?item wdt:P6375 ?value.
} GROUP BY ?item ?itemLabel
}}
GROUP BY ?count
ORDER BY DESC (?frequency)
try it!
with SPARQLWrapper 1.8.5 and 2.0.0 the query is interpreted as an ADD query since the _parseQueryType and def _cleanComments functions don't handle this case appropriately.
see WolfgangFahl/pyLoDStorage#119
When sending the query
try it!
with SPARQLWrapper 1.8.5 and 2.0.0 the query is interpreted as an ADD query since the _parseQueryType and def _cleanComments functions don't handle this case appropriately.