Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vladimiralexiev/grammar-diagrams
Grammar Railroad Diagrams for SPARQL, XSPARQL
https://github.com/vladimiralexiev/grammar-diagrams
Last synced: about 1 month ago
JSON representation
Grammar Railroad Diagrams for SPARQL, XSPARQL
- Host: GitHub
- URL: https://github.com/vladimiralexiev/grammar-diagrams
- Owner: VladimirAlexiev
- Created: 2018-11-20T14:54:18.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-10-09T13:49:14.000Z (4 months ago)
- Last Synced: 2024-11-10T09:28:18.206Z (3 months ago)
- Language: HTML
- Size: 288 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.org
Awesome Lists containing this project
README
#+TITLE: Grammar Railroad Diagrams
* Intro
Reading EBNF grammars is not easy. Seeing it on a diagram makes things easier.
https://rr.red-dove.com/ui is an excellent tool: it can scrape EBNF grammars from W3C specs, generates either a single XHTML with embedded SVG, or a zip with many PNGs, cross-links the definitions and usages.- INCOMPLETE: [[./ebnf2tdv.pl]]: convert ebnf to a list of node-node connections, for visualizing eg with d3
** Table of Contents :TOC:noexport:
:PROPERTIES:
:TOC: :include all
:END::CONTENTS:
- [[#intro][Intro]]
- [[#sparql-query-and-update][SPARQL Query and Update]]
- [[#sparql-11-railroad-diagram][SPARQL 1.1 Railroad Diagram]]
- [[#sparql-12-railroad-diagram][SPARQL 1.2 Railroad Diagram]]
- [[#sparql-star-railroad-diagram][SPARQL-star Railroad Diagram]]
- [[#chunked-sparql-diagram][Chunked SPARQL Diagram]]
- [[#shaclc][SHACLC]]
- [[#xsparql][XSPARQL]]
:END:* SPARQL Query and Update
I use this quite often while writing SPARQL.
It is bit hard to understand: use this for reference, but not for learning SPARQL.** SPARQL 1.1 Railroad Diagram
SPARQL 1.1 is the current version of SPARQL.
- [[http://rawgit2.com/VladimirAlexiev/grammar-diagrams/master/sparql11-grammar.xhtml][sparql11-grammar.xhtml]]: Cross-linked diagrams, one per production (173 total).
- [[http://rawgit2.com/VladimirAlexiev/grammar-diagrams/master/sparql11-grammar.ebnf][sparql11-grammar.ebnf]]: EBNF rules extracted from the spec
- [[http://rawgit2.com/VladimirAlexiev/grammar-diagrams/master/sparql11-grammar.txt][sparql11-grammar.txt]]: same thing but with production numbers
- extracted from: http://www.w3.org/TR/sparql11-query/
- version: http://www.w3.org/TR/2013/REC-sparql11-query-20130321/
- created on: Apr 2, 2013Preview:
[[./SPARQL-diagram-preview.png]]
** SPARQL 1.2 Railroad Diagram
SPARQL 1.2 is the long-awaited update of SPARQL with SPARQL-star (reified triples and annotations).
It's still a work in progress.
- [[http://rawgit2.com/VladimirAlexiev/grammar-diagrams/master/sparql12-grammar.xhtml][sparql12-grammar.xhtml]]: Cross-linked diagrams, one per production (190 total).
- [[http://rawgit2.com/VladimirAlexiev/grammar-diagrams/master/sparql12-grammar.ebnf][sparql12-grammar.ebnf]]: EBNF rules extracted from the spec
- [[http://rawgit2.com/VladimirAlexiev/grammar-diagrams/master/sparql12-grammar.txt][sparql12-grammar.txt]]: same thing but with production numbers
- extracted from: https://www.w3.org/TR/sparql12-query/
- version: https://www.w3.org/TR/2024/WD-sparql12-query-20240921/
- created on: Oct 9, 2024
Preview:[[./SPARQL-1.2-diagram-preview.png]]
** SPARQL-star Railroad Diagram
This is an older incarnation of SPARQL-star. You can ignore it.
- [[http://rawgit2.com/VladimirAlexiev/grammar-diagrams/master/sparql-star-grammar.xhtml][sparql-star-grammar.xhtml]]: Cross-linked diagrams, one per production (173 total).
- [[http://rawgit2.com/VladimirAlexiev/grammar-diagrams/master/sparql-star-grammar.ebnf][sparql-star-grammar.ebnf]]: EBNF rules extracted from the spec
- [[http://rawgit2.com/VladimirAlexiev/grammar-diagrams/master/sparql-star-grammar.txt][sparql-star-grammar.txt]]: same thing but with production numbers
- extracted from: https://www.w3.org/2021/12/rdf-star.html#sparql-star-ebnf
- version: 2021-12-17Preview:
[[./SPARQL-star-diagram-preview.png]]
** Chunked SPARQL Diagram
Here's a [[http://ontologicalengineering.blogspot.com/2008/12/sparql-railroad-diagram-from-hell.html][chunked diagram]], which however is partial: [[http://stackoverflow.com/questions/15758282/bigger-granularity-railroad-diagram-generator][Discussion]] whether there's a chunked generator.
Preview:[[http://1.bp.blogspot.com/_5Jqup-kC5TY/SVCGV19T6EI/AAAAAAAAALA/7UW3FznkRHM/s1600/SPARQL.png]]
* SHACLC
SHACL Compact grammar
- [[http://rawgit2.com/VladimirAlexiev/grammar-diagrams/master/shaclc-grammar.xhtml][shaclc-grammar.xhtml]]: Cross-linked diagrams, one per production (73 total)
- [[http://rawgit2.com/VladimirAlexiev/grammar-diagrams/master/shaclc-grammar.ebnf][shaclc-grammar.ebnf]]: EBNF rules converted from the original ANTRL grammar
- Extracted from: https://w3c.github.io/shacl/shacl-compact-syntax/Preview:
[[./SHACLC-diagram-preview.png]]
IMPORTANT:
The SHACL CG is currently working on extending the SHACLC grammar with more features.
You can see diagrams for 4 candidate grammars at https://github.com/VladimirAlexiev/shacl/tree/shaclc-grammars/shacl-compact-syntax/grammar#candidate-shacl-c-grammars* XSPARQL
XSPARQL is a melding of XQuery and SPARQL.
Its syntax is pretty large, so the diagrams help.
https://github.com/VladimirAlexiev/xsparql/blob/master/doc/:
- [[http://rawgit2.com/VladimirAlexiev/xsparql/master/doc/grammar.xhtml][grammar.xhtml]]: grammar diagram (XHTML+SVG, 950Kb)
- [[http://rawgit2.com/VladimirAlexiev/xsparql/master/doc/grammar-nonterminals.xhtml][grammar-nonterminals.xhtml]]: non-terminal symbols only (800Kb)
- [[http://rawgit2.com/VladimirAlexiev/xsparql/master/doc/grammar.html][grammar.html]]: original grammar, shows additions with bold and deletions with strikethrough
- [[http://rawgit2.com/VladimirAlexiev/xsparql/master/doc/grammar.ebnf][grammar.ebnf]]: EBNF (text) extracted from above, renamed eg TriplesSameSubject' to TriplesSameSubject1 because the tool cannot handle ' as identifier char
- [[http://rawgit2.com/VladimirAlexiev/xsparql/master/doc/grammar-nonterminals.ebnf][grammar-nonterminals.ebnf]]: non-terminal symbols only
Preview:[[./XSPARQL-diagram-preview.png]]