Hello @Yash Deshpande ,
welcome to this moderated Azure community forum.
Azure Digital Twins comes with an elaborate query language to query twins, relationships, properties, etc.
In the documentation, only this query reference this available. There is no syntax validation service or API available, other than actually executing the queries.
If the response helped, do "Accept Answer". If it doesn't work, please let us know the progress. All community members with similar issues will benefit by doing so. Your contribution is highly appreciated.