Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In topic comparison, order topics by work count #1139

Open
Daniel-Mietchen opened this issue May 28, 2020 · 0 comments
Open

In topic comparison, order topics by work count #1139

Daniel-Mietchen opened this issue May 28, 2020 · 0 comments

Comments

@Daniel-Mietchen
Copy link
Collaborator

@Daniel-Mietchen Daniel-Mietchen commented May 28, 2020

e.g. as per this query:

SELECT ?count ?topic ?topicLabel ?example_work ?example_workLabel
WITH {
  SELECT (COUNT(DISTINCT ?work) AS ?count) ?topic (SAMPLE(?work) AS ?example_work) WHERE {
    VALUES ?topic {  wd:Q5227350  wd:Q95612615  wd:Q1331926  wd:Q4417999  wd:Q84263196  wd:Q202864  wd:Q88434121  wd:Q87745177  wd:Q10538943  wd:Q88835036  wd:Q1149776  wd:Q309901  wd:Q29032648  wd:Q45933174  wd:Q1460420  wd:Q1252988  wd:Q50410669  wd:Q133805  wd:Q7215  wd:Q1128437  wd:Q29056927  wd:Q12184  wd:Q182672  wd:Q901464  wd:Q45881698  wd:Q525512  wd:Q192995  wd:Q764527  }
    OPTIONAL { 
      ?work wdt:P921 ?topic ; wdt:P31 wd:Q13442814 .
    }
  }
  GROUP BY ?topic
} AS %result
WHERE {
  INCLUDE %result
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en,da,es,fr,nl,no,ru,sv,zh". }
}
  
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Topics
  
Awaiting triage
Usability
  
Awaiting triage
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.