Re:Introduction to logic programming with Prolog
by jononor on Tuesday December 05, 2017 @07:12PM
(#15857425)
What would be the workflow in Prolog if I want to import a set of facts from an external source, like a database/JSON/CSV?
[ Parent
| on HN ]
Re:Introduction to logic programming with Prolog
by tannhaeuser on Wednesday December 06, 2017 @04:58AM
(#15859885)
JSON could be parsed as a term by Prolog, with suitable priority/associativity definitions for the comma, colon, and curly brace operators.
For CSV, you could write a DCG grammar for the particular file format at hand.
Integration with a relational DB, itself being based on logic, would be very different. Most Prologs have APIs to map tables to predicates.