At the moment it is not possible to get a RDF/JSON dump of available EntitySchemas. So one has to scrape the HTML to get at the code. Also serving queries for them is not possible.
At https://www.wikidata.org/wiki/Wikidata:Property_proposal/associated_shape JHeald writes:
According to posters on the wikidata-l list, viz. [https://lists.wikimedia.org/pipermail/wikidata/2019-May/013103.html], there is a standard RDF serialization for ShapeExpressions. It should be better ''either'' to include the RDF triples of these serializations directly within WDQS to describe a shape entity; ''or'' to load them into an associated triplestore, that could service federated queries from WDQS; ''rather than'' to try to keep and then maintain a parallel set of Q-items for shape expressions, that would expect each shape expression to be described in detail in duplicate. ShapeExpressions are supposed to describe themselves.
We think a dedicated triplestore is an excellent idea that would go a long way towards finishing T225701. This ticket is about setting up such a database and integrating it into the current EntitySchema services. However, as a database newbie I'm completely dependent on your opinion on this.