“Implementing GraphQL as a Query Language for Deductive Databases in SWI–Prolog Using DCGs, Quasi Quotations, and Dicts” by Falco Nogatz (@fnogatz) and Dietmar Seipel (pdf)
we intend to adopt EDCG rules for writing more powerful grammars in a simpler way in the future.
Is there more that has/can be shared regarding the use of EDCG with Quasiquotations?
Currently looking at existing and other ways to create Cytoscape visual graphs (nodes and edges) from Prolog and this is an avenue worth exploring.
For those looking for related source code (not identical) to the paper see: Pack - graphql
- First, optionally check to see if it is already installed.
?- pack_list_installed. Installed packages (18): i firstname.lastname@example.org - Predicate call graph visualisation i email@example.com - Pretty unicode tables for the CLI with Prolog i firstname.lastname@example.org - DCG related utilities i email@example.com - Dict-like OO Syntax i firstname.lastname@example.org - Extended DCG i email@example.com - Utilities for reading, writing and finding files i firstname.lastname@example.org - Function notation for Prolog i email@example.com - Function application and composition i firstname.lastname@example.org - Help for writing function-like macros i email@example.com - General miscellaneous utilities i firstname.lastname@example.org - Global Variable Syntax i email@example.com - Predicates for working with lists i firstname.lastname@example.org - Common predicates that are used throughout LogicMOO Software i email@example.com - Pfc -- a package for forward chaining in Prolog i firstname.lastname@example.org - Implement your own Abstract Predicate Streams i email@example.com - QuickCheck randomized testing i firstname.lastname@example.org - SLDNF Draw is a Prolog program that draws SLDNF Trees in LaTeX i email@example.com - Shell pipeline construction with type checking true.
If not installed then install it.
NB There are two identical versions of the pack. I would suggest using
graphql as it does not have the
- in the name which can cause problems when the name
graphql-swipl is not single quoted.
?- pack_search(graphql). % Contacting server at https://www.swi-prolog.org/pack/query ... ok p firstname.lastname@example.org - GraphQL Prolog Library p email@example.com - GraphQL Prolog Library true.
?- pack_install(graphql). % Contacting server at https://www.swi-prolog.org/pack/query ... ok Install firstname.lastname@example.org from GIT at https://github.com/NaohiroTamura/graphql.git Y/n? % Cloning into 'c:/users/eric/appdata/local/swi-prolog/pack/graphql'... % Contacting server at https://www.swi-prolog.org/pack/query ... ok % "graphql.git" was downloaded 17 times Package: graphql Title: GraphQL Prolog Library Installed version: 0.0.1 Author: Naohiro Tamura <email@example.com> Home page: https://github.com/NaohiroTamura Activate pack "graphql" Y/n? true.
For more working examples of Quasiquotations with SWI-Prolog see Anne’s Creating Web Applications in SWI-Prolog