I follow up on query where the schema.org database is used to find the number of children of a class - as a simpler database than my application. I want to get the names of the children concatenated in alphabetic order. The query
prefix schema: <http://schema.org/>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
select ?child (group_concat (?string) as ?strings)
where {
?child rdfs:subClassOf schema:Event .
?grandchild rdfs:subClassOf ?child .
bind (strafter(str(?grandchild), "http://schema.org/") as ?string)
} group by ?child order by asc(?string)
limit 20
gives
schema:PublicationEvent "OnDemandEvent BroadcastEvent"
schema:UserInteraction "UserPageVisits UserComments UserPlays UserBlocks UserDownloads UserPlusOnes UserLikes UserCheckins UserTweets"
which is not alphabetically ordered. If I replace the sort order to desc
the result is exactly the same. I seem not to understand how group by
, order by
and possibly bind
interact.