<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>PrologHub</title>
    <link>https://prologhub.com</link>
    <description>A place to meet and learn about Prolog</description>
    <language>en</language>
    <generator>Scryer Prolog</generator>
    
      <item>
        <title>Scryer Prolog Meetup 2023 Notes</title>
	<link>https://prologhub.com/scryer-prolog-meetup-2023-notes</link>
	<guid isPermaLink="true">https://prologhub.com/scryer-prolog-meetup-2023-notes</guid>
	<description><![CDATA[<p>The 9th and 10th of November was the Scryer Prolog Meetup 2023 in Düsseldorf. As a <a href="https://www.scryer.pl/">Scryer Prolog</a>  user and contributor, I was very excited to go to this meeting. Now,  I&#x27;m back at home and I can write here a report of what happened in this  event with the notes I&#x27;ve taken.</p><br><a href="https://blog.adrianistan.eu/scryer-prolog-meetup-2023-notes">Visit website</a>]]></description>
	<pubDate>14 Jan 2023 17:57:00 UT</pubDate>
      </item>
    
      <item>
        <title>library(ffi) now available on Scryer Prolog</title>
	<link>https://prologhub.com/libraryffi-now-available-scryer-prolog</link>
	<guid isPermaLink="true">https://prologhub.com/libraryffi-now-available-scryer-prolog</guid>
	<description><![CDATA[<p>I want to announce that library(ffi) is  now available on the master branch of Scryer Prolog. The purpose of  this library is be able to call native code via a C ABI. Note that FFI  is just one way to communicate with the outside world in Scryer Prolog:  sockets, files, pipes or the HTTP libraries are also good options  depending on the task and they&#x27;re safer. This library is based on <a href="https://sourceware.org/libffi/">libffi</a></p><br><a href="https://github.com/mthom/scryer-prolog/discussions/1752">Visit website</a>]]></description>
	<pubDate>12 Jan 2023 14:17:00 UT</pubDate>
      </item>
    
      <item>
        <title>Using PostgreSQL from Prolog</title>
	<link>https://prologhub.com/using-postgresql-prolog</link>
	<guid isPermaLink="true">https://prologhub.com/using-postgresql-prolog</guid>
	<description><![CDATA[<p>There are many kinds of databases in our world. Relational ones, however, remain dominant, and it&#x27;s expected that sooner or later we need to access one from our Prolog code. Let&#x27;s see how we can connect to PostgreSQL, one of the best open-source relational databases, from Prolog.</p><p></p><p>We&#x27;ll use a library called <a href="https://github.com/aarroyoc/postgresql-prolog/">postgresql-prolog</a>. It only supports Scryer Prolog at the moment, but contributions are welcome! The good thing about this library is that it doesn&#x27;t require any native code, it tries to implement the PostgreSQL protocol in Prolog and only needs a sockets library available.</p><p></p><h2>Setting up PostgreSQL</h2><p>Current PostgreSQL versions work. In this example, I&#x27;m going to test using PostgreSQL 14.2. However, at the moment only one method of authentication works well. It is <i>password</i>. Other methods are not implemented yet. Note that password can only be used in trusted networks because it sends the password in clear text. After you&#x27;ve checked that password authentication is enabled in <i>pg_hba.conf</i>, let&#x27;s go to the Prolog side.</p><p>If you&#x27;re using Docker/Docker Compose, this is a valid configuration:</p><pre><code>version: "3.6"
services:
  postgres:
    image: postgres:14.2-alpine
    environment:
      POSTGRES_USER: user
      POSTGRES_PASSWORD: password
      POSTGRES_DB: postgres
      POSTGRES_HOST_AUTH_METHOD: password
    ports:
    - 5432:5432</code></pre><h2>Installing postgresql-prolog</h2><p>The library is made of several files. To install it on your project there are various methods.</p><p>If you&#x27;re already using Logtalk packs, there&#x27;s one for postgresql-prolog! Add the <a href="https://github.com/aarroyoc/aarroyoc-packs/">aarroyoc-packs</a> repository to make it available.</p><p>Otherwise, you can just download the folder (or make a Git submodule) and keep the .pl files.</p><p>You must be able to load the library and have two new predicates available: <i>connect/6</i> and <i>query/3</i>.</p><p><code>:- use_module(postgresql).</code></p><h2>Using postgresql-prolog</h2><p>To connect to the database use the connect/6 predicate. The arguments are the following:</p><p><code>connect(+User, +Password, +Host, +Port, +Database, -Connection)</code></p><p>Basically, you need to provide a user with a password, a host with a port, and a database name. It will give you a connection to the database. We can use this connection to make queries.</p><pre><code>?- connect("user", "password", '127.0.0.1', 5432, "postgres", Conn).
 Conn = postgresql('$stream'(0x55bf885d6158))</code></pre><p>If the connection details are wrong, the predicate will fail.</p><p>Now we can do a query. The <code>query/3</code> predicate can be used to do both SELECT and INSERT/UPDATE/DELETE/... statements.</p><p><code>query(+Connection, +Query, -Result)</code></p><p>The result will be different depending on the query. INSERT/UPDATE/... queries will unify with ok if successful, while SELECT queries will give data. Both will unify with error(Error) if an error happens.</p><pre><code>?- connect("user", "password", '127.0.0.1', 5432, "postgres", Conn),
query(Conn, "CREATE TABLE test_table (id serial, name text)", Result).
    Conn = postgresql('$stream'(0x55bfae7e63f8)), Result = ok</code></pre><p>Let&#x27;s add some data:</p><pre><code>?- connect("user", "password", '127.0.0.1', 5432, "postgres", Conn),
query(Conn, "INSERT INTO test_table (name) VALUES ('test1')", Result1),
query(Conn, "INSERT INTO test_table (name) VALUES ('test2')", Result2).
    Conn = postgresql('$stream'(0x55bfbeb3ffc8)), Result1 = ok, Result2 = ok</code></pre><p>Now, you may want to ask about the security of the queries here. It should be noted that this interface does not do any check to prevent SQL injection attacks as it is considered to be a raw interface. Most secure predicates probably will be added in the future.</p><p></p><p>Let&#x27;s SELECT something.</p><pre><code>?- connect("user", "password", '127.0.0.1', 5432, "postgres", Conn), query(Conn, "SELECT * FROM test_table", Result).
   Conn = postgresql('$stream'(0x565437244618)), Result = data(["id","name"],[["1","test1"],["2","test2"]])
;  ... .

?- connect("user", "password", '127.0.0.1', 5432, "postgres", Conn), query(Conn, "SELECT name,id FROM test_table", Result).
   Conn = postgresql('$stream'(0x5654372080d8)), Result = data(["name","id"],[["test1","1"],["test2","2"]])
;  ... .</code></pre><p>If the query was successful a data structure is returned. First, it contains the names of the fields in a list. Then, it contains a list of every row in the same order.</p><p></p><p>With these basic building blocks, we can start using PostgreSQL from Prolog. As mentioned before, the project is open to contributions!</p><p></p>]]></description>
	<pubDate>03 Jan 2022 11:32:00 UT</pubDate>
      </item>
    
      <item>
        <title>Parallel Logic Programming: A Sequel</title>
	<link>https://prologhub.com/parallel-logic-programming-sequel</link>
	<guid isPermaLink="true">https://prologhub.com/parallel-logic-programming-sequel</guid>
	<description><![CDATA[<p>Multi-core and highly-connected architectures have become ubiquitous, and this has brought renewed interest in language-based approaches to the exploitation of parallelism. Since its inception, logic programming has been recognized as a programming paradigm with great potential for automated exploitation of parallelism. The comprehensive survey of the first twenty years of research in parallel logic programming, published in 2001, has served since as a fundamental reference to researchers and developers. The contents are quite valid today, but at the same time the field has continued evolving at a fast pace in the years that have followed. Many of these achievements and ongoing research have been driven by the rapid pace of technological innovation, that has led to advances such as very large clusters, the wide diffusion of multi-core processors, the game-changing role of general-purpose graphic processing units, and the ubiquitous adoption of cloud computing. This has been paralleled by significant advances within logic programming, such as tabling, more powerful static analysis and verification, the rapid growth of Answer Set Programming, and in general, more mature implementations and systems. This survey provides a review of the research in parallel logic programming covering the period since 2001, thus providing a natural continuation of the previous survey. The goal of the survey is to serve not only as a reference for researchers and developers of logic programming systems, but also as engaging reading for anyone interested in logic and as a useful source for researchers in parallel systems outside logic programming. <br/>Authors: <a href="https://arxiv.org/search/cs?searchtype=author&amp;query=Dovier%2C+A">Agostino Dovier</a>, <a href="https://arxiv.org/search/cs?searchtype=author&amp;query=Formisano%2C+A">Andrea Formisano</a>, <a href="https://arxiv.org/search/cs?searchtype=author&amp;query=Gupta%2C+G">Gopal Gupta</a>, <a href="https://arxiv.org/search/cs?searchtype=author&amp;query=Hermenegildo%2C+M+V">Manuel V. Hermenegildo</a>, <a href="https://arxiv.org/search/cs?searchtype=author&amp;query=Pontelli%2C+E">Enrico Pontelli</a>, <a href="https://arxiv.org/search/cs?searchtype=author&amp;query=Rocha%2C+R">Ricardo Rocha</a><br/></p><br><a href="https://arxiv.org/abs/2111.11218">Visit website</a>]]></description>
	<pubDate>30 Jan 2022 17:29:00 UT</pubDate>
      </item>
    
      <item>
        <title>Using Prolog to unravel the foundations of oncology dose-escalation trial designs</title>
	<link>https://prologhub.com/using-prolog-unravel-foundations-oncology-dose-escalation-trial-designs</link>
	<guid isPermaLink="true">https://prologhub.com/using-prolog-unravel-foundations-oncology-dose-escalation-trial-designs</guid>
	<description><![CDATA[<p>A longstanding collaboration with <a href="https://github.com/triska">@triska</a>,  applying Prolog to the specification and analysis of oncology  dose-escalation trial designs, has yielded some interesting progress  that I&#x27;d like to share. It seems to me that the current thrust of this  work employs Prolog — and indeed some new techniques like if_/3 (<a href="http://arxiv.org/abs/1607.01590">Neumerkel &amp; Kral 2017</a>)  — in a manner that is somehow essential to our successful attack on  certain problems in this field. As such, I think our collaboration  reflects in some interesting ways on Prolog itself. I&#x27;ll try to get  across the main gist of the application without belaboring the details.  The work I&#x27;ll describe here is contained in <a href="https://github.com/dcnorris/precautionary/blob/ff4d9f8ae8f82cfd55ea0cefcfb0e51792d59aa9/exec/prolog/dsl.pl">this self-contained file</a> from the <a href="https://dcnorris.github.io/precautionary/index.html">precautionary</a> package. Author: David C. Norris</p><br><a href="https://github.com/mthom/scryer-prolog/discussions/1136">Visit website</a>]]></description>
	<pubDate>30 Jan 2022 17:27:00 UT</pubDate>
      </item>
    
  </channel>
</rss>
