Expected behavior
The count should be lower (83) if it entails works
Suggestion
PREFIX target: <http://www.wikidata.org/entity/Q115564437>
SELECT
?works
(CONCAT("/topics/Q115564437,", SUBSTR(STR(?topic), 32)) AS ?worksUrl)
?topic ?topicLabel
(CONCAT("/topic/", SUBSTR(STR(?topic), 32)) AS ?topicUrl)
?example_work ?example_workLabel
(CONCAT("/work/", SUBSTR(STR(?example_work), 32)) AS ?example_workUrl)
WITH {
SELECT
(COUNT(DISTINCT ?work) AS ?works)
?topic
(SAMPLE(?work) AS ?example_work)
WHERE {
# Find works for the specific queried topic
?work wdt:P921/( wdt:P31*/wdt:P279* | wdt:P361+ | wdt:P1269+) target: .
# Find co-occuring topics
?work wdt:P921 ?topic .
# Avoid listing the queried topic
FILTER (target: != ?topic)
}
GROUP BY ?topic
} AS %result
WHERE {
# Label the results
INCLUDE %result
SERVICE wikibase:label { bd:serviceParam wikibase:language "en,da,de,es,fr,jp,nl,no,ru,sv,zh" . }
}
ORDER BY DESC(?count)
Describe the bug "Co-occurring topics" on topic aspect should have a DISTINCT count for works
To Reproduce Steps to reproduce the behavior:
Expected behavior The count should be lower (83) if it entails works
Suggestion