185 research outputs found
Extending the logical update view with transaction support
Since the database update view was standardised in the Prolog ISO standard,
the so called logical update view is available in all actively maintained
Prolog systems. While this update view provided a well defined update semantics
and allows for efficient handling of dynamic code, it does not help in
maintaining consistency of the dynamic database. With the introduction of
multiple threads and deployment of Prolog in continuously running server
applications, consistency of the dynamic database becomes important.
In this article, we propose an extension to the generation-based
implementation of the logical update view that supports transactions.
Generation-based transactions have been implemented according to this
description in the SWI-Prolog RDF store. The aim of this paper is to motivate
transactions, outline an implementation and generate discussion on the
desirable semantics and interface prior to implementation.Comment: Appeared in CICLOPS 2012. 9 Pages, 0 Figure
Why It's Nice to be Quoted: Quasiquoting for Prolog
Prolog's support for dynamic programming, meta programming and text
processing using context free grammars make the language highly suitable for
defining domain specific languages (DSL) as well as analysing, refactoring or
generating expression states in other (programming) languages. Well known DSLs
are the DCG (Definite Clause Grammar) notation and constraint languages such as
CHR. These extensions use Prolog operator declarations and the {...} notation
to realise a good syntax. When external languages, such as HTML, SQL or
JavaScript enter the picture, operators no longer satisfy for embedding
snippets of these languages into a Prolog source file. In addition, Prolog has
poor support for quoting long text fragments.
Haskell introduced quasi quotationsto resolve this problem. In this paper we
`ported' the Haskell mechanism for quasi quoting to Prolog. We show that this
can be done cleanly and that quasi quoting can solve the above mentioned
problems.Comment: Part of WLPE 2013 proceedings (arXiv:1308.2055
KBSET -- Knowledge-Based Support for Scholarly Editing and Text Processing with Declarative LaTeX Markup and a Core Written in SWI-Prolog
KBSET is an environment that provides support for scholarly editing in two
flavors: First, as a practical tool KBSET/Letters that accompanies the
development of editions of correspondences (in particular from the 18th and
19th century), completely from source documents to PDF and HTML presentations.
Second, as a prototypical tool KBSET/NER for experimentally investigating novel
forms of working on editions that are centered around automated named entity
recognition. KBSET can process declarative application-specific markup that is
expressed in LaTeX notation and incorporate large external fact bases that are
typically provided in RDF. KBSET includes specially developed LaTeX styles and
a core system that is written in SWI-Prolog, which is used there in many roles,
utilizing that it realizes the potential of Prolog as a unifying language.Comment: To appear in DECLARE 2019 Revised Selected Paper
Measuring Coverage of Prolog Programs Using Mutation Testing
Testing is an important aspect in professional software development, both to
avoid and identify bugs as well as to increase maintainability. However,
increasing the number of tests beyond a reasonable amount hinders development
progress. To decide on the completeness of a test suite, many approaches to
assert test coverage have been suggested. Yet, frameworks for logic programs
remain scarce.
In this paper, we introduce a framework for Prolog programs measuring test
coverage using mutations. We elaborate the main ideas of mutation testing and
transfer them to logic programs. To do so, we discuss the usefulness of
different mutations in the context of Prolog and empirically evaluate them in a
new mutation testing framework on different examples.Comment: 16 pages, Accepted for presentation in WFLP 201
Lazy Stream Programming in Prolog
In recent years, stream processing has become a prominent approach for
incrementally handling large amounts of data, with special support and
libraries in many programming languages. Unfortunately, support in Prolog has
so far been lacking and most existing approaches are ad-hoc. To remedy this
situation, we present lazy stream generators as a unified Prolog interface for
stateful computations on both finite and infinite sequences of data that are
produced incrementally through I/O and/or algorithmically.
We expose stream generators to the application programmer in two ways: 1)
through an abstract sequence manipulation API, convenient for defining custom
generators, and 2) as idiomatic lazy lists, compatible with many existing list
predicates. We define an algebra of stream generator operations that extends
Prolog via an embedded language interpreter, provides a compact notation for
composing generators and supports moving between the two isomorphic
representations.
As a special instance, we introduce answer stream generators that encapsulate
the work of coroutining first-class logic engines and support interoperation
between forward recursive AND-streams and backtracking-generated OR-streams.
Keywords: lazy stream generators, lazy lists, first-class logic engines,
stream combinators, AND-stream / OR-stream interoperation, Prolog extensionsComment: In Proceedings ICLP 2019, arXiv:1909.0764
Probabilistic inference in SWI-Prolog
Probabilistic Logic Programming (PLP) emerged as one of the most prominent approaches to cope with real-world domains. The distribution semantics is one of most used in PLP, as it is followed by many languages, such as Independent Choice Logic, PRISM, pD, Logic Programs with Annotated Disjunctions (LPADs) and ProbLog. A possible system that allows performing inference on LPADs is PITA, which transforms the input LPAD into a Prolog program containing calls to library predicates for handling Binary Decision Diagrams (BDDs). In particular, BDDs are used to compactly encode explanations for goals and efficiently compute their probability. However, PITA needs mode-directed tabling (also called tabling with answer subsumption), which has been implemented in SWI-Prolog only recently. This paper shows how SWI-Prolog has been extended to include correct answer subsumption and how the PITA transformation has been changed to use SWI-Prolog implementation
Using Prolog as the Fundament for Applications on the Semantic Web
This article describes the experiences developing a Semantic Web application entirely in Prolog. The application, a demonstrator that provides access to multiple art collections and linking these using cultural heritage vocabul
- …