Skip to content
Discussion options

You must be logged in to vote

A place can have more than one value for P1 i.e. Instance Of (Category). Hence need to perform GROUP_CONCAT

PREFIX yq: <https://data.jain.wiki/entity/>
PREFIX yp: <https://data.jain.wiki/prop/direct/>

SELECT DISTINCT ?item ?itemLabel ?itemDescription 
       (GROUP_CONCAT(DISTINCT ?mainCategoryLabel; separator=",") AS ?mainCategorys) 
WHERE {
  ?item yp:P1 ?mainCategory . # Get Main Category
  # Q8238 means "Place"
  ?mainCategory yp:P1 yq:Q8238 . # Filter Main Category for only "Places"

  SERVICE wikibase:label { 
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" .
    ?item rdfs:label ?itemLabel .
    ?item schema:description ?itemDescription .
    ?mainCategory rdfs:label ?m…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by adarshmadrecha
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
1 participant